/** * @author Edouard DUPIN * * @copyright 2010, Edouard DUPIN, all right reserved * * @license GPL v3 (see license file) */ #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) { } void appl::GlyphPainting::reload(void) { ejson::Document doc; if (false == doc.load(m_name)) { APPL_ERROR("Can not load file : '" << m_name << "' = " << etk::FSNode(m_name).getFileSystemName()); 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->getStringValue("name", ""); etk::UString background = tmpObj->getStringValue("background", "#FFF0"); etk::UString foreground = tmpObj->getStringValue("foreground", "#000F"); bool italic = tmpObj->getBooleanValue("italic", false); bool bold = tmpObj->getBooleanValue("bold", false); APPL_VERBOSE("find new color : '" << name << "' fg='" << foreground << "' bg='" << background << "' italic='" << italic << "' bold='" << bold << "'"); bool findElement = false; for (esize_t jjj=0; jjj(getManager().localKeep(_filename)); if (NULL != object) { return object; } // this element create a new one every time .... EWOL_INFO("CREATE : appl::GlyphPainting : file : \"" << _filename << "\""); object = new appl::GlyphPainting(_filename); if (NULL == object) { EWOL_ERROR("allocation error of a resource : ??GlyphPainting??"); 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; }