Patch level : 2.0 476

Files correlati     : ba0.exe ba1.exe ba0200a.msk
Ricompilazione Demo : [ ]
Commento            :

ba0, ba0200a.msk:
aggiunta la possibilita' di escludere le immagini di sfondo
per velocizzare navigazione menu su macchhine lente o in teleassistenza

ba1, ba0close:
aggiunto il supporto per l'aggiornamento delle DLL


git-svn-id: svn://10.65.10.50/trunk@11186 c028cbd2-c16b-5b4b-a496-9718f37d4682
This commit is contained in:
guy 2003-05-26 13:00:26 +00:00
parent c1c0857d33
commit 66a85ef230
10 changed files with 164 additions and 151 deletions

View File

@ -3,6 +3,7 @@
#include <applicat.h> #include <applicat.h>
#include <automask.h> #include <automask.h>
#include <config.h> #include <config.h>
#include <colors.h>
#include <controls.h> #include <controls.h>
#include <dongle.h> #include <dongle.h>
#include <execp.h> #include <execp.h>
@ -136,6 +137,9 @@ bool TPicture_mask::stop_run(KEY key)
void TPicture_mask::update() void TPicture_mask::update()
{ {
if (!ADVANCED_GRAPHICS)
return;
TImage& image = _submenu->image(); TImage& image = _submenu->image();
if (image.ok()) if (image.ok())
{ {
@ -341,8 +345,9 @@ TColor_mask::TColor_mask()
{ {
TConfig color(CONFIG_USER, "Colors"); TConfig color(CONFIG_USER, "Colors");
_color = color.list_variables(); _color = color.list_variables();
set(213, color.get_bool("Campi3D") ? "X" : ""); set(213, CAMPI_SCAVATI ? "X" : "");
set(215, color.get_bool("SmallIcons") ? "X" : ""); set(215, ADVANCED_GRAPHICS ? "X" : "");
set(216, SMALL_ICONS ? "X" : "");
} }
PNT TColor_mask::log2dev(long x, long y) const PNT TColor_mask::log2dev(long x, long y) const
@ -430,7 +435,8 @@ void TColor_mask::save_colors()
FOR_EACH_ASSOC_STRING(_color, obj, key, str) FOR_EACH_ASSOC_STRING(_color, obj, key, str)
colors.set(key, str); colors.set(key, str);
colors.set("Campi3D", get_bool(213) ? "X" : ""); colors.set("Campi3D", get_bool(213) ? "X" : "");
colors.set("SmallIcons", get_bool(215) ? "X" : ""); colors.set("AdvancedGraphics", get_bool(215) ? "X" : "");
colors.set("SmallIcons", get_bool(216) ? "X" : "");
} }
COLOR TColor_mask::get_color_entry(const char* name) const COLOR TColor_mask::get_color_entry(const char* name) const
@ -942,12 +948,13 @@ bool TMenu_application::destroy()
users.rewrite(); users.rewrite();
} }
// ba0 / 1 substitute: serve per installare anche i file menu ed installatore che erano in esecuzione TString_array list;
TFilename ba0exfile("ba0.ex_"),ba1exfile("ba1.ex_"); list_files("*.ex_", list);
if (ba0exfile.exist()||ba1exfile.exist()) list_files("*.dl_", list);
if (list.items() > 0)
{ {
TExternal_app ba0epilogue("ba0close.exe"); TExternal_app ba0close("ba0close.exe");
ba0epilogue.run(TRUE,TRUE,TRUE); // run asynchronous... ba0close.run(TRUE,TRUE,TRUE); // run asynchronous...
} }
return TRUE; return TRUE;
} }

View File

@ -1,4 +1,5 @@
#include <applicat.h> #include <applicat.h>
#include <config.h>
#include <currency.h> #include <currency.h>
#include <dongle.h> #include <dongle.h>
#include <execp.h> #include <execp.h>
@ -442,6 +443,7 @@ bool TMenu::read(const char* name, TString& root)
// Menu // Menu
/////////////////////////////////////////////////////////// ///////////////////////////////////////////////////////////
bool TMenu::read(const char* name) bool TMenu::read(const char* name)
{ {
TString root; TString root;
@ -672,3 +674,8 @@ bool TMenu::is_dangerous(const char* mod)
return _dangerous.get_pos(code) >= 0; return _dangerous.get_pos(code) >= 0;
} }
TMenu::TMenu() : _current(NULL), _item(0)
{ }
TMenu::~TMenu()
{ }

