Modificato leggermente il metodo disable delle TWindow

Forzata la chiave 1 nei TLocalisamfile appena creati


git-svn-id: svn://10.65.10.50/trunk@738 c028cbd2-c16b-5b4b-a496-9718f37d4682
This commit is contained in:
guy 1994-12-07 11:10:57 +00:00
parent 2dc933c084
commit 5299434c6b
16 changed files with 119 additions and 95 deletions

View File

@ -320,10 +320,8 @@ void TApplication::stop_run()
TApplication::TApplication() : _printer(NULL), _savefirm(0), _create_ok(FALSE)
{
init_global_vars();
_bar = TASK_MENUBAR;
}
, _bar(TASK_MENUBAR)
{}
TApplication::~TApplication()
@ -353,7 +351,7 @@ bool TApplication::create()
bool TApplication::destroy()
{
{
return TRUE;
}
@ -373,14 +371,15 @@ void TApplication::terminate()
if (_printer != NULL) // Distruzione dell'eventuale stampante
{
if (printer().isopen())
printer().close();
if (_printer->isopen())
_printer->close();
delete _printer;
_printer = NULL;
}
}
free_global_vars(); // Distruzione variabili globali
if (use_files())
free_global_vars(); // Distruzione variabili globali
customize_controls(FALSE); // Rilascio eventuali DLL
}
@ -408,7 +407,7 @@ const char* TApplication::get_module_name() const
void TApplication::set_perms()
{
{
CGetAut(1);
_dongle_aut.set(0, TRUE);
for (int i = 1 ; i < ENDAUT; i++)
@ -418,6 +417,7 @@ void TApplication::set_perms()
_dongle_aut.set(i, val);
}
_user_aut.set(0, TRUE);
if (_user.not_empty())
{
if (_user == "PRASSI")
@ -490,6 +490,17 @@ void TApplication::run(int argc, char* argv[], const char* title)
addbar = 0;
_name = cmd2name(argv[0]);
}
const int sn = get_serial_number();
if (sn < 0)
{
error_box("Perhaps you forgot to connect the dongle");
return;
}
if (use_files())
init_global_vars();
set_perms();
const TFixed_string mod(get_module_name());
@ -648,51 +659,50 @@ bool TApplication::config()
TConfig cnf(CONFIG_DITTA);
bool ok = FALSE;
TFilename maskname(cnf.get("EdMask"));
if (!maskname.empty())
const TFilename maskname(cnf.get("EdMask"));
if (maskname.empty())
return warning_box("Nessun parametro da configurare");
TMask m(maskname);
// carica campi
for (int i = 0; i < m.fields(); i++)
{
TMask m(maskname);
// carica campi
for (int i = 0; i < m.fields(); i++)
TMask_field& f = m.fld(i);
const TFieldref* fref = f.field();
if (fref != NULL)
{
const char* fname = fref->name();
if (fname != NULL)
{
TString& oldvl = cnf.get(fname);
if (!oldvl.empty())
f.set(oldvl);
}
}
}
// run mask
disable_menu_item(M_FILE_REVERT);
if (m.run() == K_ENTER && m.dirty())
{
// aggiusta campi
for (i = 0; i < m.fields(); i++)
{
TMask_field& f = m.fld(i);
const TFieldref* fref = f.field();
if (fref != NULL)
if (f.dirty())
{
const char* fname = fref->name();
if (fname != NULL)
{
TString& oldvl = cnf.get(fname);
if (!oldvl.empty())
f.set(oldvl);
}
const TFieldref* fref = f.field();
if (fref != NULL)
cnf.set(fref->name(), f.get(), NULL, TRUE);
}
}
// run mask
disable_menu_item(M_FILE_REVERT);
if (m.run() == K_ENTER && m.dirty())
{
// aggiusta campi
for (i = 0; i < m.fields(); i++)
{
TMask_field& f = m.fld(i);
if (f.dirty())
{
const TFieldref* fref = f.field();
if (fref != NULL)
cnf.set(fref->name(), f.get(), NULL, TRUE);
}
}
ok = TRUE;
}
enable_menu_item(M_FILE_REVERT);
return ok;
ok = TRUE;
}
return warning_box("Nessun parametro da configurare");
enable_menu_item(M_FILE_REVERT);
return ok;
}
void TApplication::on_firm_change()

