Gestione tasti rapidi.

git-svn-id: svn://10.65.10.50/trunk@52 c028cbd2-c16b-5b4b-a496-9718f37d4682
This commit is contained in:
guy 1994-08-23 13:52:36 +00:00
parent 5f96e2e4ea
commit 6d79069eb6
30 changed files with 7556 additions and 7418 deletions

View File

@ -12,7 +12,7 @@ MENUBAR MENU_BAR(1)
MENU MENU_BAR(1)
SUBMENU MENU_FILE "~File"
ITEM BAR_ITEM(1) "~Selezione"
ITEM BAR_ITEM(1) "~Test"
/* ba1 -2 */

View File

@ -47,7 +47,7 @@ BEGIN
FLAGS "D"
END
SPREADSHEET F_FIELDS 34 7
SPREADSHEET F_FIELDS 44 7
BEGIN
PROMPT 15 4 ""
ITEM "Nome@10"

View File

@ -21,28 +21,28 @@ public:
bool TTest_application::menu(MENU_TAG)
{
TLocalisamfile tab(LF_TABCOM);
TLocalisamfile tab(LF_COMUNI);
const TRecnotype n = tab.items();
time_t start;
clock_t start;
TRecnotype r = 1;
TString80 msg;
{
TProgind p(n, "Lettura file tabelle comuni", TRUE, TRUE, 32);
start = time(NULL);
TProgind p(n, "Lettura file comuni", TRUE, TRUE, 32);
start = clock();
for (tab.first(); tab.good(); tab.next(), r++)
{
if ((r % 50) == 0)
if ((r % 100) == 0)
{
msg.format("%ld records %ld sec", r, time(NULL) - start);
msg.format("%ld records %ld msec", r, clock() - start);
p.setstatus(r);
p.set_text(msg);
if (p.iscancelled()) break;
}
if (p.iscancelled()) break;
}
}
const time_t t = time(NULL) - start;
msg.format("%ld records in %ld sec\n%lg records per sec", r, t, (double)r/t);
const clock_t t = clock() - start;
msg.format("%ld records in %ld msec\n%lg records per sec", r, t, 1000.0*r/t);
message_box(msg);
return TRUE;

File diff suppressed because it is too large Load Diff

View File

@ -1,23 +1,21 @@
#include <xvt.h>
#include <strings.h>
#include <checks.h>
#include "ba6.h"
#define usage "Error - usage : %s -0"
#define usage "Errore - uso : %s -{0,1}"
int main(int argc,char** argv)
{
int rt = 0 ;
TString p = argv[0], s = argv[1] ;
if (argc!=2) fatal_box(usage, (const char*) p) ;
else
if (s == "-0") rt = ba6100(argc,argv) ;
if (s == "-1") rt = ba6200(argc,argv) ;
else fatal_box(usage, (const char*) p) ;
return rt;
const int r = (argc > 1) ? atoi(argv[1]) : -1;
switch (r)
{
case 0:ba6100(argc,argv) ; break;
case 1:ba6200(argc,argv) ; break;
default:error_box(usage, argv[0]) ; break;
}
return r < 0;
}

View File

@ -1,126 +1,126 @@
#include "ba6200.h"
PAGE "" -1 -1 65 14
RADIOBUTTON F_SCELTA 25
BEGIN
PROMPT 1 1 "Stampa per: "
ITEM "1|Codice comune "
MESSAGE HIDE,F_NOMEINI|HIDE,F_NOMEFINE|HIDE,F_NOME
MESSAGE RESET,F_NOMEINI|RESET,F_NOMEFINE|RESET,F_NOME
MESSAGE SHOW,F_CODICEINI|SHOW,F_CODICEFINE|SHOW,F_CODICE
MESSAGE SHOW,F_STATOINI|SHOW,F_STATOFINE
ITEM "2|Denominazione comune"
MESSAGE HIDE,F_CODICEINI|HIDE,F_CODICEFINE|HIDE,F_CODICE
MESSAGE HIDE,F_STATOINI|HIDE,F_STATOFINE
MESSAGE RESET,F_CODICEINI|RESET,F_CODICEFINE|RESET,F_CODICE
MESSAGE RESET,F_STATOINI|RESET,F_STATOFINE
MESSAGE SHOW,F_NOMEINI|SHOW,F_NOMEFINE|SHOW,F_NOME
END
DATE F_DATA
BEGIN
PROMPT 37 2 "Data di stampa "
FLAGS "A"
END
GROUPBOX F_CODICE 63 3
BEGIN
PROMPT 1 5 ""
END
STRING F_STATOINI 3
BEGIN
PROMPT 2 6 "Da codice "
USE LF_COMUNI KEY 1
INPUT STATO F_STATOINI
INPUT COM F_CODICEINI
DISPLAY "Stato" STATO
DISPLAY "Comune" COM
DISPLAY "Denominazione@50" DENCOM
OUTPUT F_STATOINI STATO
OUTPUT F_CODICEINI COM
CHECKTYPE NORMAL
END
STRING F_CODICEINI 4
BEGIN
PROMPT 20 6 ""
COPY USE F_STATOINI
INPUT STATO F_STATOINI
INPUT COM F_CODICEINI
COPY DISPLAY F_STATOINI
OUTPUT F_STATOINI STATO
OUTPUT F_CODICEINI COM
CHECKTYPE NORMAL
END
STRING F_STATOFINE 3
BEGIN
PROMPT 37 6 "A codice "
COPY USE F_STATOINI
INPUT STATO F_STATOFINE
INPUT COM F_CODICEFINE
COPY DISPLAY F_STATOINI
OUTPUT F_STATOFINE STATO
OUTPUT F_CODICEFINE COM
CHECKTYPE NORMAL
END
STRING F_CODICEFINE 4
BEGIN
PROMPT 54 6 ""
COPY USE F_STATOINI
INPUT STATO F_STATOFINE
INPUT COM F_CODICEFINE
COPY DISPLAY F_STATOINI
OUTPUT F_STATOFINE STATO
OUTPUT F_CODICEFINE COM
CHECKTYPE NORMAL
END
GROUPBOX F_NOME 63 4
BEGIN
PROMPT 1 5 ""
END
STRING F_NOMEINI 50
BEGIN
PROMPT 2 6 "Da nome "
USE LF_COMUNI KEY 2
INPUT DENCOM F_NOMEINI
DISPLAY "Denominazione@50" DENCOM
OUTPUT F_NOMEINI DENCOM
CHECKTYPE NORMAL
END
STRING F_NOMEFINE 50
BEGIN
PROMPT 2 7 "A nome "
COPY USE F_NOMEINI
INPUT DENCOM F_NOMEFINE
COPY DISPLAY F_NOMEINI
OUTPUT F_NOMEFINE DENCOM
CHECKTYPE NORMAL
END
STRING F_PROVCOM 5
BEGIN
PROMPT 1 9 "Stampa solo la provincia di "
FLAGS "U"
END
BUTTON DLG_OK 9 0
BEGIN
PROMPT 10 12 ""
END
BUTTON DLG_CANCEL 9 0
BEGIN
PROMPT 43 12 ""
END
ENDPAGE
ENDMASK
#include "ba6200.h"
PAGE "" -1 -1 65 14
RADIOBUTTON F_SCELTA 25
BEGIN
PROMPT 1 1 "Stampa per: "
ITEM "1|Codice comune "
MESSAGE HIDE,F_NOMEINI|HIDE,F_NOMEFINE|HIDE,F_NOME
MESSAGE RESET,F_NOMEINI|RESET,F_NOMEFINE|RESET,F_NOME
MESSAGE SHOW,F_CODICEINI|SHOW,F_CODICEFINE|SHOW,F_CODICE
MESSAGE SHOW,F_STATOINI|SHOW,F_STATOFINE
ITEM "2|Denominazione comune"
MESSAGE HIDE,F_CODICEINI|HIDE,F_CODICEFINE|HIDE,F_CODICE
MESSAGE HIDE,F_STATOINI|HIDE,F_STATOFINE
MESSAGE RESET,F_CODICEINI|RESET,F_CODICEFINE|RESET,F_CODICE
MESSAGE RESET,F_STATOINI|RESET,F_STATOFINE
MESSAGE SHOW,F_NOMEINI|SHOW,F_NOMEFINE|SHOW,F_NOME
END
DATE F_DATA
BEGIN
PROMPT 37 2 "Data di stampa "
FLAGS "A"
END
GROUPBOX F_CODICE 63 3
BEGIN
PROMPT 1 5 ""
END
STRING F_STATOINI 3
BEGIN
PROMPT 2 6 "Da codice "
USE LF_COMUNI KEY 1
INPUT STATO F_STATOINI
INPUT COM F_CODICEINI
DISPLAY "Stato" STATO
DISPLAY "Comune" COM
DISPLAY "Denominazione@50" DENCOM
OUTPUT F_STATOINI STATO
OUTPUT F_CODICEINI COM
CHECKTYPE NORMAL
END
STRING F_CODICEINI 4
BEGIN
PROMPT 20 6 ""
COPY USE F_STATOINI
INPUT STATO F_STATOINI
INPUT COM F_CODICEINI
COPY DISPLAY F_STATOINI
OUTPUT F_STATOINI STATO
OUTPUT F_CODICEINI COM
CHECKTYPE NORMAL
END
STRING F_STATOFINE 3
BEGIN
PROMPT 37 6 "A codice "
COPY USE F_STATOINI
INPUT STATO F_STATOFINE
INPUT COM F_CODICEFINE
COPY DISPLAY F_STATOINI
OUTPUT F_STATOFINE STATO
OUTPUT F_CODICEFINE COM
CHECKTYPE NORMAL
END
STRING F_CODICEFINE 4
BEGIN
PROMPT 54 6 ""
COPY USE F_STATOINI
INPUT STATO F_STATOFINE
INPUT COM F_CODICEFINE
COPY DISPLAY F_STATOINI
OUTPUT F_STATOFINE STATO
OUTPUT F_CODICEFINE COM
CHECKTYPE NORMAL
END
GROUPBOX F_NOME 63 4
BEGIN
PROMPT 1 5 ""
END
STRING F_NOMEINI 50
BEGIN
PROMPT 2 6 "Da nome "
USE LF_COMUNI KEY 2
INPUT DENCOM F_NOMEINI
DISPLAY "Denominazione@50" DENCOM
OUTPUT F_NOMEINI DENCOM
CHECKTYPE NORMAL
END
STRING F_NOMEFINE 50
BEGIN
PROMPT 2 7 "A nome "
COPY USE F_NOMEINI
INPUT DENCOM F_NOMEFINE
COPY DISPLAY F_NOMEINI
OUTPUT F_NOMEFINE DENCOM
CHECKTYPE NORMAL
END
STRING F_PROVCOM 5
BEGIN
PROMPT 1 9 "Stampa solo la provincia di "
FLAGS "U"
END
BUTTON DLG_OK 9 2
BEGIN
PROMPT -12 -2 ""
END
BUTTON DLG_CANCEL 9 2
BEGIN
PROMPT -22 -2 ""
END
ENDPAGE
ENDMASK

View File

@ -637,7 +637,7 @@ bool TPrimanota_application::num_handler(TMask_field& f, KEY key)
if (key == K_TAB && f.get().not_empty())
{
if (app().find(1))
dispatch_e_char(f.parent(), K_SHIFT_ENTER);
dispatch_e_char(f.parent(), K_AUTO_ENTER);
}
return TRUE;
}
@ -659,7 +659,7 @@ bool TPrimanota_application::caus_query_handler(TMask_field& f, KEY key)
{
const bool ok = suspended_handler(f, key); // Controlla sospensione
if (ok)
dispatch_e_char(f.parent(), K_INS); // Entra in modo inserimento
f.mask().stop_run(K_INS); // Entra in modo inserimento
}
}

View File

@ -3,7 +3,7 @@
#include "cg4.h"
#define usage "Error - usage : %s -{0,2,3,4,5}"
const char* const usage = "Errore - uso : %s -{0,2,3,4,5}";
int main(int argc,char** argv)
{
@ -24,6 +24,7 @@ int main(int argc,char** argv)
default:
error_box(usage, argv[0]);
}
return n < 0;
}

View File

