diff --git a/ba/ba0.cpp b/ba/ba0.cpp index 58ee4ac47..256e8de80 100755 --- a/ba/ba0.cpp +++ b/ba/ba0.cpp @@ -544,6 +544,7 @@ bool TMenuitem::perform_submenu() const bool ok = mnu != NULL && mnu->enabled(); if (ok) { +/* Cristina 6/11/97 if (mnu->items() == 1) { if (mnu->query_firm()) @@ -555,6 +556,7 @@ bool TMenuitem::perform_submenu() const } } else +*/ menu().jumpto(mnu); } @@ -682,6 +684,8 @@ void TSubmenu::read(TScanner& scanner) { TString16 flags; get_next_string(line, 6, flags, brace); + if (flags.find('D') >= 0) + _enabled = FALSE; if (flags.find('F') >= 0) _firm = TRUE; } else @@ -698,8 +702,7 @@ int TSubmenu::find_string(const char* str) const { bool found = FALSE; - TString caption(32); - + TString caption; caption = _caption; caption.upper(); if (caption.find(str) >= 0) found = TRUE; @@ -728,7 +731,7 @@ bool TSubmenu::perform(int i) bool TMenu::read(const char* name, TString& root) { - TString80 str; + TString str(255); bool first = TRUE; TScanner scanner(name); @@ -762,7 +765,7 @@ bool TMenu::read(const char* name, TString& root) bool TMenu::read(const char* name) { - TString80 root; + TString root(50); bool ok = read(name, root); if (ok && _current == NULL) { diff --git a/ba/ba1600.cpp b/ba/ba1600.cpp index 6aed9a920..5ddf62a1c 100755 --- a/ba/ba1600.cpp +++ b/ba/ba1600.cpp @@ -11,22 +11,26 @@ #include "ba1600.h" #include "ba1600a.h" +#define FOR_EACH_SHEET_ROW(sheet, row) TToken_string* row; for (int __row = 0; __row < sheet.items() && (const char*)(row = &sheet.row(__row)); __row++) + /////////////////////////////////////////////////////////// // Configurazione per installazione /////////////////////////////////////////////////////////// -int TInstall_ini::build_list(const TString& module, TString_array& a, const char* sommario) +int TInstall_ini::build_list(const TString& module, TString_array& a, + const char* sommario, bool agg) { CHECKS(module.len() >= 2, "Bad module ", (const char*)module); TConfig* sum = NULL; if (sommario) sum = new TConfig(sommario, module); - - TToken_string tmp; + + TAuto_token_string tmp; + TString paragraph; for (int sub = 0; ; sub++) { - TString16 paragraph = module; + paragraph = module; if (module[2] == '\0') // Ho specificato un modulo principale paragraph << sub; @@ -34,10 +38,16 @@ int TInstall_ini::build_list(const TString& module, TString_array& a, const char { for (int index = 0; exist("File", index); index++) { - tmp = get("File", NULL, 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 + if (agg && tmp.get_char(1) <= ' ') + continue; + if (sum) sum->set("File", tmp, paragraph, TRUE, index); - tmp.add(paragraph); + tmp.add(paragraph, 2); // Sottomodulo tmp.lower(); a.add(tmp); } @@ -55,15 +65,17 @@ int TInstall_ini::build_list(const TString& module, TString_array& a, const char return a.items(); } -int TInstall_ini::build_complete_list(const TString& module, TString_array& a, const char* sommario) +int TInstall_ini::build_complete_list(const TString& module, TString_array& a, + const char* sommario, bool agg) { - build_list(module, a, sommario); + build_list(module, a, sommario, agg); + TAuto_token_string altri(get("Moduli", module)); + TString submodule; for (const char* mod = altri.get(0); mod; mod = altri.get()) { - const TString16 submodule = mod; - if (!submodule.blank()) - build_list(submodule, a, sommario); + submodule = mod; + copy_paragraph(submodule, sommario); } return a.items(); } @@ -83,7 +95,7 @@ void TInstall_ini::copy_paragraph(const char* module, const char* summary) void TInstall_ini::copy_module_paragraphs(const char* module, const char* summary) { - TString16 mod; + TString mod; for (int sub = -1; ; sub++) { mod = module; @@ -93,14 +105,6 @@ void TInstall_ini::copy_module_paragraphs(const char* module, const char* summar else break; } - - TAuto_token_string modules(get("Moduli", module)); - for (const char* m = modules.get(0); m; m = modules.get()) - { - mod = m; - if (!mod.blank()) - copy_paragraph(mod, summary); - } } /////////////////////////////////////////////////////////// @@ -115,7 +119,7 @@ TAuto_token_string& TAuto_token_string::create(const char* ts) // Calcola il separatore for (const char* s = get_buffer(); *s; s++) { - if (strchr("|;,!^&", *s) != NULL) + if (strchr("|;,!^&+", *s) != NULL) { separator(*s); break; @@ -136,6 +140,7 @@ protected: static bool missing_notify(TSheet_field& sf, int row, KEY key); static bool file_handler(TMask_field& f, KEY k); static bool link_handler(TMask_field& f, KEY k); + static bool deselect_handler(TMask_field& f, KEY k); bool find(const TString& name) const; bool kill_missing(const char* name, bool update); @@ -152,9 +157,9 @@ public: bool TModule_mask::find(const TString& name) const { TSheet_field& sf = sfield(F_SHEET); - for (int m = sf.items()-1; m >= 0; m--) + FOR_EACH_SHEET_ROW(sf, row) { - if (name.compare(sf.row(m).get(0), -1, TRUE) == 0) + if (name.compare(row->get(0), -1, TRUE) == 0) break; } return m >= 0; @@ -164,11 +169,11 @@ bool TModule_mask::find(const TString& name) const bool TModule_mask::kill_missing(const char* name, bool update) { TSheet_field& miss = sfield(F_MISSING); - for (int m = miss.items()-1; m >= 0; m--) + FOR_EACH_SHEET_ROW(miss, row) { - if (miss.row(m).compare(name, -1, TRUE) == 0) + if (row->compare(name, -1, TRUE) == 0) { - miss.destroy(m, update); + miss.destroy(__row, update); break; } } @@ -269,14 +274,16 @@ bool TModule_mask::missing_notify(TSheet_field& sf, int r, KEY key) // Sposto tutte le righe nello spreadsheet a fianco TMask& mainmask = sf.mask(); TSheet_field& sheet = mainmask.sfield(F_SHEET); - for (int i = 0; i < sf.items(); i++) + + FOR_EACH_SHEET_ROW(sf, row) { TToken_string& newrow = sheet.row(-1); - newrow = sf.row(i); + newrow = *row; TString16 submod = newrow.left(2); submod << '0'; newrow.add(submod); } + sf.destroy(); sf.force_update(); sheet.force_update(); @@ -356,6 +363,27 @@ bool TModule_mask::link_handler(TMask_field& f, KEY k) sf->force_update(); } return TRUE; +} + +bool TModule_mask::deselect_handler(TMask_field& f, KEY k) +{ + if (k == K_SPACE) + { + TSheet_field& sheet = f.mask().sfield(F_SHEET); + +// for (int r = sheet.items()-1; r >= 0; r--) +// { +// sheet.row(r).add(" ", 1); +// } + + FOR_EACH_SHEET_ROW(sheet, row) + { + row->add(" ", 1); + } + + sheet.force_update(); + } + return TRUE; } void TModule_mask::load(const char* module) @@ -421,7 +449,7 @@ void TModule_mask::save() TInstall_ini ini; int index; - const TString16 module = get(F_MODULE); + const TString module = get(F_MODULE); for (index = 0; ; index++) { TString16 sub; sub << module << index; @@ -434,15 +462,17 @@ void TModule_mask::save() break; } - TString tmp; + TToken_string tmp; index = 0; for (int r = 0; r < sheet.items(); r++) { TToken_string& row = sheet.row(r); - TString16 sub = row.get(1); + TString16 sub = row.get(2); if (isdigit(sub[0]) || sub.left(2) == module) { - tmp = row.get(0); + tmp = row.get(0); // Nome del file + const bool agg = *row.get() > ' '; + if (agg) tmp.add("X"); // Flag aggiornamento ini.set("File", tmp, sub, TRUE, index++); } } @@ -451,7 +481,9 @@ void TModule_mask::save() TModule_mask::TModule_mask() : TMask("ba1600b") -{ +{ + set_handler(F_DESELECT, deselect_handler); + TSheet_field& s = sfield(F_SHEET); s.set_notify(sheet_notify); s.sheet_mask().set_handler(S_FILE, file_handler); @@ -475,7 +507,7 @@ protected: bool zip_file(const char* archive, const char* file) const; int split_file(const TFilename& file, long size) const; bool move_file(const TFilename& file, const char* dir) const; - bool zip_module(const TString& module) const; + bool zip_module(const TString& module, bool agg) const; public: void load(); @@ -514,9 +546,9 @@ bool TFascicolator_mask::save_handler(TMask_field& f, KEY k) ini.set("PreProcess", m.get(S_PREPROCESS)); ini.set("PostProcess", m.get(S_POSTPROCESS)); } - + const bool agg = f.dlg() == S_SAVEAGG; TFascicolator_mask& fm = (TFascicolator_mask&)m.get_sheet()->mask(); - fm.zip_module(module); + fm.zip_module(module, agg); } return TRUE; } @@ -718,15 +750,13 @@ int TFascicolator_mask::split_file(const TFilename& archive, long size) const else break; } - - if (disks > 1) - ::remove(archive); + ::remove(archive); } return disks; } -bool TFascicolator_mask::zip_module(const TString& main_module) const +bool TFascicolator_mask::zip_module(const TString& main_module, bool agg) const { TString_array arr; TInstall_ini ini; @@ -735,7 +765,7 @@ bool TFascicolator_mask::zip_module(const TString& main_module) const sommario.add(main_module); sommario << "inst.ini"; // Nome del file sommario completo - ini.build_complete_list(main_module, arr, sommario); + ini.build_complete_list(main_module, arr, sommario, agg); if (arr.items() == 0) { ::remove(sommario); @@ -746,27 +776,33 @@ bool TFascicolator_mask::zip_module(const TString& main_module) const archivio.ext("zip"); // Nome del file archivio completo bool aborted = FALSE; - TString msg(80); + TString msg; msg << "Creazione del file " << archivio << " ..."; + TProgind pi(arr.items(), msg, TRUE, TRUE); TFilename cmd; for (int i = arr.items()-1; i >= 0; i--) { pi.addstatus(1); - cmd << ' ' << arr.row(i).get(0); - if (cmd.len() > 80) - { - zip_file(archivio, cmd); - cmd.cut(0); - } if (pi.iscancelled()) { aborted = TRUE; break; } + + TToken_string& row = arr.row(i); + + // Aggiungo il nome corrente alla lista dei files da compattare + cmd << ' ' << row.get(0); + + if (cmd.len() > 80) // Se la riga ha raggiunto la dimensione giusta... + { + zip_file(archivio, cmd); // ... allora compatto + cmd.cut(0); // e svuoto la riga di comando + } } if (cmd.len() > 0 && !aborted) - zip_file(archivio, cmd); + zip_file(archivio, cmd); // Compatto gli eventuali ultimi rimasti msg.cut(0); msg << "Separazione del file " << archivio << " ..."; @@ -794,12 +830,9 @@ bool TFascicolator_mask::zip_module(const TString& main_module) const // Costruisco il nome del file da copiare su dischetto TFilename src(archivio); - if (d > 1 || disks > 1) - { - src.ext(""); - src << d; - src.ext("zip"); - } + src.ext(""); + src << d; + src.ext("zip"); msg.cut(0); msg << "Generazione del disco " << d << " di " << disks @@ -824,7 +857,8 @@ TFascicolator_mask::TFascicolator_mask() TSheet_field& s = sfield(F_SHEET); TMask& m = s.sheet_mask(); m.set_handler(S_LIST, list_handler); - m.set_handler(100, save_handler); + m.set_handler(S_SAVE, save_handler); + m.set_handler(S_SAVEAGG, save_handler); } /////////////////////////////////////////////////////////// diff --git a/ba/ba1600.h b/ba/ba1600.h index 80504438d..6195f29f9 100755 --- a/ba/ba1600.h +++ b/ba/ba1600.h @@ -8,8 +8,10 @@ class TInstall_ini : public TConfig { public: - int build_list(const TString& m, TString_array& a, const char* s = NULL); - int build_complete_list(const TString& m, TString_array& a, const char* s = NULL); + int build_list(const TString& m, TString_array& a, + const char* s = NULL, bool agg = FALSE); + int build_complete_list(const TString& m, TString_array& a, + const char* s = NULL, bool agg = FALSE); void copy_paragraph(const char* module, const char* summary); void copy_module_paragraphs(const char* module, const char* summary); @@ -32,6 +34,7 @@ public: TAuto_token_string& operator=(const TString& ts) { return create(ts); } TAuto_token_string& operator=(const TToken_string& ts) { return create(ts); } TAuto_token_string& operator=(const TAuto_token_string& ts) { return create(ts); } + TAuto_token_string() : TToken_string(50) { } TAuto_token_string(const char* ts) { create(ts); } virtual ~TAuto_token_string() { } }; diff --git a/ba/ba1600a.h b/ba/ba1600a.h index 9879e1907..b20dc4cdd 100755 --- a/ba/ba1600a.h +++ b/ba/ba1600a.h @@ -6,6 +6,7 @@ #define F_SHEET 203 #define F_MISSING 204 #define F_MODULE 205 +#define F_DESELECT 251 #define S_FILE 101 #define S_MODULE 102 @@ -14,6 +15,9 @@ #define S_EXTERN 105 #define S_PREPROCESS 106 #define S_POSTPROCESS 107 -#define S_LIST 200 + +#define S_LIST 100 +#define S_SAVE 151 +#define S_SAVEAGG 152 #endif diff --git a/ba/ba1600a.uml b/ba/ba1600a.uml index b1023d58d..af70a66c8 100755 --- a/ba/ba1600a.uml +++ b/ba/ba1600a.uml @@ -47,7 +47,7 @@ ENDPAGE ENDMASK -PAGE "Modulo" -1 -1 52 8 +PAGE "Modulo" -1 -1 52 10 STRING 101 36 BEGIN @@ -86,28 +86,30 @@ BEGIN PROMPT 1 5 "Post-processing " END -BUTTON DLG_OK 10 2 +BUTTON DLG_OK 14 2 BEGIN - PROMPT -14 -1 "" + PROMPT -13 -3 "" END -BUTTON 100 10 2 +BUTTON DLG_CANCEL 14 2 BEGIN - PROMPT -24 -1 "" - PICTURE BMP_SAVEREC - PICTURE BMP_SAVERECDN + PROMPT -13 -1 "" END -BUTTON S_LIST 10 2 +BUTTON S_SAVE 14 2 BEGIN - PROMPT -34 -1 "Lista file" + PROMPT -23 -3 "&Versione" END -BUTTON DLG_CANCEL 10 2 +BUTTON S_SAVEAGG 14 2 BEGIN - PROMPT -44 -1 "" + PROMPT -23 -1 "&Aggiornamento" END +BUTTON S_LIST 14 2 +BEGIN + PROMPT -33 -1 "Lista file" +END ENDPAGE diff --git a/ba/ba1600b.uml b/ba/ba1600b.uml index cda2eccc6..e7d6ff426 100755 --- a/ba/ba1600b.uml +++ b/ba/ba1600b.uml @@ -4,12 +4,17 @@ TOOLBAR "" 0 20 0 2 BUTTON DLG_OK 10 2 BEGIN - PROMPT -12 -11 "" + PROMPT -13 -11 "" +END + +BUTTON F_DESELECT 20 2 +BEGIN + PROMPT -11 -11 "Annulla selezione" END BUTTON DLG_CANCEL 10 2 BEGIN - PROMPT -22 -11 "" + PROMPT -33 -11 "" END ENDPAGE @@ -25,7 +30,8 @@ END SPREADSHEET F_SHEET 46 BEGIN PROMPT 1 1 "" - ITEM "File@32" + ITEM "File@28" + ITEM "Agg." ITEM "Mod." END @@ -48,9 +54,14 @@ BEGIN FLAGS "B" END -STRING S_MODULE 3 +BOOLEAN 102 BEGIN - PROMPT 1 2 "Sottomodulo " + PROMPT 1 2 "Includi nell'aggiornamento" +END + +STRING 103 3 +BEGIN + PROMPT 30 2 "Sottomodulo " END BUTTON DLG_OK 10 2 diff --git a/ba/ba1700.cpp b/ba/ba1700.cpp index 9aa80d1f3..7640d7f2a 100755 --- a/ba/ba1700.cpp +++ b/ba/ba1700.cpp @@ -69,7 +69,7 @@ bool TInstaller_mask::add_module(TConfig& ini, const TString& module) const void TInstaller_mask::update_version() { TInstall_ini ini; - + TSheet_field& sheet = sfield(F_SHEET); for (int m = sheet.items()-1; m >= 0; m--) { @@ -169,9 +169,37 @@ bool TInstaller_mask::do_process(TAuto_token_string& commands) const } bool TInstaller_mask::pre_process(TInstall_ini& ini, const char* module) const -{ - TAuto_token_string commands(ini.get("PreProcess", module)); - return do_process(commands); +{ + bool ok = TRUE; + + TInstall_ini cur_ini; + TAuto_token_string altri(ini.get("Moduli", module)); + altri.add("ba"); // La base e' obbligatoria per tutti + + TString submodule, curver, reqver; + for (const char* mod = altri.get(0); mod && ok; mod = altri.get()) + { + submodule = mod; + submodule.cut(2); + reqver = ini.get("Versione", submodule); + curver = cur_ini.get("Versione", submodule); + ok = compare_version(reqver, curver) <= 0; + if (!ok) + { + TString msg; + msg << "L'installazione del modulo " << module + << " richiede\nla versione " << reqver + << " del sottomodulo " << submodule; + error_box(msg); + } + } + if (ok) + { + TAuto_token_string commands(ini.get("PreProcess", module)); + ok = do_process(commands); + } + + return ok; } bool TInstaller_mask::post_process(TInstall_ini& ini, const char* module) const @@ -195,19 +223,25 @@ bool TInstaller_mask::install(const TString& module) TInstall_ini ini(ininame); const int dischi = ini.get_int("Dischi", module); ok = dischi > 0; - - if (ok) - ok = pre_process(ini, module); - + + if (!ok) + { + return error_box("Impossibile determinare il numero dei dischetti"); + } + else + { + ok = pre_process(ini, module); + if (!ok) return FALSE; + } + TProgind pi(dischi, "Decompressione in corso...", FALSE, TRUE); TFilename cmdline; for (int d = 1; d <= dischi && ok; d++) { - cmdline = ininame.path(); + cmdline = path; cmdline.add(module); - cmdline << "inst"; - if (dischi > 1) cmdline << d; + cmdline << "inst" << d; cmdline.ext("zip"); ok = fexist(cmdline); @@ -218,7 +252,7 @@ bool TInstaller_mask::install(const TString& module) ok = fexist(cmdline); if (!ok) { - if (!yesno_box("Impossibile trovare %s\nSi desidera riprovare?", + if (!yesno_box("Impossibile trovare %s\nSi desidera riprovare?", (const char*)cmdline)) break; } @@ -251,7 +285,6 @@ bool TInstaller_mask::install(const TString& module) { post_process(ini, module); ini.copy_module_paragraphs(module, ini.default_name()); - } } else @@ -263,21 +296,25 @@ bool TInstaller_mask::install(const TString& module) { TInstall_ini ini(ininame); TString_array list; - const int files = ini.build_complete_list(module, list); + const int files = ini.build_list(module, list); if (files > 0) { - pre_process(ini, module); - - TProgind pi(files, "Copia in corso...", FALSE, TRUE); - TFilename src, dst; - for (int f = 0; f < files && ok; f++) + ok = pre_process(ini, module); + + if (ok) { - pi.addstatus(1); - dst = list.row(f).get(0); - src = path; - src.add(dst); - ok = fcopy(src, dst); + TProgind pi(files, "Copia in corso...", FALSE, TRUE); + TFilename src, dst; + for (int f = 0; f < files && ok; f++) + { + pi.addstatus(1); + dst = list.row(f).get(0); + src = path; + src.add(dst); + ok = fcopy(src, dst); + } } + if (ok) { ini.copy_module_paragraphs(module, ini.default_name()); @@ -293,8 +330,11 @@ bool TInstaller_mask::install(const TString& module) ini.set("DiskPath", path); ini.set("Data", TDate(TODAY), module); } - update_version(); + // Non spostare nell'if precedente + if (ok) + update_version(); + return ok; }