Patch level : 10.0

Files correlati     : ba0 ba1
Ricompilazione Demo : [ ]
Commento            :
Corretta gestione immagini in menu "vecchio" stile


git-svn-id: svn://10.65.10.50/trunk@18317 c028cbd2-c16b-5b4b-a496-9718f37d4682
This commit is contained in:
guy 2009-02-23 11:40:41 +00:00
parent 96e3ab4ea0
commit 9afe89a390
9 changed files with 256 additions and 323 deletions

View File

@ -139,82 +139,34 @@ void TPicture_mask::update()
if (!ADVANCED_GRAPHICS) if (!ADVANCED_GRAPHICS)
return; return;
TImage& image = _submenu->image(); const TImage& image = _submenu->image();
if (image.ok()) if (image.ok())
{ {
int x = 1, y = 1, imgx = 640, imgy = 480; // Default values
RCT client; xvt_vobj_get_client_rect(win(), &client); RCT client; xvt_vobj_get_client_rect(win(), &client);
const bool tree_view = id2pos(DLG_TREE) >= 0; const bool tree_view = id2pos(DLG_TREE) >= 0;
int lx = 1, ly = ROWY, logx = 320, logy = 120;
if (tree_view) // TreeView == 1 if (tree_view) // TreeView == 1
{ {
RCT rctree; tfield(DLG_TREE).get_rect(rctree); RCT tree; tfield(DLG_TREE).get_rect(tree);
const int maxx = client.right - rctree.right - 2 * CHARX; RCT lgo = client; lgo.left = tree.right; lgo.bottom /= 3;
const int maxy = client.bottom - 10 * ROWY;
const double ratiox = double(maxx) / image.width();
const double ratioy = double(maxy) / image.height();
const double ratio = min(ratiox, ratioy);
imgx = int(ratio * image.width());
imgy = int(ratio * image.height());
x = client.right - maxx - 4;
y = client.bottom - maxy;
//stabilisce la dimensione del logo
if (_logo != NULL) if (_logo != NULL)
{ _logo->draw(win(), lgo, 'R', 'T', '-');
lx = rctree.right + CHARX;
const double ratio = (double)maxx / _logo->width(); lgo = client; lgo.left = tree.right; lgo.top = lgo.bottom/3; lgo.bottom -= lgo.top;
logx = int(ratio * _logo->width()); image.draw(win(), lgo, 'R', 'B', '-');
logy = int(ratio * _logo->height());
}
} }
else else
{ {
RCT rctbut; field(101).get_rect(rctbut); RCT but; field(101).get_rect(but);
RCT lgo = client; lgo.right = but.left; lgo.bottom /= 2;
int maxx = rctbut.left - CHARX;
int maxy = client.bottom - 5 * ROWY; //il logo va staccato dall'immagine
if (_logo != NULL) if (_logo != NULL)
maxy -= _logo->height(); _logo->draw(win(), lgo, 'L', 'T', '-');
const double ratiox = double(maxx) / image.width(); lgo = client; lgo.right = but.left; lgo.top = lgo.bottom/2;
const double ratioy = double(maxy) / image.height(); image.draw(win(), lgo, 'L', 'B', '-');
const double ratio = min(ratiox, ratioy);
imgx = int(ratio * image.width());
imgy = int(ratio * image.height());
x = 1;
y = client.bottom - imgy - 1;
//stabilisce la dimensione del logo
if (_logo != NULL)
{
const double ratio = (double)maxx / _logo->width();
logx = int(ratio * _logo->width());
logy = int(ratio * _logo->height());
} }
} }
RCT dst;
if (_logo != NULL)
{
::xvt_rect_set(&dst, lx, ly, lx+logx, ly+logy);
if (::xvt_dwin_is_update_needed(win(), &dst))
_logo->draw(win(), dst);
}
::xvt_rect_set(&dst, x, y, x+imgx, y+imgy);
if (::xvt_dwin_is_update_needed(win(), &dst))
image.draw(win(), dst);
}
} }
bool TPicture_mask::on_key(KEY k) bool TPicture_mask::on_key(KEY k)
@ -1467,7 +1419,7 @@ void enable_options_menu(bool on)
xvt_menu_set_item_enabled(tw, M_FILE_NEW, on); // Cambio ditta xvt_menu_set_item_enabled(tw, M_FILE_NEW, on); // Cambio ditta
xvt_menu_set_item_enabled(tw, M_FILE_PG_SETUP, on); // Imposta Stampante xvt_menu_set_item_enabled(tw, M_FILE_PG_SETUP, on); // Imposta Stampante
for (int i = 2; i <= 7; i++) // Menu opzioni for (int i = 2; i <= 7; i++) // Menu opzioni
xvt_menu_set_item_enabled(tw, MENU_ITEM(i), on); xvt_menu_set_item_enabled(tw, MENU_ITEM_ID(i), on);
xvt_menu_update(tw); xvt_menu_update(tw);
} }
@ -1794,7 +1746,7 @@ void TMenu_application::update_preferred()
MENU_ITEM& m = pm[i+3]; MENU_ITEM& m = pm[i+3];
if (i >= 0) if (i >= 0)
{ {
m.tag = MENU_ITEM(50+i); m.tag = MENU_ITEM_ID(50+i);
m.enabled = true; m.enabled = true;
const char* src = _preferred.row(i).get(0); const char* src = _preferred.row(i).get(0);
m.text = xvt_str_duplicate(src); m.text = xvt_str_duplicate(src);
@ -2091,21 +2043,21 @@ bool TMenu_application::menu(MENU_TAG mt)
bool ok = true; bool ok = true;
switch (mt) switch (mt)
{ {
case BAR_ITEM(1): main_loop(); ok = false; break; case BAR_ITEM_ID(1): main_loop(); ok = false; break;
case MENU_ITEM(2): choose_colors(); break; case MENU_ITEM_ID(2): choose_colors(); break;
case MENU_ITEM(3): choose_editors(); break; case MENU_ITEM_ID(3): choose_editors(); break;
case MENU_ITEM(4): choose_study(); break; case MENU_ITEM_ID(4): choose_study(); break;
case MENU_ITEM(5): add_to_preferred(); break; case MENU_ITEM_ID(5): add_to_preferred(); break;
case MENU_ITEM(6): manage_preferred(); break; case MENU_ITEM_ID(6): manage_preferred(); break;
case MENU_ITEM(7): case MENU_ITEM_ID(7):
if (check_user()) if (check_user())
_mask->stop_run(K_CTRL + 'R'); // Ricarica maschera _mask->stop_run(K_CTRL + 'R'); // Ricarica maschera
break; break;
default: default:
if (mt >= MENU_ITEM(50) && mt < MENU_ITEM(50+_preferred.items())) if (mt >= MENU_ITEM_ID(50) && mt < MENU_ITEM_ID(50+_preferred.items()))
{ {
bool ok = false; bool ok = false;
const int index = mt - MENU_ITEM(50); const int index = mt - MENU_ITEM_ID(50);
TToken_string node(_preferred.row(index).get(1), '/'); TToken_string node(_preferred.row(index).get(1), '/');
if (_tree_view != 0) if (_tree_view != 0)
{ {

View File

@ -381,7 +381,7 @@ TObject* TMenulist_images::key2obj(const char* key)
for (int i = 0; ext[i] != NULL; i++) for (int i = 0; ext[i] != NULL; i++)
{ {
name = key; name = key;
name << '.' << ext[i]; name.ext(ext[i]);
if (name.custom_path()) if (name.custom_path())
break; break;
} }
@ -595,18 +595,16 @@ void TMenulist_window::update()
if (img != NULL) if (img != NULL)
{ {
RCT rct; xvt_vobj_get_client_rect(win(), &rct); RCT rct; xvt_vobj_get_client_rect(win(), &rct);
const int x = (rct.right - img->width()); rct.left = rct.right/2; rct.top = rct.bottom/2;
const int y = (rct.bottom - img->height()); img->draw(win(), rct, 'R', 'B', '-');
img->draw(win(), x, y);
} }
TImage* logo = db ? _images.image(get_logo()) : NULL; //logo del programma TImage* logo = db ? _images.image(get_logo()) : NULL; //logo del programma
if (logo != NULL) //disegna il logo if (logo != NULL) //disegna il logo
{ {
RCT rct; xvt_vobj_get_client_rect(win(), &rct); RCT rct; xvt_vobj_get_client_rect(win(), &rct);
const int x = rct.left; rct.left = rct.right/2; rct.top = rct.bottom/2;
const int y = rct.bottom - logo->height(); logo->draw(win(), rct, 'L', 'B', '-');
logo->draw(win(), x, y);
} }
FOR_EACH_ARRAY_ITEM(_sorted, i, obj) FOR_EACH_ARRAY_ITEM(_sorted, i, obj)
@ -1189,16 +1187,16 @@ bool TExplorer_mask::on_field_event(TOperable_field& o, TField_event e, long jol
} }
break; break;
case DLG_CONFIG: case DLG_CONFIG:
dispatch_e_menu(TASK_WIN, MENU_ITEM(2)); dispatch_e_menu(TASK_WIN, MENU_ITEM_ID(2));
break; break;
case DLG_ADDPREF: case DLG_ADDPREF:
dispatch_e_menu(TASK_WIN, MENU_ITEM(5)); dispatch_e_menu(TASK_WIN, MENU_ITEM_ID(5));
break; break;
case DLG_PREF: case DLG_PREF:
dispatch_e_menu(TASK_WIN, MENU_ITEM(6)); dispatch_e_menu(TASK_WIN, MENU_ITEM_ID(6));
break; break;
case DLG_USER: case DLG_USER:
dispatch_e_menu(TASK_WIN, MENU_ITEM(7)); dispatch_e_menu(TASK_WIN, MENU_ITEM_ID(7));
break; break;
default: default:
break; break;
@ -1225,11 +1223,14 @@ TExplorer_mask::TExplorer_mask(TMenu& menu) : _tree(menu)
{ {
add_button_tool(DLG_SHRINK, TR("Menu Iniziale"), TOOL_FIRSTREC); add_button_tool(DLG_SHRINK, TR("Menu Iniziale"), TOOL_FIRSTREC);
add_button_tool(DLG_FINDREC, TR("Ricerca"), TOOL_LENTE); add_button_tool(DLG_FINDREC, TR("Ricerca"), TOOL_LENTE);
add_button_tool(DLG_NULL, "", 0);
add_button_tool(DLG_CONFIG, TR("Opzioni"), TOOL_CONFIG); add_button_tool(DLG_CONFIG, TR("Opzioni"), TOOL_CONFIG);
add_button_tool(DLG_USER, TR("Utente"), TOOL_PERMISSIONS); add_button_tool(DLG_USER, TR("Utente"), TOOL_PERMISSIONS);
add_button_tool(DLG_SETPRINT, TR("Imposta"), TOOL_SETPRINT); add_button_tool(DLG_SETPRINT, TR("Imposta"), TOOL_SETPRINT);
add_button_tool(DLG_NULL, "", 0);
add_button_tool(DLG_PREF, TR("Preferiti"), TOOL_PREF); add_button_tool(DLG_PREF, TR("Preferiti"), TOOL_PREF);
add_button_tool(DLG_ADDPREF, TR("Aggiungi"), TOOL_ADDPREF); add_button_tool(DLG_ADDPREF, TR("Aggiungi"), TOOL_ADDPREF);
add_button_tool(DLG_NULL, "", 0);
add_button_tool(DLG_INFO, TR("Info"), TOOL_INFO); add_button_tool(DLG_INFO, TR("Info"), TOOL_INFO);
add_button_tool(DLG_HELP, TR("Help"), TOOL_HELP); add_button_tool(DLG_HELP, TR("Help"), TOOL_HELP);
add_button_tool(DLG_QUIT, TR(""), TOOL_QUIT); add_button_tool(DLG_QUIT, TR(""), TOOL_QUIT);
@ -1273,18 +1274,11 @@ const TString& get_logo()
if (currlogo.blank()) if (currlogo.blank())
{ {
//seleziona il logo da usare in base al producer!! //seleziona il logo da usare in base al producer!!
TConfig oemini(CONFIG_OEM, "MAIN"); currlogo = get_oem_info("Logo");
const int oem = oemini.get_int("OEM", NULL, -1, -1);
if (oem >= 0)
{
TString8 para; para << "OEM_" << oem;
currlogo = oemini.get("Logo", para);
currlogo.insert("setup/"); currlogo.insert("setup/");
if (!currlogo.exist()) if (!currlogo.exist())
currlogo.cut(0); currlogo.cut(0);
} }
}
if (currlogo.blank()) if (currlogo.blank())
{ {

View File

@ -116,17 +116,7 @@ void TBook_window::update()
if (rctw.right >= 64 && rctw.bottom >= 64) if (rctw.right >= 64 && rctw.bottom >= 64)
{ {
if (_logo.ok()) if (_logo.ok())
{ _logo.draw(win(), rctw, 'C', 'B', '-');
RCT rcti = _logo.rect();
if (rcti.right > rctw.right)
{
const double ratio = double(rctw.right) / double(rcti.right);
rcti.right = int(rcti.right * ratio);
rcti.bottom = int(rcti.bottom * ratio);
}
xvt_rect_offset(&rcti, rctw.right - rcti.right, rctw.bottom - rcti.bottom);
_logo.draw(win(), rcti);
}
const PNT pnt = { 0, 0 }; const PNT pnt = { 0, 0 };
draw_spider(win(), 0x3, pnt); draw_spider(win(), 0x3, pnt);
} }

View File

@ -207,6 +207,7 @@ bool save_campo_xml()
module.SetAttr("Code", name); module.SetAttr("Code", name);
module.SetAttr("Version", version); module.SetAttr("Version", version);
module.SetAttr("Patch", ini.get("Patch")); module.SetAttr("Patch", ini.get("Patch"));
module.SetAttr("Date", ini.get("Data"));
} }
} }

View File

@ -11,17 +11,26 @@
#include <msksheet.h> #include <msksheet.h>
#include <prefix.h> #include <prefix.h>
#include <progind.h> #include <progind.h>
#include <text.h>
#include <sheet.h> #include <sheet.h>
#include <utility.h> #include <utility.h>
#include <text.h>
#include "ba1.h" #include "ba1.h"
#include "ba1600.h" #include "ba1600.h"
#include "ba1600a.h" #include "ba1600a.h"
int find(const TString& name, TString_array & rows) ; // Cerca un file nell'array di colonne e ne restituisce il numero del sottomodulo
HIDDEN int find_row(const TString& name, TString_array& rows)
{
int r;
for (r = rows.last(); r >= 0; r--)
{
const char* n = rows.row(r).get(0);
if (name.compare(n, -1, true) == 0)
break;
}
return r;
}
/////////////////////////////////////////////////////////// ///////////////////////////////////////////////////////////
// Configurazione per installazione // Configurazione per installazione
@ -36,20 +45,11 @@ protected:
virtual bool use_files() const { return false; } virtual bool use_files() const { return false; }
virtual void main_loop(); virtual void main_loop();
public: public:
virtual bool modify_mode() { return false; }
TFascicolator_mask& mask() const { return *_mask; } TFascicolator_mask& mask() const { return *_mask; }
}; };
class TFascicolator : public TCreazione_dischi
{
protected:
virtual void main_loop();
public:
virtual bool modify_mode() { return TRUE;}
};
inline TCreazione_dischi& app() { return (TCreazione_dischi&)main_app(); } inline TCreazione_dischi& app() { return (TCreazione_dischi&)main_app(); }
class TFconv_ini : public TConfig class TFconv_ini : public TConfig
@ -83,7 +83,7 @@ int TInstall_ini::build_list(const TString& module, TString_array& a,
if (module[2] == '\0') // Ho specificato un modulo principale if (module[2] == '\0') // Ho specificato un modulo principale
paragraph << sub; paragraph << sub;
bool reset_par=TRUE; bool reset_par=true;
vars.destroy(); vars.destroy();
TAssoc_array& varlist = list_variables(paragraph); TAssoc_array& varlist = list_variables(paragraph);
@ -103,7 +103,7 @@ int TInstall_ini::build_list(const TString& module, TString_array& a,
{ {
if (reset_par) if (reset_par)
{ {
reset_par=FALSE; reset_par=false;
sum->set_paragraph(paragraph); sum->set_paragraph(paragraph);
sum->remove_all(); sum->remove_all();
FOR_EACH_ASSOC_STRING(vars, obj, key, str) FOR_EACH_ASSOC_STRING(vars, obj, key, str)
@ -259,7 +259,7 @@ void TInstall_ini::export_paragraph(const char* module, const char* summary, con
// merging "File(X)" items... // merging "File(X)" items...
item_value=str; item_value=str;
tmps=item_value.get(0); tmps=item_value.get(0);
int item_number = find(tmps, old_list); int item_number=find_row(tmps, old_list);
if (item_number>=0) if (item_number>=0)
{ {
// file sostituito // file sostituito
@ -391,7 +391,7 @@ bool TInstall_ini::update_prices(const char* from)
const TDate curr_date(get("Listino","Main")); const TDate curr_date(get("Listino","Main"));
const TDate from_date(from_ini.get("Listino","Main")); const TDate from_date(from_ini.get("Listino","Main"));
if (from_date < curr_date) if (from_date < curr_date)
return FALSE; return false;
set("Listino", from_date); set("Listino", from_date);
TString_array modules; TString_array modules;
@ -403,11 +403,11 @@ bool TInstall_ini::update_prices(const char* from)
FOR_EACH_ASSOC_STRING(prices, obj, key, str) FOR_EACH_ASSOC_STRING(prices, obj, key, str)
{ {
const TFixed_string price(key); const TFixed_string price(key);
if (price.compare("Prezzo", 6, TRUE) == 0) if (price.compare("Prezzo", 6, true) == 0)
set(key, str); set(key, str);
} }
} }
return TRUE; return true;
} }
void TInstall_ini::prices(const char* module, word users, real& full, real& assist, bool correct_ass) void TInstall_ini::prices(const char* module, word users, real& full, real& assist, bool correct_ass)
@ -498,7 +498,7 @@ public:
void load(const TString& module); void load(const TString& module);
void save(); void save();
TMod_composition_msk(const bool modify_mode=FALSE); TMod_composition_msk(const bool modify_mode=false);
virtual ~TMod_composition_msk() { } virtual ~TMod_composition_msk() { }
}; };
@ -508,7 +508,7 @@ bool TMod_composition_msk::kill_missing(const char* name, bool update)
TSheet_field& miss = sfield(F_MISSING); TSheet_field& miss = sfield(F_MISSING);
FOR_EACH_SHEET_ROW_BACK(miss, r, row) FOR_EACH_SHEET_ROW_BACK(miss, r, row)
{ {
if (row->compare(name, -1, TRUE) == 0) if (row->compare(name, -1, true) == 0)
{ {
miss.destroy(r, update); miss.destroy(r, update);
break; break;
@ -523,7 +523,7 @@ bool TMod_composition_msk::kill_obsolete(const char* name, bool update)
TSheet_field& obs = sfield(F_OBSOLETE); TSheet_field& obs = sfield(F_OBSOLETE);
FOR_EACH_SHEET_ROW_BACK(obs, r, row) FOR_EACH_SHEET_ROW_BACK(obs, r, row)
{ {
if (row->compare(name, -1, TRUE) == 0) if (row->compare(name, -1, true) == 0)
{ {
obs.destroy(r, update); obs.destroy(r, update);
break; break;
@ -534,7 +534,7 @@ bool TMod_composition_msk::kill_obsolete(const char* name, bool update)
bool TMod_composition_msk::sheet_notify(TSheet_field& sf, int r, KEY key) bool TMod_composition_msk::sheet_notify(TSheet_field& sf, int r, KEY key)
{ {
bool ok = TRUE; bool ok = true;
switch(key) switch(key)
{ {
case K_TAB: case K_TAB:
@ -563,23 +563,23 @@ bool TMod_composition_msk::sheet_notify(TSheet_field& sf, int r, KEY key)
xvt_fsys_convert_dir_to_str(&dir, start.get_buffer(), start.size()); xvt_fsys_convert_dir_to_str(&dir, start.get_buffer(), start.size());
const int maxlen = start.len(); const int maxlen = start.len();
bool found = FALSE; bool found = false;
for (int i = 0; i < items; i++) for (int i = 0; i < items; i++)
{ {
TString& file = arr.row(i); TString& file = arr.row(i);
if (file.compare(start, maxlen, TRUE) == 0) if (file.compare(start, maxlen, true) == 0)
file.ltrim(maxlen+1); file.ltrim(maxlen+1);
file.lower(); file.lower();
msk.kill_missing(file, FALSE); msk.kill_missing(file, false);
if (::find(file,rows)>=0) if (find_row(file,rows)>=0)
{ {
TToken_string& row = sf.row(found ? -1 : r); TToken_string& row = sf.row(found ? -1 : r);
row = file; row = file;
row.add(" "); row.add(" ");
row.add(module); row.add(module);
found = TRUE; found = true;
} }
} }
// Se ne ho trovato almeno uno valido allora updato // Se ne ho trovato almeno uno valido allora updato
@ -624,7 +624,7 @@ bool TMod_composition_msk::sheet_notify(TSheet_field& sf, int r, KEY key)
//metodo per la gestione dello sheet con la lista dei files da ELIMINARE effettivamente //metodo per la gestione dello sheet con la lista dei files da ELIMINARE effettivamente
bool TMod_composition_msk::kill_notify(TSheet_field& sf, int r, KEY key) bool TMod_composition_msk::kill_notify(TSheet_field& sf, int r, KEY key)
{ {
bool ok = TRUE; bool ok = true;
switch(key) switch(key)
{ {
case K_TAB: case K_TAB:
@ -649,22 +649,22 @@ bool TMod_composition_msk::kill_notify(TSheet_field& sf, int r, KEY key)
xvt_fsys_convert_dir_to_str(&dir, start.get_buffer(), start.size()); xvt_fsys_convert_dir_to_str(&dir, start.get_buffer(), start.size());
const int maxlen = start.len(); const int maxlen = start.len();
bool found = FALSE; bool found = false;
for (int i = 0; i < items; i++) for (int i = 0; i < items; i++)
{ {
TString& file = arr.row(i); TString& file = arr.row(i);
if (file.compare(start, maxlen, TRUE) == 0) if (file.compare(start, maxlen, true) == 0)
file.ltrim(maxlen+1); file.ltrim(maxlen+1);
file.lower(); file.lower();
msk.kill_obsolete(file, FALSE); msk.kill_obsolete(file, false);
if (::find(file,rows)>=0) if (find_row(file,rows)>=0)
{ {
TToken_string& row = sf.row(found ? -1 : r); TToken_string& row = sf.row(found ? -1 : r);
row = file; row = file;
row.add(" "); row.add(" ");
found = TRUE; found = true;
} }
} }
// Se ne ho trovato almeno uno valido allora updato // Se ne ho trovato almeno uno valido allora updato
@ -698,7 +698,7 @@ bool TMod_composition_msk::kill_notify(TSheet_field& sf, int r, KEY key)
bool TMod_composition_msk::missing_notify(TSheet_field& sf, int r, KEY key) bool TMod_composition_msk::missing_notify(TSheet_field& sf, int r, KEY key)
{ {
bool ok = TRUE; bool ok = true;
if (key == K_INS) if (key == K_INS)
{ {
// Sposto tutte le righe nello spreadsheet a fianco // Sposto tutte le righe nello spreadsheet a fianco
@ -717,7 +717,7 @@ bool TMod_composition_msk::missing_notify(TSheet_field& sf, int r, KEY key)
sf.destroy(); sf.destroy();
sf.force_update(); sf.force_update();
sheet.force_update(); sheet.force_update();
ok = FALSE; ok = false;
} }
return ok; return ok;
} }
@ -742,7 +742,7 @@ bool TMod_composition_msk::file_handler(TMask_field& f, KEY k)
xvt_fsys_convert_dir_to_str(&dir, start.get_buffer(), start.size()); xvt_fsys_convert_dir_to_str(&dir, start.get_buffer(), start.size());
const int maxlen = start.len(); const int maxlen = start.len();
if (file.compare(start, maxlen, TRUE) == 0) if (file.compare(start, maxlen, true) == 0)
{ {
file.ltrim(maxlen+1); file.ltrim(maxlen+1);
file.add(fs.name); file.add(fs.name);
@ -761,10 +761,10 @@ bool TMod_composition_msk::file_handler(TMask_field& f, KEY k)
if (k = K_TAB && f.focusdirty()) if (k = K_TAB && f.focusdirty())
{ {
TMod_composition_msk& msk = (TMod_composition_msk&)f.mask().get_sheet()->mask(); TMod_composition_msk& msk = (TMod_composition_msk&)f.mask().get_sheet()->mask();
msk.kill_missing(f.get(), TRUE); msk.kill_missing(f.get(), true);
} }
return TRUE; return true;
} }
bool TMod_composition_msk::kill_handler(TMask_field& f, KEY k) bool TMod_composition_msk::kill_handler(TMask_field& f, KEY k)
@ -772,10 +772,10 @@ bool TMod_composition_msk::kill_handler(TMask_field& f, KEY k)
if (k = K_TAB && f.focusdirty()) if (k = K_TAB && f.focusdirty())
{ {
TMod_composition_msk& msk = (TMod_composition_msk&)f.mask().get_sheet()->mask(); TMod_composition_msk& msk = (TMod_composition_msk&)f.mask().get_sheet()->mask();
msk.kill_obsolete(f.get(), TRUE); msk.kill_obsolete(f.get(), true);
} }
return TRUE; return true;
} }
bool TMod_composition_msk::edit_handler(TMask_field& f, KEY k) bool TMod_composition_msk::edit_handler(TMask_field& f, KEY k)
@ -792,7 +792,7 @@ bool TMod_composition_msk::edit_handler(TMask_field& f, KEY k)
else else
::edit_url(file); ::edit_url(file);
} }
return TRUE; return true;
} }
bool TMod_composition_msk::link_handler(TMask_field& f, KEY k) bool TMod_composition_msk::link_handler(TMask_field& f, KEY k)
@ -817,7 +817,7 @@ bool TMod_composition_msk::link_handler(TMask_field& f, KEY k)
sheet.force_update(); sheet.force_update();
sf->force_update(); sf->force_update();
} }
return TRUE; return true;
} }
static int obsolete_found(TConfig& cfg, void* jolly) static int obsolete_found(TConfig& cfg, void* jolly)
@ -830,7 +830,7 @@ static int obsolete_found(TConfig& cfg, void* jolly)
{ {
int pos = files.find(string); int pos = files.find(string);
if (pos >=0) if (pos >=0)
files.destroy(pos, TRUE); //se trova il file sia su disco che nell'ini -> lo toglie dall'elenco su disco files.destroy(pos, true); //se trova il file sia su disco che nell'ini -> lo toglie dall'elenco su disco
} }
} }
return 0; return 0;
@ -852,7 +852,7 @@ bool TMod_composition_msk::obsolete_notify(TSheet_field& sf, int r, KEY key)
ini.for_each_paragraph(obsolete_found, &elenco_dir); //per ogni paragrafo dell'install.ini chiama la obsolete_found ini.for_each_paragraph(obsolete_found, &elenco_dir); //per ogni paragrafo dell'install.ini chiama la obsolete_found
sf.force_update(); //aggiornamento dello sheet (di sinistra) sulla maschera sf.force_update(); //aggiornamento dello sheet (di sinistra) sulla maschera
} }
return TRUE; return true;
} }
//spostamento oggetti da sheet obsoleti a sheet con files da eliminare (sulla mask e' da destra a sinistra) //spostamento oggetti da sheet obsoleti a sheet con files da eliminare (sulla mask e' da destra a sinistra)
@ -876,7 +876,7 @@ bool TMod_composition_msk::obs_handler(TMask_field& f, KEY k)
sheet.force_update(); //update dello sheet sinistro della maschera di eliminazione (files condannati) sheet.force_update(); //update dello sheet sinistro della maschera di eliminazione (files condannati)
sf->force_update(); sf->force_update();
} }
return TRUE; return true;
} }
@ -889,7 +889,7 @@ bool TMod_composition_msk::deselect_handler(TMask_field& f, KEY k)
row->add(" ", 1); row->add(" ", 1);
sheet.force_update(); sheet.force_update();
} }
return TRUE; return true;
} }
bool TMod_composition_msk::isam_handler(TMask_field& f, KEY k) bool TMod_composition_msk::isam_handler(TMask_field& f, KEY k)
@ -915,7 +915,7 @@ bool TMod_composition_msk::isam_handler(TMask_field& f, KEY k)
if (sht.run() == K_ENTER) if (sht.run() == K_ENTER)
m.set(f.dlg(), sht.selected() + LF_USER); m.set(f.dlg(), sht.selected() + LF_USER);
} }
return TRUE; return true;
} }
static int file_compare(const TObject** o1, const TObject** o2) static int file_compare(const TObject** o1, const TObject** o2)
@ -962,12 +962,12 @@ void TMod_composition_msk::load(const TString& module)
mask.lower(); mask.lower();
const TString16 ext = mask.ext(); const TString16 ext = mask.ext();
bool ok = TRUE; bool ok = true;
for (int e = 0; bad_ext[e]; e++) for (int e = 0; bad_ext[e]; e++)
{ {
if (ext == bad_ext[e]) if (ext == bad_ext[e])
{ {
ok = FALSE; ok = false;
break; break;
} }
} }
@ -976,7 +976,7 @@ void TMod_composition_msk::load(const TString& module)
{ {
FOR_EACH_SHEET_ROW_BACK(s, i, row) FOR_EACH_SHEET_ROW_BACK(s, i, row)
{ {
if (mask.compare(row->get(0), -1, TRUE) == 0) if (mask.compare(row->get(0), -1, true) == 0)
break; break;
} }
ok = i < 0; ok = i < 0;
@ -1030,7 +1030,7 @@ void TMod_composition_msk::save()
tmp = row->get(0); // Nome del file tmp = row->get(0); // Nome del file
const bool agg = row->get_char() > ' '; 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++);
ini.set("Versione", version); // Aggiorna versione del sottomodulo ini.set("Versione", version); // Aggiorna versione del sottomodulo
ini.set("Patch", patch); ini.set("Patch", patch);
} }
@ -1064,9 +1064,8 @@ void TMod_composition_msk::save()
sub << 99; sub << 99;
FOR_EACH_SHEET_ROW(kp, kr, krow) FOR_EACH_SHEET_ROW(kp, kr, krow)
{ {
ini.set("Kill", *krow, sub, TRUE, kr); ini.set("Kill", *krow, sub, true, kr);
} }
} }
TMod_composition_msk::TMod_composition_msk(const bool modify_mode) TMod_composition_msk::TMod_composition_msk(const bool modify_mode)
@ -1114,7 +1113,7 @@ class TModule_mask : public TMask
public: public:
bool list_is_dirty() const { return _dirty_composition;} bool list_is_dirty() const { return _dirty_composition;}
void dirty_composition(bool val = TRUE) { _dirty_composition = val; } void dirty_composition(bool val = true) { _dirty_composition = val; }
bool check_patchlevels(TMod_composition_msk &mm); bool check_patchlevels(TMod_composition_msk &mm);
virtual ~TModule_mask() {} virtual ~TModule_mask() {}
}; };
@ -1146,7 +1145,7 @@ protected:
virtual bool set_version_info(const TFilename& filename, virtual bool set_version_info(const TFilename& filename,
TInstall_ini& ini, const char* module) const; TInstall_ini& ini, const char* module) const;
virtual bool show_all_modules() {return FALSE;} virtual bool show_all_modules() {return false;}
public: public:
virtual void save(); virtual void save();
virtual void load(); virtual void load();
@ -1170,7 +1169,7 @@ protected:
virtual bool set_version_info(const TFilename& filename, virtual bool set_version_info(const TFilename& filename,
TInstall_ini& ini, const char* module) const; TInstall_ini& ini, const char* module) const;
virtual bool show_all_modules() {return TRUE;} virtual bool show_all_modules() {return true;}
public: public:
virtual void save(); virtual void save();
@ -1181,13 +1180,13 @@ public:
bool TCreadischi_mask::modules_notify(TSheet_field& f, int row, KEY k) bool TCreadischi_mask::modules_notify(TSheet_field& f, int row, KEY k)
{ {
bool ok = TRUE; bool ok = true;
if (k == K_INS || k == K_DEL) if (k == K_INS || k == K_DEL)
ok = FALSE; ok = false;
if (k == K_TAB) if (k == K_TAB)
{ {
TModule_mask &mm =(TModule_mask &)f.sheet_mask(); TModule_mask &mm =(TModule_mask &)f.sheet_mask();
mm.dirty_composition(FALSE); mm.dirty_composition(false);
} }
return ok; return ok;
} }
@ -1217,12 +1216,12 @@ bool TModule_mask::module_dependent(int rownum, TString_array &p_submodules, TSt
{ {
ver=curr_row.get(modsheet.cid2index(S_VERSION)); ver=curr_row.get(modsheet.cid2index(S_VERSION));
patch=atoi(curr_row.get(modsheet.cid2index(S_PATCHLEVEL))); patch=atoi(curr_row.get(modsheet.cid2index(S_PATCHLEVEL)));
return TRUE; return true;
} }
} // loop over patched modules } // loop over patched modules
} }
} // loop over external modules } // loop over external modules
return FALSE; return false;
} }
bool TModule_mask::check_patchlevels( TMod_composition_msk &mm) bool TModule_mask::check_patchlevels( TMod_composition_msk &mm)
@ -1249,7 +1248,7 @@ bool TModule_mask::check_patchlevels( TMod_composition_msk &mm)
} }
// cerca i moduli che includono i sottomoduli patchati // cerca i moduli che includono i sottomoduli patchati
bool need_update(FALSE); bool need_update(false);
TString16 sub_mod, sub_ver; TString16 sub_mod, sub_ver;
int sub_patch; int sub_patch;
TSheet_field& modsheet = get_sheet()->mask().sfield(F_SHEET); TSheet_field& modsheet = get_sheet()->mask().sfield(F_SHEET);
@ -1266,7 +1265,7 @@ bool TModule_mask::check_patchlevels( TMod_composition_msk &mm)
{ {
curr_row.add(patchlev , modsheet.cid2index(S_PATCHLEVEL)); curr_row.add(patchlev , modsheet.cid2index(S_PATCHLEVEL));
curr_row.add(get(S_DATE) , modsheet.cid2index(S_DATE)); curr_row.add(get(S_DATE) , modsheet.cid2index(S_DATE));
need_update=TRUE; need_update=true;
} }
} else } else
if (!sub_ver.blank()) if (!sub_ver.blank())
@ -1282,7 +1281,7 @@ bool TModule_mask::check_patchlevels( TMod_composition_msk &mm)
{ {
curr_row.add(patchlev , modsheet.cid2index(S_PATCHLEVEL)); curr_row.add(patchlev , modsheet.cid2index(S_PATCHLEVEL));
curr_row.add(get(S_DATE) , modsheet.cid2index(S_DATE)); curr_row.add(get(S_DATE) , modsheet.cid2index(S_DATE));
need_update=TRUE; need_update=true;
} }
} else } else
if (!sub_ver.blank()) if (!sub_ver.blank())
@ -1292,17 +1291,44 @@ bool TModule_mask::check_patchlevels( TMod_composition_msk &mm)
} }
if (need_update) if (need_update)
modsheet.force_update(); modsheet.force_update();
return TRUE; return true;
} }
bool TFascicolator_mask::patchl_handler(TMask_field& f, KEY k) bool TFascicolator_mask::patchl_handler(TMask_field& f, KEY k)
{ {
if (k == K_TAB && f.focusdirty()) if (k == K_F8 || (k == K_TAB && f.focusdirty()))
{ {
// TModule_mask& m = (TModule_mask&)f.mask(); TMask& m = f.mask();
// m.dirty_composition(); TSheet_field& s = *m.get_sheet();
long last_patch = 0;
FOR_EACH_SHEET_ROW(s, r, row)
{
const int p = row->get_int(3);
if (p > last_patch)
last_patch = p;
} }
return TRUE; switch (k)
{
case K_F8:
{
last_patch++;
if (last_patch & 0x1)
last_patch++;
f.set(last_patch);
const TDate oggi(TODAY);
m.set(S_DATE, oggi);
}
break;
case K_TAB:
if (f.get_long() < last_patch)
warning_box(FR("Attenzione: l'ultima patch sarebbe la %ld"), last_patch);
break;
default:
break;
}
}
return true;
} }
@ -1314,7 +1340,7 @@ bool TCreadischi_mask::list_handler(TMask_field& f, KEY k)
TModule_mask& m = (TModule_mask&)f.mask(); TModule_mask& m = (TModule_mask&)f.mask();
const TString& module = m.get(S_MODULE); const TString& module = m.get(S_MODULE);
if (module.not_empty()) if (module.full())
{ {
TMod_composition_msk mm; TMod_composition_msk mm;
mm.load(module); mm.load(module);
@ -1322,7 +1348,7 @@ bool TCreadischi_mask::list_handler(TMask_field& f, KEY k)
mm.save(); mm.save();
} }
} }
return TRUE; return true;
} }
bool TFascicolator_mask::list_handler(TMask_field& f, KEY k) bool TFascicolator_mask::list_handler(TMask_field& f, KEY k)
@ -1331,10 +1357,9 @@ bool TFascicolator_mask::list_handler(TMask_field& f, KEY k)
{ {
TModule_mask& m = (TModule_mask&)f.mask(); TModule_mask& m = (TModule_mask&)f.mask();
const TString& module = m.get(S_MODULE); const TString& module = m.get(S_MODULE);
if (module.full())
if (module.not_empty())
{ {
TMod_composition_msk mm(TRUE); TMod_composition_msk mm(true);
mm.load(module); mm.load(module);
if (mm.run() == K_ENTER) if (mm.run() == K_ENTER)
{ {
@ -1344,12 +1369,12 @@ bool TFascicolator_mask::list_handler(TMask_field& f, KEY k)
} }
} }
} }
return TRUE; return true;
} }
bool TCreadischi_mask::confirm_handler(TMask_field& f, KEY k) bool TCreadischi_mask::confirm_handler(TMask_field& f, KEY k)
{ {
return TRUE; return true;
} }
bool TFascicolator_mask::confirm_handler(TMask_field& f, KEY k) bool TFascicolator_mask::confirm_handler(TMask_field& f, KEY k)
@ -1367,7 +1392,7 @@ bool TFascicolator_mask::confirm_handler(TMask_field& f, KEY k)
m.field(S_PATCHLEVEL).dirty(); m.field(S_PATCHLEVEL).dirty();
if (dirty_version || dirty_module) if (dirty_version || dirty_module)
{ {
TIndwin infobar(60,TR("Salvataggio composizione modulo"),FALSE,FALSE); TIndwin infobar(60,TR("Salvataggio composizione modulo"),false,false);
TInstall_ini ini; TInstall_ini ini;
ini.set_paragraph(module); ini.set_paragraph(module);
ini.set("Versione", m.get(S_VERSION)); ini.set("Versione", m.get(S_VERSION));
@ -1395,13 +1420,13 @@ bool TFascicolator_mask::confirm_handler(TMask_field& f, KEY k)
if (patchlevel>0 && (m.list_is_dirty() || dirty_version)) if (patchlevel>0 && (m.list_is_dirty() || dirty_version))
{ {
// controlla le consistenze tra patch di moduli diversi intrinsecamente correlati // controlla le consistenze tra patch di moduli diversi intrinsecamente correlati
TIndwin infobar(60,TR("Controllo dipendenze tra sottomoduli"),FALSE,FALSE); TIndwin infobar(60,TR("Controllo dipendenze tra sottomoduli"),false,false);
TMod_composition_msk mc; TMod_composition_msk mc;
mc.load(module); mc.load(module);
m.check_patchlevels(mc); m.check_patchlevels(mc);
} }
} }
return TRUE; return true;
} }
bool TFascicolator_mask::creazip_handler(TMask_field& f, KEY k) bool TFascicolator_mask::creazip_handler(TMask_field& f, KEY k)
@ -1413,7 +1438,7 @@ bool TFascicolator_mask::creazip_handler(TMask_field& f, KEY k)
confirm_handler(fconfirm, K_SPACE); confirm_handler(fconfirm, K_SPACE);
TCreadischi_mask::creazip_handler(f,k); TCreadischi_mask::creazip_handler(f,k);
} }
return TRUE; return true;
} }
bool TCreadischi_mask::creazip_handler(TMask_field& f, KEY k) bool TCreadischi_mask::creazip_handler(TMask_field& f, KEY k)
@ -1443,7 +1468,7 @@ bool TCreadischi_mask::creazip_handler(TMask_field& f, KEY k)
bool TCreadischi_mask::why_handler(TMask_field& f, KEY k) bool TCreadischi_mask::why_handler(TMask_field& f, KEY k)
{ {
if (k != K_SPACE) if (k != K_SPACE)
return TRUE; return true;
TArray_sheet& main_sheet = (TArray_sheet&)f.mask(); TArray_sheet& main_sheet = (TArray_sheet&)f.mask();
const TFilename stopfile = main_sheet.row(main_sheet.selected()).get(1); const TFilename stopfile = main_sheet.row(main_sheet.selected()).get(1);
@ -1455,7 +1480,7 @@ bool TCreadischi_mask::why_handler(TMask_field& f, KEY k)
TString_array inifiles; TString_array inifiles;
list_files(path, inifiles); list_files(path, inifiles);
inifiles.sort(); inifiles.sort();
TProgind pi(inifiles.items(), TR("Scansione archivi successivi..."), FALSE, TRUE); TProgind pi(inifiles.items(), TR("Scansione archivi successivi..."), false, true);
TString caption; caption << TR("File eliminabili da ") << stopfile.name(); TString caption; caption << TR("File eliminabili da ") << stopfile.name();
TArray_sheet sheet(3, 3, -3, -3, caption, HR("Modulo|File@20|Ultima Patch@50")); TArray_sheet sheet(3, 3, -3, -3, caption, HR("Modulo|File@20|Ultima Patch@50"));
@ -1506,7 +1531,7 @@ bool TCreadischi_mask::why_handler(TMask_field& f, KEY k)
if (is_last) break; if (is_last) break;
} }
sheet.run(); sheet.run();
return FALSE; return false;
} }
bool TCreadischi_mask::testpatch_handler(TMask_field& f, KEY k) bool TCreadischi_mask::testpatch_handler(TMask_field& f, KEY k)
@ -1639,16 +1664,16 @@ bool TCreadischi_mask::import_export_handler(TMask_field& f, KEY k)
if (is_export) if (is_export)
{ {
TInstall_ini inst; TInstall_ini inst;
inst.export_module_paragraphs(module, path, TRUE); inst.export_module_paragraphs(module, path, true);
} }
else else
{ {
TInstall_ini ini(path); TInstall_ini ini(path);
ini.export_module_paragraphs(module, ini.default_name(), TRUE); ini.export_module_paragraphs(module, ini.default_name(), true);
} }
} }
} }
return TRUE; return true;
} }
const TFilename& TCreadischi_mask::build_export_path(TFilename& path) const const TFilename& TCreadischi_mask::build_export_path(TFilename& path) const
@ -1743,7 +1768,7 @@ void TFascicolator_mask::save()
TSheet_field& s = sfield(F_SHEET); TSheet_field& s = sfield(F_SHEET);
TCreadischi_mask::save(); TCreadischi_mask::save();
TProgind pi(s.items(), TR("Salvataggio in corso..."), FALSE, TRUE); TProgind pi(s.items(), TR("Salvataggio in corso..."), false, true);
TInstall_ini ini; TInstall_ini ini;
TString tmp; TString tmp;
@ -1785,7 +1810,7 @@ bool TCreadischi_mask::zip_file(const char* archive, const char* listfile) const
TString msg; TString msg;
msg.format(TR("Creazione del file compresso %s..."), (const char*)archive); msg.format(TR("Creazione del file compresso %s..."), (const char*)archive);
TIndwin waitw(100,msg,FALSE,FALSE); TIndwin waitw(100,msg,false,false);
TWait_cursor hourglass; TWait_cursor hourglass;
return aga_zip_filelist(listfile, archive); return aga_zip_filelist(listfile, archive);
@ -1810,15 +1835,15 @@ bool TCreadischi_mask::move_file(const TFilename& file, const char* dir) const
{ {
msg << TR(":\nInserire un nuovo disco e ritentare?"); msg << TR(":\nInserire un nuovo disco e ritentare?");
if (!yesno_box(msg)) if (!yesno_box(msg))
return FALSE; return false;
} }
else else
return error_box(msg); return error_box(msg);
} }
} }
bool write_ok = TRUE; bool write_ok = true;
bool user_abort = FALSE; bool user_abort = false;
do do
{ {
write_ok = ::fcopy(file, dest); write_ok = ::fcopy(file, dest);
@ -1828,7 +1853,7 @@ bool TCreadischi_mask::move_file(const TFilename& file, const char* dir) const
{ {
if (!yesno_box(FR("Errore di copia del file %s.\nSi desidera riprovare?"), if (!yesno_box(FR("Errore di copia del file %s.\nSi desidera riprovare?"),
(const char*)file)) (const char*)file))
user_abort = TRUE; user_abort = true;
} }
} while (!write_ok && !user_abort); } while (!write_ok && !user_abort);
@ -1854,7 +1879,7 @@ int TCreadischi_mask::split_file(const TFilename& archive, size_t chunk_size) co
return 0; return 0;
TString msg; msg << TR("Separazione del file ") << archive << "..."; TString msg; msg << TR("Separazione del file ") << archive << "...";
TProgind pi(tot_size, msg, FALSE, TRUE); TProgind pi(tot_size, msg, false, true);
byte* buff = new byte[chunk_size]; byte* buff = new byte[chunk_size];
for (int d = 1; ; d++) for (int d = 1; ; d++)
@ -1892,7 +1917,7 @@ int TCreadischi_mask::split_file(const TFilename& archive, size_t chunk_size) co
long TFascicolator_mask::find_signature(const TFilename& filename, const char* signature) const long TFascicolator_mask::find_signature(const TFilename& filename, const char* signature) const
{ {
bool found = FALSE; bool found = false;
long position = -1; long position = -1;
int compare = 0; int compare = 0;
ifstream infile(filename, ios::in | ios::binary); ifstream infile(filename, ios::in | ios::binary);
@ -1905,7 +1930,7 @@ long TFascicolator_mask::find_signature(const TFilename& filename, const char* s
compare++; compare++;
if (signature[compare] == '\0') if (signature[compare] == '\0')
{ {
found = TRUE; found = true;
break; break;
} }
} }
@ -1922,13 +1947,13 @@ long TFascicolator_mask::find_signature(const TFilename& filename, const char* s
bool TCreadischi_mask::set_version_info(const TFilename& filename, bool TCreadischi_mask::set_version_info(const TFilename& filename,
TInstall_ini& ini, const char* module) const TInstall_ini& ini, const char* module) const
{ {
return TRUE; return true;
} }
bool TFascicolator_mask::set_version_info(const TFilename& filename, bool TFascicolator_mask::set_version_info(const TFilename& filename,
TInstall_ini& ini, const char* module) const TInstall_ini& ini, const char* module) const
{ {
bool ok = FALSE; bool ok = false;
TString80 str = "Don't cry for me "; str << "Argentina."; TString80 str = "Don't cry for me "; str << "Argentina.";
long position = find_signature(filename, str); long position = find_signature(filename, str);
if (position > 0) if (position > 0)
@ -2107,7 +2132,7 @@ bool TCreadischi_mask::zip_module(const TString& main_module, bool agg, int patc
::remove(sommario); //elimina il .ini ::remove(sommario); //elimina il .ini
::remove(sommario_txt); //elimina il .txt ::remove(sommario_txt); //elimina il .txt
::remove(filelist); //elimina il file lista-file ::remove(filelist); //elimina il file lista-file
return TRUE; return true;
} }
zip_file(archivio, filelist); // Compatto gli eventuali ultimi rimasti zip_file(archivio, filelist); // Compatto gli eventuali ultimi rimasti
@ -2118,13 +2143,13 @@ bool TCreadischi_mask::zip_module(const TString& main_module, bool agg, int patc
// Memorizza il numero dei dischetti nel sommario // Memorizza il numero dei dischetti nel sommario
ini.set("Dischi", disks, main_module); // Aggiorna install.ini ini.set("Dischi", disks, main_module); // Aggiorna install.ini
ini.export_paragraph(main_module, sommario,TRUE); // Aggiorna sommario ini.export_paragraph(main_module, sommario,true); // Aggiorna sommario
const char drive = toupper(path[0]); const char drive = toupper(path[0]);
const bool floppy = xvt_fsys_is_removable_drive(path) != 0; const bool floppy = xvt_fsys_is_removable_drive(path) != 0;
msg.format(TR("Creazione del file %s"), (const char*)archivio); msg.format(TR("Creazione del file %s"), (const char*)archivio);
TProgind pi(disks, msg, FALSE, TRUE); TProgind pi(disks, msg, false, true);
for (int d = 1; d <= disks && !aborted; d++) for (int d = 1; d <= disks && !aborted; d++)
{ {
if (floppy) if (floppy)
@ -2196,19 +2221,22 @@ TFascicolator_mask::TFascicolator_mask()
m.set_handler(S_PATCHLEVEL, patchl_handler); m.set_handler(S_PATCHLEVEL, patchl_handler);
m.show(S_IMPORT); m.show(S_IMPORT);
m.set_handler(S_IMPORT, import_export_handler); m.set_handler(S_IMPORT, import_export_handler);
s.enable(TRUE); s.enable(true);
s.enable_column(S_MODULE,TRUE); s.enable_column(S_MODULE,true);
s.enable_column(S_VERSION,TRUE); s.enable_column(S_VERSION,true);
s.enable_column(S_PATCHLEVEL,TRUE); s.enable_column(S_PATCHLEVEL,true);
s.enable_column(S_EXTERN,TRUE); s.enable_column(S_EXTERN,true);
s.enable_column(S_PREPROCESS,TRUE); s.enable_column(S_PREPROCESS,true);
s.enable_column(S_POSTPROCESS,TRUE); s.enable_column(S_POSTPROCESS,true);
} }
/////////////////////////////////////////////////////////// ///////////////////////////////////////////////////////////
// Programma principale // Programma principale
/////////////////////////////////////////////////////////// ///////////////////////////////////////////////////////////
void TFascicolator::main_loop()
void TCreazione_dischi::main_loop()
{
if (is_power_station())
{ {
_mask = new TFascicolator_mask; _mask = new TFascicolator_mask;
_mask->load(); _mask->load();
@ -2222,50 +2250,26 @@ void TFascicolator::main_loop()
while (key != K_ENTER && key != K_QUIT); while (key != K_ENTER && key != K_QUIT);
delete _mask; _mask = NULL; delete _mask; _mask = NULL;
} }
else
void TCreazione_dischi::main_loop()
{ {
TCreadischi_mask m; TCreadischi_mask m;
m.load(); m.load();
int key; int key = 0;
do while (key != K_ENTER && key != K_QUIT)
{ {
key=m.run(); key=m.run();
if (key == K_ENTER) if (key == K_ENTER)
m.save(); m.save();
} }
while (key != K_ENTER && key != K_QUIT);
} }
// Cerca un file nell'array di colonne e ne restituisce il numero del sottomodulo
// -1 se
int find(const TString& name, TString_array & rows)
{
int r;
for(r = rows.items()-1; r >=0 ; r-- )
{
if (name.compare(rows.row(r).get(0), -1, TRUE) == 0)
break;
}
return r;
} }
int ba1600(int argc, char* argv[]) int ba1600(int argc, char* argv[])
{ {
if (user() == ::dongle().administrator()) if (user() == ::dongle().administrator())
{
if (argc>2 && strcmp(argv[1],"GODMODE"))
{
TFascicolator app;
app.run(argc, argv, "Megascicolator");
}
else
{ {
TCreazione_dischi app; TCreazione_dischi app;
app.run(argc, argv, TR("Creazione dischetti")); app.run(argc, argv, TR("Creazione Patch"));
}
} }
else else
error_box(FR("L'utente %s non e' abilitato all'esecuzione di questo programma"), (const char*)user()); error_box(FR("L'utente %s non e' abilitato all'esecuzione di questo programma"), (const char*)user());

View File

@ -1,20 +1,17 @@
#include "ba1600a.h" #include "ba1600a.h"
TOOLBAR "" 0 -2 0 2 TOOLBAR "" 0 0 0 2
BUTTON DLG_OK 10 2 BUTTON DLG_OK 2 2
BEGIN BEGIN
PROMPT -12 -11 "" PROMPT 1 1 ""
END END
BUTTON DLG_QUIT 10 2 #include <helpbar.h>
BEGIN
PROMPT -22 -11 ""
END
ENDPAGE ENDPAGE
PAGE "Generazione dischetti" -1 -1 78 20 PAGE "Creazione Patch" 0 2 0 0
GROUPBOX DLG_NULL 78 3 GROUPBOX DLG_NULL 78 3
BEGIN BEGIN

View File

@ -202,7 +202,7 @@ bool TInstaller_mask::add_module(TConfig& ini, const TString& module, bool patch
row.add(strpatch); row.add(strpatch);
row.add(ini.get("Data")); row.add(ini.get("Data"));
row.add(patch ? "X" : " ", C_ISPATCH); row.add(patch ? "X" : " ", C_ISPATCH);
if (pos==-1) if (pos < 0)
add(row); add(row);
else else
insert(row,pos); insert(row,pos);
@ -334,14 +334,15 @@ void TInstaller_mask::update_version()
{ {
if (*row->get(C_CODE) != ' ') if (*row->get(C_CODE) != ' ')
{ {
const TString16 module = row->get(C_CODE); const TString4 module = row->get(C_CODE);
ini.set_paragraph(module); ini.set_paragraph(module);
const TString16 newver = row->get(C_RELEASE); const TString16 newver = row->get(C_RELEASE);
const TString16 oldver = ini.get("Versione"); const TString16 oldver = ini.get("Versione");
const int numpatch = ini.get_int("Patch"); const int numpatch = ini.get_int("Patch");
TString16 strpatch; TString4 strpatch;
if (numpatch > 0) strpatch.format("%04d", numpatch); if (numpatch > 0)
strpatch.format("%04d", numpatch);
row->add(oldver, C_CURRRELEASE); row->add(oldver, C_CURRRELEASE);
row->add(strpatch, C_CURRPATCH); row->add(strpatch, C_CURRPATCH);
row->add(ini.get("Data"), C_CURRDATAREL); row->add(ini.get("Data"), C_CURRDATAREL);
@ -518,7 +519,7 @@ bool TInstaller_mask::autoload()
ininame.lower(); ininame.lower();
const int pos = ininame.find("a.ini"); const int pos = ininame.find("a.ini");
CHECKS(pos >= 6, TR("Configurazione di installazione non valida: "), (const char*)ininame); CHECKS(pos >= 6, TR("Configurazione di installazione non valida: "), (const char*)ininame);
const TString16 module = ininame.mid(pos-6, 2); const TString4 module = ininame.mid(pos-6, 2);
TConfig ini(ininame, module); TConfig ini(ininame, module);
ini.write_protect(); ini.write_protect();
int r; int r;
@ -534,13 +535,14 @@ bool TInstaller_mask::autoload()
if (patchversion.mid(4) == release.mid(4) // se le versioni corrispondono ... if (patchversion.mid(4) == release.mid(4) // se le versioni corrispondono ...
&& patchlevel > row.get_int(C_PATCH)) // ..e il patchlevel è superiore && patchlevel > row.get_int(C_PATCH)) // ..e il patchlevel è superiore
{ {
TString16 patch; patch.format("%04d", patchlevel); //aggiunge zeri per avere 3 cifre sempre TString4 patch; patch.format("%04d", patchlevel); //aggiunge zeri per avere 3 cifre sempre
if (*row.get(C_ISPATCH)<=' ') // se era un modulo ... row.add(patch, C_PATCH); // aggiorna il patchlevel mostrato per il modulo
row.add(ini.get("Data"), C_DATAREL); // aggiorna data di rilascio
if (row.get_char(C_ISPATCH)<=' ') // se era un modulo ...
{ {
row.add("+", C_ISPATCH); // .....setta la presenza di patches row.add("+", C_ISPATCH); // .....setta la presenza di patches
row.add(row.get(C_PATCH), C_BASEPATCH); // memorizza patch del modulo row.add(row.get(C_PATCH), C_BASEPATCH); // memorizza patch del modulo
} }
row.add(patch, C_PATCH); // aggiorna il patchlevel mostrato per il modulo
if (release < patchversion) if (release < patchversion)
row.add(patchversion, C_RELEASE); row.add(patchversion, C_RELEASE);
} }
@ -1036,7 +1038,7 @@ bool TInstaller_mask::install(const TString& module, int patchlevel)
chunk.add(module); chunk.add(module);
if (patchlevel > 0) if (patchlevel > 0)
{ {
TString16 name; TString8 name;
name.format("%04da", patchlevel); name.format("%04da", patchlevel);
chunk << name; chunk << name;
} }
@ -1400,14 +1402,15 @@ void TInstaller_mask::install_selection()
} }
const TString4 modulo = row->get(C_CODE); const TString4 modulo = row->get(C_CODE);
const TString modesc = dongle().module_name2desc(modulo);
const int newpatch = row->get_int(C_PATCH); const int newpatch = row->get_int(C_PATCH);
const TString oldver = row->get(C_CURRRELEASE); const TString oldver = row->get(C_CURRRELEASE);
const int oldpatch = row->get_int(C_CURRPATCH); const int oldpatch = row->get_int(C_CURRPATCH);
pi.set_text(format(FR("Installazione modulo '%s'"), (const char*)modulo)); pi.set_text(format(FR("Installazione modulo '%s'"), (const char*)modesc));
if (version2year(newver) < 2006) if (version2year(newver) < 2008)
{ {
error_box(FR("Il modulo '%s' non ha una versione valida."), (const char*)modulo); error_box(FR("Il modulo '%s' non ha una versione valida."), (const char*)modesc);
continue; continue;
} }
@ -1418,13 +1421,13 @@ void TInstaller_mask::install_selection()
//versione e patch coincidono //versione e patch coincidono
if (cmp == 0) if (cmp == 0)
ok = noyes_box(FR("Si desidera reinstallare la versione %s.%d del modulo '%s' ?"), (const char*)newver, newpatch, (const char*)modulo); ok = noyes_box(FR("Si desidera reinstallare la versione %s.%d del modulo '%s' ?"), (const char*)newver, newpatch, (const char*)modesc);
//ci sono ANCHE i pacchi //ci sono ANCHE i pacchi
if (!is_patch && cmp > 0) if (!is_patch && cmp > 0)
{ {
TString256 msg; TString256 msg;
msg.format(FR("Si desidera ritornare alla versione %s.%d del modulo '%s' ?\nAttenzione: non e' garantito il corretto\nfunzionamento di tutti i programmi!"), (const char*)newver, newpatch, (const char*)modulo); msg.format(FR("Si desidera ritornare alla versione %s.%d del modulo '%s' ?\nAttenzione: non e' garantito il corretto\nfunzionamento di tutti i programmi!"), (const char*)newver, newpatch, (const char*)modesc);
ok = noyes_box(msg); ok = noyes_box(msg);
} }
@ -1440,7 +1443,7 @@ void TInstaller_mask::install_selection()
if (newpatch < oldpatch) if (newpatch < oldpatch)
{ {
TString256 msg; TString256 msg;
msg.format(FR("Si desidera ritornare alla patch %s.%d del modulo '%s' ?\nAttenzione: non e' garantito il corretto\nfunzionamento di tutti i programmi!"), (const char*)newver, newpatch, (const char*)modulo); msg.format(FR("Si desidera ritornare alla patch %s.%d del modulo '%s' ?\nAttenzione: non e' garantito il corretto\nfunzionamento di tutti i programmi!"), (const char*)newver, newpatch, (const char*)modesc);
ok = noyes_box(msg); ok = noyes_box(msg);
} }
} //if(ok&&is_patch... } //if(ok&&is_patch...
@ -1455,7 +1458,7 @@ void TInstaller_mask::install_selection()
if (oldpatch >= basepatch) if (oldpatch >= basepatch)
is_patch = !noyes_box(FR("Si desidera reinstallare l'intero modulo '%s'?" is_patch = !noyes_box(FR("Si desidera reinstallare l'intero modulo '%s'?"
"\nRispondendo NO verranno installate le sole patch"), "\nRispondendo NO verranno installate le sole patch"),
(const char *)modulo); (const char *)modesc);
else else
is_patch = false; // Quando la versione installata precede la patch base devo reinstallare il modulo! is_patch = false; // Quando la versione installata precede la patch base devo reinstallare il modulo!
} }
@ -1550,7 +1553,7 @@ void TInstaller_mask::install_selection()
{ {
ok = install_patches(modulo, oldver, oldpatch, false) ; // installa l'ultima patch ok = install_patches(modulo, oldver, oldpatch, false) ; // installa l'ultima patch
if (!ok) if (!ok)
message_box(TR("Impossibile installare le patch del modulo '%s'"),(const char *)modulo); message_box(TR("Impossibile installare le patch del modulo '%s'"),(const char *)modesc);
} }
else //..installa anche il pacco del modulo else //..installa anche il pacco del modulo
{ {
@ -1629,7 +1632,7 @@ TInstaller_mask::TInstaller_mask()
add_button(F_INSTALL, TR("Installa"), '\0', TOOL_ELABORA); // NON mettere 'I' add_button(F_INSTALL, TR("Installa"), '\0', TOOL_ELABORA); // NON mettere 'I'
add_button(F_UPDATE, TR("Rileggi"), '\0', TOOL_CONVERT); add_button(F_UPDATE, TR("Rileggi"), '\0', TOOL_CONVERT);
add_button(DLG_NULL, "", '\0'); add_button(DLG_NULL, "", '\0');
add_button(DLG_INFO, TR("Informazioni"), K_F2, TOOL_INFO); add_button(DLG_INFO, TR("Info"), K_F2, TOOL_INFO);
add_button(DLG_HELP, TR("Help"), K_F1, TOOL_HELP); add_button(DLG_HELP, TR("Help"), K_F1, TOOL_HELP);
xvt_toolbar_set_last_tool(toolbar(), DLG_QUIT); xvt_toolbar_set_last_tool(toolbar(), DLG_QUIT);
@ -1642,12 +1645,12 @@ TInstaller_mask::TInstaller_mask()
//..non puo' fare aggiornamenti da web!!!) //..non puo' fare aggiornamenti da web!!!)
TToken_string installada; TToken_string installada;
installada.add(TR("Installa da disco")); installada.add(TR("Installa da disco"));
installada.add(TR("Installa da internet")); installada.add(TR("Installa da web "));
TRadio_field& rf = add_radio(F_TYPE, 0, "", 1, 0, 21, "0|1", installada); TRadio_field& rf = add_radio(F_TYPE, 0, "", 1, 0, 21, "0|1", installada);
*rf.message(0, true) = "DISABLE,207|ENABLE,201"; *rf.message(0, true) = "DISABLE,207|ENABLE,201";
*rf.message(1, true) = "DISABLE,201|ENABLE,207"; *rf.message(1, true) = "DISABLE,201|ENABLE,207";
add_string(F_PATH, 0, "", 22, 1, 256, "B", 58).set_selector('D', EMPTY_STRING); add_string(F_PATH, 0, "", 23, 1, 256, "B", 56).set_selector('D', EMPTY_STRING);
add_string(F_WEB, 0, "", 22, 2, 256, "", 58); add_string(F_WEB, 0, "", 23, 2, 256, "", 56);
set(F_TYPE, "0", 0x1); set(F_TYPE, "0", 0x1);
//un client non puo' scegliere a caso da dove aggiornarsi!Solo dal suo server! //un client non puo' scegliere a caso da dove aggiornarsi!Solo dal suo server!

View File

@ -6,27 +6,16 @@ int main(int argc, char** argv)
const int r = (argc > 1) ? argv[1][1] - '0' : 0; const int r = (argc > 1) ? argv[1][1] - '0' : 0;
switch (r) switch (r)
{ {
case 1: case 1: ba3200(argc,argv); break;
ba3200(argc,argv); break; case 2: ba3300(argc,argv); break;
case 2: case 3: ba3400(argc,argv); break;
ba3300(argc,argv); break; case 4: ba3500(argc,argv); break;
case 3: case 5: ba3600(argc,argv); break;
ba3400(argc,argv); break; case 6: ba3700(argc,argv); break;
case 4: case 7: ba3800(argc,argv); break;
ba3500(argc,argv); break; case 8: ba3900(argc,argv); break;
case 5: case 9: ba3a00(argc,argv); break;
ba3600(argc,argv); break; default: ba3100(argc,argv); break;
case 6:
ba3700(argc,argv); break;
case 7:
ba3800(argc,argv); break;
case 8:
ba3900(argc,argv); break;
case 9:
ba3a00(argc,argv); break;
default:
ba3100(argc,argv); break;
} }
exit(0);
return 0; return 0;
} }

View File

@ -1,7 +1,8 @@
#include "ba4300.h" #include "ba4300.h"
TOOLBAR "" 0 0 0 2 TOOLBAR "" 0 0 0 2
#include <relapbar.h>
#include <filebar.h>
BUTTON DLG_NULL 2 2 BUTTON DLG_NULL 2 2
BEGIN BEGIN
@ -15,6 +16,8 @@ BEGIN
PICTURE BMP_EMAIL PICTURE BMP_EMAIL
END END
#include <cancelbar.h>
ENDPAGE ENDPAGE
@ -225,27 +228,27 @@ BEGIN
FLAGS "DU" FLAGS "DU"
END END
BUTTON DLG_ATT 10 1 BUTTON DLG_ATT 10 2
BEGIN BEGIN
PROMPT -14 19 "~Attivita'" PROMPT -14 -1 "~Attivita'"
MESSAGE K_F6 MESSAGE K_F6
END END
BUTTON DLG_ULC 10 1 BUTTON DLG_ULC 10 2
BEGIN BEGIN
PROMPT -24 19 "U.~Locali" PROMPT -24 -1 "U.~Locali"
MESSAGE K_F5 MESSAGE K_F5
END END
BUTTON DLG_SOC 10 1 BUTTON DLG_SOC 10 2
BEGIN BEGIN
PROMPT -34 19 "~Soci" PROMPT -34 -1 "~Soci"
MESSAGE K_F7 MESSAGE K_F7
END END
BUTTON DLG_REG 10 1 BUTTON DLG_REG 10 2
BEGIN BEGIN
PROMPT -44 19 "Re~gistri" PROMPT -44 -1 "Re~gistri"
MESSAGE K_F8 MESSAGE K_F8
END END