@ -36,12 +36,9 @@ HIDDEN int compare(const TObject** o1, const TObject** o2)
{
TRigaiva* r1 = (TRigaiva*)*o1;
TRigaiva* r2 = (TRigaiva*)*o2;
TString campo1;
TString campo2;
campo1.format("%d%4s", r1->_tipodet, (const char*)r1->_codiva);
campo2.format("%d%4s", r2->_tipodet, (const char*)r2->_codiva);
return (strcmp((const char*)campo1, (const char*)campo2));
TString16 campo1; campo1.format("%d%4s", r1->_tipodet, (const char*)r1->_codiva);
TString16 campo2; campo2.format("%d%4s", r2->_tipodet, (const char*)r2->_codiva);
return (strcmp(campo1, campo2));
}
/*

View File

@ -1,121 +1,121 @@
//
// cg4400.h
//
#include <isam.h>
#include <lffiles.h>
#include <printapp.h>
#include <mask.h>
#include <strings.h>
#include <tabutil.h>
#include <utility.h>
#include <stdlib.h>
#include <urldefid.h>
#include <sheet.h>
#include <config.h>
#include <nditte.h>
#include <anagr.h>
#include <comuni.h>
#include <mov.h>
#include <rmoviva.h>
#include <clifo.h>
#include <occas.h>
#include <causali.h>
#include <cglib03.h>
const int MAXSTR = 128;
static char __tmp[MAXSTR];
//enum STAMPA { bollati=1, unici=2 };
const int TABREG = (int)TTable::name2log("REG");
bool filter_func (const TRelation*);
bool my_handler (TMask_field&, KEY);
bool mask_cod (TMask_field&, KEY);
//
// cg4400.h
//
#include <isam.h>
#include <printapp.h>
#include <mask.h>
#include <tabutil.h>
#include <utility.h>
#include <urldefid.h>
#include <sheet.h>
#include <config.h>
#include "cglib03.h"
#include <nditte.h>
#include <anagr.h>
#include <comuni.h>
#include <mov.h>
#include <rmoviva.h>
#include <clifo.h>
#include <occas.h>
#include <causali.h>
const int MAXSTR = 128;
static char __tmp[MAXSTR];
//enum STAMPA { bollati=1, unici=2 };
const int TABREG = (int)TTable::name2log("REG");
bool filter_func (const TRelation*);
bool my_handler (TMask_field&, KEY);
bool mask_cod (TMask_field&, KEY);
bool mask_mese (TMask_field&, KEY);
bool mask_fino_a_mese (TMask_field&, KEY);
bool mask_select (TMask_field&, KEY);
bool mask_verifica (TMask_field&, KEY);
bool mask_annulla (TMask_field&, KEY);
class TDati_ditta : public TObject
{
TLocalisamfile * _nditte, * _anag, *_comuni;
TString _ragsoc, _cofi, _paiva;
TString _comunefis, _viafis, _provfis, _cap;
long _codditta;
int _stampa_width;
protected:
void get_dati_ditta();
TRectype& look_com (const char * codice);
public:
const char* prima_riga ();
const char* seconda_riga ();
TDati_ditta (long cod_ditta, int stampa_width);
virtual ~TDati_ditta();
};
class CG4400_application : public TPrintapp
{
friend bool filter_func (const TRelation *r);
friend bool mask_cod (TMask_field&, KEY);
friend bool mask_mese (TMask_field&, KEY);
friend bool mask_fino_a_mese (TMask_field&, KEY);
friend bool my_handler (TMask_field&, KEY);
friend bool mask_select (TMask_field&, KEY);
friend bool mask_verifica (TMask_field&, KEY);
friend bool mask_annulla (TMask_field&, KEY);
TCursor * _cur;
TRelation *_rel;
bool mask_select (TMask_field&, KEY);
bool mask_verifica (TMask_field&, KEY);
bool mask_annulla (TMask_field&, KEY);
class TDati_ditta : public TObject
{
TLocalisamfile * _nditte, * _anag, *_comuni;
TString _ragsoc, _cofi, _paiva;
TString _comunefis, _viafis, _provfis, _cap;
long _codditta;
int _stampa_width;
protected:
void get_dati_ditta();
TRectype& look_com (const char * codice);
public:
const char* prima_riga ();
const char* seconda_riga ();
TDati_ditta (long cod_ditta, int stampa_width);
virtual ~TDati_ditta();
};
class CG4400_application : public TPrintapp
{
friend bool filter_func (const TRelation *r);
friend bool mask_cod (TMask_field&, KEY);
friend bool mask_mese (TMask_field&, KEY);
friend bool mask_fino_a_mese (TMask_field&, KEY);
friend bool my_handler (TMask_field&, KEY);
friend bool mask_select (TMask_field&, KEY);
friend bool mask_verifica (TMask_field&, KEY);
friend bool mask_annulla (TMask_field&, KEY);
TCursor * _cur;
TRelation *_rel;
TLocalisamfile *_clifo, *_nditte, *_occas, *_tab, *_tabcom;
TTable *_tabreg;
TRigaiva_array _iva_array, _riga_rmi;
TTipodoc_array _doc_array;
TRiga_array _tot_iva_array;
TArray_sheet *_ditte;
TBit_array _selected;
TArray _nomiditte; //array descrizioni ditte per sheet
bool _riferim, _mov_empty;
char _frequiva;
TDate _data_da, _data_a, _data_stampa, _dataregp, _datareg;
long _annoes, _n_ditte;
int _riepil, _tipo_reg, _fino_a_mese, _tipo_stampa;
int _r, _stampa_width; // riga corrente di stampa
real _totale_doc;
TString _codreg, _desc_lib, _codatt, _attivita;
TString _codtab, _tipodoc, _descr_doc;
bool _stampa_tutti_i_registri;
public:
const char* desc_attivita (const char * codatt);
const char* descr_doc (const char * tipo);
const char* descr_iva (const char * cod);
const char* ricerca_cf (char tipocf, long codcf);
const char* ricerca_occ(const char * occ);
int setta_riga (int, const TRigaiva&, real&, real&, real&, real&);
int riga_rmoviva();
bool set_print(int);
bool set_ditte(TMask&);
bool compila_reg();
bool controlla_liquidazione();
bool controlla_mov();
void stampa_registri_IVA();
void set_page_tot_reg();
void calcola_progressivi(real&, real&, const char*, const int);
void user_create();
void user_destroy();
bool preprocess_page(int, int);
int stampa_intestazione_ditta();
bool preprocess_print(int, int);
print_action postprocess_print(int, int);
void preprocess_header();
CG4400_application() : TPrintapp(),_ditte(NULL),_selected(10000),
_nomiditte(100) {}
virtual ~CG4400_application() {}
};
TRigaiva_array _iva_array, _riga_rmi;
TTipodoc_array _doc_array;
TRiga_array _tot_iva_array;
TArray_sheet *_ditte;
TBit_array _selected;
TArray _nomiditte; //array descrizioni ditte per sheet
bool _riferim, _mov_empty;
char _frequiva;
TDate _data_da, _data_a, _data_stampa, _dataregp, _datareg;
long _annoes, _n_ditte;
int _riepil, _tipo_reg, _fino_a_mese, _tipo_stampa;
int _r, _stampa_width; // riga corrente di stampa
real _totale_doc;
TString _codreg, _desc_lib, _codatt, _attivita;
TString _codtab, _tipodoc, _descr_doc;
bool _stampa_tutti_i_registri;
public:
const char* desc_attivita (const char * codatt);
const char* descr_doc (const char * tipo);
const char* descr_iva (const char * cod);
const char* ricerca_cf (char tipocf, long codcf);
const char* ricerca_occ(const char * occ);
int setta_riga (int, const TRigaiva&, real&, real&, real&, real&);
int riga_rmoviva();
bool set_print(int);
bool set_ditte(TMask&);
bool compila_reg();
bool controlla_liquidazione();
bool controlla_mov();
void stampa_registri_IVA();
void set_page_tot_reg();
void calcola_progressivi(real&, real&, const char*, const int);
void user_create();
void user_destroy();
bool preprocess_page(int, int);
int stampa_intestazione_ditta();
bool preprocess_print(int, int);
print_action postprocess_print(int, int);
void preprocess_header();
CG4400_application() : TPrintapp(),_ditte(NULL),_selected(10000),
_nomiditte(100) {}
virtual ~CG4400_application() {}
};

File diff suppressed because it is too large Load Diff

View File

@ -42,9 +42,9 @@ void TTab_conti::do_agg(TConto* tc, int anno_es, const real& importo,
}
void TTab_conti::aggiorna_conto(const TConto& tcon, const int anno_es, const real& importo, char sezione, bool movap, bool provv, bool somma)
void TTab_conti::aggiorna_conto(const TConto& tcon, int anno_es, const real& importo, char sezione, bool movap, bool provv, bool somma)
{
TString key;
TString80 key;
key << format("%4d", anno_es);
key << format("%3d", tcon.gruppo());
key << format("%3d", tcon.conto());
@ -68,7 +68,7 @@ void TTab_conti::aggiorna_conto(int gruppo, int conto, long sottoconto,
int anno_es, const real& importo, char sezione,
bool movap, bool provv, bool somma)
{
TString key;
TString80 key;
key << format("%4d", anno_es);
key << format("%3d", gruppo);
key << format("%3d", conto);

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

View File

@ -1,84 +1,83 @@
#ifndef APPNAME
#define APPNAME CAMPO
#define QAPPNAME "CAMPO"
#define LIBDIR c:\xvt.322\xvtwin\lib
#endif
#define NO_STD_EDIT_MENU
#define NO_STD_FILE_MENU
#define NO_STD_FONT_MENU
#define NO_STD_HELP_MENU
#define NO_STD_ABOUT_BOX
#include <url.h>
#include <urldefid.h>
MENUBAR TASK_MENUBAR
MENU MENU_FILE
ITEM M_FILE_NEW "Scelta ~Ditta..."
ITEM M_FILE_REVERT "Impostazione ~Parametri..."
SEPARATOR
ITEM M_FILE_PG_SETUP "~Impostazione Stampante..."
ITEM M_FILE_PRINT "~Stampa" DISABLED
SEPARATOR
ITEM (M_FILE+11) "I~nformazioni"
ITEM M_FILE_QUIT "~Fine"
MENU MENU_EDIT
ITEM M_EDIT_INSERT "~Inserisci"
ITEM M_EDIT_MODIFY "~Aggiorna"
ITEM M_EDIT_DELETE "~Cancella"
ITEM M_EDIT_SHOW "~Visualizza"
ITEM M_EDIT_SEARCH "C~erca" DISABLED
MENU MENU_ALT_EDIT
ITEM M_EDIT_EDIT "~Aggiorna"
ITEM M_EDIT_SEARCH "C~erca" DISABLED
ACCEL MENU_FILE "f" ALT
ACCEL MENU_EDIT "g" ALT
#if XVTWS == WINWS
#scan <xil.h>
#transparent $$$
XI_CURSOR_RESIZE cursor DISCARDABLE f:\p.due\bmp\resize.cur
XI_CURSOR_HAND cursor DISCARDABLE f:\p.due\bmp\hand.cur
XI_CURSOR_VRESIZE cursor DISCARDABLE f:\p.due\bmp\vresize.cur
COMBO_ICON icon DISCARDABLE f:\p.due\bmp\combo.ico
BMP_OK bitmap DISCARDABLE f:\p.due\bmp\ok.bmp
BMP_CANCEL bitmap DISCARDABLE f:\p.due\bmp\cancel.bmp
BMP_QUIT bitmap DISCARDABLE f:\p.due\bmp\quit.bmp
BMP_QUITDN bitmap DISCARDABLE f:\p.due\bmp\quitdn.bmp
BMP_SELECT bitmap DISCARDABLE f:\p.due\bmp\select.bmp
BMP_FIRSTREC bitmap DISCARDABLE f:\p.due\bmp\firstrec.bmp
BMP_PREVREC bitmap DISCARDABLE f:\p.due\bmp\prevrec.bmp
BMP_STOPREC bitmap DISCARDABLE f:\p.due\bmp\stoprec.bmp
BMP_NEXTREC bitmap DISCARDABLE f:\p.due\bmp\nextrec.bmp
BMP_LASTREC bitmap DISCARDABLE f:\p.due\bmp\lastrec.bmp
BMP_SAVEREC bitmap DISCARDABLE f:\p.due\bmp\saverec.bmp
BMP_SAVERECDN bitmap DISCARDABLE f:\p.due\bmp\saverecd.bmp
BMP_NEWREC bitmap DISCARDABLE f:\p.due\bmp\newrec.bmp
BMP_NEWRECDN bitmap DISCARDABLE f:\p.due\bmp\newrecdn.bmp
BMP_DELREC bitmap DISCARDABLE f:\p.due\bmp\delrec.bmp
BMP_DELRECDN bitmap DISCARDABLE f:\p.due\bmp\delrecdn.bmp
BMP_FINDREC bitmap DISCARDABLE f:\p.due\bmp\findrec.bmp
BMP_SEARCH bitmap DISCARDABLE f:\p.due\bmp\search.bmp
BMP_CHECK_ON bitmap DISCARDABLE f:\p.due\bmp\checkon.bmp
BMP_CHECK_OFF bitmap DISCARDABLE f:\p.due\bmp\checkoff.bmp
BMP_RADIO_ON bitmap DISCARDABLE f:\p.due\bmp\radioon.bmp
BMP_RADIO_OFF bitmap DISCARDABLE f:\p.due\bmp\radiooff.bmp
BMP_MODULE1 bitmap DISCARDABLE f:\p.due\bmp\module1.bmp
BMP_MODULE2 bitmap DISCARDABLE f:\p.due\bmp\module2.bmp
BMP_MODULE3 bitmap DISCARDABLE f:\p.due\bmp\module3.bmp
BMP_MODULE4 bitmap DISCARDABLE f:\p.due\bmp\module4.bmp
BMP_BOOK1 bitmap DISCARDABLE f:\p.due\bmp\book1.bmp
BMP_BOOK2 bitmap DISCARDABLE f:\p.due\bmp\book2.bmp
BMP_BOOK3 bitmap DISCARDABLE f:\p.due\bmp\book3.bmp
BMP_MODULE bitmap DISCARDABLE f:\p.due\bmp\module.bmp
BMP_EDIT bitmap DISCARDABLE f:\p.due\bmp\edit.bmp
BMP_LINK bitmap DISCARDABLE f:\p.due\bmp\link.bmp
BMP_PRINT bitmap DISCARDABLE f:\p.due\bmp\print.bmp
$$$
#endif
#ifndef APPNAME
#define APPNAME CAMPO
#define QAPPNAME "CAMPO"
#define LIBDIR c:\xvt.322\xvtwin\lib
#endif
#define NO_STD_EDIT_MENU
#define NO_STD_FILE_MENU
#define NO_STD_FONT_MENU
#define NO_STD_HELP_MENU
#define NO_STD_ABOUT_BOX
#include <url.h>
#include <urldefid.h>
MENUBAR TASK_MENUBAR
MENU MENU_FILE
ITEM M_FILE_NEW "Scelta ~Ditta..."
ITEM M_FILE_REVERT "Impostazione ~Parametri..."
SEPARATOR
ITEM M_FILE_PG_SETUP "~Impostazione Stampante..."
ITEM M_FILE_PRINT "~Stampa" DISABLED
SEPARATOR
ITEM (M_FILE+11) "I~nformazioni"
ITEM M_FILE_QUIT "~Fine"
MENU MENU_EDIT
ITEM M_EDIT_INSERT "~Inserisci"
ITEM M_EDIT_MODIFY "~Aggiorna"
ITEM M_EDIT_DELETE "~Cancella"
ITEM M_EDIT_SHOW "~Visualizza"
ITEM M_EDIT_SEARCH "C~erca" DISABLED
MENU MENU_ALT_EDIT
ITEM M_EDIT_EDIT "~Aggiorna"
ITEM M_EDIT_SEARCH "C~erca" DISABLED
ACCEL MENU_FILE "f" ALT
#if XVTWS == WINWS
#scan <xil.h>
#transparent $$$
XI_CURSOR_RESIZE cursor DISCARDABLE f:\p.due\bmp\resize.cur
XI_CURSOR_HAND cursor DISCARDABLE f:\p.due\bmp\hand.cur
XI_CURSOR_VRESIZE cursor DISCARDABLE f:\p.due\bmp\vresize.cur
COMBO_ICON icon DISCARDABLE f:\p.due\bmp\combo.ico
BMP_OK bitmap DISCARDABLE f:\p.due\bmp\ok.bmp
BMP_CANCEL bitmap DISCARDABLE f:\p.due\bmp\cancel.bmp
BMP_QUIT bitmap DISCARDABLE f:\p.due\bmp\quit.bmp
BMP_QUITDN bitmap DISCARDABLE f:\p.due\bmp\quitdn.bmp
BMP_SELECT bitmap DISCARDABLE f:\p.due\bmp\select.bmp
BMP_FIRSTREC bitmap DISCARDABLE f:\p.due\bmp\firstrec.bmp
BMP_PREVREC bitmap DISCARDABLE f:\p.due\bmp\prevrec.bmp
BMP_STOPREC bitmap DISCARDABLE f:\p.due\bmp\stoprec.bmp
BMP_NEXTREC bitmap DISCARDABLE f:\p.due\bmp\nextrec.bmp
BMP_LASTREC bitmap DISCARDABLE f:\p.due\bmp\lastrec.bmp
BMP_SAVEREC bitmap DISCARDABLE f:\p.due\bmp\saverec.bmp
BMP_SAVERECDN bitmap DISCARDABLE f:\p.due\bmp\saverecd.bmp
BMP_NEWREC bitmap DISCARDABLE f:\p.due\bmp\newrec.bmp
BMP_NEWRECDN bitmap DISCARDABLE f:\p.due\bmp\newrecdn.bmp
BMP_DELREC bitmap DISCARDABLE f:\p.due\bmp\delrec.bmp
BMP_DELRECDN bitmap DISCARDABLE f:\p.due\bmp\delrecdn.bmp
BMP_FINDREC bitmap DISCARDABLE f:\p.due\bmp\findrec.bmp
BMP_SEARCH bitmap DISCARDABLE f:\p.due\bmp\search.bmp
BMP_CHECK_ON bitmap DISCARDABLE f:\p.due\bmp\checkon.bmp
BMP_CHECK_OFF bitmap DISCARDABLE f:\p.due\bmp\checkoff.bmp
BMP_RADIO_ON bitmap DISCARDABLE f:\p.due\bmp\radioon.bmp
BMP_RADIO_OFF bitmap DISCARDABLE f:\p.due\bmp\radiooff.bmp
BMP_MODULE1 bitmap DISCARDABLE f:\p.due\bmp\module1.bmp
BMP_MODULE2 bitmap DISCARDABLE f:\p.due\bmp\module2.bmp
BMP_MODULE3 bitmap DISCARDABLE f:\p.due\bmp\module3.bmp
BMP_MODULE4 bitmap DISCARDABLE f:\p.due\bmp\module4.bmp
BMP_BOOK1 bitmap DISCARDABLE f:\p.due\bmp\book1.bmp
BMP_BOOK2 bitmap DISCARDABLE f:\p.due\bmp\book2.bmp
BMP_BOOK3 bitmap DISCARDABLE f:\p.due\bmp\book3.bmp
BMP_MODULE bitmap DISCARDABLE f:\p.due\bmp\module.bmp
BMP_EDIT bitmap DISCARDABLE f:\p.due\bmp\edit.bmp
BMP_LINK bitmap DISCARDABLE f:\p.due\bmp\link.bmp
BMP_PRINT bitmap DISCARDABLE f:\p.due\bmp\print.bmp
$$$
#endif

View File

@ -23,12 +23,12 @@
class TFile : public TObject
{
// @DPRIV
// @DPRIV
SecDef* _file;
int _len;
int _base;
public:
// @FPUB
// @FPUB
void open(const char* name, TFilelock lockmode = _manulock);
bool verify(const char* name);
void create(const char* name, TRecnotype nrecord = 10);
@ -54,12 +54,12 @@ public:
class TDir : public TObject
{
// @DPRIV
// @DPRIV
FileDes* _dir;
int _num;
public:
// @FPUB
// @FPUB
void get(int nfile, TReclock lock = _nolock, TDirtype dirtype = _nordir, TDirop op = _nordirop);
void put(int nfile, TDirtype dirtype = _nordir, TDirop op = _nordirop);
void zero();
@ -91,14 +91,14 @@ public:
class TTrec : public TSortable
{
// @DPRIV
// @DPRIV
RecDes* _rec;
int _num;
protected:
int compare(const TSortable& a) const;
public:
// @FPUB
// @FPUB
void get(int nfile, TDirtype dirtype = _nordir);
void put(int nfile, TDirtype dirtype = _nordir);
void zero();
@ -114,13 +114,15 @@ public:
void set_keys(int nkeys) { _rec->NKeys = nkeys;}
const char* fielddef(int fld) const; // ritorna una token string
const char* keydef(int key) const;
int len() const { return _rec->Fd[fields() - 1].RecOff +
_rec->Fd[fields() - 1].Len; }
#ifndef FOXPRO
void update_keydef(int key, const char* desc); //desc e' una token string
void update_fielddef(int nfld, const char* desc); //desc e' una token string
int len() const { return _rec->Fd[fields() - 1].RecOff +
_rec->Fd[fields() - 1].Len; }
virtual void print_on(ostream& out) const;
virtual void read_from(istream& in);
#endif
TTrec();
virtual ~TTrec();

View File

@ -1,26 +1,27 @@
#ifndef __KEYS_H
#define __KEYS_H
#ifndef XVT_INCL_CONST
#include <xvtconst.h>
#endif
/* @M */
#define K_BACKSPACE 8
#define K_TAB 9
#define K_ENTER 13
#define K_ESC 27
#define K_SPACE 32
#define K_SHIFT 1000
#define K_CTRL 10000
#define K_SHIFT_ENTER K_ENTER+K_SHIFT
#define K_SHIFT_TAB K_TAB+K_SHIFT
#define K_SHIFT_F2 K_SHIFT+K_F2
#define K_SHIFT_F3 K_SHIFT+K_F3
#define K_NO 'N'
#define K_SAVE 'S'
#define K_QUIT 'Q'
#define K_YES 'Y'
/* @END */
#endif
#ifndef __KEYS_H
#define __KEYS_H
#ifndef XVT_INCL_CONST
#include <xvtconst.h>
#endif
/* @M */
#define K_BACKSPACE 8
#define K_TAB 9
#define K_ENTER 13
#define K_ESC 27
#define K_SPACE 32
#define K_SHIFT 1000
#define K_CTRL 10000
#define K_CTRL_ENTER K_CTRL+K_ENTER
#define K_AUTO_ENTER K_SHIFT+K_ENTER
#define K_QUIT 10334
#define K_SAVE 10082
#define K_SHIFT_TAB K_SHIFT+K_TAB
#define K_SHIFT_F2 K_SHIFT+K_F2
#define K_SHIFT_F3 K_SHIFT+K_F3
#define K_NO 'N'
#define K_YES 'Y'
/* @END */
#endif

