added: Patterns class (in templates)

ezc patterns are managed by this class
added: some work in groupitem plugin (not finished yet)
changed: ConfParser can read a string from memory now
         (need some testing yet)



git-svn-id: svn://ttmath.org/publicrep/winix/trunk@757 e52654a7-88a9-db11-a3e9-0013d4bc506e
This commit is contained in:
2011-08-25 23:53:49 +00:00
parent ee6500ac65
commit 5b8a9c0108
46 changed files with 2896 additions and 1715 deletions

View File

@@ -69,6 +69,11 @@ void Notify::Init()
notify_thread.SetSynchro(synchro);
thread_manager->Add(&notify_thread);
patterns.SetUTF8(config->utf8);
patterns.SetDirectories(config->txt_templates_dir, config->txt_templates_dir_default);
patterns.SetLocale(&TemplatesFunctions::locale);
patterns.SetLocaleFilter(&TemplatesFunctions::locale_filter);
notify_template_cms = AddTemplate(L"notify_email_cms.txt");
plugin.Call(WINIX_NOTIFY_ADD_TEMPLATE);
@@ -78,29 +83,7 @@ void Notify::Init()
void Notify::ReadTemplates()
{
if( templates_names.empty() )
{
patterns.clear();
return;
}
patterns.resize(TemplatesFunctions::locale.Size());
for(size_t i=0 ; i<patterns.size() ; ++i)
{
patterns[i].resize(templates_names.size());
for(size_t a=0 ; a<patterns[i].size() ; ++a)
{
patterns[i][a].UTF8(config->utf8);
patterns[i][a].DeleteWhiteTextItems(false);
patterns[i][a].Directory(config->txt_templates_dir, config->txt_templates_dir_default);
patterns[i][a].ParseFile(templates_names[a]);
TemplatesFunctions::locale_filter.Filter(patterns[i][a], TemplatesFunctions::locale, i);
}
}
patterns.Reload();
notify_thread.PatternsChanged();
}
@@ -132,10 +115,7 @@ void Notify::ItemChanged(const NotifyMsg & msg)
size_t Notify::AddTemplate(const std::wstring & file_name)
{
size_t index = templates_names.size();
templates_names.push_back(file_name);
return index;
return patterns.Add(file_name, false);
}