View File

@ -42,6 +42,7 @@ protected:
virtual long handler(WINDOW win, EVENT* ep);
virtual bool extended_firm() const { return FALSE; } // Extended set_firm dialog box
virtual bool use_files() const { return TRUE; }
virtual bool create(); // Crea la finestra principale
virtual bool menu(MENU_TAG) { return TRUE; } // Controlla il menu
@ -53,6 +54,7 @@ protected:
virtual void on_firm_change();
void set_user(const char * user) { _user = user; }
void set_perms();
void terminate();
bool config();
@ -91,7 +93,6 @@ public:
static void check_parameters(int & argc, char *argv[]);
void set_perms();
const TString& user() const { return _user; }
bool has_module(int module, int checktype = CHK_ALL) const;
bool set_firm(long cod = -1);

View File

@ -403,7 +403,7 @@ bool TForm_item::edit(TMaskmode mode)
TMask m("bagn003");
if (mode == MODE_INS)
{
m.enable(0);
m.TWindow::disable();
m.show();
}

View File

@ -12,13 +12,11 @@
#include <config.h>
#include <extcdecl.h>
#include <isam.h>
#include <mailbox.h>
#include <prefix.h>
#include <relation.h>
#include <scanner.h>
#include <utility.h>
#include <lffiles.h>
#if XVT_OS==XVT_OS_SCOUNIX
#include <sys/types.h>
@ -627,6 +625,7 @@ TLocalisamfile::TLocalisamfile(int logicnum, bool linkrecinst)
{
open();
if (!linkrecinst) setkey(1); // Dangerous change by Guy
}

View File

@ -501,8 +501,8 @@ void TMask::get_mask_fields()
{
TMask_field& f = fld(i);
const int classe = f.class_id();
if (classe != CLASS_FIELD && classe != CLASS_BUTTON_FIELD && classe != CLASS_SHEET_FIELD)
const int acqua = f.class_id();
if (acqua != CLASS_FIELD && acqua != CLASS_BUTTON_FIELD && acqua != CLASS_SHEET_FIELD)
{
window_data = f.get_window_data();
if (f.dirty() == TRUE)
@ -1004,7 +1004,7 @@ void TMask::set(short fld_id, long n, bool hit)
}
void TMask::enable(bool on) const
void TMask::enable(bool on)
{
TWindow::enable(on);
if (toolwin() != NULL_WIN)
@ -1014,14 +1014,17 @@ void TMask::enable(bool on) const
void TMask::enable(short fld_id, bool on)
{
if (fld_id < 1)
{
for (int i = 0; i < fields(); i++)
if (fld_id <= 0)
{
const int gr = -fld_id;
for (int i = 0; i < fields(); i++)
{
TMask_field& f = fld(i);
if (f.dlg() > 100) fld(i).enable(on);
}
} else field(fld_id).enable(on);
if (gr == 0 || f.in_group(gr))
f.enable(on);
}
}
else field(fld_id).enable(on);
}
@ -1109,7 +1112,7 @@ void TMask::show(short fld_id, bool on)
if (fld_id <= 0)
{
const int gr = -fld_id;
for (int i = 0; i < fields(); i++) if (fld(i).in_group(gr))
for (int i = 0; i < fields(); i++) if (gr == 0 || fld(i).in_group(gr))
fld(i).show(on);
} else field(fld_id).show(on);
}

View File