View File

@ -97,30 +97,46 @@ void TMask::handler(WINDOW win, EVENT* ep)
case E_CONTROL:
switch(ep->v.ctl.id)
{
case DLG_OK :on_key(K_SHIFT_ENTER); break;
case DLG_BAR :
case DLG_CANCEL :on_key(K_ESC); break;
case DLG_PGDN :on_key(K_NEXT); break;
case DLG_PGUP :on_key(K_PREV); break;
case DLG_FIRSTREC:stop_run(K_HOME); break;
case DLG_PREVREC :stop_run(K_PREV); break;
case DLG_NEXTREC :stop_run(K_NEXT); break;
case DLG_FINDREC :stop_run(K_F9); break;
case DLG_LASTREC :stop_run(K_END); break;
case DLG_NEWREC :stop_run(K_INS); break;
case DLG_DELREC :stop_run(K_DEL); break;
case DLG_SAVEREC :stop_run(K_SAVE); break;
case DLG_QUIT :stop_run(K_QUIT); break;
case DLG_F9:
{
TMask_field* f = (TMask_field*)get_app_data(ep->v.ctl.ci.win);
f->on_key(K_F9);
}
break;
default:
control_handler(ep);
break;
}
case DLG_OK :
on_key(K_AUTO_ENTER); break;
case DLG_BAR :
case DLG_CANCEL :
on_key(K_ESC); break;
/*
case DLG_PGDN :
on_key(K_NEXT); break;
case DLG_PGUP :
on_key(K_PREV); break;
case DLG_FIRSTREC:
stop_run(K_HOME); break;
case DLG_PREVREC :
stop_run(K_PREV); break;
case DLG_NEXTREC :
stop_run(K_NEXT); break;
case DLG_FINDREC :
stop_run(K_F9); break;
case DLG_LASTREC :
stop_run(K_END); break;
case DLG_NEWREC :
stop_run(K_INS); break;
case DLG_DELREC :
stop_run(K_DEL); break;
case DLG_SAVEREC :
stop_run(K_SAVE); break;
case DLG_QUIT :
stop_run(K_QUIT); break;
*/
case DLG_F9:
{
// Attiva ricerca sul campo associato al bottone
TMask_field* f = (TMask_field*)get_app_data(ep->v.ctl.ci.win);
f->on_key(K_F9);
}
break;
default:
control_handler(ep);
break;
}
break;
default:
break;
@ -130,15 +146,16 @@ void TMask::handler(WINDOW win, EVENT* ep)
void TMask::init_mask(int mode)
{
_sheets = _pages = 0;
_enabled = 0xffff;
_focus = _first_focus = 0;
_page = -1;
_handler = NULL; _mode = mode;
_exchange = 1.0;
_sheets = _pages = 0; // Azzera numero pagine e sheets
_enabled = 0xffff; // Abilita tutte le pagine
_focus = _first_focus = 0; // Nessuna ha il focus
_page = -1; // Nessuan pagina corrente
_handler = NULL; // Nessun handler utente
_mode = mode; // Inizializza modo
_exchange = 1.0; // Il cambio per la valuta e' la lira
for (int i = 0; i <= MAX_PAGES; i++)
_pagewin[i] = NULL_WIN;
_pagewin[i] = NULL_WIN; // Azzera le finestre delle varie pagine
}
@ -584,13 +601,42 @@ void TMask::move_focus_field(int d)
bool TMask::stop_run(KEY key)
{
if (key == K_SHIFT_ENTER) key = K_ENTER;
if (key == K_CTRL_ENTER) key = K_ENTER;
if (key != K_AUTO_ENTER)
{
const int last = fields();
bool found = FALSE;
for (int i = 0; i < last; i++)
{
const TMask_field& f = fld(i);
if (f.class_id() != CLASS_BUTTON_FIELD) continue;
const TButton_field& b = (const TButton_field&)f;
if (b.exit_key() == key)
{
if (b.active())
{
found = TRUE;
break;
}
}
}
if (!found)
{
#ifdef DBG
return error_box("Non e' attivo il bottone associato a %d", key);
#else
beep();
return FALSE;
#endif
}
} else key = K_ENTER;
if (key != K_ESC && key != K_QUIT && key != K_DEL)
{
const bool ok = check_fields();
if (!ok) return FALSE;
if (is_running()) // Gestisce meglio le maschere chiuse
if (is_running()) // Gestisce correttamenete le maschere chiuse
get_mask_fields();
}
@ -606,12 +652,11 @@ bool TMask::on_key(KEY key)
}
switch(key)
{
case K_SHIFT_ENTER:
{
case K_AUTO_ENTER:
case K_CTRL_ENTER:
case K_QUIT:
case K_ESC:
case K_INS:
case K_DEL:
stop_run(key);
break;
case K_UP:
@ -639,18 +684,34 @@ bool TMask::on_key(KEY key)
#ifdef DBG
case K_F11:
message_box("Siete fortunati utenti del campo %d della maschera '%s'\n"
"caricata nell'incredibile tempo di %ld cicli\n"
"ed inizializzata mostruosamente in %ld cicli\n"
"Grazie per la comprensione",
"caricata nell'incredibile tempo di %ld millisecondi\n"
"ed inizializzata mostruosamente in %ld millisecondi\n"
"Grazie per la comprensione",
fld(_focus).dlg(), (const char*)source_file(), clock1, clock2);
break;
#endif
default:
if (key >= K_CTRL+K_F1 && key <= K_CTRL+K_F12)
if (key > K_CTRL)
{
const int page = key - (K_CTRL+K_F1);
next_page(1000+page);
}
key -= K_CTRL;
if (key >= K_F1 && key <= K_F10)
next_page(1000 + key - K_F1);
else
{
const int last = fields();
for (int i = 0; i < last; i++)
{
TMask_field& f = fld(i);
if (f.class_id() != CLASS_BUTTON_FIELD || !f.active()) continue;
TButton_field& b = (TButton_field&)f;
if (b.virtual_key() == key && fld(_focus).on_key(K_TAB) == TRUE)
{
f.on_key(K_SPACE);
break;
}
}
}
}
else return fld(_focus).on_key(key);
}

