maskfld.* Aggiunta class TField_window usata dai TWindowed_field

sheet.cpp  Tolto #include<mask.h> inutile
stdtypes.* Tolti riferimenti alla chiave Hardlock e usata classe TDongle


git-svn-id: svn://10.65.10.50/trunk@6186 c028cbd2-c16b-5b4b-a496-9718f37d4682
This commit is contained in:
guy 1998-02-13 13:53:42 +00:00
parent 377fc430a9
commit d38dca6338
5 changed files with 97 additions and 115 deletions

View File

@ -4216,6 +4216,46 @@ const char* TZoom_field::win2raw(const char* data) const
const char* TZoom_field::get_first_line() const
{ return raw2win(_str); }
///////////////////////////////////////////////////////////
// TField_window
///////////////////////////////////////////////////////////
#ifndef INCL_XI
extern "C"
{
void XVT_CALLCONV1 xi_draw_3d_rect XVT_CC_ARGS( ( WINDOW win, RCT* rctp, BOOLEAN well, int height,
COLOR color_light, COLOR color_ctrl, COLOR color_dark ) );
}
#endif
void TField_window::update()
{
const WINDOW me = win();
const WINDOW pa = parent();
if (CAMPI_SCAVATI)
{
RCT rct; xvt_vobj_get_outer_rect(me, &rct);
rct.left -= 2; rct.top -= 2; rct.right += 3; rct.bottom += 3;
xi_draw_3d_rect(pa, &rct, TRUE, 2,
MASK_LIGHT_COLOR, MASK_BACK_COLOR, MASK_DARK_COLOR);
}
xvt_dwin_clear(me, NORMAL_BACK_COLOR);
}
TField_window::TField_window(int x, int y, int dx, int dy, WINDOW parent, TWindowed_field* owner)
: _owner(owner)
{
if (owner)
{
create(x, y, dx, dy, "", WSF_HSCROLL | WSF_VSCROLL, W_PLAIN, parent);
set_font();
activate(owner->enabled());
if (owner->shown())
open();
}
}
///////////////////////////////////////////////////////////
// TWindowed field
///////////////////////////////////////////////////////////
@ -4245,21 +4285,18 @@ void TWindowed_field::parse_head(TScanner& scanner)
_ctl_data._size = scanner.integer();
}
void TWindowed_field::set_win(TWindow* w)
{
if (_win)
delete _win;
_win = w;
TField_window* TWindowed_field::create_window(int x, int y, int dx, int dy, WINDOW parent)
{
// Must be always overridden and look like this
return new TField_window(x, y, dx, dy, parent, this);
}
void TWindowed_field::create(WINDOW parent)
{
_dlg = _ctl_data._dlg;
_parent = parent;
// Example of what should be done in derived classes
// set_win(new TSpecial_window(_ctl_data._x, _ctl_data._y,
// _ctl_data._width, _ctl_data._size,
// parent, this));
_win = create_window(_ctl_data._x, _ctl_data._y,
_ctl_data._width, _ctl_data._size,
parent);
}
TWindowed_field::~TWindowed_field()

View File

@ -1412,25 +1412,48 @@ public:
virtual ~TGolem_field();
};
///////////////////////////////////////////////////////////
// TField_window & TWindowed_field
///////////////////////////////////////////////////////////
class TWindowed_field;
class TField_window : public TScroll_window
{
TWindowed_field* _owner;
protected:
virtual void update();
public:
TWindowed_field& owner() const { return *_owner; }
TField_window(int x, int y, int dx, int dy,
WINDOW parent, TWindowed_field* owner);
virtual ~TField_window() { }
};
class TWindowed_field : public TOperable_field
{
WINDOW _parent;
short _dlg;
TWindow* _win;
short _dlg;
TField_window* _win;
protected: // TMask_field
virtual void parse_head(TScanner& scanner);
virtual void create(WINDOW parent);
virtual void enable(bool on = TRUE);
virtual void show(bool on = TRUE);
protected:
virtual TField_window* create_window(int x, int y, int dx, int dy,
WINDOW parent) pure;
public: // TMask_field
virtual short dlg() const { return _dlg; }
virtual WINDOW parent() const { return _parent; }
virtual WINDOW parent() const { return win().parent(); }
virtual void enable(bool on = TRUE);
virtual void show(bool on = TRUE);
public:
TWindow& win() const { CHECK(_win, "NULL Window in field"); return *_win; }
void set_win(TWindow* w);
TField_window& win() const { CHECK(_win, "NULL Window in field"); return *_win; }
TWindowed_field(TMask* m) : TOperable_field(m), _win(NULL) { }
virtual ~TWindowed_field();
@ -1444,12 +1467,15 @@ protected: // TObject
word class_id() const;
bool is_kind_of(word cid) const;
protected: // TMask_field
virtual void create(WINDOW parent);
protected: // TWindowed_field
virtual TField_window* create_window(int x, int y, int dx, int dy,
WINDOW parent);
public:
TTree* tree() const;
void set_tree(TTree* t);
void hide_leaves(bool yes = TRUE);
void show_leaves(bool yes = TRUE) { hide_leaves(!yes); }
TTree_field(TMask* m) : TWindowed_field(m) { }
virtual ~TTree_field() { }

View File

@ -3,7 +3,6 @@
#include <colors.h>
#include <config.h>
#include <controls.h>
#include <maskfld.h>
#include <relation.h>
#include <sheet.h>
#include <urldefid.h>

View File

@ -4,14 +4,8 @@
#define __STDTYPES_CPP
#include <extcdecl.h>
#include <conf.h>
#include <modaut.h>
#include <isamrpc.h>
#if XVT_OS == XVT_OS_WIN || XVT_OS == XVT_OS_WIN32
#include <dos.h>
#include <hlapi_c.h>
#endif
#include <dongle.h>
#include <applicat.h>
#include <isam.h>
@ -34,87 +28,25 @@ void set_std_level(const long l)
// @doc INTERNAL
static int _login_status = 0;
// @func Ritorna il numero di serie della chiave
//
// @rdesc Numero di serie della chiave
int get_serial_number(const char* appname)
{
#ifdef _DEMO_
return 0;
#else
if (_login_status == 0)
{
if (HL_LOGIN(ModAd, DONT_CARE, REFKEY, VERKEY) == STATUS_OK)
{
_login_status = 1;
getser();
}
}
if (_login_status != 1)
{
if (_login_status == 2)
{
rpc_UserLogout();
SerNo = 0xFFFF;
}
TConfig ini(CONFIG_INSTALL, "Server");
const char* server = ini.get("Dongle");
const char* guest = "******";
const char* utente = (!xvt_running() && !stricmp(appname, "ba0100")) ? guest : user();
if (rpc_UserLogin(server, utente, guest, appname))
{
_login_status = 2;
SerNo = rpc_DongleNumber();
}
else
_login_status = 0;
}
switch(_login_status)
{
case 1 : CGetAut(1) != 0; break;
case 2 : rpc_DongleModules(_int_tab0); break;
default: memset(_int_tab0, 0, sizeof(_int_tab0)); break;
}
return SerNo;
#endif
int get_serial_number()
{
bool ok = dongle().ok();
if (!ok)
ok = dongle().login();
return ok ? int(dongle().number()) : -1;
}
bool test_assistance_year()
{
#ifndef _DEMO_
int dongle_year = TDate(TODAY).year();
if (SerNo > 0)
if (get_serial_number() > 0)
{
int new_year = 0;
switch(_login_status)
{
case 1:
{
word dati[4];
HL_READ(60, (int*)&dati[0]);
HL_READ(61, (int*)&dati[1]);
HL_READ(62, (int*)&dati[2]);
HL_READ(63, (int*)&dati[3]);
HL_CODE(dati, HLBLOCK);
new_year = int(dati[0]);
}
break;
case 2:
new_year = rpc_DongleYear();
break;
default:
break;
}
const int new_year = dongle().year_assist();
if (new_year >= 1997 && new_year <= dongle_year)
dongle_year = new_year;
}
@ -166,15 +98,8 @@ void init_global_vars()
// @func Dealloca le variabili globali
void free_global_vars()
{
#ifndef _DEMO_
#if XVT_OS == XVT_OS_WIN || XVT_OS == XVT_OS_WIN32
if (_login_status == 2)
rpc_UserLogout();
else
HL_LOGOUT();
#endif
#endif // _DEMO_
{
destroy_dongle();
if (openf != NULL)
{
@ -186,8 +111,7 @@ void free_global_vars()
// DB_exit();
}
#ifndef FOXPRO
#include <xvt.h>
#ifndef FOXPRO
// @doc EXTERNAL

View File

@ -17,10 +17,6 @@
#define EOL -1
#define NOERR 0
#define REFKEY "CAMPOKEY"
#define VERKEY "ìpÙˆ¬cê<"
// @doc EXTERNAL
// @type UINT8 | Altro nome di assegnazione per gli unsigned char
@ -80,7 +76,7 @@ typedef UINT16 KEY;
#undef _SVID
int get_serial_number(const char* appname);
int get_serial_number();
bool test_assistance_year();
long get_std_level();