Patch level : 10.0
Files correlati : bacnv.exe Ricompilazione Demo : [ ] Commento : Migliorata conversione maschere di testa e di riga dei documenti git-svn-id: svn://10.65.10.50/trunk@17251 c028cbd2-c16b-5b4b-a496-9718f37d4682
This commit is contained in:
parent
dc756c6efb
commit
6cc58ac7ab
116
ba/bacnv.cpp
116
ba/bacnv.cpp
@ -149,6 +149,7 @@ protected: // TApplication
|
|||||||
virtual bool menu(MENU_TAG);
|
virtual bool menu(MENU_TAG);
|
||||||
|
|
||||||
// Metodi per convert_profile
|
// Metodi per convert_profile
|
||||||
|
bool to_be_converted(TFilename& name) const;
|
||||||
bool backup_text_file(TFilename& name, TLog_report& log) const;
|
bool backup_text_file(TFilename& name, TLog_report& log) const;
|
||||||
bool rinumera_paragrafo(const TFilename& ini, const char* paragrafo,
|
bool rinumera_paragrafo(const TFilename& ini, const char* paragrafo,
|
||||||
const char* contatore, const char* variabile, TLog_report& log) const;
|
const char* contatore, const char* variabile, TLog_report& log) const;
|
||||||
@ -1999,7 +2000,7 @@ bool TConversione_archivi::rinumera_maschera(const TFilename& mskname, TLog_repo
|
|||||||
TScanner scan(mskname);
|
TScanner scan(mskname);
|
||||||
ofstream output(temp);
|
ofstream output(temp);
|
||||||
|
|
||||||
if (mskname.find("verig") > 0) // Maschera di riga
|
if (mskname.find("verig") >= 0) // Maschera di riga
|
||||||
{
|
{
|
||||||
bool killing = false;
|
bool killing = false;
|
||||||
while (!scan.eof())
|
while (!scan.eof())
|
||||||
@ -2028,6 +2029,13 @@ bool TConversione_archivi::rinumera_maschera(const TFilename& mskname, TLog_repo
|
|||||||
msg.cut(0) << TR("Rinumerazione campo ") << line;
|
msg.cut(0) << TR("Rinumerazione campo ") << line;
|
||||||
log.log(1, msg);
|
log.log(1, msg);
|
||||||
line.overwrite("5", line.len()-2);
|
line.overwrite("5", line.len()-2);
|
||||||
|
} else
|
||||||
|
if (line.match("ST 102 *"))
|
||||||
|
{
|
||||||
|
msg.cut(0) << TR("Trasformazione campo ") << line;
|
||||||
|
log.log(1, msg);
|
||||||
|
line = "LI 102 2 50\nBE\nPR 2 2 \"Tipo riga \"\nFI TIPORIGA\nEN";
|
||||||
|
killing = true; // Elimina contenuto vecchio campo tipo riga
|
||||||
}
|
}
|
||||||
output << line << endl;
|
output << line << endl;
|
||||||
}
|
}
|
||||||
@ -2043,6 +2051,7 @@ bool TConversione_archivi::rinumera_maschera(const TFilename& mskname, TLog_repo
|
|||||||
else // Maschera di testa
|
else // Maschera di testa
|
||||||
{
|
{
|
||||||
bool killing = false;
|
bool killing = false;
|
||||||
|
bool toolbar = false;
|
||||||
while (!scan.eof())
|
while (!scan.eof())
|
||||||
{
|
{
|
||||||
TString& line = scan.line();
|
TString& line = scan.line();
|
||||||
@ -2054,9 +2063,15 @@ bool TConversione_archivi::rinumera_maschera(const TFilename& mskname, TLog_repo
|
|||||||
msg.cut(0) << TR("Eliminazione campo ") << line;
|
msg.cut(0) << TR("Eliminazione campo ") << line;
|
||||||
log.log(1, msg);
|
log.log(1, msg);
|
||||||
killing = true; // Comincio a saltar righe fino ad EN
|
killing = true; // Comincio a saltar righe fino ad EN
|
||||||
}
|
} else
|
||||||
else
|
if (!toolbar && line.match("TOOLBAR \"*\" *")) // Vecchia toolbar
|
||||||
output << line << endl;
|
{
|
||||||
|
toolbar = true;
|
||||||
|
log.log(1, TR("Conversione TOOLBAR principale"));
|
||||||
|
output << "TOOLBAR \"toolbar\" 0 0 2 0" << endl; // nuova toolbar
|
||||||
|
}
|
||||||
|
else
|
||||||
|
output << line << endl; // Lascia stare la riga cosi' com'e'
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
@ -2072,21 +2087,51 @@ bool TConversione_archivi::rinumera_maschera(const TFilename& mskname, TLog_repo
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
bool TConversione_archivi::to_be_converted(TFilename& name) const
|
||||||
|
{
|
||||||
|
if (!name.custom_path() || name.find("custom") < 0)
|
||||||
|
return false;
|
||||||
|
name.lower();
|
||||||
|
|
||||||
|
if (name.ends_with(".ini"))
|
||||||
|
{
|
||||||
|
TFilename msk = name.name();
|
||||||
|
msk.ext("msk");
|
||||||
|
return msk.custom_path(); // Converto un .ini solo se esiste un .msk omonimo
|
||||||
|
} else
|
||||||
|
if (name.ends_with(".msk"))
|
||||||
|
{
|
||||||
|
TFilename ini = name.name();
|
||||||
|
ini.ext("ini");
|
||||||
|
return ini.custom_path(); // Converto un .msk solo se esiste un .ini omonimo
|
||||||
|
}
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
void TConversione_archivi::convert_profile(const char* profile_name)
|
void TConversione_archivi::convert_profile(const char* profile_name)
|
||||||
{
|
{
|
||||||
TArray_sheet elenco(-1, -1, -4, -4,
|
TArray_sheet elenco(-1, -1, -4, -4,
|
||||||
TR("Profili da convertire"), TR("@1|Profilo@40|Maschera@40"));
|
TR("Profili da convertire"), TR("@1|Profilo@60"), 0x08);
|
||||||
|
|
||||||
TFilename name = profile_name;
|
TFilename name;
|
||||||
name.ext("ini");
|
TToken_string row;
|
||||||
if (name.custom_path()) // Esiste il profilo indicato?
|
|
||||||
|
if (profile_name && *profile_name)
|
||||||
{
|
{
|
||||||
TToken_string row;
|
name = profile_name;
|
||||||
row = "X"; // preselezionato!
|
name.ext("ini");
|
||||||
row.add(name);
|
if (to_be_converted(name))
|
||||||
name.ext("msk");
|
|
||||||
if (name.exist()) // Esiste la maschera corrispondente?
|
|
||||||
{
|
{
|
||||||
|
row = "X"; // preselezionato!
|
||||||
|
row.add(name);
|
||||||
|
elenco.add(row);
|
||||||
|
}
|
||||||
|
name = profile_name;
|
||||||
|
name.ext("msk");
|
||||||
|
if (to_be_converted(name))
|
||||||
|
{
|
||||||
|
row = "X"; // preselezionato!
|
||||||
row.add(name);
|
row.add(name);
|
||||||
elenco.add(row);
|
elenco.add(row);
|
||||||
}
|
}
|
||||||
@ -2096,19 +2141,16 @@ void TConversione_archivi::convert_profile(const char* profile_name)
|
|||||||
{
|
{
|
||||||
name = prefix().get_studio();
|
name = prefix().get_studio();
|
||||||
name.add("custom");
|
name.add("custom");
|
||||||
name.add("*.ini");
|
name.add("*.*");
|
||||||
TString_array inis; list_files(name, inis);
|
TString_array files; list_files(name, files);
|
||||||
|
FOR_EACH_ARRAY_ROW(files, i, f)
|
||||||
FOR_EACH_ARRAY_ROW(inis, i, row)
|
|
||||||
{
|
{
|
||||||
TToken_string r;
|
name = *f;
|
||||||
r = "X"; // preselezionato
|
if (to_be_converted(name))
|
||||||
r.add(*row);
|
|
||||||
name = *row; name.ext("msk");
|
|
||||||
if (name.exist()) // Esiste la maschera corrispondente?
|
|
||||||
{
|
{
|
||||||
r.add(name);
|
row = "X"; // preselezionato
|
||||||
elenco.add(r);
|
row.add(*f);
|
||||||
|
elenco.add(row);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -2116,24 +2158,24 @@ void TConversione_archivi::convert_profile(const char* profile_name)
|
|||||||
if (elenco.run() == K_ENTER && elenco.one_checked())
|
if (elenco.run() == K_ENTER && elenco.one_checked())
|
||||||
{
|
{
|
||||||
TLog_report log(TR("Conversione maschere documenti"));
|
TLog_report log(TR("Conversione maschere documenti"));
|
||||||
|
|
||||||
for (int r = 0; r < elenco.items(); r++) if (elenco.checked(r))
|
for (int r = 0; r < elenco.items(); r++) if (elenco.checked(r))
|
||||||
{
|
{
|
||||||
name = elenco.row(r).get(1);
|
name = elenco.row(r).get(1);
|
||||||
if (!backup_text_file(name, log))
|
|
||||||
continue;
|
|
||||||
const bool ok = rinumera_paragrafo(name, "SHEET", "NCOLS", "Col", log);
|
|
||||||
if (!ok)
|
|
||||||
continue; // Gia' elaborato!
|
|
||||||
rinumera_paragrafo(name, "RIGHE", "NTIPIRIGA", "Tipo", log);
|
|
||||||
rinumera_paragrafo(name, "HANDLERS", "NHANDLER", "Handler", log);
|
|
||||||
rinumera_paragrafo(name, "DEFAULT", "NDEFAULTS", "Default", log);
|
|
||||||
|
|
||||||
name = elenco.row(r).get(2);
|
|
||||||
if (backup_text_file(name, log))
|
if (backup_text_file(name, log))
|
||||||
rinumera_maschera(name, log);
|
{
|
||||||
|
if (name.ends_with(".ini"))
|
||||||
|
{
|
||||||
|
const bool ok = rinumera_paragrafo(name, "SHEET", "NCOLS", "Col", log);
|
||||||
|
if (!ok)
|
||||||
|
continue; // Gia' elaborato!
|
||||||
|
rinumera_paragrafo(name, "RIGHE", "NTIPIRIGA", "Tipo", log);
|
||||||
|
rinumera_paragrafo(name, "HANDLERS", "NHANDLER", "Handler", log);
|
||||||
|
rinumera_paragrafo(name, "DEFAULT", "NDEFAULTS", "Default", log);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
rinumera_maschera(name, log);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
log.preview();
|
log.preview();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user