Patch level : 4.0 534

Files correlati     :  ve2.exe
Ricompilazione Demo : [ ]
Commento            :

Modificato filtro e generazione sorgenti


git-svn-id: svn://10.65.10.50/trunk@14439 c028cbd2-c16b-5b4b-a496-9718f37d4682
This commit is contained in:
alex 2006-10-31 16:02:37 +00:00
parent c1c987f1fa
commit 0e26dd1d32
2 changed files with 30 additions and 17 deletions

View File

@ -35,13 +35,10 @@ public:
void TDictionary_entry::add_source(const char* orig) void TDictionary_entry::add_source(const char* orig)
{ {
if (_src.items() < 8) TFilename n(orig); n.lower();
{ const char* src = n.name();
TFilename n(orig); n.lower(); if (_src.get_pos(src) < 0)
const char* src = n.name(); _src.add(src);
if (_src.get_pos(src) < 0)
_src.add(src);
}
} }
void TDictionary_entry::set_sources(const char* orig) void TDictionary_entry::set_sources(const char* orig)
@ -306,7 +303,8 @@ protected:
bool read_dictionary(); bool read_dictionary();
void fill_index(); void fill_index();
bool check_translation(const TString & ita, const TString & eng, const char tag); bool check_translation(const TString & ita, const TString & eng, const char tag);
bool good_translation(const TString & ita, const TString & eng, const TString & src); bool good_translation(const TString & ita, const TString & eng, const TString & src, int
maxlen);
void fill_chapter(); void fill_chapter();
public: public:
@ -661,7 +659,7 @@ bool TDictionary_mask::check_translation(const TString & ita, const TString & en
return ok; return ok;
} }
bool TDictionary_mask::good_translation(const TString & ita, const TString & eng, const TString & src) bool TDictionary_mask::good_translation(const TString & ita, const TString & eng, const TString & src, int maxlen)
{ {
if (ita.find('#') >= 0 || eng.find('#') >= 0) if (ita.find('#') >= 0 || eng.find('#') >= 0)
return false; return false;
@ -671,6 +669,9 @@ bool TDictionary_mask::good_translation(const TString & ita, const TString & eng
return false; return false;
if (src.find(".exe") > 0 && !check_translation(ita, eng, '%')) if (src.find(".exe") > 0 && !check_translation(ita, eng, '%'))
return false; return false;
if (maxlen > 0)
if (eng.len() > maxlen)
return false;
return true; return true;
} }
@ -678,6 +679,19 @@ void TDictionary_mask::fill_chapter()
{ {
const char letter = get(F_ALFABETO)[0]; const char letter = get(F_ALFABETO)[0];
const bool chk_modules = _modules.full(); const bool chk_modules = _modules.full();
TString_array modules;
TToken_string str;
FOR_EACH_TOKEN(_modules, m)
{
str = m;
if (str.find('*') < 0)
{
str.insert("*");
str << '*';
}
modules.add(str);
}
TSheet_field& s = sfield(F_CAPITOLO); TSheet_field& s = sfield(F_CAPITOLO);
s.destroy(); s.destroy();
@ -689,9 +703,9 @@ void TDictionary_mask::fill_chapter()
if (toupper(e._ita[0]) == letter) if (toupper(e._ita[0]) == letter)
{ {
const bool good = good_translation(e._ita, e._eng, e._src); const bool good = good_translation(e._ita, e._eng, e._src, e._max_length);
const bool translated = e._eng != "???"; const bool translated = e._eng != "???";
const bool not_error = good || translated; const bool not_error = good || !translated;
if (_filtered) if (_filtered)
{ {
@ -712,15 +726,14 @@ void TDictionary_mask::fill_chapter()
skip |= !translated; skip |= !translated;
if (!skip && chk_modules) if (!skip && chk_modules)
{ {
if (not_error &&_errors) if (not_error && _errors)
continue; continue;
if (translated && _new) if (translated && _new)
continue; continue;
FOR_EACH_TOKEN(_modules, m) FOR_EACH_ARRAY_ROW(modules, i, m)
{ {
const int p = e._src.find(m); skip = !e._src.match((const char *) *m);
skip = p < 0 || (p > 0 && e._src[p - 1] != ',' && e._src[p] != '.');
if (!skip) if (!skip)
break; break;
} }
@ -816,7 +829,7 @@ bool TDictionary_mask::on_field_event(TOperable_field& o, TField_event e, long j
_dictionary.set_translation(ita, eng); _dictionary.set_translation(ita, eng);
if (len > 0 && eng.len() > len) if (len > 0 && eng.len() > len)
warning_box("La traduzione e' lunga %d caratteri (max. %d)!", eng.len(), len); warning_box("La traduzione e' lunga %d caratteri (max. %d)!", eng.len(), len);
if (!good_translation(ita, eng, src) || eng == "???") if (!good_translation(ita, eng, src, len) || eng == "???")
s.set_back_and_fore_color(REQUIRED_BACK_COLOR, COLOR_RED, jolly); s.set_back_and_fore_color(REQUIRED_BACK_COLOR, COLOR_RED, jolly);
else else
s.set_back_and_fore_color(NORMAL_BACK_COLOR, NORMAL_COLOR, jolly); s.set_back_and_fore_color(NORMAL_BACK_COLOR, NORMAL_COLOR, jolly);

View File

@ -108,7 +108,7 @@ END
BUTTON DLG_USER 10 2 BUTTON DLG_USER 10 2
BEGIN BEGIN
PROMPT -34 -1 "~Copia" PROMPT -34 -1 "C~opia"
END END
BUTTON DLG_CANCEL 10 2 BUTTON DLG_CANCEL 10 2