@ -125,7 +125,7 @@ public:
virtual void open();
virtual void close();
virtual void enable(bool on) const;
virtual void enable(bool on = TRUE);
int id2pos(short id) const;
TMask_field& fld(int i) const { return (TMask_field&)_field[i]; } // Ritorna il campo i-esimo della maschera

View File

@ -1,4 +1,4 @@
// $Id: maskfld.cpp,v 1.58 1994-12-05 14:23:15 guy Exp $
// $Id: maskfld.cpp,v 1.59 1994-12-07 11:10:39 guy Exp $
#include <xvt.h>
#include <applicat.h>
@ -1541,7 +1541,7 @@ bool TBrowse::check(CheckTime t)
else
{
do_clear();
if (_fld->mask().mode() != MODE_QUERY && _fld->check_enabled())
if (!_fld->mask().query_mode() && _fld->check_enabled())
_fld->set_dirty(3);
}
}
@ -2018,7 +2018,6 @@ bool TEdit_field::on_key(KEY key)
{
for (int fld = m.get_key_field(i, TRUE); fld != -1; fld = m.get_key_field(i, FALSE))
m.field(fld).set_dirty(FALSE);
// dispatch_e_char(get_parent(win()), K_AUTO_ENTER);
mask().stop_run(K_AUTO_ENTER);
break;
}

View File

