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
118
ba/bacnv.cpp
118
ba/bacnv.cpp
@ -149,6 +149,7 @@ protected: // TApplication
|
||||
virtual bool menu(MENU_TAG);
|
||||
|
||||
// Metodi per convert_profile
|
||||
bool to_be_converted(TFilename& name) const;
|
||||
bool backup_text_file(TFilename& name, TLog_report& log) const;
|
||||
bool rinumera_paragrafo(const TFilename& ini, const char* paragrafo,
|
||||
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);
|
||||
ofstream output(temp);
|
||||
|
||||
if (mskname.find("verig") > 0) // Maschera di riga
|
||||
if (mskname.find("verig") >= 0) // Maschera di riga
|
||||
{
|
||||
bool killing = false;
|
||||
while (!scan.eof())
|
||||
@ -2028,6 +2029,13 @@ bool TConversione_archivi::rinumera_maschera(const TFilename& mskname, TLog_repo
|
||||
msg.cut(0) << TR("Rinumerazione campo ") << line;
|
||||
log.log(1, msg);
|
||||
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;
|
||||
}
|
||||
@ -2043,6 +2051,7 @@ bool TConversione_archivi::rinumera_maschera(const TFilename& mskname, TLog_repo
|
||||
else // Maschera di testa
|
||||
{
|
||||
bool killing = false;
|
||||
bool toolbar = false;
|
||||
while (!scan.eof())
|
||||
{
|
||||
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;
|
||||
log.log(1, msg);
|
||||
killing = true; // Comincio a saltar righe fino ad EN
|
||||
}
|
||||
else
|
||||
output << line << endl;
|
||||
} else
|
||||
if (!toolbar && line.match("TOOLBAR \"*\" *")) // Vecchia toolbar
|
||||
{
|
||||
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
|
||||
{
|
||||
@ -2072,43 +2087,70 @@ bool TConversione_archivi::rinumera_maschera(const TFilename& mskname, TLog_repo
|
||||
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)
|
||||
{
|
||||
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;
|
||||
name.ext("ini");
|
||||
if (name.custom_path()) // Esiste il profilo indicato?
|
||||
TFilename name;
|
||||
TToken_string row;
|
||||
|
||||
if (profile_name && *profile_name)
|
||||
{
|
||||
TToken_string row;
|
||||
row = "X"; // preselezionato!
|
||||
row.add(name);
|
||||
name.ext("msk");
|
||||
if (name.exist()) // Esiste la maschera corrispondente?
|
||||
name = profile_name;
|
||||
name.ext("ini");
|
||||
if (to_be_converted(name))
|
||||
{
|
||||
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);
|
||||
elenco.add(row);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
if (elenco.items() == 0) // Nessun nome valido specificato sulla riga di comando
|
||||
{
|
||||
name = prefix().get_studio();
|
||||
name.add("custom");
|
||||
name.add("*.ini");
|
||||
TString_array inis; list_files(name, inis);
|
||||
|
||||
FOR_EACH_ARRAY_ROW(inis, i, row)
|
||||
name.add("*.*");
|
||||
TString_array files; list_files(name, files);
|
||||
FOR_EACH_ARRAY_ROW(files, i, f)
|
||||
{
|
||||
TToken_string r;
|
||||
r = "X"; // preselezionato
|
||||
r.add(*row);
|
||||
name = *row; name.ext("msk");
|
||||
if (name.exist()) // Esiste la maschera corrispondente?
|
||||
name = *f;
|
||||
if (to_be_converted(name))
|
||||
{
|
||||
r.add(name);
|
||||
elenco.add(r);
|
||||
row = "X"; // preselezionato
|
||||
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())
|
||||
{
|
||||
TLog_report log(TR("Conversione maschere documenti"));
|
||||
|
||||
for (int r = 0; r < elenco.items(); r++) if (elenco.checked(r))
|
||||
{
|
||||
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))
|
||||
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();
|
||||
}
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user