From 0e26dd1d329902dd6b9ec5e337fe3140426b9bed Mon Sep 17 00:00:00 2001 From: alex Date: Tue, 31 Oct 2006 16:02:37 +0000 Subject: [PATCH] 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 --- ba/ba2700.cpp | 45 +++++++++++++++++++++++++++++---------------- ba/ba2700.uml | 2 +- 2 files changed, 30 insertions(+), 17 deletions(-) diff --git a/ba/ba2700.cpp b/ba/ba2700.cpp index 4f275214f..0cf0852a5 100755 --- a/ba/ba2700.cpp +++ b/ba/ba2700.cpp @@ -35,13 +35,10 @@ public: void TDictionary_entry::add_source(const char* orig) { - if (_src.items() < 8) - { - TFilename n(orig); n.lower(); - const char* src = n.name(); - if (_src.get_pos(src) < 0) - _src.add(src); - } + TFilename n(orig); n.lower(); + const char* src = n.name(); + if (_src.get_pos(src) < 0) + _src.add(src); } void TDictionary_entry::set_sources(const char* orig) @@ -306,7 +303,8 @@ protected: bool read_dictionary(); void fill_index(); 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(); public: @@ -661,7 +659,7 @@ bool TDictionary_mask::check_translation(const TString & ita, const TString & en 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) return false; @@ -671,6 +669,9 @@ bool TDictionary_mask::good_translation(const TString & ita, const TString & eng return false; if (src.find(".exe") > 0 && !check_translation(ita, eng, '%')) return false; + if (maxlen > 0) + if (eng.len() > maxlen) + return false; return true; } @@ -678,6 +679,19 @@ void TDictionary_mask::fill_chapter() { const char letter = get(F_ALFABETO)[0]; 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); s.destroy(); @@ -689,9 +703,9 @@ void TDictionary_mask::fill_chapter() 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 not_error = good || translated; + const bool not_error = good || !translated; if (_filtered) { @@ -712,15 +726,14 @@ void TDictionary_mask::fill_chapter() skip |= !translated; if (!skip && chk_modules) { - if (not_error &&_errors) + if (not_error && _errors) continue; if (translated && _new) 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) break; } @@ -816,7 +829,7 @@ bool TDictionary_mask::on_field_event(TOperable_field& o, TField_event e, long j _dictionary.set_translation(ita, eng); if (len > 0 && 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); else s.set_back_and_fore_color(NORMAL_BACK_COLOR, NORMAL_COLOR, jolly); diff --git a/ba/ba2700.uml b/ba/ba2700.uml index 23e348195..dc7ec8f70 100755 --- a/ba/ba2700.uml +++ b/ba/ba2700.uml @@ -108,7 +108,7 @@ END BUTTON DLG_USER 10 2 BEGIN - PROMPT -34 -1 "~Copia" + PROMPT -34 -1 "C~opia" END BUTTON DLG_CANCEL 10 2