View File

@ -1,187 +1,187 @@
#ifndef __MASK_H
#define __MASK_H
#ifndef __WINDOW_H
#include <window.h>
#endif
#ifndef __MASKFLD_H
#include <maskfld.h>
#endif
#ifndef __REAL_H
#include <real.h>
#endif
// @T
typedef bool (*MASK_HANDLER)(TMask& mask, KEY key);
enum TMaskmode { NO_MODE, MODE_INS , MODE_MOD , MODE_DEL ,
MODE_VIS , MODE_QUERY, MODE_QUERYINS,
MODE_SEARCH };
// @END
// @C
// Classe TMask : public TWindow
// @END
class TMask : public TWindow
{
// @DPRIV
enum { MAX_PAGES = 12 }; // Massimo numero di pagine nella maschera
WINDOW _pagewin[MAX_PAGES+1]; // Windows of the pages
int _pages; // Number of pages of the mask
int _page; // Current page
word _enabled; // Are pages enabled (bit field)
int _mode; // Mode of the mask
TArray _field; // Fields in the mask
int _first_focus; // First control to have focus
int _focus; // Control with focus
int _sheets; // Number of sheets
MASK_HANDLER _handler; // User defined key handler
TFilename _source_file; // Source file of the mask
TFilename _workfile; // Name of savefile
long _lastpos; // last read offset on savefile
real _exchange; // Current value exhange
protected:
// Ritorna la finestra della pagina corrente (Usare con attenzione)
WINDOW win() const { return _page == -1 ? NULL_WIN : _pagewin[_page]; }
WINDOW toolwin() const { return _pagewin[MAX_PAGES]; }
int find_field_win(WINDOW win) const; // number of field with window win
void set_mask_fields() const; // update screen
void load_checks() const; // load checks related fields
virtual void start_run(); // called when the mask starts to run
virtual TMask_field* parse_field(TScanner& scanner);
void init_mask(int mode);
WINDOW read_page(TScanner& scanner, bool toolbar = FALSE);
void read_mask(const char* name, int mode, int num);
void add_buttons();
int find_parent_page(const TMask_field&) const;
int find_first_field(WINDOW w, int dir) const;
int find_active_field(int first, int dir) const;
bool check_current_page(); // Check all the fields on the current page
void next_page(int p); // Show next/previous page
int curr_page() const { return _page; } // Current page number
void control_handler(EVENT* ep);
void handler(WINDOW win, EVENT* ep);
public:
// @FPUB
// crea leggendo descrizione da file .msk
TMask(const char* name, int mode = NO_MODE, int num = 0);
// crea mask vuota con parametri dati
TMask(const char* title, int pages, int cols, int rows, int xpos = -1,
int ypos = -1, int mode = NO_MODE);
virtual ~TMask();
const TFilename& source_file() const { return _source_file; }
// aggiunta campi a runtime
void add_static (short id, int page, const char* prompt, int x, int y,
const char* flags = "");
void add_string (short id, int page, const char* prompt, int x, int y,
int dim, const char* flags = "", int width = 0);
void add_number (short id, int page, const char* prompt, int x, int y,
int dim, const char* flags = "", int ndec = 0);
void add_date (short id, int page, const char* prompt, int x, int y,
const char* flags = "");
void add_button (short id, int page, const char* prompt, int x, int y,
int dx = 9, int dy = 1, const char* flags = "");
void add_radio(short id, int page, const char* prompt, int x, int y,
int dx, const char* codes, const char* items, const char* flags = "");
int fields() const { return _field.items(); }
int sheets() const { return _sheets; }
void set_mode(int m) { _mode = m; }
int mode() const { return _mode; }
void set_exchange(const real& e);
const real& exchange() const { return _exchange; }
bool check_fields();
void get_mask_fields(); // read screen contents
virtual bool stop_run(KEY key); // called to close the mask
virtual void open();
virtual void close();
virtual void enable(bool on) const;
int id2pos(short id) const;
TMask_field& fld(int i) const { return (TMask_field&)_field[i]; } // Ritorna il campo i-esimo della maschera
TMask_field& field(short id) const; // field with given id
void set(short fld_id, const char* str, bool hit=FALSE);
void set(short fld_id, long num, bool hit=FALSE);
const TString& get(short fld_id) const;
long get_long(short fld_id) const;
int get_int(short fld_id) const { return (int)get_long(fld_id); }
bool get_bool(short fld_id) const;
int first_focus(short id);
void set_focus();
void move_focus_field(int num);
void set_focus_win(WINDOW win, bool force);
int focus_field() const { return _focus;}
virtual bool on_key(KEY key);
void enable(short fld_id, bool on = TRUE); // Abilita un campo
void disable(short fld_id) { enable(fld_id, FALSE); }
void enable_default(short fld_id = -1);
void enable_page(int p, bool on = TRUE);
void disable_page(int p) { enable_page(p, FALSE); }
bool page_enabled(int p) const;
byte num_keys() const;
void enable_key(byte key, bool on = TRUE);
void disable_key(byte key) { enable_key(key, FALSE); }
short get_key_field(byte key, bool first) const;
bool key_valid(int key) const;
void show(short fld_id = -1, bool on = TRUE);
void hide(short fld_id = -1) { show(fld_id, FALSE); }
void show_default(short fld_id = -1);
void reset(short fld_id = -1);
void undo(short fld_id = -1);
void autoload(const TRelation* = NULL);
void autosave(TRelation* = NULL) const;
void send_key(KEY key, short id) const;
void set_handler(short fld_id, CONTROL_HANDLER handler);
void set_handler(MASK_HANDLER handler);
void set_workfile(const char* workfile) { _workfile = workfile; _lastpos = 0L;}
bool save(bool append = FALSE) const;
bool load(bool reset = FALSE);
short dirty() const; // Ritorna il primo campo dirty
bool no_mode() const { return _mode == NO_MODE; }
bool query_mode() const { return _mode == MODE_QUERY || _mode == MODE_QUERYINS; }
bool edit_mode() const { return _mode == MODE_MOD || _mode == MODE_VIS || _mode == MODE_DEL; }
bool insert_mode() const { return _mode == MODE_QUERYINS || _mode == MODE_INS; }
virtual const char* get_caption() const;
virtual void set_caption(const char* c);
};
#endif // __MASK_H
#ifndef __MASK_H
#define __MASK_H
#ifndef __WINDOW_H
#include <window.h>
#endif
#ifndef __MASKFLD_H
#include <maskfld.h>
#endif
#ifndef __REAL_H
#include <real.h>
#endif
// @T
typedef bool (*MASK_HANDLER)(TMask& mask, KEY key);
enum TMaskmode { NO_MODE, MODE_INS , MODE_MOD , MODE_DEL ,
MODE_VIS , MODE_QUERY, MODE_QUERYINS,
MODE_SEARCH };
// @END
// @C
// Classe TMask : public TWindow
// @END
class TMask : public TWindow
{
// @DPRIV
enum { MAX_PAGES = 12 }; // Massimo numero di pagine nella maschera
WINDOW _pagewin[MAX_PAGES+1]; // Windows of the pages
int _pages; // Number of pages of the mask
int _page; // Current page
word _enabled; // Are pages enabled (bit field)
int _mode; // Mode of the mask
TArray _field; // Fields in the mask
int _first_focus; // First control to have focus
int _focus; // Control with focus
int _sheets; // Number of sheets
MASK_HANDLER _handler; // User defined key handler
TFilename _source_file; // Source file of the mask
TFilename _workfile; // Name of savefile
long _lastpos; // last read offset on savefile
real _exchange; // Current value exhange
protected:
// Ritorna la finestra della pagina corrente (Usare con attenzione)
WINDOW win() const { return _page == -1 ? NULL_WIN : _pagewin[_page]; }
WINDOW toolwin() const { return _pagewin[MAX_PAGES]; }
int find_field_win(WINDOW win) const; // number of field with window win
void set_mask_fields() const; // update screen
void load_checks() const; // load checks related fields
virtual void start_run(); // called when the mask starts to run
virtual TMask_field* parse_field(TScanner& scanner);
void init_mask(int mode);
WINDOW read_page(TScanner& scanner, bool toolbar = FALSE);
void read_mask(const char* name, int mode, int num);
void add_buttons();
int find_parent_page(const TMask_field&) const;
int find_first_field(WINDOW w, int dir) const;
int find_active_field(int first, int dir) const;
bool check_current_page(); // Check all the fields on the current page
void next_page(int p); // Show next/previous page
int curr_page() const { return _page; } // Current page number
void control_handler(EVENT* ep);
void handler(WINDOW win, EVENT* ep);
public:
// @FPUB
// crea leggendo descrizione da file .msk
TMask(const char* name, int mode = NO_MODE, int num = 0);
// crea mask vuota con parametri dati
TMask(const char* title, int pages, int cols, int rows, int xpos = -1,
int ypos = -1, int mode = NO_MODE);
virtual ~TMask();
const TFilename& source_file() const { return _source_file; }
// aggiunta campi a runtime
void add_static (short id, int page, const char* prompt, int x, int y,
const char* flags = "");
void add_string (short id, int page, const char* prompt, int x, int y,
int dim, const char* flags = "", int width = 0);
void add_number (short id, int page, const char* prompt, int x, int y,
int dim, const char* flags = "", int ndec = 0);
void add_date (short id, int page, const char* prompt, int x, int y,
const char* flags = "");
void add_button (short id, int page, const char* prompt, int x, int y,
int dx = 9, int dy = 1, const char* flags = "");
void add_radio(short id, int page, const char* prompt, int x, int y,
int dx, const char* codes, const char* items, const char* flags = "");
int fields() const { return _field.items(); }
int sheets() const { return _sheets; }
void set_mode(int m) { _mode = m; }
int mode() const { return _mode; }
void set_exchange(const real& e);
const real& exchange() const { return _exchange; }
bool check_fields();
void get_mask_fields(); // read screen contents
virtual bool stop_run(KEY key); // called to close the mask
virtual void open();
virtual void close();
virtual void enable(bool on) const;
int id2pos(short id) const;
TMask_field& fld(int i) const { return (TMask_field&)_field[i]; } // Ritorna il campo i-esimo della maschera
TMask_field& field(short id) const; // field with given id
void set(short fld_id, const char* str, bool hit=FALSE);
void set(short fld_id, long num, bool hit=FALSE);
const TString& get(short fld_id) const;
long get_long(short fld_id) const;
int get_int(short fld_id) const { return (int)get_long(fld_id); }
bool get_bool(short fld_id) const;
int first_focus(short id);
void set_focus();
void move_focus_field(int num);
void set_focus_win(WINDOW win, bool force);
int focus_field() const { return _focus;}
virtual bool on_key(KEY key);
void enable(short fld_id, bool on = TRUE); // Abilita un campo
void disable(short fld_id) { enable(fld_id, FALSE); }
void enable_default(short fld_id = -1);
void enable_page(int p, bool on = TRUE);
void disable_page(int p) { enable_page(p, FALSE); }
bool page_enabled(int p) const;
byte num_keys() const;
void enable_key(byte key, bool on = TRUE);
void disable_key(byte key) { enable_key(key, FALSE); }
short get_key_field(byte key, bool first) const;
bool key_valid(int key) const;
void show(short fld_id = -1, bool on = TRUE);
void hide(short fld_id = -1) { show(fld_id, FALSE); }
void show_default(short fld_id = -1);
void reset(short fld_id = -1);
void undo(short fld_id = -1);
void autoload(const TRelation* = NULL);
void autosave(TRelation* = NULL) const;
void send_key(KEY key, short id) const;
void set_handler(short fld_id, CONTROL_HANDLER handler);
void set_handler(MASK_HANDLER handler);
void set_workfile(const char* workfile) { _workfile = workfile; _lastpos = 0L;}
bool save(bool append = FALSE) const;
bool load(bool reset = FALSE);
short dirty() const; // Ritorna il primo campo dirty
bool no_mode() const { return _mode == NO_MODE; }
bool query_mode() const { return _mode == MODE_QUERY || _mode == MODE_QUERYINS; }
bool edit_mode() const { return _mode == MODE_MOD || _mode == MODE_VIS || _mode == MODE_DEL; }
bool insert_mode() const { return _mode == MODE_QUERYINS || _mode == MODE_INS; }
virtual const char* get_caption() const;
virtual void set_caption(const char* c);
};
#endif // __MASK_H

