Patch level : 4.0

Files correlati     : tutti
Ricompilazione Demo : [ ]
Commento            :
Rivista e migliorata gestione visibilita'/abilitazione moduli


git-svn-id: svn://10.65.10.50/trunk@15378 c028cbd2-c16b-5b4b-a496-9718f37d4682
This commit is contained in:
guy 2007-06-01 09:44:03 +00:00
parent f0656d915a
commit 6a7321cb62
13 changed files with 91 additions and 75 deletions

View File

@ -701,19 +701,14 @@ void TApplication::enable_menu_item(
bool TApplication::has_module(int module, int checktype) const
{
bool ok = TRUE;
#ifndef _DEMO_
// Ignora i bit di attivazione della chiave programmatori (sempre attivati)
if (get_serial_number() == 0)
checktype = CHK_USER;
if (checktype == CHK_ALL || checktype == CHK_DONGLE)
ok = dongle().active(module);
#ifdef _DEMO_
bool ok = true;
#else
bool ok = dongle().active(module);
#endif
// Testa bit di attivazione dell'utente
if (ok && (checktype == CHK_ALL || checktype == CHK_USER))
if (ok && checktype != CHK_DONGLE)
ok = _user_aut[module];
return ok;
}

View File

@ -15,7 +15,7 @@
#define MSG_ED "ED" // message edit (maskfld -> relapp)
#define CHK_ALL -1 // all authorization checks
#define CHK_DONGLE 0 // dongle authorization checks
#define CHK_USER 1 // user authorization checks
//#define CHK_USER 1 // user authorization checks
#ifndef __ASSOC_H
class TAssoc_array;

View File

@ -244,6 +244,7 @@ void TDongle::set_developer_permissions()
{
_module.set(255); // Last module on key
_module.set(); // Activate all modules
_shown.reset();
_max_users = 1;
_last_update = TDate(TODAY);
@ -298,6 +299,7 @@ bool TDongle::hardlock_login(bool test_all_keys)
const bool already = already_programmed();
_module.reset(); // Disattiva tutti i moduli
_shown.reset();
const int last_word = already ? 12 : 4;
word data[4];
@ -489,8 +491,9 @@ bool TDongle::login(bool test_all_keys)
_max_users = 1;
_last_update = TDate(TODAY);
_year_assist = _last_update.year();
_module.set(255); // Last module on key
_module.set(); // Activate all modules
_module.set(ENDAUT); // Last module on key
_module.set(); // Activate all modules
_shown.reset();
#else
if (_type != _no_dongle) // Already logged in
logout();
@ -694,7 +697,7 @@ bool TDongle::active(word module) const
yes = r.find("AGA") >= 0;
}
else
yes = (module < ENDAUT) && _module[module];
yes = (module < ENDAUT) && _module[module] && shown(module);
return yes;
}
@ -703,7 +706,7 @@ bool TDongle::activate(word module, bool on)
bool ok = module < ENDAUT;
if (ok)
{
_module.set(module, on);
_module.set(module, on && shown(module));
_dirty = true;
}
return ok;
@ -986,19 +989,29 @@ const TString& TDongle::module_code2desc(word mod) const
bool TDongle::shown(word code) const
{
const TString4 mod = module_code2name(code);
bool yes = mod.not_empty();
bool yes = code < ENDAUT;
if (yes)
{
bool do_test = true;
if (code != EEAUT)
yes = _shown[code];
if (!yes) // Puo' voler dire "nascosto" ma anche "non ho mai controllato"
{
TConfig cfg("install.ini", mod);
cfg.write_protect();
do_test = cfg.get_bool("Ee");
const TString4 mod = module_code2name(code);
yes = mod.not_empty();
if (yes && code > BAAUT)
{
bool do_test = true;
if (code != EEAUT)
{
TConfig cfg("install.ini", mod);
cfg.write_protect();
do_test = cfg.get_bool("Ee");
}
if (do_test)
yes = active(EEAUT);
}
if (yes)
((TBit_array&)_shown).set(code); // Setto il flag di visibilta' per la prossima volta
}
if (do_test)
yes = active(EEAUT);
}
return yes;
}

View File

@ -24,6 +24,7 @@ class TDongle : public TObject
word _eprom[64];
TDate _last_update;
TBit_array _module;
TBit_array _shown;
bool _dirty;
TDate _last_assist;