@ -28,7 +28,7 @@ class TSpreadsheet : public TWindow
TMask _mask;
int _columns;
bool _firstfocus;
bool _firstfocus, _enabled;
XI_OBJ *_list, *_itf;
@ -84,6 +84,8 @@ public:
bool dirty() const { return _owner->dirty(); }
void set_dirty(bool spork = TRUE) { _owner->set_dirty(spork); }
bool enabled() const { return _enabled; }
void set_notify(SPREADSHEET_NOTIFY n) { _notify = n; }
@ -616,7 +618,6 @@ break;
{
set_dirty(3);
xiev->refused = TRUE;
mask2str(_cur_row);
}
}
break;
@ -704,6 +705,8 @@ break;
void TSpreadsheet::enable(bool on)
{
_enabled = on;
const dword old = xi_get_attrib(_list);
dword att = on ? (old & ~XI_ATR_NAVIGATE) : (old | XI_ATR_NAVIGATE);
if (old != att)
@ -883,7 +886,7 @@ void TSpreadsheet::mask2str(int riga)
#ifdef DBG
if (pos < 0)
{
warning_box("Non e' visibile il campo %d per lo sheet", dlg);
yesnofatal_box("Non e' visibile il campo %d per lo sheet", dlg);
r.add(" ");
}
#endif
@ -983,7 +986,8 @@ void TSpreadsheet::str2mask(int riga)
{
TMask_field& f = sheet_mask().fld(pos);
f.set(val);
f.enable(!cell_disabled(riga, id-FIRST_FIELD));
const bool on = enabled() ? !cell_disabled(riga, id-FIRST_FIELD) : FALSE;
f.enable(on);
if (f.dirty() <= TRUE)
{

View File

@ -1 +1 @@
#define VERSION 1.17
#define VERSION 1.18

View File

@ -1,4 +1,4 @@
// $Id: relapp.cpp,v 1.36 1994-12-02 13:30:27 guy Exp $
// $Id: relapp.cpp,v 1.37 1994-12-07 11:10:48 guy Exp $
#include <mailbox.h>
#include <sheet.h>
#include <urldefid.h>
@ -241,7 +241,9 @@ void TRelation_application::enable_query()
if (c.enabled_default())
{
if (k == 1)
{
c.enable(query);
}
if (c.has_query())
((TEdit_field&)c).enable_check(query);
}

View File

@ -1,4 +1,4 @@
// $Id: relation.cpp,v 1.25 1994-12-02 13:30:30 guy Exp $
// $Id: relation.cpp,v 1.26 1994-12-07 11:10:50 guy Exp $
// relation.cpp
// fv 12/8/93
// relation class for isam files
@ -1208,7 +1208,7 @@ const char* TFieldref::read(const TRelation* c) const
if (c == NULL)
{
TLocalisamfile f(_fileid);
TLocalisamfile f(_fileid, TRUE);
s = read(f.curr());
}
else
@ -1224,7 +1224,7 @@ void TFieldref::write(const char* val, TRelation* c) const
if (c == NULL)
{
f = new TLocalisamfile(_fileid);
f = new TLocalisamfile(_fileid, TRUE);
curr = &f->curr();
}
else

View File

@ -1,6 +1,6 @@
#include <mask.h>
#include <applicat.h>
#include <colors.h>
#include <mask.h>
#include <relation.h>
#include <sheet.h>
#include <urldefid.h>
@ -318,9 +318,7 @@ bool TSheet::on_key(KEY key)
{
case K_SPACE:
_checked.not(selected());
set_opaque_text(TRUE);
update_row(selected());
set_opaque_text(FALSE);
force = TRUE;
break;
case K_F2:
uncheck(-1);

View File

@ -13,24 +13,26 @@
#endif
#include <checks.h>
#include <prefix.h>
#include <isam.h>
#include <prefix.h>
#define REFKEY "CAMPOKEY"
#define VERKEY "ìpÙˆ¬cê<"
long stdlevel ;
int get_serial_number()
{
#if XVT_OS != XVT_OS_SCOUNIX
const int status = HL_LOGIN(ModAd, DONT_CARE, REFKEY, VERKEY);
if (status != STATUS_OK)
return -1;
#endif
return getser();
}
void init_global_vars()
{
#if XVT_OS != XVT_OS_SCOUNIX
HL_LOGIN(ModAd, DONT_CARE, REFKEY, VERKEY);
#endif
const int ws = getser();
if (ws < 0)
fatal_box("Perhaps you forgot to connect the dongle?");
CHECK(prefhndl == NULL, "Can't init global vars two times");
prefhndl = new TPrefix;
@ -66,13 +68,16 @@ void init_global_vars()
}
void free_global_vars()
{
{
#if XVT_OS != XVT_OS_SCOUNIX
HL_LOGOUT();
#endif
delete openf;
delete openrec;
delete prefhndl;
if (prefhndl != NULL)
{
delete openf;
delete openrec;
delete prefhndl;
}
}

View File

@ -50,6 +50,7 @@ typedef UINT16 KEY;
// @FPUB
int get_serial_number();
void init_global_vars();
void free_global_vars();

View File

@ -357,9 +357,9 @@ void TWindow::maximize() const
#endif
}
void TWindow::enable(bool on) const
void TWindow::enable(bool on)
{
enable_window(win(), on);
enable_window(win(), _enabled = on);
}

View File

@ -60,6 +60,7 @@ protected:
// @DPROT
bool _open : 1; // Se la finestra e' aperta
bool _modal : 1; // Se la finestra e' modale
bool _enabled : 1; // Se la finestra e' abilitata
bool _running : 1; // Se la finestra e' in esecuzione
bool _pixmap : 1; // Se se le coordiante sono in pixel
@ -93,6 +94,7 @@ public:
bool is_open() const { return _open; } // Ritorna _open
bool is_modal() const { return _modal; } // Ritorna _modal
bool is_running() const { return _running; } // Ritorna _running
bool enabled() const { return _enabled; }
TPoint size() const; // Determina numero di righe e colonne nella finestra
short rows() const { return (short)size().y; }// Ritorna numero di righe
@ -108,8 +110,8 @@ public:
void iconize() const;
void maximize() const;
virtual void enable(bool = TRUE) const;
void disable() const { enable(FALSE); }
virtual void enable(bool = TRUE);
void disable() { enable(FALSE); }
void open_modal(); // Mostra la finestra modale
void close_modal(); // Nasconde la finestra modale