Patch level : 10.0
Files correlati : ba0 ba8 Ricompilazione Demo : [ ] Commento : Aggiunto supporto per campi booleani nei report Supporto per assenza di chiavetta=DEMO git-svn-id: svn://10.65.10.50/trunk@19531 c028cbd2-c16b-5b4b-a496-9718f37d4682
This commit is contained in:
parent
6088806da9
commit
145d520370
@ -403,7 +403,6 @@ class TAVM
|
||||
TVariant_stack _stack, _rstack;
|
||||
const TBytecode* _bc; // Current word (or command line)
|
||||
int _ip; // Current instruction pointer
|
||||
ostream* _outstr;
|
||||
|
||||
TAssoc_array _words;
|
||||
TAssoc_array _vars;
|
||||
@ -426,7 +425,7 @@ public:
|
||||
const TString& get_last_error() const { return _last_error; }
|
||||
|
||||
bool compile(istream& instr, TBytecode& bc);
|
||||
bool execute(const TBytecode& bc, ostream* outstr);
|
||||
bool execute(const TBytecode& bc);
|
||||
void do_restart(bool cold);
|
||||
bool do_include(const char* fname);
|
||||
void do_fetch(const TString& name);
|
||||
@ -733,7 +732,7 @@ bool TAVM::do_include(const char* fname)
|
||||
ifstream inf(name);
|
||||
ok = compile(inf, bc);
|
||||
if (ok)
|
||||
execute(bc, NULL);
|
||||
execute(bc);
|
||||
}
|
||||
return ok;
|
||||
}
|
||||
@ -854,10 +853,9 @@ void TAVM::execute(const TAVM_op& op)
|
||||
break;
|
||||
case avm_dot:
|
||||
{
|
||||
const TString& msg = _stack.pop().as_string();
|
||||
if (_outstr != NULL)
|
||||
*_outstr << msg;
|
||||
// else xvtil_popup_message(msg); // More annoying than useful :-)
|
||||
const TVariant& var = _stack.pop();
|
||||
if (!_vm->execute_dot(var)) // Demando la ridirezione dell'output
|
||||
xvtil_popup_message(var.as_string()); // More annoying than useful :-)
|
||||
}
|
||||
break;
|
||||
case avm_drop:
|
||||
@ -1040,7 +1038,7 @@ void TAVM::execute(const TAVM_op& op)
|
||||
}
|
||||
}
|
||||
|
||||
bool TAVM::execute(const TBytecode& cmdline, ostream* outstr)
|
||||
bool TAVM::execute(const TBytecode& cmdline)
|
||||
{
|
||||
const TBytecode* old_bc = _bc;
|
||||
const int old_ip = _ip;
|
||||
@ -1050,7 +1048,6 @@ bool TAVM::execute(const TBytecode& cmdline, ostream* outstr)
|
||||
_rstack.reset();
|
||||
_bc = &cmdline;
|
||||
_ip = 0;
|
||||
_outstr = outstr;
|
||||
|
||||
while (_bc != NULL)
|
||||
{
|
||||
@ -1123,7 +1120,6 @@ bool TAVM::execute(const TBytecode& cmdline, ostream* outstr)
|
||||
//const bool ok = _bc != NULL; // Not aborted
|
||||
_bc = old_bc;
|
||||
_ip = old_ip;
|
||||
_outstr = NULL;
|
||||
|
||||
return !aborted;
|
||||
}
|
||||
@ -1142,7 +1138,7 @@ void TAVM::do_restart(bool cold)
|
||||
}
|
||||
|
||||
TAVM::TAVM(TAlex_virtual_machine* vm)
|
||||
: _vm(vm), _interactive(false), _outstr(NULL)
|
||||
: _vm(vm), _interactive(false)
|
||||
{
|
||||
do_restart(true);
|
||||
}
|
||||
@ -1180,9 +1176,9 @@ bool TAlex_virtual_machine::compile(istream& instr, TBytecode& bc)
|
||||
return avm().compile(instr, bc);
|
||||
}
|
||||
|
||||
bool TAlex_virtual_machine::execute(const TBytecode& bc, ostream* out)
|
||||
bool TAlex_virtual_machine::execute(const TBytecode& bc)
|
||||
{
|
||||
return avm().execute(bc, out);
|
||||
return avm().execute(bc);
|
||||
}
|
||||
|
||||
bool TAlex_virtual_machine::compile(const char* cmd, TBytecode& bc)
|
||||
@ -1304,6 +1300,11 @@ bool TAlex_virtual_machine::defined(const char* name)
|
||||
return avm().defined(name);
|
||||
}
|
||||
|
||||
bool TAlex_virtual_machine::execute_dot(const TVariant& var)
|
||||
{
|
||||
return false; // Do nothing
|
||||
}
|
||||
|
||||
TAlex_virtual_machine::TAlex_virtual_machine() : _avm(NULL)
|
||||
{
|
||||
}
|
||||
|
@ -32,6 +32,7 @@ protected:
|
||||
|
||||
public:
|
||||
virtual size_t get_usr_words(TString_array& names) const;
|
||||
virtual bool execute_dot(const TVariant& var);
|
||||
virtual bool execute_usr_word(unsigned int opcode, TVariant_stack& stack);
|
||||
virtual bool get_usr_val(const TString& name, TVariant& var) const;
|
||||
virtual bool set_usr_val(const TString& name, const TVariant& var);
|
||||
@ -42,7 +43,7 @@ public:
|
||||
|
||||
bool compile(istream& instr, TBytecode& bc);
|
||||
bool compile(const char* cmd, TBytecode& bc);
|
||||
bool execute(const TBytecode& bc, ostream* out = NULL);
|
||||
bool execute(const TBytecode& bc);
|
||||
bool include(const char* fname);
|
||||
|
||||
void warm_restart();
|
||||
|
@ -93,7 +93,7 @@ long TApplication::task_eh(WINDOW win, EVENT *ep)
|
||||
case E_CREATE:
|
||||
if (_application->pre_create())
|
||||
{
|
||||
#ifdef _DEMO_
|
||||
if (dongle().demo())
|
||||
{
|
||||
const TString16 dname(encode("DATA"));
|
||||
const TString16 hname(encode("ORA"));
|
||||
@ -118,7 +118,6 @@ long TApplication::task_eh(WINDOW win, EVENT *ep)
|
||||
else
|
||||
exit(0);
|
||||
}
|
||||
#endif
|
||||
|
||||
// Setta il vero menu principale se diverso dal default
|
||||
const int meno = _application->argc() > 1 ? atoi(_application->argv(1)+1) : 0;
|
||||
@ -227,6 +226,7 @@ long TApplication::handler(WINDOW win, EVENT* ep)
|
||||
{
|
||||
// I comandi della clipboard vanno ridiretti alla finestra col focus
|
||||
WINDOW w = xvt_scr_get_focus_vobj();
|
||||
if (w == NULL_WIN) w = cur_win();
|
||||
if (w != NULL_WIN && w != win) // Evito ciclo infinito
|
||||
{
|
||||
dispatch_event(w, *ep, true);
|
||||
@ -278,7 +278,7 @@ void TApplication::stop_run()
|
||||
{
|
||||
if (_savefirm)
|
||||
prefix().set_codditta(_savefirm);
|
||||
#ifdef _DEMO_
|
||||
if (dongle().demo())
|
||||
{
|
||||
const TString16 hname(encode("ORA"));
|
||||
TConfig c(CONFIG_INSTALL, "Main");
|
||||
@ -296,7 +296,6 @@ void TApplication::stop_run()
|
||||
else
|
||||
message_box(TR("Questo e' un programma dimostrativo.\nOggi rimangono %s minuti di utilizzo."), remaining_time.string(3, 0));
|
||||
}
|
||||
#endif
|
||||
terminate();
|
||||
|
||||
xvt_app_destroy();
|
||||
@ -467,11 +466,9 @@ void TApplication::check_parameters(
|
||||
|
||||
bool TApplication::test_assistance_year() const
|
||||
{
|
||||
bool ok = true;
|
||||
#ifndef _DEMO_
|
||||
const int dongle_year = dongle().year_assist();
|
||||
int app_year, dum1, dum2, dum3;
|
||||
ok = TApplication::get_version_info(app_year, dum1, dum2, dum3);
|
||||
bool ok = TApplication::get_version_info(app_year, dum1, dum2, dum3);
|
||||
if (ok)
|
||||
{
|
||||
ok = app_year <= dongle_year;
|
||||
@ -481,7 +478,6 @@ bool TApplication::test_assistance_year() const
|
||||
ok = TDate(TODAY).year() <= solar_year+2;
|
||||
}
|
||||
}
|
||||
#endif // _DEMO_
|
||||
return ok;
|
||||
}
|
||||
|
||||
@ -515,11 +511,6 @@ void TApplication::run(
|
||||
else
|
||||
_name = cmd2name(argv[0]);
|
||||
|
||||
if (use_files())
|
||||
init_global_vars();
|
||||
else
|
||||
CGetPref();
|
||||
|
||||
const int sn = get_serial_number();
|
||||
if (sn > 0 && !test_assistance_year())
|
||||
{
|
||||
@ -527,6 +518,11 @@ void TApplication::run(
|
||||
return;
|
||||
}
|
||||
|
||||
if (use_files())
|
||||
init_global_vars();
|
||||
else
|
||||
CGetPref();
|
||||
|
||||
set_perms();
|
||||
|
||||
const char* mod = get_module_name();
|
||||
@ -608,14 +604,10 @@ void TApplication::enable_menu_item(
|
||||
|
||||
bool TApplication::has_module(int module, int checktype) const
|
||||
{
|
||||
#ifdef _DEMO_
|
||||
const bool ok = true;
|
||||
#else
|
||||
bool ok = dongle().active(module);
|
||||
// Testa bit di attivazione dell'utente
|
||||
if (ok && checktype != CHK_DONGLE)
|
||||
ok = _user_aut[module];
|
||||
#endif
|
||||
return ok;
|
||||
}
|
||||
|
||||
@ -634,8 +626,7 @@ bool TApplication::set_firm(long newfirm)
|
||||
const long oldfirm = get_firm();
|
||||
const bool interactive = newfirm <= 0;
|
||||
|
||||
#ifndef _DEMO_
|
||||
if (interactive)
|
||||
if (interactive && firm_change_enabled())
|
||||
{
|
||||
TMask mask("bagn002");
|
||||
TFilename pp(__ptprf); pp.cut(pp.len()-1);
|
||||
@ -663,7 +654,6 @@ bool TApplication::set_firm(long newfirm)
|
||||
}
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
if (interactive)
|
||||
{
|
||||
@ -707,11 +697,7 @@ bool TApplication::firm_change_enabled() const
|
||||
|
||||
// @comm Praticamente controlla se e' stato lanciato da ba0 o dal program manager
|
||||
{
|
||||
#ifdef _DEMO_
|
||||
return false;
|
||||
#else
|
||||
return true;
|
||||
#endif
|
||||
return !dongle().demo();
|
||||
}
|
||||
|
||||
void TApplication::on_firm_change()
|
||||
|
@ -13,9 +13,9 @@ COLOR RGB2COLOR(unsigned char red, unsigned char green, unsigned char blue)
|
||||
|
||||
COLOR choose_color(COLOR col, WINDOW win)
|
||||
{
|
||||
COLOR def = xvt_dm_post_choose_color(win, col);
|
||||
if (def == 0) def = COLOR_BLACK; // Per non confonderlo col colore 0, default per XI
|
||||
return def;
|
||||
xvt_dm_post_color_sel(&col, win);
|
||||
if (col == 0) col = COLOR_BLACK; // Per non confonderlo col colore 0, default per XI
|
||||
return col;
|
||||
}
|
||||
|
||||
COLOR blend_colors(COLOR col1, COLOR col2, double perc)
|
||||
@ -26,10 +26,10 @@ COLOR blend_colors(COLOR col1, COLOR col2, double perc)
|
||||
const unsigned int r2 = XVT_COLOR_GET_RED(col2);
|
||||
const unsigned int g2 = XVT_COLOR_GET_GREEN(col2);
|
||||
const unsigned int b2 = XVT_COLOR_GET_BLUE(col2);
|
||||
|
||||
const byte r = byte(r1 * perc + r2*(1.0-perc));
|
||||
const byte g = byte(g1 * perc + g2*(1.0-perc));
|
||||
const byte b = byte(b1 * perc + b2*(1.0-perc));
|
||||
const double inv_perc = 1.0 - perc;
|
||||
const byte r = byte(r1 * perc + r2*(inv_perc));
|
||||
const byte g = byte(g1 * perc + g2*(inv_perc));
|
||||
const byte b = byte(b1 * perc + b2*(inv_perc));
|
||||
return RGB2COLOR(r, g, b);
|
||||
}
|
||||
|
||||
|
@ -384,6 +384,13 @@ void customize_colors()
|
||||
xi_set_pref(XI_PREF_COLOR_DARK, MASK_DARK_COLOR);
|
||||
xi_set_pref(XI_PREF_COLOR_DISABLED, DISABLED_COLOR);
|
||||
|
||||
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_COLOR;
|
||||
xcc[3].type = XVT_COLOR_SELECT; xcc[3].color = FOCUS_BACK_COLOR;
|
||||
xvt_vobj_set_attr(TASK_WIN, ATTR_APP_CTL_COLORS, (long)xcc);
|
||||
|
||||
BTN_BACK_COLOR = colors.get_color("ButtonBack", NULL, -1, BTN_BACK_COLOR);
|
||||
aga_set_pref(AGA_PREF_BTN_COLOR_CTRL, BTN_BACK_COLOR);
|
||||
|
||||
@ -486,13 +493,8 @@ void free_controls()
|
||||
|
||||
bool has_virtual_keyboard()
|
||||
{
|
||||
static int maybe = -1;
|
||||
if (maybe < 0)
|
||||
{
|
||||
TConfig ini(CONFIG_INSTALL, "Main");
|
||||
maybe = ini.get_bool("VirtualKeyboard") ? 1 : 0;
|
||||
}
|
||||
return maybe != 0;
|
||||
static bool hvk = ini_get_bool(CONFIG_INSTALL, "Main", "VirtualKeyboard");
|
||||
return hvk;
|
||||
}
|
||||
|
||||
///////////////////////////////////////////////////////////
|
||||
|
@ -14,8 +14,6 @@
|
||||
// Dongle stuff
|
||||
///////////////////////////////////////////////////////////
|
||||
|
||||
#ifndef _DEMO_
|
||||
|
||||
#define USERADR 26952
|
||||
#define AGAADR 26953
|
||||
#define REFKEY (unsigned char*)"CAMPOKEY"
|
||||
@ -85,8 +83,6 @@ bool TEutronFooter::valid()
|
||||
return _checksum == checksum(false);
|
||||
}
|
||||
|
||||
#endif // _DEMO_
|
||||
|
||||
///////////////////////////////////////////////////////////
|
||||
// Current dongle
|
||||
///////////////////////////////////////////////////////////
|
||||
@ -167,7 +163,6 @@ const TString& TDongle::administrator(TString* pwd) const
|
||||
// non trasformare in array: pena di morte!
|
||||
void TDongle::garble(word* data) const
|
||||
{
|
||||
#ifndef _DEMO_
|
||||
switch (_hardware)
|
||||
{
|
||||
case _dongle_hardlock:
|
||||
@ -179,12 +174,10 @@ void TDongle::garble(word* data) const
|
||||
default:
|
||||
break;
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
bool TDongle::already_programmed() const
|
||||
{
|
||||
#ifndef _DEMO_
|
||||
if (_hardware == _dongle_hardlock)
|
||||
{
|
||||
word data[4];
|
||||
@ -216,12 +209,9 @@ bool TDongle::already_programmed() const
|
||||
if (eh->_checksum != cs)
|
||||
return false; // Malicious programming!
|
||||
}
|
||||
#endif // _DEMO_
|
||||
return true;
|
||||
}
|
||||
|
||||
#ifndef _DEMO_
|
||||
|
||||
void TDongle::set_developer_permissions()
|
||||
{
|
||||
if (_serno == 0 && is_power_station())
|
||||
@ -463,8 +453,6 @@ bool TDongle::network_login(bool test_all_keys)
|
||||
return ok;
|
||||
}
|
||||
|
||||
#endif // _DEMO_
|
||||
|
||||
int TDongle::can_try_server() const
|
||||
{
|
||||
if (xvt_sys_dongle_server_is_running())
|
||||
@ -477,17 +465,6 @@ bool TDongle::login(bool test_all_keys)
|
||||
{
|
||||
bool ok = true;
|
||||
|
||||
#ifdef _DEMO_
|
||||
_hardware = _dongle_unknown;
|
||||
_type = _user_dongle;
|
||||
_serno = 0;
|
||||
_max_users = 1;
|
||||
_last_update = TDate(TODAY);
|
||||
_year_assist = _last_update.year();
|
||||
_module.set(ENDAUT); // Last module on key
|
||||
_module.set(); // Activate all modules
|
||||
_shown.reset();
|
||||
#else
|
||||
if (_type != _no_dongle) // Already logged in
|
||||
logout();
|
||||
|
||||
@ -495,14 +472,9 @@ bool TDongle::login(bool test_all_keys)
|
||||
if (hw == _dongle_unknown)
|
||||
{
|
||||
if (can_try_server())
|
||||
{
|
||||
hw = _dongle_network;
|
||||
}
|
||||
else
|
||||
{
|
||||
TConfig ini(CONFIG_INSTALL, "Main");
|
||||
hw = (TDongleHardware)ini.get_int("Donglehw");
|
||||
}
|
||||
hw = (TDongleHardware)ini_get_int(CONFIG_INSTALL, "Main", "Donglehw");
|
||||
}
|
||||
switch(hw)
|
||||
{
|
||||
@ -532,36 +504,40 @@ bool TDongle::login(bool test_all_keys)
|
||||
}
|
||||
|
||||
if (ok)
|
||||
{
|
||||
TConfig ini(CONFIG_INSTALL, "Main");
|
||||
ini.set("Donglehw",(int)_hardware);
|
||||
ini_set_int(CONFIG_INSTALL, "Main", "Donglehw", (int)_hardware);
|
||||
else
|
||||
{ // DEMO
|
||||
_hardware = _dongle_unknown;
|
||||
_type = _no_dongle;
|
||||
_serno = 0;
|
||||
_max_users = 1;
|
||||
_last_update = TDate(TODAY);
|
||||
_year_assist = _last_update.year();
|
||||
_module.set(ENDAUT); // Last module on key
|
||||
_module.set(); // Activate all modules
|
||||
_shown.reset();
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
return ok;
|
||||
}
|
||||
|
||||
bool TDongle::logout()
|
||||
{
|
||||
#ifndef _DEMO_
|
||||
if (_type != _no_dongle)
|
||||
switch (_hardware)
|
||||
{
|
||||
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;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
}
|
||||
#endif
|
||||
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;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
|
||||
_type = _no_dongle;
|
||||
_serno = 0xFFFF;
|
||||
@ -575,7 +551,6 @@ bool TDongle::logout()
|
||||
bool TDongle::read_words(word reg, word len, word* ud) const
|
||||
{
|
||||
bool ok = false;
|
||||
#ifndef _DEMO_
|
||||
switch (_hardware)
|
||||
{
|
||||
case _dongle_hardlock:
|
||||
@ -603,7 +578,6 @@ bool TDongle::read_words(word reg, word len, word* ud) const
|
||||
default:
|
||||
break;
|
||||
}
|
||||
#endif // _DEMO_
|
||||
return ok;
|
||||
}
|
||||
|
||||
@ -613,7 +587,6 @@ bool TDongle::read_words(word reg, word len, word* ud) const
|
||||
bool TDongle::write_words(word reg, word len, word* data) const
|
||||
{
|
||||
bool ok = false;
|
||||
#ifndef _DEMO_
|
||||
switch(_hardware)
|
||||
{
|
||||
case _dongle_hardlock:
|
||||
@ -640,7 +613,6 @@ bool TDongle::write_words(word reg, word len, word* data) const
|
||||
default:
|
||||
break;
|
||||
}
|
||||
#endif // _DEMO_
|
||||
return ok;
|
||||
}
|
||||
|
||||
@ -757,8 +729,6 @@ bool TDongle::activate(word module, bool on)
|
||||
return ok;
|
||||
}
|
||||
|
||||
#ifndef _DEMO_
|
||||
|
||||
bool TDongle::burn_hardlock()
|
||||
{
|
||||
word data[4];
|
||||
@ -863,13 +833,11 @@ bool TDongle::burn_eutron()
|
||||
|
||||
return ok;
|
||||
}
|
||||
#endif // _DEMO_
|
||||
|
||||
bool TDongle::burn()
|
||||
{
|
||||
bool ok = local() && _type == _user_dongle;
|
||||
|
||||
#ifndef _DEMO_
|
||||
if (ok)
|
||||
{
|
||||
switch(_hardware)
|
||||
@ -879,7 +847,7 @@ bool TDongle::burn()
|
||||
default : break;
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
if (ok)
|
||||
_dirty = false;
|
||||
|
||||
@ -1059,3 +1027,6 @@ bool TDongle::shown(word code) const
|
||||
}
|
||||
return yes;
|
||||
}
|
||||
|
||||
bool TDongle::demo() const
|
||||
{ return hardware() == _dongle_unknown && type() == _no_dongle; }
|
||||
|
@ -100,6 +100,7 @@ public:
|
||||
|
||||
bool shown(word module) const; // Stabilisce se un modulo e' visibile in installazione
|
||||
bool hidden(word module) const { return !shown(module); } // Modulo invisibile
|
||||
bool demo() const;
|
||||
|
||||
TDongle();
|
||||
virtual ~TDongle();
|
||||
|
@ -5,6 +5,7 @@
|
||||
#include <expr.h>
|
||||
#include <extcdecl.h>
|
||||
#include <diction.h>
|
||||
#include <dongle.h>
|
||||
#include <mailbox.h>
|
||||
#include <postman.h>
|
||||
#include <prefix.h>
|
||||
@ -978,14 +979,15 @@ int TBaseisamfile::_write(const TRectype& rec)
|
||||
if (key.blank())
|
||||
return _iskeyerr;
|
||||
|
||||
#ifdef _DEMO_
|
||||
const int logicnum = num();
|
||||
if ((logicnum > LF_COMUNI && logicnum < LF_ANALISI) || logicnum > LF_RELANA)
|
||||
if (dongle().demo())
|
||||
{
|
||||
if (items() > 979L)
|
||||
return _isfilefull;
|
||||
const int logicnum = num();
|
||||
if ((logicnum > LF_COMUNI && logicnum < LF_ANALISI) || logicnum > LF_RELANA)
|
||||
{
|
||||
if (items() > 979L)
|
||||
return _isfilefull;
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
// Forza l'uso della chiave principale (per chiavi duplicate?)
|
||||
const int fhnd = handle(_curr_key > 0 ? 1 : 0);
|
||||
|
@ -1,5 +1,6 @@
|
||||
#include <codeb.h>
|
||||
#include <diction.h>
|
||||
#include <dongle.h>
|
||||
#include <extcdecl.h>
|
||||
#include <currency.h>
|
||||
#include <prefix.h>
|
||||
@ -955,13 +956,20 @@ TPrefix::TPrefix() : _filelevel(0), _stdlevel(0), _items(0), _firm(NULL)
|
||||
if (!fexist(__ptprf) || strchr(__ptprf, ' ') != NULL)
|
||||
fatal_box(FR("Percorso dati non valido: '%s'"), __ptprf);
|
||||
|
||||
if (dongle().demo())
|
||||
{
|
||||
const bool dati_demo = ini_get_bool(CONFIG_STUDIO, "Main", "Demo");
|
||||
if (!dati_demo)
|
||||
fatal_box(FR("Area dati '%s' non utilizzabile in DEMO!"), __ptprf);
|
||||
}
|
||||
|
||||
const TFilename dir(prfx);
|
||||
long primaditta = atol(dir.name());
|
||||
if (primaditta > 0L && !exist(primaditta))
|
||||
{
|
||||
TPointer_array ditte; firms(ditte);
|
||||
primaditta = ditte.empty() ? 0L : ditte.get_long(0);
|
||||
set_codditta(primaditta, TRUE);
|
||||
set_codditta(primaditta, true);
|
||||
}
|
||||
|
||||
DB_init();
|
||||
|
@ -5,6 +5,7 @@
|
||||
#include <recarray.h>
|
||||
#include <relation.h>
|
||||
#include <reprint.h>
|
||||
#include <utility.h>
|
||||
#include <xml.h>
|
||||
|
||||
#include <anagr.h>
|
||||
@ -991,17 +992,14 @@ bool TReport_script::execute(TReport& rep)
|
||||
return good;
|
||||
}
|
||||
|
||||
bool TReport_script::execute(TReport_field& rf, ostream* outstr)
|
||||
bool TReport_script::execute(TReport_field& rf)
|
||||
{
|
||||
bool good = true;
|
||||
if (ok())
|
||||
{
|
||||
TReport& rep = rf.section().report();
|
||||
rep.set_curr_field(&rf);
|
||||
if (_bc == NULL)
|
||||
good = compile(rep);
|
||||
if (good)
|
||||
good = rep.execute(*_bc, outstr);
|
||||
good = execute(rep);
|
||||
}
|
||||
return good;
|
||||
}
|
||||
@ -1210,6 +1208,7 @@ const char* TReport_field::type_name() const
|
||||
switch (_type)
|
||||
{
|
||||
case 'A': n = "Array"; break;
|
||||
case 'B': n = "Booleano"; break;
|
||||
case 'D': n = "Data"; break;
|
||||
case 'E': n = "Ellisse"; break;
|
||||
case 'I': n = "Immagine"; break;
|
||||
@ -1230,6 +1229,7 @@ TFieldtypes TReport_field::var_type() const
|
||||
TFieldtypes ft = _nullfld;
|
||||
switch (_type)
|
||||
{
|
||||
case 'B': ft = _boolfld; break;
|
||||
case 'D': ft = _datefld; break;
|
||||
case 'P': // Prezzo
|
||||
case 'V': // Valuta
|
||||
@ -1288,21 +1288,12 @@ bool TReport_field::execute_prescript()
|
||||
bool ok = true;
|
||||
if (!draw_deactivated())
|
||||
{
|
||||
TString256 tmp;
|
||||
ostrstream outstr(tmp.get_buffer(), tmp.size()-1);
|
||||
|
||||
ok = _prescript.execute(*this, &outstr);
|
||||
ok = _prescript.execute(*this);
|
||||
if (ok && type() == 'A')
|
||||
{
|
||||
TReport_array_item* item = get_array_item();
|
||||
if (item != NULL)
|
||||
ok = item->_script.execute(*this, &outstr);
|
||||
}
|
||||
|
||||
if (ok && tmp.not_empty())
|
||||
{
|
||||
tmp.cut(256);
|
||||
set(tmp);
|
||||
ok = item->_script.execute(*this);
|
||||
}
|
||||
}
|
||||
return ok;
|
||||
@ -1310,7 +1301,7 @@ bool TReport_field::execute_prescript()
|
||||
|
||||
bool TReport_field::execute_postscript()
|
||||
{
|
||||
return draw_deactivated() || _postscript.execute(*this, NULL);
|
||||
return draw_deactivated() || _postscript.execute(*this);
|
||||
}
|
||||
|
||||
COLOR TReport_field::link_color() const
|
||||
@ -1332,7 +1323,7 @@ void TReport_field::get_currency(TCurrency& cur) const
|
||||
|
||||
TReport_array_item* TReport_field::get_array_item() const
|
||||
{
|
||||
if (type() == 'A')
|
||||
if (type() == 'A' && !_list.empty())
|
||||
{
|
||||
const TString& val = _var.as_string();
|
||||
int i = 0;
|
||||
@ -1367,6 +1358,12 @@ const TString& TReport_field::formatted_text() const
|
||||
return EMPTY_STRING;
|
||||
}
|
||||
break;
|
||||
case 'B':
|
||||
if (_var.as_bool())
|
||||
return get_tmp_string() = "X";
|
||||
else
|
||||
return EMPTY_STRING;
|
||||
break;
|
||||
case 'D':
|
||||
{
|
||||
const TDate d = _var.as_date();
|
||||
@ -1448,7 +1445,7 @@ const TRectangle& TReport_field::compute_draw_rect(const TBook& book)
|
||||
if (dynamic_height())
|
||||
{
|
||||
const TString& txt = formatted_text();
|
||||
if (!txt.blank())
|
||||
if (txt.full())
|
||||
{
|
||||
TString_array para;
|
||||
book.compute_text_frame(txt, print_font(), r, para);
|
||||
@ -1512,6 +1509,40 @@ void TReport_field::print(TBook& book) const
|
||||
|
||||
switch (_type)
|
||||
{
|
||||
case 'B':
|
||||
if (is_power_reseller())
|
||||
{
|
||||
const TRectangle& rctout = get_draw_rect();
|
||||
const int side = 3*rctout.height()/4;
|
||||
TRectangle rctin(rctout.x, rctout.y, 2*side, side);
|
||||
if (_halign == 'C') rctin.x += (rctout.width() - rctin.width())/2; else
|
||||
if (_halign == 'R') rctin.x = rctout.right() - side;
|
||||
if (_valign == 'C') rctin.y += (rctout.height() - rctin.height())/2; else
|
||||
if (_valign == 'B') rctin.y = rctout.bottom() - rctin.height();
|
||||
if (print_tools(book))
|
||||
book.draw_rectangle(rctin);
|
||||
if (get().as_bool())
|
||||
{
|
||||
rctin.deflate(rctin.width()/8, rctin.height()/8);
|
||||
const TFixed_string name("res/ok.png");
|
||||
book.draw_image(rctin, name);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
const TString& str = formatted_text();
|
||||
if (str.full())
|
||||
{
|
||||
book.set_font(print_font());
|
||||
book.set_text_align(horizontal_alignment(), vertical_alignment());
|
||||
book.set_text_color(fore_color(), back_color());
|
||||
const TRectangle& pr = print_rect(book);
|
||||
TString8 sec_code; section().code(sec_code);
|
||||
book.draw_text(pr, str, sec_code);
|
||||
}
|
||||
print_rect(book);
|
||||
}
|
||||
break;
|
||||
case 'E':
|
||||
if (print_tools(book))
|
||||
book.draw_ellipse(get_draw_rect());
|
||||
@ -2270,6 +2301,17 @@ void TReport::set_postscript(const char* src)
|
||||
_postscript.set(src);
|
||||
}
|
||||
|
||||
bool TReport::execute_dot(const TVariant& var)
|
||||
{
|
||||
if (_curr_field != NULL)
|
||||
{
|
||||
_curr_field->set(var);
|
||||
return true;
|
||||
}
|
||||
return TAlex_virtual_machine::execute_dot(var);
|
||||
}
|
||||
|
||||
|
||||
bool TReport::execute_prescript()
|
||||
{
|
||||
bool ok = true;
|
||||
|
@ -128,7 +128,7 @@ public:
|
||||
|
||||
bool compile(TReport& report);
|
||||
bool execute(TReport& report);
|
||||
bool execute(TReport_field& rf, ostream* outstr);
|
||||
bool execute(TReport_field& rf);
|
||||
|
||||
void save(TXmlItem& root, const char* tag) const;
|
||||
bool load(const TXmlItem& root, const char* tag);
|
||||
@ -538,6 +538,7 @@ public:
|
||||
void set_prescript(const char* src);
|
||||
const TString& postscript() const;
|
||||
void set_postscript(const char* src);
|
||||
virtual bool execute_dot(const TVariant& var);
|
||||
virtual bool execute_prescript();
|
||||
virtual bool execute_postscript();
|
||||
|
||||
|
@ -20,7 +20,6 @@ int get_serial_number()
|
||||
|
||||
bool test_assistance_year()
|
||||
{
|
||||
#ifndef _DEMO_
|
||||
int dongle_year = TDate(TODAY).year();
|
||||
|
||||
if (get_serial_number() > 0)
|
||||
@ -35,9 +34,6 @@ bool test_assistance_year()
|
||||
if (ok)
|
||||
ok = app_year <= dongle_year;
|
||||
return ok;
|
||||
#else
|
||||
return TRUE;
|
||||
#endif // _DEMO_
|
||||
}
|
||||
|
||||
// @doc INTERNAL
|
||||
|
@ -32,6 +32,8 @@ struct TPoint
|
||||
bool operator !=(const TPoint& p) const { return p.x != x || p.y != y; }
|
||||
TPoint& operator +=(const TPoint& pnt) { x += pnt.x; y += pnt.y; return *this; }
|
||||
TPoint& operator -=(const TPoint& pnt) { x -= pnt.x; y -= pnt.y; return *this; }
|
||||
TPoint operator +(const TPoint& pnt) const { return TPoint(x+pnt.x, y+pnt.y); }
|
||||
TPoint operator -(const TPoint& pnt) const { return TPoint(x-pnt.x, y-pnt.y); }
|
||||
void reset() { x = y = 0; }
|
||||
|
||||
// @cmember Costruttori
|
||||
@ -57,6 +59,7 @@ public:
|
||||
long height() const { return _size.y; }
|
||||
const TPoint& pos() const { return *this; }
|
||||
const TPoint& size() const { return _size; }
|
||||
const TPoint center() const { return TPoint(x+_size.x/2, y+_size.y/2); }
|
||||
|
||||
void set_width(long w) { _size.x = w; normalize(); }
|
||||
void set_height(long h) { _size.y = h; normalize(); }
|
||||
|
Loading…
x
Reference in New Issue
Block a user