git-svn-id: svn://10.65.10.50/branches/R_10_00@23116 c028cbd2-c16b-5b4b-a496-9718f37d4682
This commit is contained in:
parent
691e28a3a2
commit
05df13cb7c
@ -3,14 +3,146 @@
|
||||
#include <colors.h>
|
||||
#include <config.h>
|
||||
#include <dongle.h>
|
||||
#include <golem.h>
|
||||
#include <isamrpc.h>
|
||||
#include <prefix.h>
|
||||
#include <progind.h>
|
||||
#include <sqlset.h>
|
||||
#include <toolfld.h>
|
||||
#include <treectrl.h>
|
||||
#include <urldefid.h>
|
||||
#include <utility.h>
|
||||
|
||||
static int txt_sort(const TSortable& o1, const TSortable& o2, void* jolly)
|
||||
{
|
||||
const TString& s1 = (const TString&)o1;
|
||||
const TString& s2 = (const TString&)o2;
|
||||
|
||||
int p = 0;
|
||||
if (s1.starts_with("sy", true)) p |= 1;
|
||||
if (s2.starts_with("sy", true)) p |= 2;
|
||||
if (p == 1) return -1;
|
||||
if (p == 2) return +1;
|
||||
|
||||
int cmp = s1.compare(s2, 2, true);
|
||||
if (cmp == 0)
|
||||
{
|
||||
const int p1 = atoi(s1.mid(2));
|
||||
const int p2 = atoi(s2.mid(2));
|
||||
cmp = p2-p1;
|
||||
}
|
||||
|
||||
return cmp;
|
||||
}
|
||||
|
||||
void history()
|
||||
{
|
||||
int year, rel, tag, patch;
|
||||
main_app().get_version_info(year, rel, tag, patch);
|
||||
|
||||
TString_array txt;
|
||||
TString server = "93.146.247.172";
|
||||
|
||||
const TString& appname = main_app().name();
|
||||
TString8 pattern;
|
||||
if (!appname.starts_with("ba0", true))
|
||||
pattern = appname.left(2);
|
||||
pattern << "*.txt";
|
||||
|
||||
TFilename path; path.format("/release%d0/", rel);
|
||||
TFilename url; url << path << pattern;
|
||||
|
||||
http_isredirected_server(server, url);
|
||||
http_dir(server, url, txt);
|
||||
if (txt.empty())
|
||||
{
|
||||
path.format("/release%d0/", --rel);
|
||||
url = path; url << pattern;
|
||||
http_isredirected_server(server, url);
|
||||
http_dir(server, url, txt);
|
||||
}
|
||||
|
||||
TFilename tmp; tmp.tempdir(); tmp.add("history.html");
|
||||
ofstream h(tmp);
|
||||
h << "<html><body><table border=1>" << endl
|
||||
<< "<tr><th>Modulo</th><th>Versione</th><th>Patch</th><th>Descrizione</th></tr>" << endl;
|
||||
|
||||
const char* title = TR("Storia delle modifiche");
|
||||
if (!txt.empty())
|
||||
{
|
||||
txt.TArray::sort(txt_sort, &pattern);
|
||||
|
||||
TProgress_monitor pi(txt.items(), title);
|
||||
|
||||
TString last_module;
|
||||
|
||||
FOR_EACH_ARRAY_ROW(txt, r, riga)
|
||||
{
|
||||
if (!pi.add_status())
|
||||
break;
|
||||
const TFilename fname = riga->get(0);
|
||||
if (!fname.match(pattern, true))
|
||||
continue;
|
||||
|
||||
const TString16 name = fname.name_only();
|
||||
const int np = atoi(name.mid(2));
|
||||
if (np <= 0)
|
||||
continue;
|
||||
|
||||
if (pattern[0] == '*') // Scarta i moduli non posseduti
|
||||
{
|
||||
TString8 mod = name.left(2);
|
||||
const word cod = dongle().module_name2code(mod);
|
||||
if (cod > BAAUT)
|
||||
{
|
||||
if (!dongle().active(cod))
|
||||
continue;
|
||||
mod << "0.exe";
|
||||
if (!fexist(mod))
|
||||
continue;
|
||||
}
|
||||
}
|
||||
|
||||
TFilename remote = path; remote.add(fname);
|
||||
TFilename local; local.tempdir(); local.add(fname);
|
||||
|
||||
TString4 mod = fname.left(2);
|
||||
if (mod != last_module)
|
||||
last_module = mod;
|
||||
else
|
||||
mod.cut(0);
|
||||
|
||||
h << "<tr>" << "<td><b>" << mod << "</b></td>";
|
||||
h << "<td>" << rel << "</td><td>";
|
||||
if (np > patch)
|
||||
h << "<b>" << name << "</b>";
|
||||
else
|
||||
h << name;
|
||||
h << "</td><td>";
|
||||
if (http_get(server, remote, local))
|
||||
{
|
||||
ifstream i(local);
|
||||
TString str(256);
|
||||
while (i.good() && !i.eof())
|
||||
{
|
||||
i.getline(str.get_buffer(), str.size());
|
||||
if (str.find('.') > 0 && fexist(str))
|
||||
continue;
|
||||
h << str << "<br/>";
|
||||
}
|
||||
i.close();
|
||||
xvt_fsys_remove_file(local);
|
||||
}
|
||||
h << "</td></tr>" << endl;
|
||||
}
|
||||
}
|
||||
h << "</table></body></html>" << endl;
|
||||
h.close();
|
||||
goto_url(tmp);
|
||||
}
|
||||
|
||||
///////////////////////////////////////////////////////////
|
||||
// TAdavnced_property sheet
|
||||
// TAdvanced_property sheet
|
||||
///////////////////////////////////////////////////////////
|
||||
|
||||
class TAdvanced_property_sheet : public TMask
|
||||
@ -21,7 +153,7 @@ protected:
|
||||
virtual long handler(WINDOW win, EVENT* e);
|
||||
void edit();
|
||||
void esporta();
|
||||
|
||||
|
||||
public:
|
||||
void freeze(bool on) { _pf->freeze(on); }
|
||||
void add_cat(const char* prompt);
|
||||
@ -46,8 +178,9 @@ long TAdvanced_property_sheet::handler(WINDOW win, EVENT* e)
|
||||
case E_CONTROL:
|
||||
switch(e->v.ctl.id)
|
||||
{
|
||||
case DLG_EDIT: edit(); return 0L;
|
||||
case DLG_EDIT : edit(); return 0L;
|
||||
case DLG_EXPORT: esporta(); return 0L;
|
||||
case DLG_INFO : history(); return 0L;
|
||||
default: break;
|
||||
}
|
||||
break;
|
||||
@ -143,18 +276,23 @@ void TAdvanced_property_sheet::set_read_only(bool ro)
|
||||
}
|
||||
|
||||
TAdvanced_property_sheet::TAdvanced_property_sheet(const char* title, int width, int height)
|
||||
: TMask(title && *title ? title : TR("Proprietà"), 1, width, height), _pf(NULL)
|
||||
: TMask(title && *title ? title : TR("Proprietà"), 1, width, height), _pf(NULL)
|
||||
{
|
||||
add_button_tool(DLG_CANCEL, TR("Ritorna"), TOOL_CANCEL);
|
||||
add_button_tool(DLG_EXPORT, TR("Esporta"), TOOL_EXCEL);
|
||||
if (is_power_reseller(true))
|
||||
add_button_tool(DLG_EDIT, TR("Edit"), TOOL_EDIT);
|
||||
add_button_tool(DLG_INFO, TR("Modifiche"), TOOL_INFO);
|
||||
add_button_tool(DLG_HELP, TR("Help"), TOOL_HELP);
|
||||
|
||||
if (!xvt_net_get_status())
|
||||
disable(DLG_INFO);
|
||||
|
||||
_pf = new TProp_field(this);
|
||||
_pf->create(DLG_USER, 0, 0, 0, 0, page_win(0));
|
||||
}
|
||||
|
||||
/*
|
||||
///////////////////////////////////////////////////////////
|
||||
// TBasic_property sheet
|
||||
///////////////////////////////////////////////////////////
|
||||
@ -206,6 +344,7 @@ void TBasic_property_sheet::add_prop(const char* prop, long val)
|
||||
TBasic_property_sheet::TBasic_property_sheet(const char* title, int width, int height)
|
||||
: TArray_sheet(-1, -1, width, height, title, format("@%d|@%d", width/4-2, 3*width/4-2))
|
||||
{ }
|
||||
*/
|
||||
|
||||
///////////////////////////////////////////////////////////
|
||||
// TProperty sheet
|
||||
@ -213,38 +352,27 @@ TBasic_property_sheet::TBasic_property_sheet(const char* title, int width, int h
|
||||
|
||||
void TProperty_sheet::add_cat(const char* cat)
|
||||
{
|
||||
if (_power)
|
||||
((TAdvanced_property_sheet*)_ps)->add_cat(cat);
|
||||
else
|
||||
((TBasic_property_sheet*)_ps)->add_cat(cat);
|
||||
((TAdvanced_property_sheet*)_ps)->add_cat(cat);
|
||||
}
|
||||
|
||||
void TProperty_sheet::add_prop(const char* prop, const char* val)
|
||||
{
|
||||
if (_power)
|
||||
((TAdvanced_property_sheet*)_ps)->add_prop(prop, val);
|
||||
else
|
||||
((TBasic_property_sheet*)_ps)->add_prop(prop, val);
|
||||
((TAdvanced_property_sheet*)_ps)->add_prop(prop, val);
|
||||
}
|
||||
|
||||
void TProperty_sheet::add_prop(const char* prop, long val)
|
||||
{
|
||||
if (_power)
|
||||
((TAdvanced_property_sheet*)_ps)->add_prop(prop, val);
|
||||
else
|
||||
((TBasic_property_sheet*)_ps)->add_prop(prop, val);
|
||||
((TAdvanced_property_sheet*)_ps)->add_prop(prop, val);
|
||||
}
|
||||
|
||||
void TProperty_sheet::freeze(bool f)
|
||||
{
|
||||
if (_power)
|
||||
((TAdvanced_property_sheet*)_ps)->freeze(f);
|
||||
((TAdvanced_property_sheet*)_ps)->freeze(f);
|
||||
}
|
||||
|
||||
void TProperty_sheet::set_read_only(bool ro)
|
||||
{
|
||||
if (_power)
|
||||
((TAdvanced_property_sheet*)_ps)->set_read_only(ro);
|
||||
((TAdvanced_property_sheet*)_ps)->set_read_only(ro);
|
||||
}
|
||||
|
||||
KEY TProperty_sheet::run()
|
||||
@ -252,14 +380,7 @@ KEY TProperty_sheet::run()
|
||||
|
||||
|
||||
TProperty_sheet::TProperty_sheet(const char* title, int width, int height)
|
||||
{
|
||||
const int nAssYear = xvt_vobj_get_attr(NULL_WIN, ATTR_APPL_VERSION_YEAR);
|
||||
_power = nAssYear >= 2121;
|
||||
if (_power)
|
||||
_ps = new TAdvanced_property_sheet(title, width, height);
|
||||
else
|
||||
_ps = new TBasic_property_sheet(title, width, height);
|
||||
}
|
||||
{ _ps = new TAdvanced_property_sheet(title, width, height); }
|
||||
|
||||
TProperty_sheet::~TProperty_sheet()
|
||||
{
|
||||
@ -276,15 +397,14 @@ public:
|
||||
TInfo_mask();
|
||||
};
|
||||
|
||||
|
||||
TInfo_mask::TInfo_mask() : TProperty_sheet(TR("Informazioni"))
|
||||
{
|
||||
freeze(true);
|
||||
|
||||
const word ser_no = dongle().number();
|
||||
|
||||
int year = 2121, release = 11, tag = 0, patch = 1;
|
||||
TString80 versione = "2121.11.00";
|
||||
int year = 2151, release = 12, tag = 0, patch = 1;
|
||||
TString80 versione = "2151.12.00";
|
||||
if (main_app().get_version_info(year, release, tag, patch))
|
||||
versione.format("%d.%02d.%02d Patch %d", year, release, tag, patch);
|
||||
|
||||
@ -306,51 +426,37 @@ TInfo_mask::TInfo_mask() : TProperty_sheet(TR("Informazioni"))
|
||||
arg << main_app().argv(a) << ' ';
|
||||
arg.trim();
|
||||
|
||||
TConfig campoini(CONFIG_INSTALL, "Main");
|
||||
TConfig userini(CONFIG_GUI, "Printer");
|
||||
|
||||
TString prot;
|
||||
const TDongleHardware dhw = dongle().hardware();
|
||||
switch (dhw)
|
||||
{
|
||||
case _dongle_hardlock: prot = "Hardlock"; break;
|
||||
case _dongle_eutron : prot = "Eutron"; break;
|
||||
case _dongle_network : prot = dongle().server_name(); break;
|
||||
case _dongle_ssa : prot = "SSA";
|
||||
if (fexist("ssa.ini"))
|
||||
case _dongle_ssanet:
|
||||
prot = "SSA@";
|
||||
case _dongle_network:
|
||||
prot << dongle().server_name();
|
||||
break;
|
||||
case _dongle_ssa:
|
||||
prot = "SSA";
|
||||
{
|
||||
const TString& host = ini_get_string("ssa.ini", "", "SSA-PORT");
|
||||
if (host.full())
|
||||
prot << '@' << host;
|
||||
TString_array ssa;
|
||||
if (list_files("*.ssa", ssa) > 0)
|
||||
prot = ssa.row(0);
|
||||
}
|
||||
break;
|
||||
default : prot = TR("Nessuna"); break;
|
||||
default:
|
||||
prot = TR("Nessuna");
|
||||
break;
|
||||
}
|
||||
|
||||
int type = campoini.get_int("Type", "Main");
|
||||
int type = ini_get_int(CONFIG_INSTALL, "Main", "Type");
|
||||
const char* tipo = NULL;
|
||||
switch (type)
|
||||
{
|
||||
case 1: tipo = TR("Postazione singola"); break;
|
||||
case 2: tipo = TR("Server"); break;
|
||||
case 3: tipo = TR("Client"); break;
|
||||
default:
|
||||
if (campoini.get_bool("TestDatabase"))
|
||||
{
|
||||
if (dhw == _dongle_network)
|
||||
{
|
||||
tipo = TR("Server");
|
||||
campoini.set("Type", type = 2);
|
||||
}
|
||||
else
|
||||
tipo = TR("Server o Postazione singola");
|
||||
}
|
||||
else
|
||||
{
|
||||
tipo = TR("Client");
|
||||
campoini.set("Type", type = 3);
|
||||
}
|
||||
break;
|
||||
case 2: tipo = TR("Server"); break;
|
||||
case 3: tipo = TR("Client"); break;
|
||||
default: tipo = TR("Postazione singola"); break;
|
||||
}
|
||||
|
||||
TFilename temp; temp.tempdir();
|
||||
@ -384,7 +490,7 @@ TInfo_mask::TInfo_mask() : TProperty_sheet(TR("Informazioni"))
|
||||
add_cat(TR("Area dati"));
|
||||
TFilename study = firm2dir(-1);
|
||||
add_prop(TR("Studio"), study);
|
||||
const long codditta = campoini.get_long("Firm", "Main");
|
||||
const long codditta = ini_get_int(CONFIG_INSTALL, "Main", "Firm");
|
||||
add_prop(TR("Ditta"), codditta);
|
||||
if (prefix_valid())
|
||||
{
|
||||
@ -393,7 +499,9 @@ TInfo_mask::TInfo_mask() : TProperty_sheet(TR("Informazioni"))
|
||||
add_prop(TR("Valuta"), f.codice_valuta());
|
||||
}
|
||||
else
|
||||
add_prop(TR("Ragione Sociale"), campoini.get("Company"));
|
||||
{
|
||||
add_prop(TR("Ragione Sociale"), ini_get_string(CONFIG_DITTA, "Main", "RAGSOC"));
|
||||
}
|
||||
|
||||
add_cat(TR("Dati Stazione"));
|
||||
add_prop(TR("Sistema Operativo"), stros);
|
||||
@ -416,7 +524,10 @@ TInfo_mask::TInfo_mask() : TProperty_sheet(TR("Informazioni"))
|
||||
add_prop(TR("Stampante"), printer);
|
||||
|
||||
add_cat(TR("Configurazioni"));
|
||||
add_prop(TR("Config locale"), campoini.name());
|
||||
{
|
||||
TConfig campoini(CONFIG_INSTALL, "Main");
|
||||
add_prop(TR("Config locale"), campoini.name());
|
||||
}
|
||||
add_prop(TR("Config studio"), study.add("studio.ini"));
|
||||
if (codditta > 0)
|
||||
{
|
||||
|
@ -1,17 +1,12 @@
|
||||
#ifndef __ABOUT_H
|
||||
#define __ABOUT_H
|
||||
|
||||
#ifndef __MASK_H
|
||||
#include <mask.h>
|
||||
#endif
|
||||
|
||||
#ifndef __TREECTRL_H
|
||||
#include <treectrl.h>
|
||||
#ifndef __WINDOW_H
|
||||
#include <window.h>
|
||||
#endif
|
||||
|
||||
class TProperty_sheet : public TObject
|
||||
{
|
||||
bool _power;
|
||||
TWindow* _ps;
|
||||
|
||||
protected:
|
||||
@ -29,5 +24,6 @@ public:
|
||||
};
|
||||
|
||||
void about();
|
||||
void history();
|
||||
|
||||
#endif
|
||||
|
@ -717,6 +717,8 @@ bool TAVM::do_include(const char* fname)
|
||||
if (ok)
|
||||
execute(bc);
|
||||
}
|
||||
else
|
||||
cantread_box(fname);
|
||||
return ok;
|
||||
}
|
||||
|
||||
|
@ -88,12 +88,6 @@ HIDDEN void paint_background(WINDOW win)
|
||||
|
||||
if (ADVANCED_GRAPHICS)
|
||||
{
|
||||
/*
|
||||
const int ix = xvt_vobj_get_attr(win, ATTR_ICON_WIDTH);
|
||||
const int iy = xvt_vobj_get_attr(win, ATTR_ICON_HEIGHT);
|
||||
xvt_dwin_draw_icon(win, r.right-ix-CHARY, r.bottom-iy-CHARY, ICON_RSRC);
|
||||
xvt_dwin_draw_icon(win, CHARY, r.bottom-iy-CHARY, ICON_RSRC);
|
||||
*/
|
||||
RCT ir;
|
||||
xvt_rect_set(&ir, CHARY, r.bottom-TOOL_SIZE-CHARY, TOOL_SIZE+CHARY, r.bottom-CHARY);
|
||||
xvt_dwin_draw_icon_rect(win, &ir, ICON_RSRC);
|
||||
@ -191,6 +185,9 @@ long TApplication::handler(WINDOW win, EVENT* ep)
|
||||
case M_FILE_ABOUT:
|
||||
about();
|
||||
break;
|
||||
case M_HELP_VERSION:
|
||||
history();
|
||||
break;
|
||||
case M_HELP_CONTENTS:
|
||||
{
|
||||
TFilename n = "campo";
|
||||
@ -330,6 +327,11 @@ void TApplication::terminate()
|
||||
customize_controls(FALSE); // Rilascio eventuali DLL
|
||||
}
|
||||
|
||||
bool TApplication::check_autorization() const
|
||||
{
|
||||
return !_name.starts_with("ba", true);
|
||||
}
|
||||
|
||||
const char* TApplication::get_module_name() const
|
||||
{
|
||||
TString& module = ((TApplication*)this)->_module_name; // Fool the compiler
|
||||
@ -446,7 +448,7 @@ void TApplication::check_parameters(
|
||||
const TFixed_string u(argv[argc-1]);
|
||||
if (u.starts_with("-u", true) || u.starts_with("/u", true))
|
||||
{
|
||||
TString16 usr = u.mid(2,16);
|
||||
TString80 usr = u.mid(2,16);
|
||||
usr.upper();
|
||||
user() = usr;
|
||||
argc--;
|
||||
@ -456,24 +458,24 @@ void TApplication::check_parameters(
|
||||
|
||||
bool TApplication::test_assistance_year(bool verbose) const
|
||||
{
|
||||
const int dongle_year = dongle().year_assist();
|
||||
int app_year, dum1, dum2, dum3;
|
||||
bool ok = TApplication::get_version_info(app_year, dum1, dum2, dum3);
|
||||
int app_year, version, dum2, dum3;
|
||||
bool ok = TApplication::get_version_info(app_year, version, dum2, dum3);
|
||||
if (ok)
|
||||
{
|
||||
ok = app_year <= dongle_year;
|
||||
const int dongle_year = dongle().year_assist();
|
||||
ok = (app_year <= dongle_year) || (app_year > dongle_year && _name.starts_with("ba", true));
|
||||
if (ok)
|
||||
{
|
||||
if (check_autorization())
|
||||
{
|
||||
Tdninst dninst; //queste 2 righe sono quelle da mettere nei programmi
|
||||
Tdninst dninst; // queste 2 righe sono quelle da mettere nei programmi
|
||||
ok = dninst.can_I_run(false, verbose);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
if (verbose)
|
||||
error_box(TR("E' necessario rinnovare l'assistenza per l'anno in corso"));
|
||||
error_box(FR("E' necessario rinnovare l'assistenza per la versione %d"), version);
|
||||
}
|
||||
}
|
||||
else
|
||||
@ -488,9 +490,9 @@ bool TApplication::test_assistance_year(bool verbose) const
|
||||
|
||||
// @mfunc Fa partire l'applicazione
|
||||
void TApplication::run(
|
||||
int argc, // @parm Numero deglia argomenti da passara all'applicazione
|
||||
char* argv[], // @parm Argomenti da passare all'applicazione
|
||||
const char* title) // @parm Titolo dell'applicazione
|
||||
int argc, // @parm Numero degli argomenti da passara all'applicazione
|
||||
char* argv[], // @parm Argomenti da passare all'applicazione
|
||||
const char* title) // @parm Titolo dell'applicazione
|
||||
|
||||
// @comm E' in questa fase che si controlla se esiste la chiave e' attaccata
|
||||
{
|
||||
@ -550,7 +552,7 @@ void TApplication::run(
|
||||
|
||||
bool TApplication::get_version_info(int& year, int& release, int& tag, int& patch)
|
||||
{
|
||||
const char* const VERSIONANDPATCH = "Don't cry for me Argentina.2121.11.00.0000.2132";
|
||||
const char* const VERSIONANDPATCH = "Don't cry for me Argentina.2151.12.00.0100.2263";
|
||||
|
||||
TToken_string vep(VERSIONANDPATCH, '.');
|
||||
year = vep.get_int(1);
|
||||
@ -559,7 +561,7 @@ bool TApplication::get_version_info(int& year, int& release, int& tag, int& patc
|
||||
patch = vep.get_int();
|
||||
int checksum = vep.get_int();
|
||||
|
||||
bool valid = year >= 2121 && release > 0 && tag >= 0 && patch >= 0 &&
|
||||
bool valid = year >= 2151 && release > 0 && tag >= 0 && patch >= 0 &&
|
||||
checksum == (year + release + tag + patch);
|
||||
return valid;
|
||||
}
|
||||
@ -846,4 +848,4 @@ bool TSkeleton_application::menu(MENU_TAG tag)
|
||||
if (tag == BAR_ITEM_ID(1))
|
||||
main_loop();
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
@ -129,7 +129,7 @@ public:
|
||||
// @cmember Ritorna la <c TToken_string> con la lista dei moduli cui appartiene il programma
|
||||
virtual const char * extra_modules() const { return ""; }
|
||||
// @cmember Abilita la verifica del modulo cui appartiene il programma
|
||||
virtual bool check_autorization() const { return true; }
|
||||
virtual bool check_autorization() const;
|
||||
|
||||
// @cmember Forza la chiusura dell'applicazione
|
||||
void stop_run();
|
||||
|
@ -26,7 +26,7 @@ void TBrowse_application::main_loop()
|
||||
|
||||
// Seleziona il cursore a clessidra se necessario
|
||||
if (k != K_QUIT && k != K_F9)
|
||||
begin_wait();
|
||||
xvt_scr_set_busy_cursor();
|
||||
|
||||
switch (k)
|
||||
{
|
||||
@ -82,7 +82,7 @@ void TBrowse_application::main_loop()
|
||||
}
|
||||
|
||||
if (k != K_QUIT && k != K_F9)
|
||||
end_wait();
|
||||
xvt_scr_reset_busy_cursor();
|
||||
} while (k != K_QUIT);
|
||||
|
||||
if (curr_mask().is_open())
|
||||
|
@ -284,7 +284,7 @@ void TBrowse::custom_display()
|
||||
for (int i = 0; s && *s; s = it.get(++i))
|
||||
if (strcmp(s, ANAMAG_DESCR) == 0)
|
||||
{
|
||||
add_display_field("Descrizione aggiuntiva@50", ANAMAG_DESCRAGG, i + 1);
|
||||
add_display_field(HR("Descrizione aggiuntiva@50"), ANAMAG_DESCRAGG, i + 1);
|
||||
break;
|
||||
}
|
||||
}
|
||||
@ -1078,7 +1078,7 @@ KEY TBrowse::run()
|
||||
return k;
|
||||
}
|
||||
|
||||
begin_wait();
|
||||
xvt_scr_set_busy_cursor();
|
||||
|
||||
do_input(true);
|
||||
_cursor->read(_isgteq);
|
||||
@ -1130,7 +1130,7 @@ KEY TBrowse::run()
|
||||
}
|
||||
}
|
||||
|
||||
end_wait();
|
||||
xvt_scr_reset_busy_cursor();
|
||||
|
||||
TBrowse_sheet s(_cursor, _items, caption, _head, buttons, field(), siblings, _custom_filter_handler);
|
||||
|
||||
|
@ -40,6 +40,7 @@
|
||||
#define CLASS_BROWSEFILE_FIELD 233
|
||||
#define CLASS_MEMO_FIELD 234
|
||||
#define CLASS_ZOOM_FIELD 235
|
||||
#define CLASS_HTML_FIELD 236
|
||||
#define CLASS_EDITABLE_FIELD 240
|
||||
#define CLASS_BOOLEAN_FIELD 241
|
||||
#define CLASS_LIST_FIELD 242
|
||||
|
@ -23,7 +23,7 @@
|
||||
#include <d4all.h>
|
||||
#include <codeb.h>
|
||||
#include <rectypes.h>
|
||||
#include <progind.h>
|
||||
|
||||
|
||||
/*--------------------------------------------------------------------------
|
||||
numero massimo di database aperti contemporaneamente
|
||||
@ -613,21 +613,22 @@ int DB_packfile(short vis, const char* filename, long eod)
|
||||
handle=DB_open(filename,1,0); /* Exclusive mode open! */
|
||||
if (handle >= 0)
|
||||
{
|
||||
WINDOW pi = NULL_WIN;
|
||||
long rc = 0L;
|
||||
if (vis)
|
||||
{
|
||||
char s[_MAX_PATH];
|
||||
strcpy(s,"Compattamento ");
|
||||
strcat(s, filename);
|
||||
progind_create(1,s,FALSE,FALSE);
|
||||
pi = xvt_dm_progress_create(NULL_WIN, s, 1, FALSE);
|
||||
}
|
||||
rc = d4recCount(dbdata[handle]);
|
||||
if (eod < rc)
|
||||
rt=d4zap(dbdata[handle],++eod,rc);
|
||||
else
|
||||
rt=d4pack(dbdata[handle]);
|
||||
if (vis)
|
||||
progind_destroy();
|
||||
if (pi)
|
||||
xvt_dm_progress_destroy(pi);
|
||||
DB_close(handle);
|
||||
}
|
||||
else
|
||||
@ -641,22 +642,23 @@ int DB_packfile(short vis, const char* filename, long eod)
|
||||
--------------------------------------------------------------------------*/
|
||||
int DB_packmemo(short vis, const char * filename)
|
||||
{
|
||||
int rt=0,handle;
|
||||
int rt=0,handle=0;
|
||||
|
||||
code_base.autoOpen = 0;
|
||||
handle=DB_open(filename,1,0); /* Exclusive mode open! */
|
||||
if (handle > -1)
|
||||
{
|
||||
WINDOW pi = NULL_WIN;
|
||||
if (vis)
|
||||
{
|
||||
char s[256];
|
||||
char s[_MAX_PATH];
|
||||
strcpy(s, "Compattamento memo file : ");
|
||||
strcat(s, filename);
|
||||
progind_create(100L,s,FALSE,FALSE);
|
||||
xvt_dm_progress_create(NULL_WIN, s, 1, FALSE);
|
||||
}
|
||||
rt=d4memoCompress(dbdata[handle]);
|
||||
if (vis)
|
||||
progind_destroy();
|
||||
if (pi)
|
||||
xvt_dm_progress_destroy(pi);
|
||||
DB_close(handle);
|
||||
}
|
||||
else
|
||||
@ -678,6 +680,7 @@ static int DB_clean_file(int handle, const char* filename,
|
||||
long cnt = 0;
|
||||
INDEX4 *w = NULL;
|
||||
long items = DB_reccount(handle);
|
||||
WINDOW pi = NULL_WIN;
|
||||
|
||||
if (items == 0)
|
||||
return 0;
|
||||
@ -696,7 +699,7 @@ static int DB_clean_file(int handle, const char* filename,
|
||||
lt = expr4len(t->tagFile->expr);
|
||||
l = lt - 9;
|
||||
if (vis)
|
||||
progind_create(items,"Ricerca record duplicati",FALSE,FALSE);
|
||||
pi = xvt_dm_progress_create(NULL_WIN,"Ricerca record duplicati",items,FALSE);
|
||||
|
||||
rt = tfile4bottom(t->tagFile);
|
||||
|
||||
@ -704,8 +707,8 @@ static int DB_clean_file(int handle, const char* filename,
|
||||
{
|
||||
strncpy(s0, a4tagKey(dbdata[handle]), lt);
|
||||
|
||||
if (vis)
|
||||
progind_set_status(++cnt);
|
||||
if (pi)
|
||||
xvt_dm_progress_set_status(pi, ++cnt, items);
|
||||
|
||||
if (!strncmp(s, s0, l))
|
||||
{
|
||||
@ -719,8 +722,8 @@ static int DB_clean_file(int handle, const char* filename,
|
||||
|
||||
} // while
|
||||
rt = code_base.errorCode;
|
||||
if (vis)
|
||||
progind_destroy();
|
||||
if (pi)
|
||||
xvt_dm_progress_destroy(pi);
|
||||
|
||||
i4close(w);
|
||||
return rt;
|
||||
@ -746,6 +749,7 @@ int DB_packindex(short vis, const char* filename, const RecDes *r, long *peod, b
|
||||
{
|
||||
TAG4INFO tags[MaxKeys+1];
|
||||
INDEX4 * w = NULL;
|
||||
WINDOW pi = NULL_WIN;
|
||||
int i = 0;
|
||||
const char *ff = find_slash_backslash(filename);
|
||||
if (ff == NULL || *ff == '\0')
|
||||
@ -758,14 +762,18 @@ int DB_packindex(short vis, const char* filename, const RecDes *r, long *peod, b
|
||||
if (vis)
|
||||
{
|
||||
char s[_MAX_PATH+32]; sprintf(s,"Creazione di %d indici su %s", (int)r->NKeys, ff);
|
||||
progind_create(1, s, FALSE, FALSE); // No bar
|
||||
pi = xvt_dm_progress_create(NULL_WIN, s, 1, FALSE); // No bar
|
||||
}
|
||||
|
||||
w = i4create(dbdata[handle],NULL,tags); // NULL filename -> "production" index
|
||||
if (w == NULL)
|
||||
rt = code_base.errorCode;
|
||||
|
||||
if (vis) progind_destroy();
|
||||
if (pi)
|
||||
{
|
||||
xvt_dm_progress_destroy(pi);
|
||||
pi = NULL_WIN;
|
||||
}
|
||||
|
||||
if (rt == e4unique || rt == r4unique)
|
||||
{
|
||||
@ -775,10 +783,14 @@ int DB_packindex(short vis, const char* filename, const RecDes *r, long *peod, b
|
||||
if (vis)
|
||||
{
|
||||
char s[_MAX_PATH+32]; strcpy(s,"Rimozione duplicati "); strcat(s, ff);
|
||||
progind_create(1, s, FALSE, FALSE); // No bar
|
||||
pi = xvt_dm_progress_create(NULL_WIN, s, 1, FALSE); // No bar
|
||||
}
|
||||
rt = DB_clean_file(handle, filename, ff, r, vis);
|
||||
if (vis) progind_destroy();
|
||||
if (pi)
|
||||
{
|
||||
xvt_dm_progress_destroy(pi);
|
||||
pi = NULL_WIN;
|
||||
}
|
||||
}
|
||||
else
|
||||
tags[0].unique = r4unique_continue;
|
||||
@ -787,13 +799,17 @@ int DB_packindex(short vis, const char* filename, const RecDes *r, long *peod, b
|
||||
if (vis)
|
||||
{
|
||||
char s[_MAX_PATH+32]; sprintf(s,"Creazione di %d indici su %s", (int)r->NKeys, ff);
|
||||
progind_create(1, s, FALSE, FALSE); // no bar
|
||||
pi = xvt_dm_progress_create(NULL_WIN, s, 1, FALSE); // No bar
|
||||
}
|
||||
// w = i4create(dbdata[handle],filename,tags);
|
||||
w = i4create(dbdata[handle], NULL ,tags); // NULL filename -> "production" index 6/8/2014
|
||||
if (w == NULL)
|
||||
rt = code_base.errorCode;
|
||||
if (vis) progind_destroy();
|
||||
if (pi)
|
||||
{
|
||||
xvt_dm_progress_destroy(pi);
|
||||
pi = NULL_WIN;
|
||||
}
|
||||
}
|
||||
}
|
||||
for (i=0; i < r->NKeys && tags[i].name; i++)
|
||||
|
@ -852,6 +852,9 @@ static void cfg2file(int which_config, TFilename& file)
|
||||
case CONFIG_OEM:
|
||||
file = "setup/oem.ini";
|
||||
break;
|
||||
case CONFIG_SSA:
|
||||
file = "ssa.ini";
|
||||
break;
|
||||
default:
|
||||
NFCHECK("Chi usa questo strano .ini?");
|
||||
break;
|
||||
|
@ -27,6 +27,8 @@ class TConfig;
|
||||
#define CONFIG_WST 8
|
||||
// file parametri OEM (setup/oem.ini)
|
||||
#define CONFIG_OEM 9
|
||||
// file parametri SSA (ssa.ini)
|
||||
#define CONFIG_SSA 10
|
||||
|
||||
// Callback per for_each_paragraph
|
||||
typedef int (*CONFIG_CALLBACK)(TConfig& cfg, void* jolly);
|
||||
|
@ -220,7 +220,7 @@ bool is_xvt_font(const char * nome_font)
|
||||
bool found = false;
|
||||
for (int i = num_fonts-1; i >= 0; i--)
|
||||
{
|
||||
if (!found && xvt_str_compare_ignoring_case(fonts[i], nome_font) == 0)
|
||||
if (!found && xvt_str_same(fonts[i], nome_font))
|
||||
found = true;
|
||||
xvt_mem_free(fonts[i]);
|
||||
}
|
||||
|
@ -149,9 +149,9 @@ const char* TDowJones::expand_value(const char* val)
|
||||
{
|
||||
if (*val == '_')
|
||||
{
|
||||
if (xvt_str_compare_ignoring_case(val, "_FIRM") == 0)
|
||||
if (xvt_str_same(val, "_FIRM"))
|
||||
val = get_firm_val(); else
|
||||
if (xvt_str_compare_ignoring_case(val, "_EURO") == 0)
|
||||
if (xvt_str_same(val, "_EURO"))
|
||||
val = get_euro_val();
|
||||
}
|
||||
else
|
||||
@ -497,7 +497,7 @@ bool same_values(const char * valuea, const char * valueb)
|
||||
if (valueb == NULL || *valueb <= ' ')
|
||||
valueb = TCurrency::get_firm_val();
|
||||
|
||||
return xvt_str_compare_ignoring_case(valuea, valueb) == 0;
|
||||
return xvt_str_same(valuea, valueb) != 0;
|
||||
}
|
||||
|
||||
real change_currency(const real& num,
|
||||
|
@ -13,28 +13,10 @@
|
||||
// Dongle stuff
|
||||
///////////////////////////////////////////////////////////
|
||||
|
||||
#define USERADR 26952
|
||||
#define AGAADR 26953
|
||||
#define REFKEY (unsigned char*)"CAMPOKEY"
|
||||
#define VERKEY (unsigned char*)"ìpÙˆ¬cê<"
|
||||
|
||||
#pragma pack(push, 1)
|
||||
|
||||
struct TEutronHeader
|
||||
{
|
||||
char _serno[8]; // 8
|
||||
unsigned short _year_assist; // 10
|
||||
unsigned short _max_users; // 12
|
||||
unsigned long _last_date; // 16
|
||||
unsigned long _scad_date; // 20
|
||||
unsigned long _checksum; // 24
|
||||
unsigned short _version; // 26
|
||||
unsigned short _patch; // 28
|
||||
unsigned short _offset_to_bits; // 30
|
||||
unsigned short _size_of_bits; // 32
|
||||
};
|
||||
|
||||
#pragma pack(pop)
|
||||
//#define USERADR 26952
|
||||
//#define AGAADR 26953
|
||||
//#define REFKEY (unsigned char*)"CAMPOKEY"
|
||||
//#define VERKEY (unsigned char*)"ìpÙˆ¬cê<"
|
||||
|
||||
///////////////////////////////////////////////////////////
|
||||
// Current dongle
|
||||
@ -89,7 +71,7 @@ inline void reset_bit(word& w, byte b)
|
||||
|
||||
TDongle::TDongle()
|
||||
: _hardware(_dongle_unknown), _type(_no_dongle), _serno(0xFFFF),
|
||||
_max_users(1), _year_assist(2009), _dirty(false), _OEM(-1)
|
||||
_max_users(1), _year_assist(2015), _dirty(false), _OEM(-1)
|
||||
{
|
||||
memset(_eprom, 0, sizeof(_eprom));
|
||||
}
|
||||
@ -115,55 +97,11 @@ const TString& TDongle::administrator(TString* pwd) const
|
||||
// non trasformare in array: pena di morte!
|
||||
void TDongle::garble(word* data) const
|
||||
{
|
||||
switch (_hardware)
|
||||
{
|
||||
case _dongle_hardlock:
|
||||
xvt_dongle_hl_crypt(data);
|
||||
break;
|
||||
case _dongle_eutron:
|
||||
xvt_dongle_sl_crypt(data);
|
||||
break;
|
||||
case _dongle_ssa:
|
||||
xvt_dongle_sa_crypt(data); // Reversible XOR encryption
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
xvt_dongle_sa_crypt(data); // Reversible XOR encryption
|
||||
}
|
||||
|
||||
bool TDongle::already_programmed() const
|
||||
{
|
||||
if (_hardware == _dongle_hardlock)
|
||||
{
|
||||
word data[4];
|
||||
memcpy(data, &_eprom[60], sizeof(data));
|
||||
garble(data);
|
||||
|
||||
if (data[0] < 1997 || data[0] > 2997)
|
||||
return false;
|
||||
|
||||
if (data[1] == 0 || data[1] >= 10000)
|
||||
return false;
|
||||
|
||||
const TDate today(TODAY);
|
||||
const long giulio = *((const long*)&data[2]);
|
||||
const long yyyymmdd = today.julian2date(giulio);
|
||||
const TDate d(yyyymmdd);
|
||||
if (d.year() < 1997 || d > today)
|
||||
return false;
|
||||
} else
|
||||
if (_hardware == _dongle_eutron)
|
||||
{
|
||||
const TEutronHeader* eh = (const TEutronHeader*)_eprom;
|
||||
if (eh->_serno[0] == 0 || eh->_checksum == 0)
|
||||
return false; // Really virgin.
|
||||
|
||||
unsigned long cs = 0;
|
||||
for (byte* ptr = (byte*)_eprom; ptr < (byte*)&eh->_checksum; ptr++)
|
||||
cs += *ptr | ~(short(*ptr << 8));
|
||||
if (eh->_checksum != cs)
|
||||
return false; // Malicious programming!
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
@ -187,194 +125,10 @@ void TDongle::set_developer_permissions()
|
||||
_year_assist = 3000;
|
||||
}
|
||||
|
||||
|
||||
bool TDongle::hardlock_login(bool test_all_keys)
|
||||
{
|
||||
bool ok = true;
|
||||
_type = _user_dongle;
|
||||
if (test_all_keys)
|
||||
{
|
||||
xvt_dongle_hl_logout();
|
||||
if (xvt_dongle_hl_login(AGAADR, REFKEY, VERKEY))
|
||||
_type = _aga_dongle;
|
||||
}
|
||||
xvt_dongle_hl_logout();
|
||||
ok = xvt_dongle_hl_login(USERADR, REFKEY, VERKEY) != 0;
|
||||
|
||||
if (ok)
|
||||
{
|
||||
_hardware = _dongle_hardlock;
|
||||
|
||||
xvt_dongle_hl_read_block((unsigned char*)_eprom);
|
||||
|
||||
word data[4];
|
||||
memcpy(data, _eprom, sizeof(data));
|
||||
garble(data);
|
||||
|
||||
if (data[0] == 0xFAE8)
|
||||
_serno = data[1];
|
||||
else
|
||||
{
|
||||
if (data[0] == 0x3283 || data[0] == 0xA3AA) // chiave programmatori !!
|
||||
{
|
||||
if (_type == _user_dongle)
|
||||
_type = _developer_dongle;
|
||||
_serno = 0;
|
||||
#ifdef DBG
|
||||
if (test_all_keys && is_power_station())
|
||||
_type = _aga_dongle;
|
||||
#endif
|
||||
}
|
||||
}
|
||||
}
|
||||
// else log_message("hardlock_login() failed");
|
||||
|
||||
if (ok)
|
||||
{
|
||||
_max_users = 1;
|
||||
_last_update = TDate(TODAY);
|
||||
_year_assist = _last_update.year();
|
||||
|
||||
if (_type == _user_dongle) //chiave cliente
|
||||
{
|
||||
const bool already = already_programmed();
|
||||
|
||||
_module.reset(); // Disattiva tutti i moduli
|
||||
_shown.reset();
|
||||
const int last_word = already ? 12 : 4;
|
||||
word data[4];
|
||||
|
||||
// Legge flag di attivazione dei moduli
|
||||
for (int i = 0; i < last_word; i += 4)
|
||||
{
|
||||
memcpy(data, &_eprom[48+i], sizeof(data));
|
||||
garble(data);
|
||||
if (data[3] == _serno) // Validate block
|
||||
{
|
||||
for (int j = 0; j < 3; j++)
|
||||
{
|
||||
word parola = data[j] ^ _serno;
|
||||
if (parola)
|
||||
{
|
||||
for (int b = 15; b >= 0; b--)
|
||||
{
|
||||
if (test_bit(parola, b))
|
||||
{
|
||||
const word bit = i * 12 + j * 16 + b;
|
||||
_module.set(bit+1);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
break;
|
||||
}
|
||||
_module.set(0, true); // Forza l'attivazione della base
|
||||
|
||||
// Legge anno di assitenza e numero massimo di utenti
|
||||
memcpy(data, &_eprom[60], sizeof(data));
|
||||
garble(data);
|
||||
|
||||
if (already)
|
||||
{
|
||||
_year_assist = data[0];
|
||||
_max_users = data[1];
|
||||
const long giulio = *((const long*)&data[2]);
|
||||
const long yyyymmdd = _last_update.julian2date(giulio);
|
||||
_last_update = yyyymmdd;
|
||||
}
|
||||
else
|
||||
{
|
||||
_year_assist = 0;
|
||||
_dirty = true;
|
||||
}
|
||||
}
|
||||
else
|
||||
set_developer_permissions();
|
||||
}
|
||||
else
|
||||
_type = _no_dongle;
|
||||
|
||||
return ok;
|
||||
}
|
||||
|
||||
bool TDongle::eutron_login(bool test_all_keys)
|
||||
{
|
||||
bool ok = false;
|
||||
|
||||
const char* labels[3] = { "AGA.INFORMATICA", "AGA.CAMPO", "25EBAI" };
|
||||
TDongleType types[3] = { _aga_dongle, _user_dongle, _developer_dongle };
|
||||
for (int k = test_all_keys ? 0 : 1; k < 3; k++)
|
||||
{
|
||||
const unsigned char* pwd = (const unsigned char*)::encode(labels[k]);
|
||||
ok = xvt_dongle_sl_login((const unsigned char*)labels[k], pwd) != 0;
|
||||
if (ok)
|
||||
{
|
||||
_hardware = _dongle_eutron;
|
||||
_type = types[k];
|
||||
break;
|
||||
}
|
||||
// else log_message("eutron_login(\"%s\") failed", labels[k]);
|
||||
}
|
||||
if (ok)
|
||||
{
|
||||
_serno = 0;
|
||||
_max_users = 1;
|
||||
_last_update = TDate(TODAY);
|
||||
_year_assist = _last_update.year();
|
||||
|
||||
if (_type == _user_dongle) //chiave cliente
|
||||
{
|
||||
_module.reset(); // Disattiva tutti i moduli
|
||||
if (read_words(0, sizeof(TEutronHeader) / 2, _eprom))
|
||||
{
|
||||
const TEutronHeader* eh = (const TEutronHeader*)_eprom;
|
||||
TString16 serno; serno.strncpy(eh->_serno, 8);
|
||||
_serno = unsigned(atol(serno));
|
||||
if (already_programmed())
|
||||
{
|
||||
_max_users = eh->_max_users;
|
||||
_last_update = eh->_last_date;
|
||||
_year_assist = eh->_year_assist;
|
||||
|
||||
// Calcola il numero della word dove cominciano i bit di attivazione
|
||||
unsigned short otb = eh->_offset_to_bits;
|
||||
if (otb == 0) otb = 16; // Compatibile Hardlock
|
||||
|
||||
unsigned short sob = eh->_size_of_bits;
|
||||
if (sob == 0) sob = 16; // Compatibile Hardlock
|
||||
|
||||
word data[64];
|
||||
if (read_words(otb, sob, data))
|
||||
{
|
||||
int module = 1;
|
||||
for (word w = 0; w < sob; w++)
|
||||
{
|
||||
for (int b = 0; b < 16; b++)
|
||||
{
|
||||
if (test_bit(data[w], b))
|
||||
_module.set(module);
|
||||
module++;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
_dirty = true;
|
||||
}
|
||||
_module.set(0, true); // Forza l'attivazione della base
|
||||
}
|
||||
else
|
||||
set_developer_permissions();
|
||||
}
|
||||
return ok;
|
||||
}
|
||||
|
||||
bool TDongle::ssa_login(const char* mod)
|
||||
{
|
||||
if (mod && *mod)
|
||||
return is_power_station() || xvt_dongle_sa_login(mod) == 0;
|
||||
return xvt_dongle_sa_login(mod) == 0;
|
||||
|
||||
_max_users = 1;
|
||||
_last_update = TDate(TODAY);
|
||||
@ -395,7 +149,7 @@ bool TDongle::ssa_login(const char* mod)
|
||||
if (dn.find_serno())
|
||||
_year_assist = dn.assist_year();
|
||||
else
|
||||
_year_assist = 2121;
|
||||
_year_assist = 2091; // Vecchia versione
|
||||
for (word m = BAAUT+1; m < ENDAUT; m++)
|
||||
{
|
||||
const TString& name = module_code2name(m);
|
||||
@ -418,7 +172,7 @@ bool TDongle::network_login(bool test_all_keys)
|
||||
rpc_UserLogout(appname);
|
||||
|
||||
TString server = "127.0.0.1";
|
||||
if (!xvt_sys_dongle_server_is_running())
|
||||
if (!(xvt_sys_dongle_server_running() & 0x1))
|
||||
server = ini_get_string(CONFIG_INSTALL, "Server", "Dongle");
|
||||
|
||||
// const char* guest = "******";
|
||||
@ -442,7 +196,7 @@ bool TDongle::network_login(bool test_all_keys)
|
||||
_year_assist = rpc_DongleYear();
|
||||
ok = rpc_DongleModules(_module);
|
||||
if (ok && main_app().name() == "ba0100")
|
||||
warning_box(TR("ATTENZIONE! Il server di protezione non e' aggiornato:\n"
|
||||
warning_box(TR("ATTENZIONE! Il server di protezione non è aggiornato:\n"
|
||||
"Controllare la corretta installazione del servizio"));
|
||||
}
|
||||
}
|
||||
@ -451,20 +205,6 @@ bool TDongle::network_login(bool test_all_keys)
|
||||
return ok;
|
||||
}
|
||||
|
||||
int TDongle::can_try_server() const
|
||||
{
|
||||
// Se authoriz sta andando sono obbligato ad usarlo
|
||||
if (xvt_sys_dongle_server_is_running())
|
||||
return 3;
|
||||
|
||||
// Se sono un client ed ho l'indirizzo di authoriz sono obbligato ad usarlo
|
||||
const TString& dongle = ini_get_string(CONFIG_INSTALL, "Server", "Dongle");
|
||||
if (dongle.full())
|
||||
return ini_get_int(CONFIG_INSTALL, "Main", "Type") == 3 ? 3 : 1;
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
bool TDongle::login(bool test_all_keys)
|
||||
{
|
||||
bool ok = true;
|
||||
@ -472,53 +212,50 @@ bool TDongle::login(bool test_all_keys)
|
||||
if (_type != _no_dongle) // Already logged in
|
||||
logout();
|
||||
|
||||
TDongleHardware hw = _hardware;
|
||||
if (hw == _dongle_unknown)
|
||||
{
|
||||
if (can_try_server())
|
||||
TDongleHardware hw = _hardware;
|
||||
const int srv = xvt_sys_dongle_server_running();
|
||||
if (srv != 0)
|
||||
{
|
||||
if (srv & 2)
|
||||
hw = _dongle_ssanet;
|
||||
else
|
||||
hw = _dongle_network;
|
||||
}
|
||||
else
|
||||
{
|
||||
const TString& port = ini_get_string(CONFIG_SSA, "", "SSA-PORT");
|
||||
if (port.full())
|
||||
hw = _dongle_ssanet;
|
||||
else
|
||||
hw = (TDongleHardware)ini_get_int(CONFIG_INSTALL, "Main", "Donglehw");
|
||||
}
|
||||
switch(hw)
|
||||
{
|
||||
case _dongle_hardlock: ok = hardlock_login(test_all_keys); break;
|
||||
case _dongle_eutron : ok = eutron_login(test_all_keys); break;
|
||||
case _dongle_network : ok = network_login(test_all_keys); break;
|
||||
case _dongle_ssa : ok = ssa_login(NULL); break;
|
||||
default : ok = false; break;
|
||||
}
|
||||
if (!ok)
|
||||
{
|
||||
// retry login for various dongles ...
|
||||
const int should_use_server = can_try_server();
|
||||
if (should_use_server != 3) // Non sono obbligato ad usare il Dongle Server
|
||||
{
|
||||
if (!ok && hw != _dongle_eutron)
|
||||
ok = eutron_login(test_all_keys);
|
||||
if (!ok && hw != _dongle_hardlock)
|
||||
ok = hardlock_login(test_all_keys);
|
||||
if (!ok && hw != _dongle_ssa)
|
||||
ok = ssa_login(NULL);
|
||||
}
|
||||
|
||||
if (ok)
|
||||
ini_set_int(CONFIG_INSTALL, "Main", "Donglehw", (int)_hardware);
|
||||
else
|
||||
{ // DEMO
|
||||
_hardware = _dongle_unknown;
|
||||
_type = _no_dongle;
|
||||
_serno = 0xFFFF; //numero di serie più alto possibile (65535 in esadecimale: non sarà mai raggiunto da chiavi clienti...magari!)
|
||||
_max_users = 1;
|
||||
_last_update = TDate(TODAY);
|
||||
_year_assist = 3000; // anno di assistenza a 3000 per non avere problemi con le versioni nei vari anni
|
||||
_module.set(ENDAUT); // Last module on key
|
||||
_module.set(); // Activate all modules
|
||||
_shown.reset();
|
||||
const TString& dongle = ini_get_string(CONFIG_INSTALL, "Server", "Dongle");
|
||||
hw = dongle.full() ? _dongle_network : _dongle_ssa;
|
||||
}
|
||||
}
|
||||
if (hw == _dongle_network)
|
||||
ok = network_login(test_all_keys);
|
||||
else
|
||||
ok = ssa_login(NULL);
|
||||
|
||||
if (ok)
|
||||
{
|
||||
_hardware = hw;
|
||||
ini_set_int(CONFIG_INSTALL, "Main", "Donglehw", (int)_hardware);
|
||||
}
|
||||
else
|
||||
{ // DEMO
|
||||
_hardware = _dongle_unknown;
|
||||
_type = _no_dongle;
|
||||
_serno = 0xFFFF; //numero di serie più alto possibile (65535 in esadecimale: non sarà mai raggiunto da chiavi clienti...magari!)
|
||||
_max_users = 1;
|
||||
_last_update = TDate(TODAY);
|
||||
_year_assist = 3000; // anno di assistenza a 3000 per non avere problemi con le versioni nei vari anni
|
||||
_module.set(ENDAUT); // Last module on key
|
||||
_module.set(); // Activate all modules
|
||||
_shown.reset();
|
||||
}
|
||||
|
||||
if (!ok && hw == _dongle_ssa)
|
||||
if (!ok && local())
|
||||
{
|
||||
TString_array ssa;
|
||||
const int n = list_files("*.ssa", ssa);
|
||||
@ -551,15 +288,10 @@ bool TDongle::logout()
|
||||
{
|
||||
switch (_hardware)
|
||||
{
|
||||
case _dongle_hardlock:
|
||||
xvt_dongle_hl_logout();
|
||||
break;
|
||||
case _dongle_eutron:
|
||||
xvt_dongle_sl_logout();
|
||||
break;
|
||||
case _dongle_network:
|
||||
rpc_UserLogout(main_app().name());
|
||||
break;
|
||||
case _dongle_ssanet:
|
||||
case _dongle_ssa:
|
||||
xvt_dongle_sa_logout(NULL);
|
||||
break;
|
||||
@ -573,77 +305,6 @@ bool TDongle::logout()
|
||||
return true;
|
||||
}
|
||||
|
||||
// Data punta ad un array di 4 words
|
||||
// Deve essere cosi' per problemi del C,
|
||||
// non trasformare in array: pena di morte!
|
||||
bool TDongle::read_words(word reg, word len, word* ud) const
|
||||
{
|
||||
bool ok = false;
|
||||
switch (_hardware)
|
||||
{
|
||||
case _dongle_hardlock:
|
||||
{
|
||||
for (word i = 0; i < len; i++)
|
||||
xvt_dongle_hl_read(reg+i, &ud[i]);
|
||||
ok = true;
|
||||
}
|
||||
break;
|
||||
case _dongle_eutron:
|
||||
while (len > 0)
|
||||
{
|
||||
const unsigned short size = (len <= 16) ? len : 16;
|
||||
ok = xvt_dongle_sl_read_block(reg, size, ud) != 0;
|
||||
if (!ok)
|
||||
{
|
||||
yesnofatal_box("EUTRON read error");
|
||||
break;
|
||||
}
|
||||
len -= size;
|
||||
reg += size;
|
||||
ud += size;
|
||||
}
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
return ok;
|
||||
}
|
||||
|
||||
// Data punta ad un array di 4 words
|
||||
// Deve essere cosi' per problemi del C,
|
||||
// non trasformare in array: pena di morte!
|
||||
bool TDongle::write_words(word reg, word len, word* data) const
|
||||
{
|
||||
bool ok = false;
|
||||
switch(_hardware)
|
||||
{
|
||||
case _dongle_hardlock:
|
||||
{
|
||||
for (word r = 0; r < len; r++)
|
||||
{
|
||||
const word address = reg+r;
|
||||
ok = xvt_dongle_hl_write(address, data[r]) != 0;
|
||||
}
|
||||
}
|
||||
break;
|
||||
case _dongle_eutron:
|
||||
while (len > 0)
|
||||
{
|
||||
const unsigned short size = (len <= 16) ? len : 16;
|
||||
ok = xvt_dongle_sl_write_block(reg, size, data) != 0;
|
||||
if (!ok)
|
||||
break;
|
||||
len -= size;
|
||||
reg += size;
|
||||
data += size;
|
||||
}
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
return ok;
|
||||
}
|
||||
|
||||
int TDongle::oem() const
|
||||
{
|
||||
if (_OEM < 0)
|
||||
@ -741,8 +402,12 @@ const TString& TDongle::short_name() const
|
||||
|
||||
const TString& TDongle::server_name() const
|
||||
{
|
||||
if (network() && !xvt_sys_dongle_server_is_running())
|
||||
if (network() && !xvt_sys_dongle_server_running())
|
||||
{
|
||||
if (hardware() == _dongle_ssanet)
|
||||
return ini_get_string(CONFIG_SSA, NULL, "Port");
|
||||
return ini_get_string(CONFIG_INSTALL, "Server", "Dongle");
|
||||
}
|
||||
|
||||
TString& tmp = get_tmp_string(50);
|
||||
xvt_sys_get_host_name(tmp.get_buffer(), tmp.size());
|
||||
@ -767,124 +432,10 @@ bool TDongle::activate(word module, bool on)
|
||||
return ok;
|
||||
}
|
||||
|
||||
bool TDongle::burn_hardlock()
|
||||
{
|
||||
word data[4];
|
||||
|
||||
const TDate today(TODAY);
|
||||
const bool already = already_programmed();
|
||||
if (already)
|
||||
{
|
||||
memcpy(data, &_eprom[60], sizeof(data));
|
||||
garble(data);
|
||||
if (data[0] < 2001 || data[0] > 3001)
|
||||
return error_box("On Line Assistance error.");
|
||||
if (data[1] == 0 || data[1] >= 10000)
|
||||
return error_box("Bad users number.");
|
||||
const long val = *((const long*)&data[2]);
|
||||
const long yyyymmdd = today.julian2date(val);
|
||||
const TDate date(yyyymmdd);
|
||||
if (date > today)
|
||||
return error_box("Too late sir: key has already expired!");
|
||||
}
|
||||
|
||||
data[0] = _year_assist;
|
||||
data[1] = _max_users;
|
||||
long* val = (long*)&data[2];
|
||||
*val = today.date2julian();
|
||||
garble(data);
|
||||
write_words(60, 4, data);
|
||||
_last_update = today;
|
||||
|
||||
// Il primo bit della memoria della chiave corrisponde al modulo uno
|
||||
// non allo zero (che e' la base ed e' sempre attivo)
|
||||
word module = 1;
|
||||
for (int octect = 0; octect < 3; octect++)
|
||||
{
|
||||
for(int parola = 0; parola < 3; parola++)
|
||||
{
|
||||
word& p = data[parola];
|
||||
p = 0;
|
||||
for (int bit = 0; bit < 16; bit++)
|
||||
{
|
||||
if (active(module))
|
||||
set_bit(p, bit);
|
||||
module++;
|
||||
}
|
||||
p ^= _serno;
|
||||
}
|
||||
data[3] = _serno;
|
||||
garble(data);
|
||||
write_words(48 + 4*octect, 4, data);
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
bool TDongle::burn_eutron()
|
||||
{
|
||||
TEutronHeader* eh = (TEutronHeader*)_eprom;
|
||||
memset(eh, 0, sizeof(TEutronHeader));
|
||||
|
||||
_last_update = TDate(TODAY);
|
||||
sprintf(eh->_serno, "%lu", (unsigned long)_serno);
|
||||
eh->_year_assist = _year_assist;
|
||||
eh->_max_users = _max_users;
|
||||
eh->_last_date = atol(_last_update.string(ANSI));
|
||||
eh->_scad_date = 0;
|
||||
|
||||
unsigned long cs = 0;
|
||||
for (byte* ptr = (byte*)_eprom; ptr < (byte*)&eh->_checksum; ptr++)
|
||||
cs += *ptr | ~(short(*ptr << 8));
|
||||
eh->_checksum = cs;
|
||||
|
||||
const word otb = sizeof(TEutronHeader) / 2;
|
||||
const word sob = 16;
|
||||
eh->_offset_to_bits = otb;
|
||||
eh->_size_of_bits = sob;
|
||||
|
||||
bool ok = write_words(0, otb, _eprom);
|
||||
|
||||
if (ok)
|
||||
{
|
||||
word data[sob]; memset(data, 0, sizeof(data));
|
||||
for (int module = 1; module < 256; module++)
|
||||
{
|
||||
if (active(module))
|
||||
{
|
||||
word& w = data[(module-1) / 16];
|
||||
set_bit(w, (module-1) % 16, true);
|
||||
}
|
||||
}
|
||||
ok = write_words(otb, sob, data);
|
||||
}
|
||||
|
||||
return ok;
|
||||
}
|
||||
|
||||
bool TDongle::burn()
|
||||
{
|
||||
bool ok = local() && _type == _user_dongle;
|
||||
|
||||
if (ok)
|
||||
{
|
||||
switch(_hardware)
|
||||
{
|
||||
case _dongle_hardlock: ok = burn_hardlock(); break;
|
||||
case _dongle_eutron : ok = burn_eutron(); break;
|
||||
default : ok = false; break;
|
||||
}
|
||||
}
|
||||
|
||||
if (ok)
|
||||
_dirty = false;
|
||||
|
||||
return ok;
|
||||
}
|
||||
|
||||
const TString_array& TDongle::info() const
|
||||
{
|
||||
if (_info.items() == 0)
|
||||
if (_info.empty())
|
||||
{
|
||||
TScanner scanner("campo.aut");
|
||||
for (int aut = 0; ; aut++)
|
||||
@ -907,7 +458,7 @@ const TString_array& TDongle::info() const
|
||||
word TDongle::module_name2code(const char* mod) const
|
||||
{
|
||||
int i = BAAUT;
|
||||
if (mod && *mod && xvt_str_compare_ignoring_case(mod, "sy") != 0)
|
||||
if (mod && *mod && !xvt_str_same(mod, "sy"))
|
||||
{
|
||||
if (real::is_natural(mod))
|
||||
{
|
||||
@ -949,7 +500,7 @@ const TString& TDongle::module_name2desc(const char* mod) const
|
||||
const word cod = module_name2code(mod);
|
||||
if (cod == 0)
|
||||
{
|
||||
if (xvt_str_compare_ignoring_case(mod, "sy") == 0)
|
||||
if (xvt_str_same(mod, "sy"))
|
||||
return get_tmp_string() = TR("Sistema");
|
||||
}
|
||||
return module_code2desc(cod);
|
||||
@ -1482,5 +1033,5 @@ bool Tdninst::encode(const TString& f) const
|
||||
Tdninst::Tdninst() : _year_assist(0)
|
||||
{
|
||||
TEnigma_machine s;
|
||||
_year_assist = s.year_assist(); // 2101 or 2121?
|
||||
_year_assist = s.year_assist(); // 2101, 2121, 2151
|
||||
}
|
||||
|
@ -17,8 +17,8 @@
|
||||
#include <strings.h>
|
||||
#endif
|
||||
|
||||
enum TDongleHardware { _dongle_unknown, _dongle_hardlock, _dongle_eutron, _dongle_network, _dongle_ssa };
|
||||
enum TDongleType { _no_dongle, _user_dongle, _developer_dongle, _aga_dongle };
|
||||
enum TDongleHardware { _dongle_unknown=0, _dongle_network=3, _dongle_ssa=4, _dongle_ssanet=5 };
|
||||
enum TDongleType { _no_dongle, _user_dongle, _developer_dongle };
|
||||
|
||||
class TDongle : public TObject
|
||||
{
|
||||
@ -40,18 +40,11 @@ class TDongle : public TObject
|
||||
protected:
|
||||
bool already_programmed() const;
|
||||
void set_developer_permissions();
|
||||
bool hardlock_login(bool test_all_dongles);
|
||||
bool eutron_login(bool test_all_dongles);
|
||||
bool network_login(bool test_all_dongles);
|
||||
|
||||
bool ssa_login(const char* mod);
|
||||
bool ssa_test_module(const char* mod);
|
||||
bool ssa_logout();
|
||||
|
||||
bool burn_hardlock();
|
||||
bool burn_eutron();
|
||||
|
||||
int can_try_server() const;
|
||||
const TString_array& info() const; // Array di coppie modulo|descrizione
|
||||
|
||||
public: // TObject
|
||||
@ -69,10 +62,6 @@ public:
|
||||
|
||||
void garble(word* data) const;
|
||||
|
||||
// Solo per un po' di tempo, poi diverranno protected (servono a ba1500 old style)
|
||||
bool read_words(word reg, word len, word *data) const;
|
||||
bool write_words(word reg, word len, word *data) const;
|
||||
|
||||
TDongleType type() const { return _type; }
|
||||
|
||||
bool active(word module) const;
|
||||
@ -86,8 +75,8 @@ public:
|
||||
bool burn();
|
||||
|
||||
TDongleHardware hardware() const { return _hardware; }
|
||||
bool local() const { return _hardware != _dongle_network && ok(); }
|
||||
bool network() const { return _hardware == _dongle_network; }
|
||||
bool local() const { return _hardware == _dongle_ssa && ok(); }
|
||||
bool network() const { return _hardware == _dongle_network || _hardware == _dongle_ssanet; }
|
||||
const TString& administrator(TString* pwd = NULL) const;
|
||||
int oem() const;
|
||||
const TString& reseller() const;
|
||||
|
@ -2006,7 +2006,7 @@ bool TForm_picture::update()
|
||||
const int pos = i.find('|');
|
||||
if (pos >= 0)
|
||||
i.cut(pos);
|
||||
if (xvt_str_compare_ignoring_case(i.ext(), "bmp") == 0)
|
||||
if (xvt_str_same(i.ext(), "bmp"))
|
||||
{
|
||||
i.replace('\\', '/');
|
||||
i.trim();
|
||||
@ -2470,9 +2470,10 @@ bool TPrint_section::update()
|
||||
reset();
|
||||
for (word i = 0; i < fields(); i++)
|
||||
{
|
||||
if (!field(i).is_section())
|
||||
TForm_item& ri = field(i);
|
||||
if (!ri.is_section())
|
||||
{
|
||||
const bool esito = field(i).update();
|
||||
const bool esito = ri.update();
|
||||
if (!esito)
|
||||
ok = false;
|
||||
}
|
||||
|
@ -6,15 +6,11 @@
|
||||
|
||||
static __int64 mcd(__int64 a, __int64 b)
|
||||
{
|
||||
if (a < 0)
|
||||
a = -a;
|
||||
if (b < 0)
|
||||
b = -b;
|
||||
|
||||
__int64 r;
|
||||
if (a < 0) a = -a;
|
||||
if (b < 0) b = -b;
|
||||
while (b > 0)
|
||||
{
|
||||
r = a % b;
|
||||
__int64 r = a % b;
|
||||
a = b;
|
||||
b = r;
|
||||
}
|
||||
@ -23,14 +19,11 @@ static __int64 mcd(__int64 a, __int64 b)
|
||||
|
||||
static __int64 mcm(__int64 a, __int64 b)
|
||||
{
|
||||
if (a < 0)
|
||||
a = -a;
|
||||
if (b < 0)
|
||||
b = -b;
|
||||
if (a < 0) a = -a;
|
||||
if (b < 0) b = -b;
|
||||
return ((a * b) / mcd(a, b));
|
||||
}
|
||||
|
||||
|
||||
void fraction::simplify()
|
||||
{
|
||||
if (_den > 1 && _num > 1)
|
||||
@ -56,7 +49,7 @@ void fraction::build_fraction (const char *s)
|
||||
|
||||
_num = 0;
|
||||
_den = 1;
|
||||
if (n.not_empty())
|
||||
if (n.full())
|
||||
{
|
||||
int pdec = n.find(',');
|
||||
const int psqr = n.find('['), psls = n.find('/');
|
||||
@ -129,11 +122,7 @@ void fraction::build_fraction (const char *s)
|
||||
}
|
||||
}
|
||||
n.strip(",.-+/[]");
|
||||
#ifdef WIN32
|
||||
sscanf(n, "%I64d", &_num);
|
||||
#else
|
||||
sscanf(n, "%Ld", &_num);
|
||||
#endif
|
||||
sscanf_s(n, "%I64d", &_num);
|
||||
if (len_periodo > 0)
|
||||
{
|
||||
_den = 9;
|
||||
@ -171,9 +160,10 @@ fraction::fraction(const fraction& b)
|
||||
|
||||
fraction::fraction(const real& num, const real& den)
|
||||
{
|
||||
if (den == ZERO)
|
||||
if (den.is_zero())
|
||||
build_fraction("");
|
||||
else
|
||||
{
|
||||
if (den == UNO)
|
||||
build_fraction(num.stringa());
|
||||
else
|
||||
@ -181,11 +171,12 @@ fraction::fraction(const real& num, const real& den)
|
||||
real n = num; n /= den;
|
||||
build_fraction(n.stringa());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
int fraction::sign() const
|
||||
{
|
||||
if ( _num == 0 || _den == 0)
|
||||
if (_num == 0 || _den == 0)
|
||||
return 0;
|
||||
return _num < 0 ? (_den < 0 ? +1 : -1) : (_den < 0 ? -1 : +1);
|
||||
}
|
||||
@ -200,7 +191,6 @@ fraction& fraction::operator =(const fraction & b)
|
||||
fraction& fraction::operator += (const fraction & b)
|
||||
{
|
||||
const __int64 m = mcm(_den, b._den);
|
||||
|
||||
_num = _num * ( m / _den) + b._num * ( m / b._den);
|
||||
_den = m;
|
||||
simplify();
|
||||
@ -209,8 +199,7 @@ fraction& fraction::operator += (const fraction & b)
|
||||
|
||||
fraction& fraction::operator -= (const fraction & b)
|
||||
{
|
||||
__int64 m = mcm(_den, b._den);
|
||||
|
||||
const __int64 m = mcm(_den, b._den);
|
||||
_num = _num * ( m / _den) - b._num * ( m / b._den);
|
||||
_den = m;
|
||||
simplify();
|
||||
|
@ -9,7 +9,7 @@ static CONNID _connection = 0;
|
||||
|
||||
bool rpc_Start()
|
||||
{
|
||||
bool ok = TRUE;
|
||||
bool ok = true;
|
||||
if (_client == NULL)
|
||||
{
|
||||
srand(clock());
|
||||
@ -32,7 +32,7 @@ bool rpc_Stop()
|
||||
_client = NULL;
|
||||
_connection = 0;
|
||||
}
|
||||
return TRUE;
|
||||
return true;
|
||||
}
|
||||
|
||||
bool rpc_Call(const char* cmd)
|
||||
@ -205,7 +205,7 @@ bool rpc_DongleModules(TBit_array& ba)
|
||||
word* buff = (word*)rpc_Request("DongleModules()", size, time);
|
||||
if (buff && size > 0)
|
||||
{
|
||||
ba.reset(); ba.set(0, TRUE);
|
||||
ba.reset(); ba.set(0, true);
|
||||
const int words = int(size/2);
|
||||
int module = 1;
|
||||
for (int i = 0; i < words; i++)
|
||||
@ -213,7 +213,7 @@ bool rpc_DongleModules(TBit_array& ba)
|
||||
for (int b = 0; b < 16; b++)
|
||||
{
|
||||
if (buff[i] & (1 << b))
|
||||
ba.set(module, TRUE);
|
||||
ba.set(module, true);
|
||||
module++;
|
||||
}
|
||||
}
|
||||
@ -302,8 +302,8 @@ bool rpc_UserLogin(const char* server, const char* user,
|
||||
}
|
||||
|
||||
const bool local = server == NULL || *server == '\0' ||
|
||||
xvt_str_compare_ignoring_case(server, "127.0.0.1") == 0 ||
|
||||
xvt_str_compare_ignoring_case(server, "localhost") == 0;
|
||||
xvt_str_same(server, "127.0.0.1") ||
|
||||
xvt_str_same(server, "localhost");
|
||||
TString80 name;
|
||||
if (local)
|
||||
xvt_sys_get_host_name(name.get_buffer(), name.size());
|
||||
|
@ -184,19 +184,19 @@ void TMask::read_mask(
|
||||
|
||||
init_mask();
|
||||
|
||||
while (scanner.ok() && scanner.popkey() != "EN")
|
||||
while (scanner.ok())
|
||||
{
|
||||
if (scanner.key() == "PA")
|
||||
const TString& key = scanner.popkey();
|
||||
if (key.empty() || key == "EN")
|
||||
break;
|
||||
if (key == "PA")
|
||||
{
|
||||
read_page(scanner, false);
|
||||
if (_pages >= max)
|
||||
break;
|
||||
}
|
||||
else
|
||||
{
|
||||
if (scanner.key() == "TO")
|
||||
read_page(scanner, true);
|
||||
}
|
||||
} else
|
||||
if (key == "TO")
|
||||
read_page(scanner, true);
|
||||
}
|
||||
|
||||
if (_pages <= 0)
|
||||
|
@ -354,6 +354,7 @@ void TMask_field::construct(
|
||||
break;
|
||||
case CLASS_TREE_FIELD:
|
||||
case CLASS_OUTLOOK_FIELD:
|
||||
case CLASS_HTML_FIELD:
|
||||
_ctl_data._height = len;
|
||||
_ctl_data._width = width;
|
||||
_ctl_data._size = 0;
|
||||
@ -3037,7 +3038,7 @@ bool TDate_field::on_key(KEY key)
|
||||
olddate = TDate(data);
|
||||
long ansidate = olddate.date2ansi();
|
||||
|
||||
ansidate = xvt_dm_post_choose_date(parent(), &rct, ansidate);
|
||||
ansidate = xvt_dm_post_date_sel(parent(), &rct, ansidate);
|
||||
|
||||
const TDate newdate(ansidate);
|
||||
if (newdate != olddate)
|
||||
@ -3106,7 +3107,7 @@ void TReal_field::create(WINDOW w)
|
||||
{
|
||||
TCursor& cur = *browse()->cursor();
|
||||
const TRecnotype ne = cur.items();
|
||||
if (ne > 0 && xvt_str_compare_ignoring_case(cur.file(0).name(), "ESC") == 0) // ... codice esercizio?
|
||||
if (ne > 0 && xvt_str_same(cur.file(0).name(), "ESC")) // ... codice esercizio?
|
||||
{
|
||||
const TRectype& esc = cur.curr();
|
||||
for (cur = ne-1; cur.pos() > 0; --cur)
|
||||
|
@ -15,6 +15,7 @@
|
||||
#define MOV_TOTDOCVAL "TOTDOCVAL"
|
||||
#define MOV_RITFIS "RITFIS"
|
||||
#define MOV_RITSOC "RITSOC"
|
||||
#define MOV_REVCHARGE "REVCHARGE"
|
||||
#define MOV_CODCAUS "CODCAUS"
|
||||
#define MOV_DESCR "DESCR"
|
||||
#define MOV_TIPOMOV "TIPOMOV"
|
||||
|
@ -661,7 +661,7 @@ TSocket_connection::TSocket_connection(TLanManager* lm,
|
||||
_server.cut(pos);
|
||||
}
|
||||
|
||||
if (_server.blank() || xvt_str_compare_ignoring_case(_server, "localhost") == 0)
|
||||
if (_server.blank() || xvt_str_same(_server, "localhost"))
|
||||
_server = "127.0.0.1";
|
||||
|
||||
connect();
|
||||
@ -913,10 +913,13 @@ bool TSocketClient::HttpGetFile(CONNID id, const char* remote, const char* local
|
||||
{
|
||||
outfile.write(buf, count);
|
||||
total += count;
|
||||
if (total >= size || !pi.setstatus(total)) // Controllo se ormai ho finito
|
||||
if (total >= size || !pi.set_status(total)) // Controllo se ormai ho finito
|
||||
break;
|
||||
strpi.add(TR("Trasferiti"), 1);
|
||||
strpi << ' ' << bytes2str(total);
|
||||
strpi << ' ' << bytes2str(total);
|
||||
const int sec = (clock()-pi.start_clock())/CLOCKS_PER_SEC;
|
||||
if (sec > 1)
|
||||
strpi << " (" << bytes2str(total/sec) << "/s)";
|
||||
pi.set_text(strpi);
|
||||
}
|
||||
}
|
||||
@ -925,8 +928,8 @@ bool TSocketClient::HttpGetFile(CONNID id, const char* remote, const char* local
|
||||
}
|
||||
else // Dimensione ignota
|
||||
{
|
||||
TIndwin pi(100, strpi, true, false);
|
||||
while (!cur_socket->eof() && !pi.iscancelled())
|
||||
TProgress_monitor pi(1, strpi);
|
||||
while (!cur_socket->eof() && !pi.is_cancelled())
|
||||
{
|
||||
cur_socket->read(buf.get_buffer(), buf.size());
|
||||
const size_t count = (size_t)cur_socket->gcount();
|
||||
@ -936,10 +939,13 @@ bool TSocketClient::HttpGetFile(CONNID id, const char* remote, const char* local
|
||||
total += count;
|
||||
strpi.add(TR("Trasferiti"), 1);
|
||||
strpi << ' ' << bytes2str(total);
|
||||
const int sec = (clock()-pi.start_clock())/CLOCKS_PER_SEC;
|
||||
if (sec > 1)
|
||||
strpi << " (" << bytes2str(total/sec) << "/s)";
|
||||
pi.set_text(strpi);
|
||||
}
|
||||
}
|
||||
ok = total > 0 && !pi.iscancelled(); // Ho finito per bene?
|
||||
ok = total > 0 && !pi.is_cancelled(); // Ho finito per bene?
|
||||
}
|
||||
}
|
||||
else
|
||||
@ -983,7 +989,20 @@ HIDDEN int find_href(const TString& riga, int from, TString& filename)
|
||||
bool TSocketClient::HttpGetDir(CONNID id, const char* remote, TString_array& list)
|
||||
{
|
||||
TFilename local; local.temp();
|
||||
const bool ok = HttpGetFile(id, remote, local);
|
||||
|
||||
TString server = remote, pattern;
|
||||
bool ok = false;
|
||||
if (server.find('*') > 0 || server.find('?') > 0)
|
||||
{
|
||||
const int slash = server.rfind('/');
|
||||
if (slash > 0)
|
||||
{
|
||||
pattern = server.mid(slash+1);
|
||||
server.cut(slash+1);
|
||||
}
|
||||
}
|
||||
|
||||
ok = HttpGetFile(id, server, local);
|
||||
if (ok)
|
||||
{
|
||||
TString riga(512);
|
||||
@ -994,7 +1013,10 @@ bool TSocketClient::HttpGetDir(CONNID id, const char* remote, TString_array& lis
|
||||
s.getline(riga.get_buffer(), riga.size());
|
||||
riga.lower();
|
||||
for (int href = find_href(riga, 0, name); href >= 0; href = find_href(riga, href, name))
|
||||
list.add(name);
|
||||
{
|
||||
if (pattern.blank() || name.match(pattern, true))
|
||||
list.add(name);
|
||||
}
|
||||
}
|
||||
s.close();
|
||||
xvt_fsys_remove_file(local);
|
||||
|
@ -110,16 +110,16 @@ int TODBC_recordset::on_get_columns(int argc, char** values, char** columns)
|
||||
|
||||
if (fldtype != NULL)
|
||||
{
|
||||
if (xvt_str_compare_ignoring_case(fldtype, "DATE") == 0)
|
||||
if (xvt_str_same(fldtype, "DATE"))
|
||||
{
|
||||
info->_type = _datefld;
|
||||
info->_width = 10;
|
||||
} else
|
||||
if (xvt_str_compare_ignoring_case(fldtype, "NUMERIC") == 0)
|
||||
if (xvt_str_same(fldtype, "NUMERIC"))
|
||||
{
|
||||
info->_type = _realfld;
|
||||
} else
|
||||
if (xvt_str_compare_ignoring_case(fldtype, "BLOB") == 0)
|
||||
if (xvt_str_same(fldtype, "BLOB"))
|
||||
{
|
||||
info->_type = _memofld;
|
||||
info->_width = 50;
|
||||
|
@ -494,7 +494,7 @@ const TFilename& TFile_info::load_filedes()
|
||||
{
|
||||
_dir = _filedes.SysName[0] != '$' ? _comdir : _nordir;
|
||||
_name = CAddPref(_filedes.SysName);
|
||||
strncpy(_filedes.Des, dictionary_translate(_filedes.Des), sizeof(_filedes.Des)-1);
|
||||
strncpy_s(_filedes.Des, sizeof(_filedes.Des), dictionary_translate(_filedes.Des), sizeof(_filedes.Des)-1);
|
||||
}
|
||||
else
|
||||
_name.cut(0);
|
||||
@ -533,8 +533,8 @@ TFile_info::TFile_info(int logicnum, TFilename& name)
|
||||
int err = DB_recinfo(_name, &_filedes, (RecDes*)&rec.rec(), keys.get_buffer());
|
||||
if (err == NOERR && prefix().add_recdes(logicnum, rec, keys))
|
||||
{
|
||||
strncpy(_filedes.SysName, _name, sizeof(_filedes.SysName));
|
||||
_filedes.SysName[41] = '\0';
|
||||
strncpy_s(_filedes.SysName, sizeof(_filedes.SysName), _name, sizeof(_filedes.SysName));
|
||||
_filedes.SysName[sizeof(_filedes.SysName)-1] = '\0';
|
||||
}
|
||||
else
|
||||
_name.cut(0);
|
||||
@ -1035,7 +1035,7 @@ void TPrefix::set(
|
||||
{
|
||||
const TString saved_prf = __ptprf; // Salvo __ptprf che viene cambiato da CGetPref
|
||||
char* prfx = (char*)CGetPref(); // Safe non const cast for StPath cprefix
|
||||
strcpy(__ptprf, saved_prf);
|
||||
strcpy_s(__ptprf, sizeof(__ptprf), saved_prf);
|
||||
xvt_fsys_build_pathname(prfx, NULL, __ptprf, _prefix, NULL, NULL);
|
||||
}
|
||||
else
|
||||
@ -1166,7 +1166,7 @@ bool TPrefix::set_studio(const char* study, long ditta)
|
||||
const TString old_study(__ptprf);
|
||||
const TString old_firm(_prefix);
|
||||
|
||||
strcpy(__ptprf, study);
|
||||
strcpy_s(__ptprf, sizeof(__ptprf), study);
|
||||
const word len = strlen(__ptprf);
|
||||
if (len > 0 && __ptprf[len-1] != '\\' && __ptprf[len-1] != '/')
|
||||
{
|
||||
@ -1179,7 +1179,7 @@ bool TPrefix::set_studio(const char* study, long ditta)
|
||||
bool ok = set_codditta(ditta, TRUE);
|
||||
if (!ok)
|
||||
{
|
||||
strcpy(__ptprf, old_study);
|
||||
strcpy_s(__ptprf, sizeof(__ptprf), old_study);
|
||||
set(old_firm, true);
|
||||
}
|
||||
return ok;
|
||||
|
@ -495,9 +495,9 @@ void TPrint_application::set_header (
|
||||
|
||||
CHECK (r >= 1, "Header rows start at 1");
|
||||
va_list vl;
|
||||
va_start (vl, fmt);
|
||||
vsprintf (tmp.get_buffer(), fmt, vl);
|
||||
va_end (vl);
|
||||
va_start(vl, fmt);
|
||||
vsprintf_s(tmp.get_buffer(), tmp.size(), fmt, vl);
|
||||
va_end(vl);
|
||||
|
||||
TPrintrow *pp = (TPrintrow *)_header.objptr(r - 1);
|
||||
if (!pp)
|
||||
@ -519,10 +519,9 @@ void TPrint_application::set_footer (
|
||||
{
|
||||
CHECK (r >= 1, "Footer rows start at 1");
|
||||
TString256 tmp;
|
||||
va_list vl;
|
||||
va_start (vl, fmt);
|
||||
vsprintf (tmp.get_buffer(), fmt, vl);
|
||||
va_end (vl);
|
||||
va_list vl; va_start(vl, fmt);
|
||||
vsprintf_s(tmp.get_buffer(), tmp.size(), fmt, vl);
|
||||
va_end(vl);
|
||||
TPrintrow *pp = (TPrintrow *) _footer.objptr (r - 1);
|
||||
if (pp == NULL)
|
||||
{
|
||||
|
@ -1073,6 +1073,9 @@ TPrintrow& TPrintrow::put(const char *str, int position, int len)
|
||||
if (len <= 0)
|
||||
len = strlen (str);
|
||||
|
||||
if (position >= _row.size())
|
||||
return *this;
|
||||
|
||||
if (position < 0)
|
||||
position = _lastpos;
|
||||
else
|
||||
|
@ -1,6 +1,7 @@
|
||||
#include "xvt.h"
|
||||
#include "xinclude.h"
|
||||
|
||||
#include <applicat.h>
|
||||
#include <colors.h>
|
||||
#include <diction.h>
|
||||
#include <progind.h>
|
||||
@ -330,25 +331,28 @@ bool TProgress_monitor::set_status(long n)
|
||||
if (_status <= 0L && n <= 0L)
|
||||
_start = clock();
|
||||
|
||||
// Se è passato un secondo allora crea la TProgind
|
||||
if (_pi == NULL && (clock() - _start) >= CLOCKS_PER_SEC)
|
||||
// Se è passato un secondo allora crea la progress dialog
|
||||
if (_pd == NULL_WIN && n > 0 && (clock() - _start) >= CLOCKS_PER_SEC)
|
||||
{
|
||||
_pi = new TProgind(_total, _txt, _cancellable);
|
||||
_pi->set_start_time(_start);
|
||||
_pd = xvt_dm_progress_create(NULL_WIN/*cur_win()*/, main_app().title(), _total, _cancellable);
|
||||
if (_txt.full())
|
||||
xvt_dm_progress_set_text(_pd, _txt);
|
||||
xvt_scr_reset_busy_cursor();
|
||||
}
|
||||
// Aggiorna la TProgind associata, sempre che esista
|
||||
_status = min(n, _total);
|
||||
return _pi == NULL || _pi->setstatus(_status);
|
||||
if (_pd != NULL_WIN && !xvt_dm_progress_set_status(_pd, _status, _total))
|
||||
_cancelled = true;
|
||||
return !_cancelled;
|
||||
}
|
||||
|
||||
void TProgress_monitor::set_text(const char* msg)
|
||||
{
|
||||
_txt = msg;
|
||||
if (_pi == NULL && _total <= 1 && (clock() - _start) >= CLOCKS_PER_SEC)
|
||||
if (_pd == NULL_WIN && _total <= 1 && (clock() - _start) >= CLOCKS_PER_SEC)
|
||||
set_status(1);
|
||||
if (_pi != NULL)
|
||||
_pi->set_text(_txt);
|
||||
if (_pd)
|
||||
xvt_dm_progress_set_text(_pd, _txt);
|
||||
}
|
||||
|
||||
void TProgress_monitor::set_max(long tot)
|
||||
@ -356,98 +360,23 @@ void TProgress_monitor::set_max(long tot)
|
||||
if (tot != _total)
|
||||
{
|
||||
_total = tot;
|
||||
if (_pi != NULL)
|
||||
_pi->setmax(tot);
|
||||
set_status(_status = 0L); // Forza aggiornamento timer e barra
|
||||
}
|
||||
}
|
||||
|
||||
bool TProgress_monitor::is_cancelled() const
|
||||
{
|
||||
return _cancellable && _pi != NULL && _pi->iscancelled();
|
||||
}
|
||||
{ return _cancelled; }
|
||||
|
||||
TProgress_monitor::TProgress_monitor(long items, const char* txt, bool cancancel)
|
||||
: _total(items), _txt(txt), _status(0), _cancellable(cancancel), _pi(NULL), _start(clock())
|
||||
: _total(items), _txt(txt), _status(0), _cancellable(cancancel),
|
||||
_pd(NULL_WIN), _start(clock()), _cancelled(false)
|
||||
{ xvt_scr_set_busy_cursor(); }
|
||||
|
||||
TProgress_monitor::~TProgress_monitor()
|
||||
{
|
||||
// Distruggi la TProgind o la clessidra, a seconda del caso
|
||||
if (_pi != NULL)
|
||||
delete _pi;
|
||||
if (_pd != NULL_WIN)
|
||||
xvt_dm_progress_destroy(_pd);
|
||||
else
|
||||
xvt_scr_reset_busy_cursor();
|
||||
}
|
||||
|
||||
///////////////////////////////////////////////////////////
|
||||
// C-style bindings
|
||||
///////////////////////////////////////////////////////////
|
||||
|
||||
// uses static pointer for single instance of TIndwin
|
||||
static TIndwin* __indwin__p = NULL;
|
||||
|
||||
void progind_create(long m, const char* t, bool b, bool c)
|
||||
{
|
||||
CHECK(__indwin__p == NULL, "Cannot have more than one progress indicator");
|
||||
__indwin__p = new TProgind(m, t, b, c);
|
||||
do_events();
|
||||
}
|
||||
|
||||
bool progind_set_status(long l)
|
||||
{
|
||||
return ((TProgind*)__indwin__p)->setstatus(l);
|
||||
}
|
||||
|
||||
void progind_cancel()
|
||||
{
|
||||
__indwin__p->cancel();
|
||||
}
|
||||
|
||||
bool progind_iscancelled()
|
||||
{
|
||||
return __indwin__p->iscancelled();
|
||||
}
|
||||
|
||||
bool progind_isfinished()
|
||||
{
|
||||
return __indwin__p->isfinished();
|
||||
}
|
||||
|
||||
void progind_destroy()
|
||||
{
|
||||
CHECK(__indwin__p != NULL, "No progress indicator to delete");
|
||||
delete __indwin__p;
|
||||
__indwin__p = NULL;
|
||||
}
|
||||
|
||||
/*
|
||||
void timerind_create(long l, const char* title, bool bar, bool cancel,
|
||||
int interval)
|
||||
{
|
||||
CHECK(__indwin__p == NULL, "Cannot have more than one progress indicator");
|
||||
__indwin__p = new TTimerind(l,title,bar,cancel,60,interval);
|
||||
}
|
||||
|
||||
void timerind_cancel()
|
||||
{
|
||||
__indwin__p->cancel();
|
||||
}
|
||||
|
||||
bool timerind_iscancelled()
|
||||
{
|
||||
return __indwin__p->iscancelled();
|
||||
}
|
||||
|
||||
bool timerind_isfinished()
|
||||
{
|
||||
return __indwin__p->isfinished();
|
||||
}
|
||||
|
||||
void timerind_destroy()
|
||||
{
|
||||
delete __indwin__p;
|
||||
__indwin__p = NULL;
|
||||
}
|
||||
|
||||
*/
|
||||
|
@ -164,16 +164,17 @@ public:
|
||||
class TProgress_monitor : public TObject
|
||||
{
|
||||
long _total, _status;
|
||||
TString _txt;
|
||||
bool _cancellable;
|
||||
TProgind* _pi;
|
||||
clock_t _start;
|
||||
TString _txt;
|
||||
bool _cancellable, _cancelled;
|
||||
WINDOW _pd;
|
||||
|
||||
public:
|
||||
virtual bool set_status(long n);
|
||||
void set_max(long tot);
|
||||
bool add_status(long i = 1) { return set_status(_status+i); }
|
||||
void set_text(const char* msg);
|
||||
clock_t start_clock() const { return _start; }
|
||||
|
||||
// deprecated TProgind compatibility methods
|
||||
bool setstatus(long n) { return set_status(n); }
|
||||
@ -187,26 +188,4 @@ public:
|
||||
|
||||
#endif
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
// Non commentate perche' destinate a sparire
|
||||
void progind_create(long, const char*, bool, bool);
|
||||
bool progind_set_status(long s);
|
||||
void progind_cancel();
|
||||
bool progind_iscancelled();
|
||||
bool progind_isfinished();
|
||||
void progind_destroy();
|
||||
|
||||
/* NEVER used stuff!
|
||||
void timerind_create(long, const char*, bool, bool, int);
|
||||
void timerind_cancel();
|
||||
bool timerind_iscancelled();
|
||||
bool timerind_isfinished();
|
||||
void timerind_destroy();
|
||||
*/
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif /* __PROGIND_H */
|
||||
|
@ -47,11 +47,6 @@
|
||||
#define RDOC_MOVMAG "MOVMAG"
|
||||
#define RDOC_CODMAGC "CODMAGC"
|
||||
#define RDOC_DATACONS "DATACONS"
|
||||
#define RDOC_QTAGG1 "QTAGG1"
|
||||
#define RDOC_QTAGG2 "QTAGG2"
|
||||
#define RDOC_QTAGG3 "QTAGG3"
|
||||
#define RDOC_QTAGG4 "QTAGG4"
|
||||
#define RDOC_QTAGG5 "QTAGG5"
|
||||
#define RDOC_IMPIANTO "IMPIANTO"
|
||||
#define RDOC_LINEA "LINEA"
|
||||
#define RDOC_IDRIGA "IDRIGA"
|
||||
|
@ -1515,7 +1515,7 @@ const char* real::string(const char *picture) const
|
||||
return string ();
|
||||
if (*picture == '.')
|
||||
return points (atoi (picture + 1));
|
||||
if (xvt_str_compare_ignoring_case(picture, "LETTERE") == 0)
|
||||
if (xvt_str_same(picture, "LETTERE"))
|
||||
return literals ();
|
||||
|
||||
TString v (string());
|
||||
|
@ -2509,22 +2509,22 @@ bool TReport::get_report_field(const TString& name, TVariant& var) const
|
||||
return true;
|
||||
}
|
||||
|
||||
if (xvt_str_compare_ignoring_case(str, "PAGE") == 0)
|
||||
if (xvt_str_same(str, "PAGE"))
|
||||
{
|
||||
var = long(_rep_page);
|
||||
return true;
|
||||
} else
|
||||
if (xvt_str_compare_ignoring_case(str, "BOOKPAGE") == 0)
|
||||
if (xvt_str_same(str, "BOOKPAGE"))
|
||||
{
|
||||
var = long(_book_page);
|
||||
return true;
|
||||
}
|
||||
if (xvt_str_compare_ignoring_case(str, "COPY") == 0)
|
||||
if (xvt_str_same(str, "COPY"))
|
||||
{
|
||||
var = long(_rep_copy);
|
||||
return true;
|
||||
} else
|
||||
if (xvt_str_compare_ignoring_case(str, "COPIES") == 0)
|
||||
if (xvt_str_same(str, "COPIES"))
|
||||
{
|
||||
var = long(_rep_copies);
|
||||
return true;
|
||||
|
@ -9,7 +9,7 @@
|
||||
// Private interface
|
||||
///////////////////////////////////////////////////////////
|
||||
|
||||
#include "../sqlite/sqlite3.h"
|
||||
#include "../../sqlite3/include/sqlite3.h"
|
||||
|
||||
class TSQLite : public TObject
|
||||
{
|
||||
@ -419,16 +419,16 @@ int TSQL_recordset::on_get_items(int argc, char** values, char** columns)
|
||||
const char* fldtype = columns[argc+i];
|
||||
if (fldtype != NULL)
|
||||
{
|
||||
if (xvt_str_compare_ignoring_case(fldtype, "DATE") == 0)
|
||||
if (xvt_str_same(fldtype, "DATE"))
|
||||
{
|
||||
info->_type = _datefld;
|
||||
info->_width = 10;
|
||||
} else
|
||||
if (xvt_str_compare_ignoring_case(fldtype, "NUMERIC") == 0)
|
||||
if (xvt_str_same(fldtype, "NUMERIC"))
|
||||
{
|
||||
info->_type = _realfld;
|
||||
} else
|
||||
if (xvt_str_compare_ignoring_case(fldtype, "BLOB") == 0)
|
||||
if (xvt_str_same(fldtype, "BLOB"))
|
||||
{
|
||||
info->_type = _memofld;
|
||||
info->_width = 50;
|
||||
|
@ -856,16 +856,10 @@ TString& TString::format(
|
||||
// @comm Funziona come la funzione "sprintf" standard del C e ritorna la
|
||||
// stringa formattata con i parametri passati.
|
||||
{
|
||||
char spark[512];
|
||||
memset(spark, 0, sizeof(spark));
|
||||
char spark[512] = { 0 };
|
||||
va_list pars;
|
||||
va_start(pars, fmt);
|
||||
|
||||
#ifdef WIN32
|
||||
const unsigned int tot = _vsnprintf(spark, sizeof(spark)-1, fmt, pars);
|
||||
#else
|
||||
const unsigned int tot = vsprintf(spark, fmt, pars);
|
||||
#endif
|
||||
va_end(pars);
|
||||
|
||||
CHECK(tot < sizeof(spark), "Ue'! Quanto scrivi?");
|
||||
@ -1051,11 +1045,7 @@ TString& TFixed_string::format(
|
||||
{
|
||||
va_list pars;
|
||||
va_start(pars, fmt);
|
||||
#ifdef WIN32
|
||||
const int tot = _vsnprintf(_str, size()+1, fmt, pars);
|
||||
#else
|
||||
const int tot = vsprintf(_str, fmt, pars);
|
||||
#endif
|
||||
va_end(pars);
|
||||
CHECK(tot >= 0 && tot <= size(), "Ue'! Quanto scrivi con 'sta format?");
|
||||
return *this;
|
||||
|
@ -61,7 +61,7 @@ TString& TTable_application::get_mask_name(TString& t) const
|
||||
{
|
||||
CHECK(_rel, "Can't use a NULL relation to retrieve table module");
|
||||
|
||||
TString8 m = _tabname;
|
||||
TString16 m = _tabname; // Lasciare TString16 per tabelle di cmodulo con codice cliente!
|
||||
if (m[0] == '%' || m[0] == '$')
|
||||
m.ltrim(1); else
|
||||
if (m[0] == '&')
|
||||
|
@ -1662,3 +1662,51 @@ TField_window* TTreelist_field::create_window(int x, int y, int dx, int dy, WIND
|
||||
|
||||
TTreelist_field::TTreelist_field(TMask* m) : TTree_field(m)
|
||||
{ _items.destroy(); }
|
||||
|
||||
///////////////////////////////////////////////////////////
|
||||
// THTML_field
|
||||
///////////////////////////////////////////////////////////
|
||||
|
||||
class THTML_window : public TField_window
|
||||
{
|
||||
public:
|
||||
THTML_window(int x, int y, int dx, int dy, WINDOW parent, THTML_field* owner);
|
||||
};
|
||||
|
||||
THTML_window::THTML_window(int x, int y, int dx, int dy, WINDOW parent, THTML_field* owner)
|
||||
: TField_window(0, 0, 0, 0, NULL, NULL)
|
||||
{
|
||||
XVT_COLOR_COMPONENT xcc[8]; memset(xcc, 0, sizeof(xcc));
|
||||
xcc[0].type = XVT_COLOR_BACKGROUND; xcc[0].color = NORMAL_BACK_COLOR;
|
||||
xcc[1].type = XVT_COLOR_FOREGROUND; xcc[1].color = NORMAL_COLOR;
|
||||
xcc[2].type = XVT_COLOR_HIGHLIGHT; xcc[2].color = FOCUS_BACK_COLOR;
|
||||
xcc[3].type = XVT_COLOR_SELECT; xcc[3].color = FOCUS_COLOR;
|
||||
xcc[4].type = XVT_COLOR_BLEND; xcc[4].color = MASK_BACK_COLOR;
|
||||
xcc[5].type = XVT_COLOR_TROUGH; xcc[5].color = DISABLED_BACK_COLOR;
|
||||
xcc[6].type = XVT_COLOR_CAPTIONTEXT; xcc[6].color = PROMPT_COLOR;
|
||||
|
||||
set_owner(owner);
|
||||
WIN_DEF wd; memset(&wd, 0, sizeof(wd));
|
||||
wd.rct = resize_rect(x, y, dx, dy, wd.wtype, parent);
|
||||
wd.wtype = WC_HTML;
|
||||
wd.ctlcolors = xcc;
|
||||
wd.v.ctl.ctrl_id = owner->dlg();
|
||||
|
||||
set_win(xvt_ctl_create_def(&wd, parent, 0L));
|
||||
}
|
||||
|
||||
word THTML_field::class_id() const
|
||||
{ return CLASS_TREELIST_FIELD; }
|
||||
|
||||
bool THTML_field::is_kind_of(word cid) const
|
||||
{ return cid == CLASS_TREELIST_FIELD || TWindowed_field::is_kind_of(cid); }
|
||||
|
||||
TField_window* THTML_field::create_window(int x, int y, int dx, int dy, WINDOW parent)
|
||||
{ return new THTML_window(x, y, dx, dy, parent, this); }
|
||||
|
||||
void THTML_field::set_window_data(const char* url)
|
||||
{ xvt_html_set_url(win().win(), url); }
|
||||
|
||||
THTML_field::THTML_field(TMask* m)
|
||||
: TWindowed_field(m)
|
||||
{ }
|
||||
|
@ -183,5 +183,20 @@ public:
|
||||
virtual ~TTreelist_field() { }
|
||||
};
|
||||
|
||||
class THTML_field : public TWindowed_field
|
||||
{
|
||||
protected: // TObject
|
||||
virtual word class_id() const;
|
||||
virtual bool is_kind_of(word cid) const;
|
||||
|
||||
protected: // TWindowed_field
|
||||
virtual TField_window* create_window(int x, int y, int dx, int dy, WINDOW parent);
|
||||
virtual void set_window_data(const char* data);
|
||||
|
||||
public:
|
||||
THTML_field(TMask* m);
|
||||
virtual ~THTML_field() { }
|
||||
};
|
||||
|
||||
#endif
|
||||
|
||||
|
@ -99,7 +99,7 @@ bool fcopy(
|
||||
const char* wflag = append ? "ab" : "wb";
|
||||
|
||||
// Copia il file su se stesso?
|
||||
if (xvt_str_compare_ignoring_case(orig, dest) == 0)
|
||||
if (xvt_str_same(orig, dest))
|
||||
return true; // Or FALSE?
|
||||
|
||||
FILE* i = fopen(orig, rflag);
|
||||
@ -107,7 +107,7 @@ bool fcopy(
|
||||
return error_box(FR("Impossibile leggere il file %s\nda copiare in %s"), orig, dest);
|
||||
|
||||
if (!append)
|
||||
::remove_file(dest);
|
||||
xvt_fsys_remove_file(dest);
|
||||
FILE* o = fopen(dest, wflag);
|
||||
if (o == NULL)
|
||||
{
|
||||
@ -207,13 +207,14 @@ int remove_files(const char* path, bool subdirs) // @parm maschera files da canc
|
||||
{
|
||||
dir.insert(TR("Cancellazione cartella ")); // ... do it manually
|
||||
TProgress_monitor bar(count, dir);
|
||||
for (SLIST_ELT e = xvt_slist_get_first(files); e && bar.add_status(); e = xvt_slist_get_next(files, e))
|
||||
for (SLIST_ELT e = xvt_slist_get_first(files); e; e = xvt_slist_get_next(files, e))
|
||||
{
|
||||
const char* n = xvt_slist_get(files, e, NULL);
|
||||
if (dexist(n))
|
||||
xvt_fsys_rmdir(n);
|
||||
else
|
||||
xvt_fsys_remove_file(n);
|
||||
bar.add_status();
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -605,9 +606,9 @@ long daytime()
|
||||
// DON'T cache this bool because hostname can be local or server
|
||||
static bool is_sirio_station(const char* hostname)
|
||||
{
|
||||
const char* const ranger[] = { "NBKCORRADIW81", "KIRK", "KLINGON", "MOBILE", "PCTRUFFELLI", "SPOCK", NULL };
|
||||
const char* const ranger[] = { "NBKCORRADIW81", "KLINGON", "MOBILE", "PCTRUFFELLI", "SPOCK", NULL };
|
||||
for (int i = 0; ranger[i]; i++)
|
||||
if (xvt_str_compare_ignoring_case(hostname, ranger[i]) == 0)
|
||||
if (xvt_str_same(hostname, ranger[i]))
|
||||
return true;
|
||||
return false;
|
||||
}
|
||||
@ -618,11 +619,10 @@ bool is_power_station()
|
||||
if (ps < 0)
|
||||
{
|
||||
const TDongle& d = dongle();
|
||||
if ((d.local() && (d.number() == 0 || d.number()==1045)) ||
|
||||
(d.network() && is_sirio_station(d.server_name())))
|
||||
if (d.local())
|
||||
ps = is_sirio_station(get_hostname());
|
||||
else
|
||||
ps = FALSE;
|
||||
ps = is_sirio_station(d.server_name());
|
||||
}
|
||||
return ps != 0;
|
||||
}
|
||||
|
@ -601,12 +601,10 @@ HIDDEN WINDOW _statbar = NULL_WIN;
|
||||
WINDOW xvtil_create_statbar()
|
||||
// @xref <f xvt_statbar_set> <f xvt_statbar_refresh>
|
||||
{
|
||||
CHECK(_statbar == NULL_WIN, "Onli uan statbar, plis");
|
||||
|
||||
if (TASK_WIN != NULL_WIN) // Puo' succedere in chiusura menu
|
||||
{
|
||||
const int prop_count = 4;
|
||||
char* prop_list[prop_count+1] =
|
||||
const int p_count = 4;
|
||||
char* p_list[p_count+1] =
|
||||
{
|
||||
"Status bar",
|
||||
"HEIGHT=24",
|
||||
@ -615,9 +613,7 @@ WINDOW xvtil_create_statbar()
|
||||
NULL
|
||||
};
|
||||
|
||||
_statbar = statbar_create(0, 0, 600, 1024, 800, prop_count, prop_list,
|
||||
TASK_WIN, 0, 0, "");
|
||||
CHECK(_statbar, "Can't create the status bar");
|
||||
_statbar = statbar_create(0, 0, 600, 1024, 800, p_count, p_list, TASK_WIN, 0, 0, "");
|
||||
statbar_set_fontid(_statbar, xvtil_default_font());
|
||||
}
|
||||
return _statbar;
|
||||
@ -772,13 +768,6 @@ COLOR trans_color(
|
||||
return col;
|
||||
}
|
||||
|
||||
void begin_wait()
|
||||
{ xvt_scr_set_busy_cursor(); }
|
||||
|
||||
void end_wait()
|
||||
{ xvt_scr_reset_busy_cursor(); }
|
||||
|
||||
|
||||
// @doc INTERNAL
|
||||
|
||||
// @func Permette di converitire lo stile del pattern in attributi grafici da
|
||||
|
@ -59,15 +59,12 @@ void dispatch_e_menu(WINDOW win, MENU_TAG item);
|
||||
void dispatch_e_char(WINDOW win, KEY key);
|
||||
void dispatch_e_scroll(WINDOW win, KEY key);
|
||||
|
||||
void begin_wait();
|
||||
void end_wait();
|
||||
|
||||
// One-liner for waiting!
|
||||
class TWait_cursor
|
||||
{
|
||||
public:
|
||||
TWait_cursor() { ::begin_wait(); }
|
||||
~TWait_cursor() { ::end_wait(); }
|
||||
TWait_cursor() { xvt_scr_set_busy_cursor(); }
|
||||
~TWait_cursor() { xvt_scr_reset_busy_cursor(); }
|
||||
};
|
||||
|
||||
void xvtil_set_font(WINDOW win, const char* family, int style, int dim = 0);
|
||||
|
Loading…
x
Reference in New Issue
Block a user