From 71c4cdf406504ed1a979c4bcce04c9a92a7bc704 Mon Sep 17 00:00:00 2001 From: guy Date: Wed, 3 Dec 1997 11:10:55 +0000 Subject: [PATCH] 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 --- ba/ba1600.cpp | 107 ++++++++++++++++++++++++++++--------------------- ba/ba1600b.uml | 8 ++-- 2 files changed, 66 insertions(+), 49 deletions(-) diff --git a/ba/ba1600.cpp b/ba/ba1600.cpp index 527cf9edb..6860d8155 100755 --- a/ba/ba1600.cpp +++ b/ba/ba1600.cpp @@ -28,36 +28,35 @@ int TInstall_ini::build_list(const TString& module, TString_array& a, TAuto_token_string tmp; TString paragraph; - for (int sub = 0; ; sub++) + for (int sub = 0; sub <= 9; sub++) { paragraph = module; if (module[2] == '\0') // Ho specificato un modulo principale paragraph << sub; - - if (set_paragraph(paragraph)) + + if (sum) { - for (int index = 0; exist("File", index); index++) - { - tmp = get("File", NULL, index); // Nome e aggiornamento - - // Quando creo il disco di aggiornamento salto tutti i file - // che non hanno il flag di aggiornamento settato - const bool inagg = tmp.get_char(2) > ' '; - if (agg && !inagg) - continue; - - if (sum) - sum->set("File", tmp, paragraph, TRUE, index); - tmp.add(paragraph, 2); // Sottomodulo - tmp.lower(); - a.add(tmp); - } + sum->set_paragraph(paragraph); + sum->remove_all(); + } + + TAssoc_array& varlist = (TAssoc_array&)list_variables(paragraph); + FOR_EACH_ASSOC_STRING(varlist, obj, key, str) + { + tmp = str; // Nome e aggiornamento + // Quando creo il disco di aggiornamento salto tutti i file + // che non hanno il flag di aggiornamento settato + if (agg && tmp.get_char(1) != 'X') + continue; + if (sum) + sum->set(key, tmp); + tmp.add(paragraph, 2); // Sottomodulo + tmp.lower(); + a.add(tmp); } - else - break; - if (module[2] == '\0') - break; + if (module[2] != '\0') + break; } 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) { - TConfig sum(summary, module); + TConfig sum(summary, module); + sum.remove_all(); TAssoc_array& ass = (TAssoc_array&)list_variables(module); FOR_EACH_ASSOC_STRING(ass, obj, key, str) sum.set(key, str); @@ -192,7 +192,7 @@ protected: bool kill_missing(const char* name, bool update); public: - void load(const char* module); + void load(const TString& module); void save(); 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); const int items = arr.items(); - TString16 module; - module << sf.mask().get(F_MODULE) << '0'; - if (items > 0) { 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; 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); row = file; + row.add(" "); row.add(module); found = TRUE; } @@ -300,10 +302,10 @@ bool TModule_mask::sheet_notify(TSheet_field& sf, int r, KEY key) { // Propongo il sottomodulo automaticamente in inserimento TString16 module; - module << sf.mask().get(F_MODULE) << '0'; + module << sf.mask().get(F_MODULE) << '1'; TToken_string& row = sf.row(r); - row.add(module, 1); + row.add(module, 2); } break; default: @@ -396,10 +398,9 @@ bool TModule_mask::link_handler(TMask_field& f, KEY k) TSheet_field& sheet = mainmask.sfield(F_SHEET); TToken_string& newrow = sheet.row(-1); newrow = modmask.get(101); // Nome del file - newrow.add(""); // Non fa' parte dell'aggiornamento - TString16 submod = newrow.left(2); - submod << '0'; // Sottomodulo standard - newrow.add(submod); + newrow.add(" "); // Non fa' parte dell'aggiornamento + newrow.add(mainmask.get(F_MODULE)); // Modulo attuale + newrow << '1'; // Sottomodulo standard if (modmask.is_running()) { modmask.stop_run(K_ESC); @@ -424,7 +425,18 @@ bool TModule_mask::deselect_handler(TMask_field& f, KEY k) 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; set(F_MODULE, module); @@ -432,7 +444,7 @@ void TModule_mask::load(const char* module) TInstall_ini ini; TSheet_field& s = sfield(F_SHEET); ini.build_list(module, s.rows_array()); - s.rows_array().sort(); + s.rows_array().TArray::sort(file_compare); TFilename mask; mask << module << "*.*"; @@ -487,16 +499,11 @@ void TModule_mask::save() int index; const TString module = get(F_MODULE); - for (index = 0; ; index++) + for (index = 0; index <= 9; index++) { TString16 sub; sub << module << index; if (ini.set_paragraph(sub)) - { - TAssoc_array& list = (TAssoc_array&)ini.list_variables(); - list.destroy(); - } - else - break; + ini.remove_all(); } TToken_string tmp; @@ -505,10 +512,20 @@ void TModule_mask::save() FOR_EACH_SHEET_ROW_BACK(sheet, r, row) { 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 - const bool agg = row->get_char(1) > ' '; + const bool agg = row->get_char() > ' '; if (agg) tmp.add("X"); // Flag aggiornamento ini.set("File", tmp, sub, TRUE, index++); } diff --git a/ba/ba1600b.uml b/ba/ba1600b.uml index c8bc1d521..156f9a392 100755 --- a/ba/ba1600b.uml +++ b/ba/ba1600b.uml @@ -7,9 +7,9 @@ BEGIN PROMPT -13 -11 "" END -BUTTON F_DESELECT 20 2 +BUTTON F_DESELECT 24 2 BEGIN - PROMPT -11 -11 "Annulla selezione" + PROMPT -11 -11 "Annulla aggiornamento" END BUTTON DLG_CANCEL 10 2 @@ -27,10 +27,10 @@ BEGIN FLAGS "D" END -SPREADSHEET F_SHEET 46 +SPREADSHEET F_SHEET 47 BEGIN PROMPT 1 1 "" - ITEM "File@28" + ITEM "File@27" ITEM "Agg." ITEM "Mod." END