View File

@ -157,9 +157,8 @@ public:
void set_dangerous_modules(const TToken_string& mod) void set_dangerous_modules(const TToken_string& mod)
{ _dangerous = mod; } { _dangerous = mod; }
TMenu() : _current(NULL), _item(0) { } TMenu();
TMenu(const char* name) { read(name); } virtual ~TMenu();
virtual ~TMenu() { }
}; };

View File

@ -499,8 +499,9 @@ void TMenulist_window::draw_item(int i)
} }
void TMenulist_window::update() void TMenulist_window::update()
{ {
TImage* img = _images.image(_image_name); // Delay time before clearing const bool db = _tree != NULL && ADVANCED_GRAPHICS;
TImage* img = db ? _images.image(_image_name) : NULL; // Delay time before clearing
TField_window::update(); TField_window::update();
if (_tree == NULL) if (_tree == NULL)

View File

@ -93,12 +93,17 @@ END
BOOLEAN 213 BOOLEAN 213
BEGIN BEGIN
PROMPT 38 13 "Campi 3D" PROMPT 36 13 "Campi 3D"
END END
BOOLEAN 215 BOOLEAN 215
BEGIN BEGIN
PROMPT 38 14 "Icone piccole" PROMPT 36 14 "Grafica avanzata"
END
BOOLEAN 216
BEGIN
PROMPT 36 15 "Icone piccole"
END END
BUTTON 214 12 2 BUTTON 214 12 2

View File

@ -1,87 +1,52 @@
#include <io.h>
#include <stdio.h>
#include <stdlib.h>
#include <errno.h>
#include <files.h>
#include <windows.h> #include <windows.h>
typedef unsigned char bool ; #include <stdio.h>
#define FALSE 0
#define TRUE 1
int main(int argc, char** argv); int PASCAL WinMain(HINSTANCE, HINSTANCE , LPSTR, int)
bool fcopy(const char* orig, const char* dest);
bool fexist(const char* file);
int update_file(const char *from, const char * to);
bool fexist(
const char* file) // @parm Nome del file di cui contrallarne l'esistenza
{
int err = access(file, 0);
return err == 0;
}
bool fcopy(
const char* orig, // @parm Nome del file di origine
const char* dest) // @parm Nome del file di destinazione
// file <p dest> in coda al file <p orig> (default FALSE)
// @comm Nel caso vengano ravvisati degli errori durante l'operazione vengono
// creati dei box di comunicazione che indicano la causa del problema
{
// Copia il file su se stesso?
if (stricmp(orig, dest) == 0)
return TRUE; // Or FALSE?
FILE* i = fopen(orig, "rb");
if (!i) return fprintf(stderr,"Impossibile leggere il file %s", orig);
FILE* o = fopen(dest, "wb");
if (!o)
{
fclose(i);
return fprintf(stderr,"Impossibile scrivere il file ", dest);
}
const word size = 16*1024;
unsigned char * buffer=new unsigned char[size];
bool ok = TRUE;
while (ok)
{
const word letti = fread(buffer, 1, size, i);
ok = fwrite(buffer, 1, letti, o) == letti;
if (letti < size) break;
}
if (!ok) fprintf(stderr,"Errore di scrittura: probabile disco pieno!");
fclose(o);
fclose(i);
delete buffer;
return ok;
}
int update_file(const char *from, const char * to)
{
int r=0;
if (fexist(from))
{
if (fcopy(from,to))
r=remove(from);
}
return r;
}
int PASCAL WinMain(HINSTANCE _this, HINSTANCE _prev , LPSTR _cmd,int _mode)
{ {
int r=0; ::Sleep(1000); // Apetta un secondo che termini ba0.exe
char ba1exe[]="ba1.exe",ba1ex[]="ba1.ex_";
char ba0exe[]="ba0.exe",ba0ex[]="ba0.ex_"; WIN32_FIND_DATA data;
HANDLE hHandle = ::FindFirstFile("*.??_", &data);
BOOL bRunning = hHandle != INVALID_HANDLE_VALUE;
while (bRunning)
{
const char* newext = NULL;
const char* oldpath = data.cFileName;
char drive[_MAX_DRIVE], path[_MAX_PATH], fname[_MAX_FNAME], ext[_MAX_EXT];
_splitpath(oldpath, drive, path, fname, ext);
if (stricmp(ext, ".ex_") == 0)
newext = ".exe"; else
if (stricmp(ext, ".dl_") == 0)
newext = ".dll";
if (newext != NULL)
{
char newpath[_MAX_PATH];
_makepath(newpath, drive, path, fname, newext);
if (::CopyFile(oldpath, newpath, FALSE))
{
::DeleteFile(oldpath);
}
else
{
char msg[512];
LPVOID lpMsgBuf;
FormatMessage(
FORMAT_MESSAGE_ALLOCATE_BUFFER | FORMAT_MESSAGE_FROM_SYSTEM | FORMAT_MESSAGE_IGNORE_INSERTS,
NULL, GetLastError(), MAKELANGID(LANG_NEUTRAL, SUBLANG_DEFAULT), // Default language
(LPTSTR) &lpMsgBuf, 0, NULL);
sprintf(msg, "Impossibile ridenominare il file %s in %s:\n%s",
oldpath, newpath, lpMsgBuf);
::LocalFree(lpMsgBuf);
::MessageBox(NULL, msg, "Errore", MB_ICONERROR | MB_OK);
}
}
bRunning = ::FindNextFile(hHandle, &data);
}
update_file(ba1ex,ba1exe);
update_file(ba0ex,ba0exe);
return 0; return 0;
} }

View File

@ -1,5 +1,5 @@
#include <ctype.h>
#include <fcntl.h> #include <fcntl.h>
#include <io.h>
#include <share.h> #include <share.h>
#include <sys/stat.h> #include <sys/stat.h>
#include <errno.h> #include <errno.h>

View File

@ -1,3 +1,5 @@
#include <time.h>
#include <applicat.h> #include <applicat.h>
#include <progind.h> #include <progind.h>
#include <relation.h> #include <relation.h>

View File

@ -136,7 +136,7 @@ void TPackFiles_application::main_loop()
f_name = d.name(); f_name = d.name();
f_name.ext("dbf"); f_name.ext("dbf");
retry = FALSE; retry = FALSE;
present = access(f_name,0) == 0; present = f_name.exist();
do do
{ {
status = NOERR; status = NOERR;

View File

@ -1,3 +1,5 @@
#include <stdio.h>
#include <agasys.h> #include <agasys.h>
#include <applicat.h> #include <applicat.h>
#include <defmask.h> #include <defmask.h>
@ -80,7 +82,10 @@ class TInstaller_mask : public TArray_sheet
{ {
static TInstaller_mask* _curr_mask; static TInstaller_mask* _curr_mask;
bool _installed; // Flag per verificare se almeno un modulo e' stato installato bool _installed; // Flag per verificare se almeno un modulo e' stato installato
enum {NONE, NEW_MENU, NEW_MENUPRG, NEW_INSTALLER} _reboot_program;
enum { NONE = 0, NEW_MENU = 1, NEW_MENUPRG = 2, NEW_INSTALLER = 4, NEW_DLL = 8 };
int _reboot_program;
protected: // TSheet protected: // TSheet
virtual bool on_key(KEY key); virtual bool on_key(KEY key);
static bool quit_handler(TMask_field& f, KEY k); static bool quit_handler(TMask_field& f, KEY k);
@ -98,7 +103,8 @@ protected:
int precheck_modules(bool only_newer=TRUE); int precheck_modules(bool only_newer=TRUE);
void update_version(); void update_version();
bool move_file(const TFilename& fromdir, const TFilename& file, const char* dir) const; int needs_underscore(const TFilename& file) const;
bool move_file(const TFilename& file, const char* dir) const;
bool move_module(const TString& module, TInstall_ini& ini, bool update) const; bool move_module(const TString& module, TInstall_ini& ini, bool update) const;
bool can_install(const char* module, TInstall_ini& ini); bool can_install(const char* module, TInstall_ini& ini);
@ -526,24 +532,47 @@ bool TInstaller_mask::can_install(const char* module, TInstall_ini& ini)
return ok; return ok;
} }
int TInstaller_mask::needs_underscore(const TFilename& file) const
{
char fname[_MAX_FNAME], ext[_MAX_EXT];
xvt_fsys_parse_pathname(file, NULL, NULL, fname, ext, NULL);
int underscore = NONE;
if (xvt_str_compare_ignoring_case(ext, ".exe") == 0)
{
if (xvt_str_compare_ignoring_case(fname, "ba0") == 0)
underscore = NEW_MENUPRG; else
if (xvt_str_compare_ignoring_case(fname, "ba1") == 0)
underscore = NEW_INSTALLER;
}
else
{
if (xvt_str_compare_ignoring_case(ext, ".dll") == 0)
underscore = NEW_DLL;
}
return underscore;
}
// sposta il file dal direttorio temporaneo a quello passato come destinazione // sposta il file dal direttorio temporaneo a quello passato come destinazione
// from: direttorio di partenza // from: direttorio di partenza
// file: nome del file con path completo da spostare (può includere sottodirettori) // file: nome del file con path completo da spostare (può includere sottodirettori)
// todir: direttorio destinazione (si assume che esista già) // todir: direttorio destinazione (si assume che esista già)
bool TInstaller_mask::move_file(const TFilename& from, const TFilename& file, const char* todir) const bool TInstaller_mask::move_file(const TFilename& file, const char* todir) const
{ {
TFilename dest(todir); char fname[_MAX_FNAME], ext[_MAX_EXT];
const char *fname=file.mid(from.len()+1); xvt_fsys_parse_pathname(file, NULL, NULL, fname, ext, NULL);
if (stricmp(fname,"ba0.exe")==0)
dest.add("BA0.EX_");
else if (stricmp(fname,"ba1.exe")==0)
dest.add("BA1.EX_");
else
dest.add(fname);
const int underscore = needs_underscore(file);
if (underscore)
ext[2] = '_';
TFilename dest(todir);
dest.add(fname);
dest.ext(ext);
if (!dest.exist()) if (!dest.exist())
{ {
TToken_string dirs((const char * )(dest.path()),'\\'); TToken_string dirs(dest.path(), SLASH);
// file contains non existent subdir specification ? // file contains non existent subdir specification ?
TFilename subdir; TFilename subdir;
for (int c=0; c < dirs.items()-1; c++) for (int c=0; c < dirs.items()-1; c++)
@ -566,7 +595,7 @@ bool TInstaller_mask::move_file(const TFilename& from, const TFilename& file, co
if (!space_ok) if (!space_ok)
{ {
TString msg; TString msg;
msg << TR("Lo spazio sull'unita' e' insufficiente"); msg << TR("Lo spazio sull'unita' di destinazione e' insufficiente");
if (xvt_fsys_is_removable_drive(dest)) if (xvt_fsys_is_removable_drive(dest))
{ {
msg << TR(":\nInserire un nuovo disco e ritentare?"); msg << TR(":\nInserire un nuovo disco e ritentare?");
@ -590,9 +619,13 @@ bool TInstaller_mask::move_file(const TFilename& from, const TFilename& file, co
(const char*)file); (const char*)file);
} while (!write_ok && user_retry); } while (!write_ok && user_retry);
if (write_ok && strcmp(dest.ext(),"men")==0) if (write_ok)
((TInstaller_mask *)this)->_reboot_program=NEW_MENU; {
int rp = underscore;
if (rp == NONE && xvt_str_compare_ignoring_case(ext, ".men")==0)
rp = NEW_MENU;
(int&)_reboot_program |= rp; // Skip const!
}
return write_ok; return write_ok;
} }
@ -612,7 +645,7 @@ bool TInstaller_mask::move_module(const TString& module, TInstall_ini& ini, bool
src.add(file->get(0)); src.add(file->get(0));
if (update) if (update)
{ {
const bool move_ok = move_file(tempdir, src, dst); const bool move_ok = move_file(src, dst);
if (!move_ok) if (!move_ok)
ok = update = FALSE; ok = update = FALSE;
} }
@ -891,9 +924,7 @@ bool TInstaller_mask::install(const TString& module, int patchlevel)
if (ok) if (ok)
{ {
msg.cut(0); msg.cut(0) << TR("Copia del modulo ") << module;
msg << TR("Copia del modulo '");
msg << module << TR("' in corso ...");
TProgind pi(files, msg, TRUE, TRUE); TProgind pi(files, msg, TRUE, TRUE);
TFilename src, dst; TFilename src, dst;
for (int f = 0; f < files && ok; f++) for (int f = 0; f < files && ok; f++)
@ -903,11 +934,17 @@ bool TInstaller_mask::install(const TString& module, int patchlevel)
dst.lower(); dst.lower();
src = path; src = path;
src.add(dst); src.add(dst);
if (dst=="ba1.exe") const int underscore = needs_underscore(dst);
dst="ba1.ex_"; if (underscore)
if (dst=="ba0.exe") {
dst="ba0.ex_"; dst.rtrim(1);
dst << '_';
}
ok = fcopy(src, dst); ok = fcopy(src, dst);
if (ok && underscore != NONE)
_reboot_program |= underscore;
cancelled = pi.iscancelled(); cancelled = pi.iscancelled();
} }
ok &= !cancelled; ok &= !cancelled;
@ -1223,36 +1260,23 @@ TInstaller_mask::TInstaller_mask()
TInstaller_mask::~TInstaller_mask() TInstaller_mask::~TInstaller_mask()
{ {
_curr_mask = NULL; _curr_mask = NULL;
TString msg;
TFilename ba0exfile("ba0.ex_"),ba1exfile("ba1.ex_"); if (_reboot_program != NONE)
{
TString msg;
msg << TR("Sono stati aggiornati i seguenti elementi:") < '\n';
if (_reboot_program & NEW_MENU)
msg << TR("voci di menu;");
if (_reboot_program & NEW_MENUPRG)
msg << TR("navigatore dei menu;");
if (_reboot_program & NEW_INSTALLER)
msg << TR("installatore");
if (_reboot_program & NEW_DLL)
msg << TR("librerie di base;");
switch (_reboot_program) msg.rtrim(1);
{ msg << '\n' << TR("E' necessario uscire e rientrare dal programma.");
case NEW_MENU:
msg << TR("sono stati aggiornati i menu");
default:
if (ba0exfile.exist())
{
if (!msg.blank())
msg << TR(" e ");
else
msg << TR("e' stato ");
msg << TR("aggiornato il navigatore dei menu");
}
if (ba1exfile.exist())
{
if (!msg.blank())
msg << TR(" e ");
else
msg << TR("e' stato ");
msg << TR("aggiornato l'installatore");
}
}
if (!msg.empty())
{
msg.insert(TR("Attenzione:"));
msg << TR(".\nE' necessario uscire e rientrare dal programma");
warning_box(msg); warning_box(msg);
} }
} }
@ -1367,14 +1391,17 @@ void TExtendedInstaller::main_loop()
_m = NULL; _m = NULL;
} }
#define PROGNAME "Installer"
int ba1700(int argc, char* argv[]) int ba1700(int argc, char* argv[])
{ {
const char* const PROGNAME = "Installazione moduli";
if (user() != ::dongle().administrator()) if (user() != ::dongle().administrator())
{ {
TInstaller app; TInstaller app;
app.run(argc, argv, PROGNAME); app.run(argc, argv, PROGNAME);
} else { }
else
{
TExtendedInstaller app; TExtendedInstaller app;
app.run(argc, argv, PROGNAME); app.run(argc, argv, PROGNAME);
} }