ba1600.cpp Corretti errori di caricamnto/scaricamento lista files

Il sottomodulo standard passa da 0 a 1
ba1600b.uml Cambiato prompt del bottone di annullamento aggiornamento lento


git-svn-id: svn://10.65.10.50/trunk@5688 c028cbd2-c16b-5b4b-a496-9718f37d4682
This commit is contained in:
guy 1997-12-03 11:10:55 +00:00
parent 84ee56654f
commit 71c4cdf406
2 changed files with 66 additions and 49 deletions

View File

@ -28,36 +28,35 @@ int TInstall_ini::build_list(const TString& module, TString_array& a,
TAuto_token_string tmp; TAuto_token_string tmp;
TString paragraph; TString paragraph;
for (int sub = 0; ; sub++) for (int sub = 0; sub <= 9; sub++)
{ {
paragraph = module; paragraph = module;
if (module[2] == '\0') // Ho specificato un modulo principale if (module[2] == '\0') // Ho specificato un modulo principale
paragraph << sub; paragraph << sub;
if (set_paragraph(paragraph)) if (sum)
{ {
for (int index = 0; exist("File", index); index++) sum->set_paragraph(paragraph);
{ sum->remove_all();
tmp = get("File", NULL, index); // Nome e aggiornamento }
// Quando creo il disco di aggiornamento salto tutti i file TAssoc_array& varlist = (TAssoc_array&)list_variables(paragraph);
// che non hanno il flag di aggiornamento settato FOR_EACH_ASSOC_STRING(varlist, obj, key, str)
const bool inagg = tmp.get_char(2) > ' '; {
if (agg && !inagg) tmp = str; // Nome e aggiornamento
continue; // Quando creo il disco di aggiornamento salto tutti i file
// che non hanno il flag di aggiornamento settato
if (sum) if (agg && tmp.get_char(1) != 'X')
sum->set("File", tmp, paragraph, TRUE, index); continue;
tmp.add(paragraph, 2); // Sottomodulo if (sum)
tmp.lower(); sum->set(key, tmp);
a.add(tmp); tmp.add(paragraph, 2); // Sottomodulo
} tmp.lower();
a.add(tmp);
} }
else
break;
if (module[2] == '\0') if (module[2] != '\0')
break; break;
} }
if (sum) if (sum)
@ -81,7 +80,8 @@ int TInstall_ini::build_complete_list(const TString& module, TString_array& a,
void TInstall_ini::export_paragraph(const char* module, const char* summary) void TInstall_ini::export_paragraph(const char* module, const char* summary)
{ {
TConfig sum(summary, module); TConfig sum(summary, module);
sum.remove_all();
TAssoc_array& ass = (TAssoc_array&)list_variables(module); TAssoc_array& ass = (TAssoc_array&)list_variables(module);
FOR_EACH_ASSOC_STRING(ass, obj, key, str) FOR_EACH_ASSOC_STRING(ass, obj, key, str)
sum.set(key, str); sum.set(key, str);
@ -192,7 +192,7 @@ protected:
bool kill_missing(const char* name, bool update); bool kill_missing(const char* name, bool update);
public: public:
void load(const char* module); void load(const TString& module);
void save(); void save();
TModule_mask(); TModule_mask();
@ -243,12 +243,13 @@ bool TModule_mask::sheet_notify(TSheet_field& sf, int r, KEY key)
TString_array arr; list_files(mask, arr); TString_array arr; list_files(mask, arr);
const int items = arr.items(); const int items = arr.items();
TString16 module;
module << sf.mask().get(F_MODULE) << '0';
if (items > 0) if (items > 0)
{ {
TModule_mask& msk = (TModule_mask&)sf.mask(); TModule_mask& msk = (TModule_mask&)sf.mask();
TString16 module = sf.row(r).get(2);
if (module.len() < 3)
module << msk.get(F_MODULE) << '1';
TFilename start; TFilename start;
DIRECTORY dir; xvt_fsys_get_dir(&dir); DIRECTORY dir; xvt_fsys_get_dir(&dir);
@ -269,6 +270,7 @@ bool TModule_mask::sheet_notify(TSheet_field& sf, int r, KEY key)
{ {
TToken_string& row = sf.row(found ? -1 : r); TToken_string& row = sf.row(found ? -1 : r);
row = file; row = file;
row.add(" ");
row.add(module); row.add(module);
found = TRUE; found = TRUE;
} }
@ -300,10 +302,10 @@ bool TModule_mask::sheet_notify(TSheet_field& sf, int r, KEY key)
{ {
// Propongo il sottomodulo automaticamente in inserimento // Propongo il sottomodulo automaticamente in inserimento
TString16 module; TString16 module;
module << sf.mask().get(F_MODULE) << '0'; module << sf.mask().get(F_MODULE) << '1';
TToken_string& row = sf.row(r); TToken_string& row = sf.row(r);
row.add(module, 1); row.add(module, 2);
} }
break; break;
default: default:
@ -396,10 +398,9 @@ bool TModule_mask::link_handler(TMask_field& f, KEY k)
TSheet_field& sheet = mainmask.sfield(F_SHEET); TSheet_field& sheet = mainmask.sfield(F_SHEET);
TToken_string& newrow = sheet.row(-1); TToken_string& newrow = sheet.row(-1);
newrow = modmask.get(101); // Nome del file newrow = modmask.get(101); // Nome del file
newrow.add(""); // Non fa' parte dell'aggiornamento newrow.add(" "); // Non fa' parte dell'aggiornamento
TString16 submod = newrow.left(2); newrow.add(mainmask.get(F_MODULE)); // Modulo attuale
submod << '0'; // Sottomodulo standard newrow << '1'; // Sottomodulo standard
newrow.add(submod);
if (modmask.is_running()) if (modmask.is_running())
{ {
modmask.stop_run(K_ESC); modmask.stop_run(K_ESC);
@ -424,7 +425,18 @@ bool TModule_mask::deselect_handler(TMask_field& f, KEY k)
return TRUE; return TRUE;
} }
void TModule_mask::load(const char* module) static int file_compare(const TObject** o1, const TObject** o2)
{
TToken_string* r1 = (TToken_string*)*o1;
TToken_string* r2 = (TToken_string*)*o2;
int cmp = stricmp(r1->get(-2), r2->get(-2));
if (cmp == 0)
cmp = stricmp(*r1, *r2);
return cmp;
}
void TModule_mask::load(const TString& module)
{ {
TWait_cursor hourglass; TWait_cursor hourglass;
set(F_MODULE, module); set(F_MODULE, module);
@ -432,7 +444,7 @@ void TModule_mask::load(const char* module)
TInstall_ini ini; TInstall_ini ini;
TSheet_field& s = sfield(F_SHEET); TSheet_field& s = sfield(F_SHEET);
ini.build_list(module, s.rows_array()); ini.build_list(module, s.rows_array());
s.rows_array().sort(); s.rows_array().TArray::sort(file_compare);
TFilename mask; TFilename mask;
mask << module << "*.*"; mask << module << "*.*";
@ -487,16 +499,11 @@ void TModule_mask::save()
int index; int index;
const TString module = get(F_MODULE); const TString module = get(F_MODULE);
for (index = 0; ; index++) for (index = 0; index <= 9; index++)
{ {
TString16 sub; sub << module << index; TString16 sub; sub << module << index;
if (ini.set_paragraph(sub)) if (ini.set_paragraph(sub))
{ ini.remove_all();
TAssoc_array& list = (TAssoc_array&)ini.list_variables();
list.destroy();
}
else
break;
} }
TToken_string tmp; TToken_string tmp;
@ -505,10 +512,20 @@ void TModule_mask::save()
FOR_EACH_SHEET_ROW_BACK(sheet, r, row) FOR_EACH_SHEET_ROW_BACK(sheet, r, row)
{ {
TString16 sub = row->get(2); TString16 sub = row->get(2);
if (isdigit(sub[0]) || sub.left(2) == module) if (sub.blank())
sub << module << '1';
else
{
if (isdigit(sub[0]))
{
sub.insert(module, 0);
sub.cut(3);
}
}
if (sub.left(2) == module)
{ {
tmp = row->get(0); // Nome del file tmp = row->get(0); // Nome del file
const bool agg = row->get_char(1) > ' '; const bool agg = row->get_char() > ' ';
if (agg) tmp.add("X"); // Flag aggiornamento if (agg) tmp.add("X"); // Flag aggiornamento
ini.set("File", tmp, sub, TRUE, index++); ini.set("File", tmp, sub, TRUE, index++);
} }

View File

@ -7,9 +7,9 @@ BEGIN
PROMPT -13 -11 "" PROMPT -13 -11 ""
END END
BUTTON F_DESELECT 20 2 BUTTON F_DESELECT 24 2
BEGIN BEGIN
PROMPT -11 -11 "Annulla selezione" PROMPT -11 -11 "Annulla aggiornamento"
END END
BUTTON DLG_CANCEL 10 2 BUTTON DLG_CANCEL 10 2
@ -27,10 +27,10 @@ BEGIN
FLAGS "D" FLAGS "D"
END END
SPREADSHEET F_SHEET 46 SPREADSHEET F_SHEET 47
BEGIN BEGIN
PROMPT 1 1 "" PROMPT 1 1 ""
ITEM "File@28" ITEM "File@27"
ITEM "Agg." ITEM "Agg."
ITEM "Mod." ITEM "Mod."
END END