View File

@ -3690,10 +3690,9 @@ char TRectype::get_char(const char* fieldname) const
return get_str(fieldname)[0];
}
bool TRectype::get_bool(const char* fieldname) const
{
return *(get_str(fieldname)) == 'X';
return get_char(fieldname) == 'X';
}
TDate TRectype::get_date(const char* fieldname) const
@ -3749,8 +3748,7 @@ void TRectype::put(const char* fieldname, char val)
void TRectype::put(const char* fieldname, bool val)
{
const char s[2] = { val ? 'X' : ' ', '\0' };
put_str( fieldname, s);
put( fieldname, val ? 'X' : ' ');
}

View File

@ -208,9 +208,9 @@ void TMask::read_mask(
{
// Costruisce la lista dei gruppi di appartenenza dell'utente
const TString_array& uag = user_and_groups();
TConfig ini(prof);
TConfig ini(prof);
FOR_EACH_ARRAY_ROW_BACK(uag, c, utonto)
{
{
*utonto << "_Locks";
if (ini.set_paragraph(*utonto))
{

View File

@ -5261,7 +5261,7 @@ void TField_window::update()
TField_window::TField_window(int x, int y, int dx, int dy, WINDOW parent, TWindowed_field* owner)
: _owner(owner)
{
if (owner)
if (owner != NULL)
{
create(x, y, dx, dy, "", WSF_HSCROLL | WSF_VSCROLL, W_PLAIN, parent);
activate(owner->enabled());

View File

@ -313,11 +313,6 @@ long double operator%(const real& a, const real& b)
return resto;
}
long double sqrt(long double a)
{
return sqrtl(a);
}
long double sqr(long double a)
{
return a*a;
@ -328,6 +323,13 @@ long double exp10(long double a)
return powl(10.0, a);
}
#if _MSC_VER < 1300
long double sqrt(long double a)
{
return sqrtl(a);
}
long double pow(long double a, long double b)
{
return powl(a, b);
@ -368,6 +370,9 @@ long double abs(long double a)
return fabsl(a);
}
#endif
#else
#include <gm.h>

View File

@ -125,9 +125,11 @@ inline long double fnc_max(long double a, long double b) { return a > b ? a : b;
long double operator%(const real& a, const real& b);
void swap(real& a, real& b) ;
long double sqrt(long double) ;
long double sqr(long double) ;
long double exp10(long double) ;
#if _MSC_VER < 1300
long double sqrt(long double) ;
long double pow(long double, long double) ;
long double exp(long double a) ;
long double log10(long double a) ;
@ -136,6 +138,9 @@ long double sin(long double a) ;
long double cos(long double a) ;
long double tan(long double a) ;
long double abs(long double a) ;
#else
#include <math.h>
#endif
#else

View File

@ -4,6 +4,7 @@
#include <prefix.h>
#include <recarray.h>
#include <tabutil.h>
#include <user.h>
///////////////////////////////////////////////////////////
// TRecord_Array

View File

@ -1,7 +1,6 @@
#include <xvt.h>
#include <dongle.h>
//#include <incstr.h>
#include <prefix.h>
#include <real.h>
#include <utility.h>
@ -16,7 +15,6 @@
TString& user()
{
static TString80 _user;
return _user;
}

View File

@ -39,9 +39,6 @@ int PRINT_HEIGHT = 10;
#define CTRL_R (K_CTRL + 'R')
#define CTRL_P (K_CTRL + 'P')
HIDDEN bool in_update;
class _BkMenuItem : public TObject
{
public:
@ -262,7 +259,7 @@ void TViswin::display_link (long y, long x1, long x2, const char *d)
{
paint_link (y, x1, x2);
_link_displayed = TRUE;
if (in_update) return;
if (_in_update) return;
TString80 dd; dd.strncpy(d, 50);
xvtil_statbar_set(dd);
@ -295,16 +292,16 @@ void TViswin::erase_link (
{
paint_link (y, x1, x2);
_link_displayed = FALSE;
if (in_update) return;
if (!in_update)
if (!_in_update)
{
xvtil_statbar_set("");
xvtil_statbar_refresh();
if (_showbuts)
disable_button(DLG_LINK);
if (_toplevel)
enable_menu_item(M_VISWIN_LINK, FALSE);
}
if (_showbuts) disable_button(DLG_LINK);
if (_toplevel) enable_menu_item(M_VISWIN_LINK, FALSE);
}
}
// @doc INTERNAL
@ -660,28 +657,31 @@ void TViswin::paint_screen ()
const long rw = origin ().y + j;
if (rw < _txt.lines ())
paint_row (rw);
else if (!_isopen)
else
{
autoscroll (FALSE);
set_mode (M_COPY);
set_pen (COLOR_BLACK);
if (!_isopen)
{
autoscroll (FALSE);
set_mode (M_COPY);
set_pen (COLOR_BLACK);
PNT b, e;
b.h = tabx(X_OFFSET-1);
b.v = taby((int)(j + (long)Y_OFFSET - origin().y))/* -2 *****/;
e.h = tabx(columns());
e.v = b.v;
xvt_dwin_draw_set_pos(win(), b);
xvt_dwin_draw_line(win(), e);
set_pen (COLOR_LTGRAY);
e.v++;
b.v++;
xvt_dwin_draw_set_pos (win (), b);
xvt_dwin_draw_line (win (), e);
set_brush (COLOR_DKGRAY);
bar (X_OFFSET-1, (int)(j+(long)Y_OFFSET-origin().y),
(int)columns()+1, (int)(rows()-(long)BUTTONROW_SIZE));
autoscroll (TRUE);
PNT b, e;
b.h = tabx(X_OFFSET-1);
b.v = taby((int)(j + (long)Y_OFFSET - origin().y))/* -2 *****/;
e.h = tabx(columns());
e.v = b.v;
xvt_dwin_draw_set_pos(win(), b);
xvt_dwin_draw_line(win(), e);
set_pen (COLOR_LTGRAY);
e.v++;
b.v++;
xvt_dwin_draw_set_pos (win (), b);
xvt_dwin_draw_line (win (), e);
set_brush (COLOR_DKGRAY);
bar (X_OFFSET-1, (int)(j+(long)Y_OFFSET-origin().y),
(int)columns()+1, (int)(rows()-(long)BUTTONROW_SIZE));
autoscroll (TRUE);
}
break;
}
}
@ -1152,7 +1152,7 @@ void TViswin::paint_point (
// @flag TRUE | Cancella il cursore precedente
// @flag FALSE | Mantiene il cursore precedente
{
static bool wasbar;
autoscroll (FALSE);
const int x = int(_point.x - origin().x + X_OFFSET);
@ -1173,7 +1173,7 @@ void TViswin::paint_point (
}
}
autoscroll (TRUE);
wasbar = _isbar;
}
// draw screen header
@ -1249,10 +1249,10 @@ bool TViswin::can_be_closed() const
void TViswin::update ()
{
if (_scrolling)
if (_scrolling || _in_update)
return;
in_update = TRUE;
_in_update = TRUE;
erase_point();
autoscroll(FALSE);
@ -1286,7 +1286,7 @@ void TViswin::update ()
check_link(&_point);
autoscroll (TRUE);
_need_scroll = none;
in_update = FALSE;
_in_update = FALSE;
}
void TViswin::abort_print ()
@ -2559,7 +2559,7 @@ TViswin::TViswin(const char *fname,
_isprint (printbutton), _iscross (FALSE), _selecting (FALSE), _isselection (FALSE),
_isbar (FALSE), _scrolling (FALSE), _istimer (FALSE), _selflag (FALSE), _sel_displayed (FALSE),
_link_displayed (FALSE), _cross_displayed (FALSE), _point_displayed (FALSE),
_need_scroll (none), _txt (fname, BUFFERSIZE), _txt_to_find(64),
_need_scroll (none), _txt (fname, BUFFERSIZE), _txt_to_find(64), _in_update(FALSE),
_down_dir(TRUE), _case_sensitive(FALSE), _regexp(FALSE), _multiple (FALSE),
_frozen (FALSE), _rulers(rulers), _showbuts(FALSE), _menu_present(FALSE), _brwfld(brwfld)
{

View File

@ -80,7 +80,7 @@ class TViswin : public TField_window
// @cmember:(INTERNAL) Indica il tipo di scroll richiesto (vedi <t scroll>)
scroll _need_scroll;
// @cmember:(INTERNAL) Flag per il disegno intelligente
bool _wasneeded;
bool _in_update;
// @cmember:(INTERNAL) Array di bottoni attivi nella finestra
TArray _button;