View File

@ -1,4 +1,4 @@
// $Id: maskfld.cpp,v 1.2 1994-08-17 14:05:45 guy Exp $
// $Id: maskfld.cpp,v 1.3 1994-08-23 13:52:21 guy Exp $
#include <xvt.h>
#include <applicat.h>
@ -1823,7 +1823,7 @@ 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_SHIFT_ENTER);
dispatch_e_char(get_parent(win()), K_AUTO_ENTER);
break;
}
}
@ -2053,29 +2053,49 @@ void TButton_field::create(WINDOW parent)
{
long flags = CTL_FLAG_CENTER_JUST;
if (_prompt.empty()) switch (dlg())
switch (dlg())
{
case DLG_OK:
_prompt = "Conferma";
if (_prompt.empty())
_prompt = "Conferma";
_virtual_key = _exit_key = K_ENTER;
flags |= CTL_FLAG_DEFAULT;
break;
case DLG_CANCEL:
_prompt = "Annulla";
if (_prompt.empty())
_prompt = "Annulla";
_virtual_key = _exit_key = K_ESC;
break;
case DLG_PGUP:
_prompt = "Pag <<"; break;
case DLG_PGDN:
_prompt = "Pag >>"; break;
case DLG_SAVEREC:
_prompt = "Registra"; break;
case DLG_QUIT:
_prompt = "Fine"; break;
if (_prompt.empty())
_prompt = "Fine";
_virtual_key = K_F4;
_exit_key = K_QUIT;
break;
default:
{
_exit_key = 0;
TToken_string* message = (TToken_string*)_message.objptr(0);
if (message != NULL)
{
TToken_string msg(message->get(0), ',');
const TFixed_string m(msg.get(0));
if (m == "EXIT")
_exit_key = msg.get_int();
else
if (msg.get_int() == 0) _exit_key = atoi(m);
}
const int n = _prompt.find('~');
_virtual_key = (n >= 0) ? toupper(_prompt[n+1]) : _exit_key;
}
break;
}
#if XWTWS == WMWS
_prompt.center_just(_width);
#endif
#endif
wincreate(WC_PUSHBUTTON, _width + 2, _size, _prompt, parent, flags);
}

View File

