[DEV] glyph pattern might be ended
This commit is contained in:
parent
79b8f594d6
commit
6f4a67b47b
@ -16,20 +16,20 @@
|
||||
{ name="error", foreground="#FF0000"},
|
||||
{ name="doubleQuoteText", foreground="#00fF00"},
|
||||
|
||||
{ name="type", foreground="#56bf10", bold="yes"},
|
||||
{ name="type", foreground="#56bf10", bold=true},
|
||||
{ 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"}
|
||||
{ name="comment", foreground="#ef4def", italic=true},
|
||||
{ name="commentDoxygen", foreground="#ef4d00", bold=true, italic=true},
|
||||
{ name="keyword", foreground="#5c8fed", bold=true},
|
||||
{ name="macro", foreground="#6c09c8", bold=true},
|
||||
{ name="SYNTAX_ERROR", foreground="#000000", background="#FF0000", bold=true},
|
||||
{ name="functionName", foreground="#24d1e0", bold=true},
|
||||
{ name="TestResultOK", foreground="#000000", background="#00FF00", bold=true},
|
||||
{ name="TestResultERROR", FG="#000000", background="#FF0000", bold=true}
|
||||
]
|
||||
}
|
||||
|
@ -22,5 +22,13 @@
|
||||
<color>functionName</color>
|
||||
<start>([a-zA-Z0-9]|-|_)*</start>
|
||||
</rule>
|
||||
<rule name="numeric constant">
|
||||
<color>number</color>
|
||||
<start>\@((0(x|X)[0-9a-fA-F]*)|(\d+\.?\d*|\.\d+)((e|E)(\+|\-)?\d+)?)(L|l|UL|ul|u|U|F|f)?\@</start>
|
||||
</rule>
|
||||
<rule name="my boolean">
|
||||
<color>boolean</color>
|
||||
<start>\@true|false\@</start>
|
||||
</rule>
|
||||
</pass2>
|
||||
</EdnLang>
|
||||
|
@ -9,7 +9,7 @@
|
||||
#include <appl/Debug.h>
|
||||
#include <appl/global.h>
|
||||
#include <appl/glyphDecoration/GlyphPainting.h>
|
||||
#include <exml/exml.h>
|
||||
#include <ejson/ejson.h>
|
||||
#include <etk/os/FSNode.h>
|
||||
#include <ewol/resources/ResourceManager.h>
|
||||
|
||||
@ -25,18 +25,65 @@ appl::GlyphPainting::GlyphPainting(const etk::UString& _filename) :
|
||||
}
|
||||
|
||||
appl::GlyphPainting::~GlyphPainting(void) {
|
||||
// remove all element
|
||||
for (int32_t iii=0; iii<m_list.size(); iii++){
|
||||
if (NULL != m_list[iii]) {
|
||||
delete(m_list[iii]);
|
||||
m_list[iii] = NULL;
|
||||
}
|
||||
}
|
||||
m_list.clear();
|
||||
|
||||
}
|
||||
|
||||
void appl::GlyphPainting::reload(void) {
|
||||
|
||||
ejson::Document doc;
|
||||
if (false == doc.load(m_name)) {
|
||||
APPL_ERROR("Can not load file : '" << m_name << "'");
|
||||
return;
|
||||
}
|
||||
ejson::Array* baseArray = doc.getArray("ednColor");
|
||||
if (baseArray == NULL) {
|
||||
APPL_ERROR("Can not get basic array : 'ednColor'");
|
||||
return;
|
||||
}
|
||||
for (esize_t iii = 0; iii < baseArray->size(); ++iii) {
|
||||
ejson::Object* tmpObj = baseArray->getObject(iii);
|
||||
if (tmpObj == NULL) {
|
||||
APPL_DEBUG(" can not get object in 'ednColor' id=" << iii);
|
||||
continue;
|
||||
}
|
||||
etk::UString name = tmpObj->getString("name");
|
||||
etk::UString background = tmpObj->getString("background");
|
||||
etk::UString foreground = tmpObj->getString("foreground");
|
||||
bool italic = tmpObj->getString("italic");
|
||||
bool bold = tmpObj->getString("bold");
|
||||
bool findElement = false;
|
||||
for (esize_t jjj=0; jjj<m_list.size(); ++jjj) {
|
||||
if (m_list[jjj].getName() != name) {
|
||||
continue;
|
||||
}
|
||||
m_list[jjj].setForeground(foreground);
|
||||
m_list[jjj].setBackground(background);
|
||||
m_list[jjj].setItalic(italic);
|
||||
m_list[jjj].setBold(bold);
|
||||
findElement == true;
|
||||
}
|
||||
if (findElement == true) {
|
||||
continue;
|
||||
}
|
||||
appl::GlyphDecoration tmpDeco(name);
|
||||
tmpDeco.setForeground(foreground);
|
||||
tmpDeco.setBackground(background);
|
||||
tmpDeco.setItalic(italic);
|
||||
tmpDeco.setBold(bold);
|
||||
m_list.pushBack(tmpDeco);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
esize_t appl::GlyphPainting::request(const etk::UString& _name) {
|
||||
for (esize_t iii=0; iii<m_list.size(); ++iii) {
|
||||
if (m_list[iii].getName() == name) {
|
||||
return iii;
|
||||
}
|
||||
}
|
||||
// create an empty deco ...
|
||||
appl::GlyphDecoration tmpDeco(name);
|
||||
m_list.pushBack(tmpDeco);
|
||||
return m_list.size()-1;
|
||||
}
|
||||
|
||||
appl::GlyphPainting* appl::GlyphPainting::keep(const etk::UString& _filename) {
|
||||
|
@ -17,7 +17,7 @@
|
||||
namespace appl {
|
||||
class GlyphPainting : public ewol::Resource {
|
||||
private:
|
||||
etk::Vector<appl::GlyphDecoration*> m_list;
|
||||
etk::Vector<appl::GlyphDecoration> m_list;
|
||||
protected:
|
||||
GlyphPainting(const etk::UString& _filename);
|
||||
virtual ~GlyphPainting(void);
|
||||
@ -34,13 +34,15 @@ namespace appl {
|
||||
* @param[in] _name Name of the deco.
|
||||
* @return id of the deco.
|
||||
*/
|
||||
esize_t registerDeco(const etk::UString& _name);
|
||||
esize_t request(const etk::UString& _name);
|
||||
/**
|
||||
* @brief Get Decoration handle.
|
||||
* @param[in] _id Id of the decoration.
|
||||
* @return pointer on deco.
|
||||
*/
|
||||
appl::GlyphDecoration* getDeco(esize_t _id);
|
||||
const appl::GlyphDecoration& get(esize_t _id) const {
|
||||
return m_list[_id];
|
||||
};
|
||||
public:
|
||||
/**
|
||||
* @brief keep the resource pointer.
|
||||
@ -48,7 +50,7 @@ namespace appl {
|
||||
* @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");
|
||||
static appl::GlyphPainting* keep(const etk::UString& _filename);
|
||||
/**
|
||||
* @brief release the keeped resources
|
||||
* @param[in,out] reference on the object pointer
|
||||
|
@ -40,8 +40,8 @@ def Create(target):
|
||||
|
||||
# Generic color management for the text editor :
|
||||
myModule.AddSrcFile([
|
||||
'appl/glyphDecoration/GlyphDecoration.cpp'])
|
||||
# 'appl/Colorize/ColorizeManager.cpp'])
|
||||
'appl/glyphDecoration/GlyphDecoration.cpp',
|
||||
'appl/glyphDecoration/GlyphPainting.cpp'])
|
||||
|
||||
# syntax coloration for the text editor
|
||||
#myModule.AddSrcFile([
|
||||
|
Loading…
x
Reference in New Issue
Block a user