/** * @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() { addResourceType("appl::GlyphPainting"); } void appl::GlyphPainting::init(const std::string& _filename) { gale::Resource::init(_filename); APPL_DEBUG("SFP : load \"" << _filename << "\""); reload(); } appl::GlyphPainting::~GlyphPainting() { } void appl::GlyphPainting::reload() { ejson::Document doc; if (false == doc.load(m_name)) { APPL_ERROR("Can not load file : '" << m_name << "' = " << etk::FSNode(m_name).getFileSystemName()); return; } // for debug only : /* APPL_WARNING("Load file : '" << m_name << "' = " << etk::FSNode(m_name).getFileSystemName()); std::string tmppppp; doc.generate(tmppppp); APPL_DEBUG(tmppppp); */ std::shared_ptr baseArray = doc.getArray("ednColor"); if (baseArray == nullptr) { APPL_ERROR("Can not get basic array : 'ednColor'"); return; } for (size_t iii = 0; iii < baseArray->size(); ++iii) { std::shared_ptr tmpObj = baseArray->getObject(iii); if (tmpObj == nullptr) { APPL_DEBUG(" can not get object in 'ednColor' id=" << iii); continue; } std::string name = tmpObj->getStringValue("name", ""); std::string background = tmpObj->getStringValue("background", "#FFF0"); std::string 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 (size_t jjj=0; jjj