@ -1,4 +1,4 @@
/* $Id: maskfld.h,v 1.1.1.1 1994-08-12 10:51:57 alex Exp $ */
/* $Id: maskfld.h,v 1.2 1994-08-23 13:52:23 guy Exp $ */
#ifndef __MASKFLD_H
#define __MASKFLD_H
@ -17,8 +17,8 @@
class TMask_field;
class TRelation; // __RELATION_H
class TCursor;
class TFieldref;
class TCursor;
class TFieldref;
// @T
typedef bool (*CONTROL_HANDLER)(TMask_field& field, KEY key);
@ -33,167 +33,167 @@ enum CheckTime { RUNNING_CHECK, STARTING_CHECK, FINAL_CHECK };
class TMask_field : public TObject
{
// @DPRIV
friend class TMask;
// @DPRIV
friend class TMask;
TMask* _mask; // The mask the control belongs to
TMask* _mask; // The mask the control belongs to
TString _help; // Help message
TFieldref* _field; // Corresponding field on the file
TBit_array _keys; // The keys the field belongs to
TBit_array _groups; // The groups the field belongs to
TString _help; // Help message
TFieldref* _field; // Corresponding field on the file
TBit_array _keys; // The keys the field belongs to
TBit_array _groups; // The groups the field belongs to
protected:
// @DPROT
static int _x, _y; // Coordinate of the control
static int _width; // Size of the control
static TFixed_string _prompt;// Prompt of the field
CONTROL_HANDLER _handler;
// @DPROT
static int _x, _y; // Coordinate of the control
static int _width; // Size of the control
static TFixed_string _prompt;// Prompt of the field
CONTROL_HANDLER _handler;
int _size; // Max length of the string
int _size; // Max length of the string
WINDOW _win; // Window of the control (not its parent!)
WINDOW _promptwin; // Prompt of the control
short _dlg; // Identifier of the control
WINDOW _win; // Window of the control (not its parent!)
WINDOW _promptwin; // Prompt of the control
short _dlg; // Identifier of the control
int _validate_func; // Number of validation function
TArray _validate_parms; // Parameters for validation function
TArray _message; // Messages to send on modify
int _validate_func; // Number of validation function
TArray _validate_parms; // Parameters for validation function
TArray _message; // Messages to send on modify
struct TField_Flags
{
bool automagic : 1;
bool dirty : 1; // Modified during run ?
bool enabled : 1; // Is editable
bool enable_default : 1;
bool firm : 1; // Is the current firm ?
bool focusdirty : 1; // Modified during focus ?
bool ghost : 1;
bool persistent : 1;
bool rightjust : 1;
bool roman : 1; // Is a Roman number ?
bool showed : 1; // Is visible
bool show_default : 1;
bool uppercase : 1;
bool exchange : 1; // Value exchange
bool zerofilled : 1;
struct TField_Flags
{
bool automagic : 1;
bool dirty : 1; // Modified during run ?
bool enabled : 1; // Is editable
bool enable_default : 1;
bool firm : 1; // Is the current firm ?
bool focusdirty : 1; // Modified during focus ?
bool ghost : 1;
bool persistent : 1;
bool rightjust : 1;
bool roman : 1; // Is a Roman number ?
bool showed : 1; // Is visible
bool show_default : 1;
bool uppercase : 1;
bool exchange : 1; // Value exchange
bool zerofilled : 1;
TField_Flags();
char update(const char*);
} _flags;
TField_Flags();
char update(const char*);
} _flags;
void construct(TScanner& scanner, WINDOW parent);
void construct(short id, const char* prompt, int x, int y, int len,
WINDOW parent, const char* flags = "", int width = 0);
void construct(TScanner& scanner, WINDOW parent);
void construct(short id, const char* prompt, int x, int y, int len,
WINDOW parent, const char* flags = "", int width = 0);
virtual WINDOW win() const { return _win; }
virtual WINDOW win() const { return _win; }
WINDOW wincreate(WIN_TYPE ct, short dx, short dy,
const char* title, WINDOW parent, long flags);
int create_prompt(WINDOW parent, int width = 0, int heigth = 1);
WINDOW wincreate(WIN_TYPE ct, short dx, short dy,
const char* title, WINDOW parent, long flags);
int create_prompt(WINDOW parent, int width = 0, int heigth = 1);
long default_flags() const;
long default_flags() const;
virtual void parse_head(TScanner& scanner);
virtual bool parse_item(TScanner& scanner);
virtual void parse_head(TScanner& scanner);
virtual bool parse_item(TScanner& scanner);
virtual void create(WINDOW parent);
virtual void destroy();
virtual void create(WINDOW parent);
virtual void destroy();
virtual const char* get_window_data() const;
virtual void set_window_data(const char* data);
virtual const char* get_window_data() const;
virtual void set_window_data(const char* data);
virtual void set_field_data(const char* data);
virtual const char* get_field_data() const;
virtual const char* get_field_data() const;
bool do_message(int n);
bool do_message(int n);
public:
// @FPUB
short atodlg(const char* s) const;
// @FPUB
short atodlg(const char* s) const;
WINDOW parent() const;
short dlg() const { return _dlg; }
virtual bool ok() const;
bool dirty() const { return _flags.dirty; }
bool focusdirty() const { return _flags.focusdirty; }
void set_focusdirty(bool d = TRUE) { _flags.focusdirty = d; }
void set_dirty(bool d = TRUE) { _flags.dirty = d; set_focusdirty(d); }
WINDOW parent() const;
short dlg() const { return _dlg; }
virtual bool ok() const;
bool dirty() const { return _flags.dirty; }
bool focusdirty() const { return _flags.focusdirty; }
void set_focusdirty(bool d = TRUE) { _flags.focusdirty = d; }
void set_dirty(bool d = TRUE) { _flags.dirty = d; set_focusdirty(d); }
virtual const char* class_name() const;
virtual word class_id() const;
int size() const { return _size; }
virtual const char* class_name() const;
virtual word class_id() const;
int size() const { return _size; }
bool roman() const { return _flags.roman; }
bool automagic() const { return _flags.automagic; }
bool ghost() const { return _flags.ghost; }
bool roman() const { return _flags.roman; }
bool automagic() const { return _flags.automagic; }
bool ghost() const { return _flags.ghost; }
virtual bool has_check() const { return FALSE;}
virtual bool has_query() const { return FALSE;}
virtual bool has_message() const { return _message.items() > 0; }
virtual bool has_check() const { return FALSE;}
virtual bool has_query() const { return FALSE;}
virtual bool has_message() const { return _message.items() > 0; }
virtual CheckType check_type() const { return CHECK_NONE; }
bool required() const { return check_type() == CHECK_REQUIRED; }
virtual bool check(CheckTime = RUNNING_CHECK) { return TRUE;}
virtual CheckType check_type() const { return CHECK_NONE; }
bool required() const { return check_type() == CHECK_REQUIRED; }
virtual bool check(CheckTime = RUNNING_CHECK) { return TRUE;}
virtual void reset();
virtual void reset();
virtual void enable(bool on = TRUE);
void disable() { enable(FALSE); }
bool enabled() const { return _flags.enabled; }
void enable_default();
virtual void enable(bool on = TRUE);
void disable() { enable(FALSE); }
bool enabled() const { return _flags.enabled; }
void enable_default();
virtual void show(bool on = TRUE);
void hide() { show(FALSE); }
bool showed() const { return _flags.showed; }
void show_default();
virtual void show(bool on = TRUE);
void hide() { show(FALSE); }
bool showed() const { return _flags.showed; }
void show_default();
bool active() const; // Is visible and enabled?
bool active() const; // Is visible and enabled?
void set_handler(CONTROL_HANDLER handler) { _handler = handler; }
void set_handler(CONTROL_HANDLER handler) { _handler = handler; }
bool is_edit() const;
bool to_check(KEY k, bool checkrun = FALSE) const;
bool is_edit() const;
bool to_check(KEY k, bool checkrun = FALSE) const;
virtual bool on_hit();
virtual bool on_key(KEY key);
virtual bool on_hit();
virtual bool on_key(KEY key);
void set(const char* s);
TString& get() const;
virtual const char* picture_data(const char* data, bool video);
void set(const char* s);
TString& get() const;
virtual const char* picture_data(const char* data, bool video);
bool autoload(const TRelation* r = NULL);
bool autosave(TRelation* r = NULL) const;
bool autoload(const TRelation* r = NULL);
bool autosave(TRelation* r = NULL) const;
void undo();
void undo();
const char* prompt() const;
void set_prompt(const char* p);
const char* prompt() const;
void set_prompt(const char* p);
bool in_key(byte key) const { return _keys[key]; }
void set_key(byte key) { _keys.set(long(key)); _keys.set(0L);}
word last_key() const;
bool in_key(byte key) const { return _keys[key]; }
void set_key(byte key) { _keys.set(long(key)); _keys.set(0L);}
word last_key() const;
bool in_group(byte group) const { return _groups[group]; }
void set_group(byte group) { _groups.set(long(group)); _groups.set(0L);}
bool in_group(byte group) const { return _groups[group]; }
void set_group(byte group) { _groups.set(long(group)); _groups.set(0L);}
const TFieldref* field() const { return _field; }
void set_focus() const;
const TFieldref* field() const { return _field; }
void set_focus() const;
// set focus, message-box, set focus
bool message_box(const char* fmt, ...) const;
bool warning_box(const char* fmt, ...) const;
bool error_box(const char* fmt, ...) const;
bool yesno_box(const char* fmt, ...) const;
KEY yesnocancel_box(const char* fmt, ...) const;
// set focus, message-box, set focus
bool message_box(const char* fmt, ...) const;
bool warning_box(const char* fmt, ...) const;
bool error_box(const char* fmt, ...) const;
bool yesno_box(const char* fmt, ...) const;
KEY yesnocancel_box(const char* fmt, ...) const;
TMask& mask() const { return *_mask; }
TMask_field(TMask* mask);
virtual ~TMask_field();
TMask& mask() const { return *_mask; }
TMask_field(TMask* mask);
virtual ~TMask_field();
};
@ -208,57 +208,57 @@ class TEdit_field : public TMask_field
friend class TList_sheet;
protected:
// @DPROT
TString _str;
TString _picture;
TString _warning;
CheckType _check; // Accettabilita' di valori nulli
bool _forced;
bool _check_enabled; // Abilitato
// @DPROT
TString _str;
TString _picture;
TString _warning;
CheckType _check; // Accettabilita' di valori nulli
bool _forced;
bool _check_enabled; // Abilitato
TBrowse* _browse;
TList_sheet* _sheet;
WINDOW _buttonwin;
TBrowse* _browse;
TList_sheet* _sheet;
WINDOW _buttonwin;
const TBrowse* get_browse(TScanner& scanner) const;
const TBrowse* get_browse(TScanner& scanner) const;
virtual word class_id() const;
virtual void parse_head(TScanner& scanner);
virtual bool parse_item(TScanner& scanner);
virtual void show(bool on);
virtual void enable(bool on);
virtual word class_id() const;
virtual void parse_head(TScanner& scanner);
virtual bool parse_item(TScanner& scanner);
virtual void show(bool on);
virtual void enable(bool on);
virtual void create(WINDOW parent);
virtual void destroy();
virtual void create(WINDOW parent);
virtual void destroy();
bool validate(KEY k);
bool validate(KEY k);
virtual void set_window_data(const char* data);
virtual void set_field_data(const char* data);
virtual const char* get_field_data() const;
virtual void set_window_data(const char* data);
virtual void set_field_data(const char* data);
virtual const char* get_field_data() const;
public:
// @FPUB
virtual bool on_hit();
virtual bool on_key(KEY key);
virtual bool has_check() const;
virtual bool has_query() const { return _browse || _sheet;}
virtual const char* picture_data(const char* data, bool video);
virtual CheckType check_type() const { return _check; }
void check_type(CheckType c) { _check = c; }
// @FPUB
virtual bool on_hit();
virtual bool on_key(KEY key);
virtual bool has_check() const;
virtual bool has_query() const { return _browse || _sheet;}
virtual const char* picture_data(const char* data, bool video);
virtual CheckType check_type() const { return _check; }
void check_type(CheckType c) { _check = c; }
bool forced() const { return _forced;}
virtual bool check(CheckTime = RUNNING_CHECK);
TBrowse* browse() const { return _browse;}
void enable_check(bool on = TRUE) ;
bool check_enabled() const { return _check_enabled;}
bool forced() const { return _forced;}
virtual bool check(CheckTime = RUNNING_CHECK);
TBrowse* browse() const { return _browse;}
void enable_check(bool on = TRUE) ;
bool check_enabled() const { return _check_enabled;}
const char* format(const char* data);
const char* picture() const { return _picture; }
const char* format(const char* data);
const char* picture() const { return _picture; }
TEdit_field(TMask* mask);
virtual ~TEdit_field();
TEdit_field(TMask* mask);
virtual ~TEdit_field();
};
@ -268,56 +268,56 @@ public:
class TBrowse
{
TEdit_field* _fld; // The field owning the sheet
TRelation* _relation; // Main relation
TCursor* _cursor; // Cursor on the relation
TString _insert;
TString _filter;
long _rec;
bool _secondary;
bool _checked;
TEdit_field* _fld; // The field owning the sheet
TRelation* _relation; // Main relation
TCursor* _cursor; // Cursor on the relation
TString _insert;
TString _filter;
long _rec;
bool _secondary;
bool _checked;
TToken_string _head, _items;
TToken_string _inp_id, _inp_fn;
TToken_string _out_id, _out_fn;
TToken_string _head, _items;
TToken_string _inp_id, _inp_fn;
TToken_string _out_id, _out_fn;
protected:
void do_output(CheckTime = RUNNING_CHECK);
void do_clear();
bool do_insert();
void do_output(CheckTime = RUNNING_CHECK);
void do_clear();
bool do_insert();
TMask_field& field(short n) const;
TMask_field& field(short n) const;
TToken_string& create_siblings(TToken_string& siblings);
public:
int do_input(bool filter = FALSE); // Serve ai TCursor_sheet
int do_input(bool filter = FALSE); // Serve ai TCursor_sheet
TBrowse(TEdit_field* f, TRelation* r, int key = 1, const char* filter = "");
TBrowse(TEdit_field* f, TCursor* c);
~TBrowse();
TBrowse(TEdit_field* f, TRelation* r, int key = 1, const char* filter = "");
TBrowse(TEdit_field* f, TCursor* c);
~TBrowse();
void parse_join(TScanner& scanner);
void parse_input(TScanner& scanner);
void parse_display(TScanner& scanner);
void parse_output(TScanner& scanner);
void parse_insert(TScanner& scanner);
bool parse_copy(const TString& what, const TBrowse* b);
void parse_join(TScanner& scanner);
void parse_input(TScanner& scanner);
void parse_display(TScanner& scanner);
void parse_output(TScanner& scanner);
void parse_insert(TScanner& scanner);
bool parse_copy(const TString& what, const TBrowse* b);
void set_insert(const char* s) { _insert = s;}
const TString& get_insert() const { return _insert;}
const TString& get_filter() const { return _filter;}
void set_insert(const char* s) { _insert = s;}
const TString& get_insert() const { return _insert;}
const TString& get_filter() const { return _filter;}
TEdit_field& field() {return *_fld;}
TEdit_field& field() {return *_fld;}
bool check(CheckTime = RUNNING_CHECK);
bool empty_check();
const TToken_string& head() const { return _head;}
const TToken_string& items() const { return _items;}
TCursor* cursor() const { return _cursor;}
bool checked() const { return _checked;}
bool secondary() const { return _secondary;}
bool check(CheckTime = RUNNING_CHECK);
bool empty_check();
const TToken_string& head() const { return _head;}
const TToken_string& items() const { return _items;}
TCursor* cursor() const { return _cursor;}
bool checked() const { return _checked;}
bool secondary() const { return _secondary;}
KEY run();
KEY run();
};
@ -330,23 +330,23 @@ class TReal_field : public TEdit_field
int _decimals;
protected:
// @FPROT
virtual word class_id() const;
// @FPROT
virtual word class_id() const;
virtual const char* get_window_data() const;
virtual void set_window_data(const char* data);
virtual const char* get_window_data() const;
virtual void set_window_data(const char* data);
virtual void create(WINDOW parent);
virtual void parse_head(TScanner& scanner);
virtual bool on_key(KEY key);
virtual void create(WINDOW parent);
virtual void parse_head(TScanner& scanner);
virtual bool on_key(KEY key);
public:
// @FPUB
void set_decimals(int d); // Set precision & picture
int decimals() const { return _decimals; } // Get precision
void exchange(const real& o, const real& n); // Change value / o * n
// @FPUB
void set_decimals(int d); // Set precision & picture
int decimals() const { return _decimals; } // Get precision
void exchange(const real& o, const real& n); // Change value / o * n
TReal_field(TMask* mask);
TReal_field(TMask* mask);
};
@ -357,15 +357,15 @@ public:
class TDate_field : public TEdit_field
{
protected:
// @FPROT
virtual word class_id() const;
virtual void create(WINDOW parent);
virtual bool on_key(KEY key);
// @FPROT
virtual word class_id() const;
virtual void create(WINDOW parent);
virtual bool on_key(KEY key);
public:
// @FPUB
void parse_head(TScanner& scanner);
TDate_field(TMask* mask);
// @FPUB
void parse_head(TScanner& scanner);
TDate_field(TMask* mask);
};
@ -376,24 +376,24 @@ public:
class TBoolean_field : public TMask_field
{
protected:
// @DPROT
bool _on;
// @DPROT
bool _on;
virtual word class_id() const;
virtual word class_id() const;
virtual void create(WINDOW parent);
virtual const char* get_window_data() const;
virtual void set_window_data(const char* data);
virtual void set_field_data(const char* data = NULL);
virtual const char* get_field_data() const;
virtual bool parse_item(TScanner& scanner);
virtual void enable(bool on);
virtual bool on_hit();
virtual bool on_key(KEY key);
virtual void create(WINDOW parent);
virtual const char* get_window_data() const;
virtual void set_window_data(const char* data);
virtual void set_field_data(const char* data = NULL);
virtual const char* get_field_data() const;
virtual bool parse_item(TScanner& scanner);
virtual void enable(bool on);
virtual bool on_hit();
virtual bool on_key(KEY key);
public:
// @FPUB
TBoolean_field(TMask* mask);
// @FPUB
TBoolean_field(TMask* mask);
};
@ -403,43 +403,43 @@ public:
class TList_field : public TMask_field
{
// @FPRIV
void add_list();
// @FPRIV
void add_list();
protected:
// @FPROT
TToken_string _values;
TToken_string _codes;
TString _str;
// @FPROT
TToken_string _values;
TToken_string _codes;
TString _str;
virtual word class_id() const;
virtual word class_id() const;
virtual void set_window_data(const char* data);
virtual const char* get_window_data() const;
virtual void set_field_data(const char* data = NULL);
virtual const char* get_field_data() const;
// virtual const char* picture_data(const char* data, bool video);
virtual void create(WINDOW parent);
virtual void set_window_data(const char* data);
virtual const char* get_window_data() const;
virtual void set_field_data(const char* data = NULL);
virtual const char* get_field_data() const;
// virtual const char* picture_data(const char* data, bool video);
virtual void create(WINDOW parent);
virtual void current(int n);
virtual int current() const;
virtual void current(int n);
virtual int current() const;
int str2curr(const char* data);
virtual bool on_hit();
virtual bool on_key(KEY key);
virtual void read_item(TScanner& scanner);
int str2curr(const char* data);
virtual bool on_hit();
virtual bool on_key(KEY key);
virtual void read_item(TScanner& scanner);
virtual void parse_head(TScanner& scanner);
virtual bool parse_item(TScanner& scanner);
virtual void parse_head(TScanner& scanner);
virtual bool parse_item(TScanner& scanner);
public:
// @FPUB
TList_field(TMask* mask);
virtual void replace_items(const char* codes, const char* values);
virtual void add_item(const char* code_value);
// @FPUB
TList_field(TMask* mask);
virtual void replace_items(const char* codes, const char* values);
virtual void add_item(const char* code_value);
virtual void delete_item(const char* code);
int items() const;
int items() const;
};
@ -451,29 +451,29 @@ class TRadio_field : public TList_field
{
enum { MAX_RADIO = 8 };
// @FPRIV
int _nitems;
// @FPRIV
int _nitems;
int _active_item;
WINDOW _radio_ctl_win[MAX_RADIO];
protected:
// @FPROT
virtual word class_id() const;
virtual void create(WINDOW parent);
virtual void destroy();
virtual void enable(bool on);
virtual void show(bool on);
// @FPROT
virtual word class_id() const;
virtual void create(WINDOW parent);
virtual void destroy();
virtual void enable(bool on);
virtual void show(bool on);
virtual void current(int n);
virtual int current() const;
WINDOW win() const { return _radio_ctl_win[_active_item]; }
virtual void current(int n);
virtual int current() const;
WINDOW win() const { return _radio_ctl_win[_active_item]; }
public:
// @FPUB
TRadio_field(TMask* mask);
// @FPUB
TRadio_field(TMask* mask);
void check_radiobutton(WINDOW checked);
bool move_focus(int d);
void check_radiobutton(WINDOW checked);
bool move_focus(int d);
};
@ -483,21 +483,25 @@ public:
// @END
class TButton_field : public TMask_field
{
{
KEY _virtual_key, _exit_key;
protected:
// @FPROT
virtual word class_id() const;
virtual void create(WINDOW parent);
// @FPROT
virtual word class_id() const;
virtual void create(WINDOW parent);
void parse_head(TScanner& scanner);
bool parse_item(TScanner& scanner);
virtual void enable(bool);
virtual void show(bool);
virtual bool on_key(KEY key);
void parse_head(TScanner& scanner);
bool parse_item(TScanner& scanner);
virtual void enable(bool);
virtual void show(bool);
virtual bool on_key(KEY key);
public:
// @FPUB
// @FPUB
TButton_field(TMask* mask);
KEY virtual_key() const { return _virtual_key; }
KEY exit_key() const { return _exit_key; }
};
@ -508,12 +512,12 @@ public:
class TGroup_field : public TMask_field
{
protected:
// @DPROT
// @DPROT
virtual void parse_head(TScanner& scanner);
virtual void create(WINDOW parent);
public:
// @FPUB
// @FPUB
TGroup_field(TMask* mask);
};

View File

@ -609,6 +609,14 @@ break;
}
set_focus_cell(cur_row, cur_col);
check_enabled = TRUE; // Enable checks
}
break;
case K_PREV:
case K_NEXT:
{
XI_OBJ* itf = xi_get_itf(win());
const bool ok = (bool)xi_move_focus(itf);
if (ok) dispatch_e_char(parent(), k);
}
break;
/*

View File

@ -1,4 +1,4 @@
// $Id: relapp.cpp,v 1.2 1994-08-17 14:08:21 guy Exp $
// $Id: relapp.cpp,v 1.3 1994-08-23 13:52:26 guy Exp $
#include <mailbox.h>
#include <sheet.h>
#include <urldefid.h>
@ -676,7 +676,7 @@ bool TRelation_application::main_loop()
KEY k;
// Provoca l'autopremimento per il messaggio di LINK
if (_lnflag) _mask->send_key(K_SHIFT_ENTER, 0);
if (_lnflag) _mask->send_key(K_CTRL_ENTER, 0);
do
{

File diff suppressed because it is too large Load Diff

View File

@ -1,31 +1,36 @@
BUTTON DLG_SAVEREC 8 2
BEGIN
PROMPT -16 -1 ""
END
BUTTON DLG_NEWREC 8 2
BEGIN
PROMPT -26 -1 "Nuovo"
END
BUTTON DLG_DELREC 8 2
BEGIN
PROMPT -36 -1 "Elimina"
END
BUTTON DLG_FINDREC 8 2
BEGIN
PROMPT -46 -1 "Ricerca"
END
BUTTON DLG_CANCEL 8 2
BEGIN
PROMPT -56 -1 ""
END
BUTTON DLG_QUIT 8 2
BEGIN
PROMPT -66 -1 ""
END
BUTTON DLG_SAVEREC 8 2
BEGIN
PROMPT -16 -1 "~Registra"
MESSAGE EXIT,K_SAVE
END
BUTTON DLG_NEWREC 8 2
BEGIN
PROMPT -26 -1 "~Nuovo"
MESSAGE EXIT,K_INS
END
BUTTON DLG_DELREC 8 2
BEGIN
PROMPT -36 -1 "~Elimina"
MESSAGE EXIT,K_DEL
END
BUTTON DLG_FINDREC 8 2
BEGIN
PROMPT -46 -1 "Ricerca"
MESSAGE EXIT,K_F9
END
BUTTON DLG_CANCEL 8 2
BEGIN
PROMPT -56 -1 ""
MESSAGE EXIT,K_ESC
END
BUTTON DLG_QUIT 8 2
BEGIN
PROMPT -66 -1 ""
MESSAGE EXIT,K_QUIT
END

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

View File

@ -1,215 +1,216 @@
#ifndef __WINDOW_H
#define __WINDOW_H
#ifndef __XVTILITY_H
#include <xvtility.h>
#endif
void close_all_dialogs();
bool can_close();
// @C
// Classe TPoint
// @END
// @N
// Punto dello schermo
// @END
struct TPoint
{
// @DPUB
long x, y;
// Coordinate
// @FPUB
TPoint(long sx = 0, long sy = 0) : x(sx), y(sy) {}
// Costruttore
TPoint(PNT pnt) : x(pnt.h/CHARX), y(pnt.v/CHARY) {}
void set(long sx, long sy) { x = sx; y = sy; }
void set(PNT pnt) { x = pnt.h/CHARX; y = pnt.v/CHARY; }
TPoint& operator= (PNT pnt) { set(pnt); return *this; }
TPoint& operator= (TPoint pnt) { set(pnt.x,pnt.y); return *this; }
bool operator ==(const TPoint& p) { return p.x == x && p.y == y; }
bool operator !=(const TPoint& p) { return p.x != x || p.y != y; }
};
// @C
// Classe TWindow
//
// @END
class TWindow
{
friend class TWindow_manager;
// @DPRIV
static DRAW_CTOOLS _ct; // Set di drawing tools (xvttype.h)
static bool _ctools_saved; // E' stata salvata _ct ?
WINDOW _win; // Descrittore finestra
KEY _lastkey; // Tasto di uscita
// @FPRIV
bool save_ctools(); // Compila la struct _ct con i valori correnti
bool restore_ctools(); // Ripristina i valori DA _ct
protected:
// @DPROT
bool _open : 1; // Se la finestra e' aperta
bool _modal : 1; // Se la finestra e' modale
bool _running : 1; // Se la finestra e' in esecuzione
// @FPROT
static long window_handler(WINDOW win, EVENT* ep);
virtual WINDOW create(short x, short y, short dx, short dy,
const char* title = "", long flags = WSF_NONE,
WIN_TYPE rt = W_DOC, WINDOW parent = NULL_WIN) ;
void set_win(WINDOW w) { _win = w; } // Usare con cautela
void set_modal(bool m) { _modal = m; } // Modifica il flag _modal
WINDOW parent() const;
virtual void update() {} // E_UPDATE
virtual bool on_key(KEY) { return TRUE; } // E_CHAR
virtual PNT log2dev(long x, long y) const;
virtual TPoint dev2log(const PNT& p) const;
public:
// @FPUB
TWindow(); // Costruttore
virtual ~TWindow();
virtual void handler(WINDOW win, EVENT* ep); // Handler finestra
virtual void set_focus(); // Mette la finestra in primo piano
virtual WINDOW win() const { return _win; } // Ritorna il descrittore della finestra
bool is_open() const { return _open; } // Ritorna _open
bool is_modal() const { return _modal; } // Ritorna _modal
bool is_running() const { return _running; } // Ritorna _running
TPoint size() const; // Determina numero di righe e colonne nella finestra
short rows() const { return (short)size().y; }// Ritorna numero di righe
short columns() const { return (short)size().x; } // Ritorna numero di colonne
virtual void start_run() {}
virtual bool stop_run(KEY key);
void force_update(); // Forza ridisegno della finestra
virtual void open(); // Mostra la finestra
virtual void close(); // Nasconde la finestra
void iconize() const;
void maximize() const;
virtual void enable(bool = TRUE) const;
void disable() const { enable(FALSE); }
void open_modal(); // Mostra la finestra modale
void close_modal(); // Nasconde la finestra modale
KEY run(); // Esegue la finestra
KEY last_key() const { return _lastkey; } // Ritorna l'ultimo tasto
virtual void set_caption(const char* title);
virtual const char* get_caption() const;
// Riempie la finestra con il colore in color
void clear(COLOR color);
// Setta il draw mode
void set_mode(DRAW_MODE mode);
// Setta il colore
void set_color(COLOR fore, COLOR back);
// Setta opaque_text. Quando e' FALSE il testo viene scritto in modo trasparente
void set_opaque_text(bool o);
// Sceglie penna con colore color eccetera
void set_pen(COLOR color, int width = 1, PAT_STYLE pat = PAT_SOLID, PEN_STYLE st = P_SOLID);
void hide_pen(); // Nasconde la penna
void hide_brush(); // Nasconde il pennello
void set_brush(COLOR color, PAT_STYLE = PAT_SOLID); // Sceglie pennello con colore color
void set_font(int family = FF_SYSTEM, int style = 0, int dim = 0); // Sceglie il font
// Disegna un rettangolo con la possibilita' di settare la penna e il draw_mode
void frame(short left, short top, short right, short bottom, int flag);
// Queste funzioni chiamano tutte frame con diversi flag
void rect(short left, short top, short right, short bottom);
void bar(short left, short top, short right, short bottom);
void invert_bar(short left, short top, short right, short bottom);
void stringat(short x, short y, const char* str);
void printat(short x, short y, const char* fmt, ...); // Scrive un testo nella finestra alla posizione indicata
void line(short x0, short y0, short x1, short y1); // Disegna una linea nella finestra
void icon(short x0, short y0, int iconid = -1);
};
class TTemp_window : public TWindow
{
public:
TTemp_window(WINDOW w);
virtual ~TTemp_window();
};
// @C
// Classe TScroll_window : public TWindow
//
// Finestra con scrollbar
//
// @END
class TScroll_window : public TWindow
{
// @DPRIV
TPoint _origin;
TPoint _max;
short _shift;
bool _autoscroll : 1;
bool _has_hscroll : 1;
bool _has_vscroll : 1;
protected:
// @FPROT
virtual WINDOW create(short x, short y, short dx, short dy,
const char* title = "", long flags = WSF_NONE,
WIN_TYPE rt = W_DOC, WINDOW parent = NULL_WIN) ; // Crea la finestra
virtual PNT log2dev(long x, long y) const;
virtual bool on_key(KEY key);
public:
// @FPUB
TScroll_window();
// Costruttore
virtual void handler(WINDOW win, EVENT* ep);
void set_scroll_max(long maxx, long maxy);
// Setta punto di massimo scroll
void update_thumb(long x = -1, long y = -1);
// Aggiorna la scrollbar
void autoscroll(bool on) { _autoscroll = on; }
// Setta autoscroll
bool autoscrolling() const { return _autoscroll; }
const TPoint& origin() const { return _origin; }
// Ritorna punto origine
const TPoint& range() const { return _max; }
// Ritorna punto massimo
};
#endif // __WINDOW_H
#ifndef __WINDOW_H
#define __WINDOW_H
#ifndef __XVTILITY_H
#include <xvtility.h>
#endif
void close_all_dialogs();
bool can_close();
WINDOW cur_win();
// @C
// Classe TPoint
// @END
// @N
// Punto dello schermo
// @END
struct TPoint
{
// @DPUB
long x, y;
// Coordinate
// @FPUB
TPoint(long sx = 0, long sy = 0) : x(sx), y(sy) {}
// Costruttore
TPoint(PNT pnt) : x(pnt.h/CHARX), y(pnt.v/CHARY) {}
void set(long sx, long sy) { x = sx; y = sy; }
void set(PNT pnt) { x = pnt.h/CHARX; y = pnt.v/CHARY; }
TPoint& operator= (PNT pnt) { set(pnt); return *this; }
TPoint& operator= (TPoint pnt) { set(pnt.x,pnt.y); return *this; }
bool operator ==(const TPoint& p) { return p.x == x && p.y == y; }
bool operator !=(const TPoint& p) { return p.x != x || p.y != y; }
};
// @C
// Classe TWindow
//
// @END
class TWindow
{
friend class TWindow_manager;
// @DPRIV
static DRAW_CTOOLS _ct; // Set di drawing tools (xvttype.h)
static bool _ctools_saved; // E' stata salvata _ct ?
WINDOW _win; // Descrittore finestra
KEY _lastkey; // Tasto di uscita
// @FPRIV
bool save_ctools(); // Compila la struct _ct con i valori correnti
bool restore_ctools(); // Ripristina i valori DA _ct
protected:
// @DPROT
bool _open : 1; // Se la finestra e' aperta
bool _modal : 1; // Se la finestra e' modale
bool _running : 1; // Se la finestra e' in esecuzione
// @FPROT
static long window_handler(WINDOW win, EVENT* ep);
virtual WINDOW create(short x, short y, short dx, short dy,
const char* title = "", long flags = WSF_NONE,
WIN_TYPE rt = W_DOC, WINDOW parent = NULL_WIN) ;
void set_win(WINDOW w) { _win = w; } // Usare con cautela
void set_modal(bool m) { _modal = m; } // Modifica il flag _modal
WINDOW parent() const;
virtual void update() {} // E_UPDATE
virtual bool on_key(KEY) { return TRUE; } // E_CHAR
virtual PNT log2dev(long x, long y) const;
virtual TPoint dev2log(const PNT& p) const;
public:
// @FPUB
TWindow(); // Costruttore
virtual ~TWindow();
virtual void handler(WINDOW win, EVENT* ep); // Handler finestra
virtual void set_focus(); // Mette la finestra in primo piano
virtual WINDOW win() const { return _win; } // Ritorna il descrittore della finestra
bool is_open() const { return _open; } // Ritorna _open
bool is_modal() const { return _modal; } // Ritorna _modal
bool is_running() const { return _running; } // Ritorna _running
TPoint size() const; // Determina numero di righe e colonne nella finestra
short rows() const { return (short)size().y; }// Ritorna numero di righe
short columns() const { return (short)size().x; } // Ritorna numero di colonne
virtual void start_run() {}
virtual bool stop_run(KEY key);
void force_update(); // Forza ridisegno della finestra
virtual void open(); // Mostra la finestra
virtual void close(); // Nasconde la finestra
void iconize() const;
void maximize() const;
virtual void enable(bool = TRUE) const;
void disable() const { enable(FALSE); }
void open_modal(); // Mostra la finestra modale
void close_modal(); // Nasconde la finestra modale
KEY run(); // Esegue la finestra
KEY last_key() const { return _lastkey; } // Ritorna l'ultimo tasto
virtual void set_caption(const char* title);
virtual const char* get_caption() const;
// Riempie la finestra con il colore in color
void clear(COLOR color);
// Setta il draw mode
void set_mode(DRAW_MODE mode);
// Setta il colore
void set_color(COLOR fore, COLOR back);
// Setta opaque_text. Quando e' FALSE il testo viene scritto in modo trasparente
void set_opaque_text(bool o);
// Sceglie penna con colore color eccetera
void set_pen(COLOR color, int width = 1, PAT_STYLE pat = PAT_SOLID, PEN_STYLE st = P_SOLID);
void hide_pen(); // Nasconde la penna
void hide_brush(); // Nasconde il pennello
void set_brush(COLOR color, PAT_STYLE = PAT_SOLID); // Sceglie pennello con colore color
void set_font(int family = FF_SYSTEM, int style = 0, int dim = 0); // Sceglie il font
// Disegna un rettangolo con la possibilita' di settare la penna e il draw_mode
void frame(short left, short top, short right, short bottom, int flag);
// Queste funzioni chiamano tutte frame con diversi flag
void rect(short left, short top, short right, short bottom);
void bar(short left, short top, short right, short bottom);
void invert_bar(short left, short top, short right, short bottom);
void stringat(short x, short y, const char* str);
void printat(short x, short y, const char* fmt, ...); // Scrive un testo nella finestra alla posizione indicata
void line(short x0, short y0, short x1, short y1); // Disegna una linea nella finestra
void icon(short x0, short y0, int iconid = -1);
};
class TTemp_window : public TWindow
{
public:
TTemp_window(WINDOW w);
virtual ~TTemp_window();
};
// @C
// Classe TScroll_window : public TWindow
//
// Finestra con scrollbar
//
// @END
class TScroll_window : public TWindow
{
// @DPRIV
TPoint _origin;
TPoint _max;
short _shift;
bool _autoscroll : 1;
bool _has_hscroll : 1;
bool _has_vscroll : 1;
protected:
// @FPROT
virtual WINDOW create(short x, short y, short dx, short dy,
const char* title = "", long flags = WSF_NONE,
WIN_TYPE rt = W_DOC, WINDOW parent = NULL_WIN) ; // Crea la finestra
virtual PNT log2dev(long x, long y) const;
virtual bool on_key(KEY key);
public:
// @FPUB
TScroll_window();
// Costruttore
virtual void handler(WINDOW win, EVENT* ep);
void set_scroll_max(long maxx, long maxy);
// Setta punto di massimo scroll
void update_thumb(long x = -1, long y = -1);
// Aggiorna la scrollbar
void autoscroll(bool on) { _autoscroll = on; }
// Setta autoscroll
bool autoscrolling() const { return _autoscroll; }
const TPoint& origin() const { return _origin; }
// Ritorna punto origine
const TPoint& range() const { return _max; }
// Ritorna punto massimo
};
#endif // __WINDOW_H

View File

@ -107,11 +107,13 @@ HIDDEN BOOLEAN event_hook(HWND hwnd,
ULONG lparam,
long* ret)
{
if (msg == WM_CTLCOLOR)
switch(msg)
{
case WM_CTLCOLOR:
{
const word type = HIWORD(lparam);
if (type == CTLCOLOR_LISTBOX || type == CTLCOLOR_EDIT ||
if (type == CTLCOLOR_LISTBOX || type == CTLCOLOR_EDIT ||
type == CTLCOLOR_MSGBOX)
{
HWND hwnd = LOWORD(lparam);
@ -137,44 +139,64 @@ HIDDEN BOOLEAN event_hook(HWND hwnd,
*ret = focus ? FocusBrush : NormalBrush;
return TRUE;
}
} else
if (msg == WM_COMMAND)
}
break;
case WM_COMMAND:
{
const word notify = HIWORD(lparam);
if (notify == EN_KILLFOCUS || notify == EN_SETFOCUS)
{
HWND hwnd = LOWORD(lparam); // Ridisegna BENE il campo
InvalidateRect(hwnd, NULL, TRUE);
}
}
break;
case WM_KEYDOWN:
if (wparam == VK_PRIOR || wparam == VK_NEXT ||
wparam == VK_UP || wparam == VK_DOWN )
{
char name[16];
GetClassName(hwnd, name, 5);
if (stricmp(name, "Edit") == 0)
{
KEY key;
switch(wparam)
{
word notify = HIWORD(lparam);
if (notify == EN_KILLFOCUS || notify == EN_SETFOCUS)
{
HWND hwnd = LOWORD(lparam);
InvalidateRect(hwnd, NULL, TRUE);
}
} else
if (msg == WM_KEYUP)
{
if (wparam == VK_PRIOR || wparam == VK_NEXT ||
wparam == VK_UP || wparam == VK_DOWN )
{
char name[16];
GetClassName(hwnd, name, 15);
if (stricmp(name, "Edit") == 0)
{
switch(wparam)
{
case VK_PRIOR:wparam = K_PREV; break;
case VK_NEXT :wparam = K_NEXT; break;
case VK_UP :wparam = K_UP; break;
case VK_DOWN :wparam = K_DOWN; break;
default:wparam = 0; break;
}
if (wparam)
{
WINDOW w = xvtwi_hwnd_to_window(GetParent(hwnd));
dispatch_e_char(w, wparam);
}
}
}
}
case VK_PRIOR:
wparam = K_PREV; break;
case VK_NEXT:
key = K_NEXT; break;
case VK_UP:
key = K_UP; break;
case VK_DOWN:
key = K_DOWN; break;
default:
key = 0; break;
}
if (key > 0)
{
WINDOW w = cur_win();
if (w != NULL_WIN)
dispatch_e_char(w, key);
}
}
}
break;
case WM_MENUCHAR:
{
WINDOW w = cur_win();
if (w != NULL_WIN)
{
const KEY key = toupper(wparam)+K_CTRL;
dispatch_e_char(w, key);
}
}
break;
default:
break;
}
return FALSE;
return FALSE;
}
#endif
@ -671,6 +693,7 @@ int xvt_get_checked_radio(const WINDOW* ctls, int count)
///////////////////////////////////////////////////////////
HIDDEN WINDOW statbar = NULL_WIN;
HIDDEN TString80 stattext;
WINDOW xvt_create_statbar()
{
@ -701,18 +724,23 @@ WINDOW xvt_create_statbar()
}
void xvt_statbar_set(const char* text)
{
TString t(text); t.cut(60);
const TDate oggi(TODAY);
t << '\t' << oggi.string() << " - " << MainApp()->title();
{
#if XVT_OS == XVT_OS_WIN
statbar_set_title(statbar, (char*)(const char*)t);
if (text != NULL)
{
stattext.strncpy(text, 56);
const TDate oggi(TODAY);
stattext << '\t' << oggi.string() << " - " << MainApp()->title();
}
statbar_set_title(statbar, (char*)(const char*)stattext);
#endif
}
void xvt_statbar_refresh()
{
invalidate_rect(statbar, NULL);
#if XVT_OS == XVT_OS_WIN
statbar_set_title(statbar, (char*)(const char*)stattext);
#endif
}
///////////////////////////////////////////////////////////
@ -742,7 +770,8 @@ bool xvt_test_menu_tag(MENU_TAG tag)
COLOR trans_color(char c)
{
switch (c) {
switch (c)
{
case 'n': return COLOR_BLACK; break;
case 'r': return COLOR_RED; break;
case 'g': return COLOR_GREEN; break;
@ -755,8 +784,9 @@ COLOR trans_color(char c)
case 'd': return COLOR_DKGRAY; break;
case 'l': return COLOR_LTGRAY; break;
case 'k': return COLOR_GRAY; break;
default: CHECK(0,"trans_color: Undefined color"); return -1; break;
default: CHECK(0,"trans_color: Undefined color"); break;
}
return -1;
}
PAT_STYLE trans_brush(char p)
@ -772,8 +802,9 @@ PAT_STYLE trans_brush(char p)
case '\\': return PAT_BDIAG; break;
case 'X' : return PAT_DIAGCROSS; break;
case '+' : return PAT_CROSS; break;
default: CHECK(0,"trans_brush: Undefined pattern"); return PAT_NONE; break;
default : CHECK(0,"trans_brush: Undefined pattern"); break;
}
return PAT_NONE;
}
PEN_STYLE trans_pen(char p)
@ -783,7 +814,8 @@ PEN_STYLE trans_pen(char p)
case 'n' : return P_SOLID; break;
case '.' : return P_DOT; break;
case '-' : return P_DASH; break;
default: CHECK(0,"trans_pen: Undefined pattern"); return P_SOLID; break;
default: CHECK(0,"trans_pen: Undefined pattern"); break;
}
return P_SOLID;
}