Gestione tasti rapidi.
git-svn-id: svn://10.65.10.50/trunk@52 c028cbd2-c16b-5b4b-a496-9718f37d4682
This commit is contained in:
parent
5f96e2e4ea
commit
6d79069eb6
@ -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 */
|
||||
|
@ -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"
|
||||
|
@ -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;
|
||||
|
@ -90,7 +90,7 @@ BEGIN
|
||||
OUTPUT FLD_GD1_RAGSOC RAGSOC
|
||||
HELP "Inserire la ragione sociale della ditta"
|
||||
CHECKTYPE REQUIRED
|
||||
FLAGS "G"
|
||||
FLAGS "G"
|
||||
MESSAGE COPY,2@
|
||||
END
|
||||
|
||||
|
20
ba/ba6.cpp
20
ba/ba6.cpp
@ -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] ;
|
||||
const int r = (argc > 1) ? atoi(argv[1]) : -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;
|
||||
switch (r)
|
||||
{
|
||||
case 0:ba6100(argc,argv) ; break;
|
||||
case 1:ba6200(argc,argv) ; break;
|
||||
default:error_box(usage, argv[0]) ; break;
|
||||
}
|
||||
return r < 0;
|
||||
}
|
||||
|
||||
|
||||
|
@ -110,14 +110,14 @@ BEGIN
|
||||
FLAGS "U"
|
||||
END
|
||||
|
||||
BUTTON DLG_OK 9 0
|
||||
BUTTON DLG_OK 9 2
|
||||
BEGIN
|
||||
PROMPT 10 12 ""
|
||||
PROMPT -12 -2 ""
|
||||
END
|
||||
|
||||
BUTTON DLG_CANCEL 9 0
|
||||
BUTTON DLG_CANCEL 9 2
|
||||
BEGIN
|
||||
PROMPT 43 12 ""
|
||||
PROMPT -22 -2 ""
|
||||
END
|
||||
|
||||
ENDPAGE
|
||||
|
@ -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
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -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;
|
||||
}
|
||||
|
||||
|
@ -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));
|
||||
}
|
||||
|
||||
/*
|
||||
|
54
cg/cg4400.h
54
cg/cg4400.h
@ -2,16 +2,16 @@
|
||||
// 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 "cglib03.h"
|
||||
|
||||
#include <nditte.h>
|
||||
#include <anagr.h>
|
||||
#include <comuni.h>
|
||||
@ -20,13 +20,13 @@
|
||||
#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");
|
||||
//enum STAMPA { bollati=1, unici=2 };
|
||||
const int TABREG = (int)TTable::name2log("REG");
|
||||
|
||||
bool filter_func (const TRelation*);
|
||||
bool my_handler (TMask_field&, KEY);
|
||||
@ -65,8 +65,8 @@ class CG4400_application : public TPrintapp
|
||||
friend bool mask_verifica (TMask_field&, KEY);
|
||||
friend bool mask_annulla (TMask_field&, KEY);
|
||||
|
||||
TCursor * _cur;
|
||||
TRelation *_rel;
|
||||
TCursor * _cur;
|
||||
TRelation *_rel;
|
||||
TLocalisamfile *_clifo, *_nditte, *_occas, *_tab, *_tabcom;
|
||||
TTable *_tabreg;
|
||||
TRigaiva_array _iva_array, _riga_rmi;
|
||||
@ -75,43 +75,43 @@ class CG4400_application : public TPrintapp
|
||||
TArray_sheet *_ditte;
|
||||
TBit_array _selected;
|
||||
TArray _nomiditte; //array descrizioni ditte per sheet
|
||||
bool _riferim, _mov_empty;
|
||||
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
|
||||
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 _codreg, _desc_lib, _codatt, _attivita;
|
||||
TString _codtab, _tipodoc, _descr_doc;
|
||||
bool _stampa_tutti_i_registri;
|
||||
bool _stampa_tutti_i_registri;
|
||||
|
||||
public:
|
||||
const char* desc_attivita (const char * codatt);
|
||||
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);
|
||||
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_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 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 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) {}
|
||||
_nomiditte(100) {}
|
||||
|
||||
virtual ~CG4400_application() {}
|
||||
};
|
||||
|
212
cg/cg4500.cpp
212
cg/cg4500.cpp
@ -4,10 +4,7 @@
|
||||
#include <tabutil.h>
|
||||
#include <printapp.h>
|
||||
#include <mask.h>
|
||||
#include <date.h>
|
||||
#include <scanner.h>
|
||||
#include <utility.h>
|
||||
#include <prefix.h>
|
||||
#include <config.h>
|
||||
#include <urldefid.h>
|
||||
|
||||
@ -18,9 +15,8 @@
|
||||
#include <causali.h>
|
||||
#include <nditte.h>
|
||||
|
||||
#include <cg4.h>
|
||||
#include <cg4500a.h>
|
||||
#include <cg4500b.h>
|
||||
#include "cg4500a.h"
|
||||
#include "cg4500b.h"
|
||||
|
||||
bool mask_dataini (TMask_field&, KEY);
|
||||
bool mask_newanno (TMask_field&, KEY);
|
||||
@ -29,32 +25,32 @@ bool mask_frequenza (TMask_field&, KEY);
|
||||
|
||||
class CG4500_application : public TApplication
|
||||
{
|
||||
friend bool mask_dataini (TMask_field&, KEY);
|
||||
friend bool mask_newanno (TMask_field&, KEY);
|
||||
friend bool mask_annoiva (TMask_field&, KEY);
|
||||
friend bool mask_frequenza (TMask_field&);
|
||||
friend bool mask_dataini (TMask_field&, KEY);
|
||||
friend bool mask_newanno (TMask_field&, KEY);
|
||||
friend bool mask_annoiva (TMask_field&, KEY);
|
||||
friend bool mask_frequenza (TMask_field&);
|
||||
|
||||
TTable* _esc, * _reg, * _lia, * _lbu;
|
||||
TLocalisamfile* _nditte;
|
||||
int _anno, _newanno, _annoiva;
|
||||
TDate _dataini, _datafin, _datainp, _datafip;
|
||||
TString _annop;
|
||||
long _ditta;
|
||||
char _frequenza;
|
||||
TTable* _esc, * _reg, * _lia, * _lbu;
|
||||
TLocalisamfile* _nditte;
|
||||
int _anno, _newanno, _annoiva;
|
||||
TDate _dataini, _datafin, _datainp, _datafip;
|
||||
TString _annop;
|
||||
long _ditta;
|
||||
char _frequenza;
|
||||
|
||||
public:
|
||||
virtual bool create();
|
||||
virtual bool destroy();
|
||||
virtual bool menu(MENU_TAG m);
|
||||
virtual bool create();
|
||||
virtual bool destroy();
|
||||
virtual bool menu(MENU_TAG m);
|
||||
|
||||
void create_files();
|
||||
void destroy_files();
|
||||
bool set();
|
||||
bool setta();
|
||||
bool apertura_es();
|
||||
bool apertura_iva();
|
||||
void create_files();
|
||||
void destroy_files();
|
||||
bool set();
|
||||
bool setta();
|
||||
bool apertura_es();
|
||||
bool apertura_iva();
|
||||
|
||||
CG4500_application() {}
|
||||
CG4500_application() {}
|
||||
};
|
||||
|
||||
TDate InizioEsercizio(int anno)
|
||||
@ -68,7 +64,7 @@ TDate InizioEsercizio(int anno)
|
||||
TabEs.put ("CODTAB", codtab);
|
||||
TabEs.read();
|
||||
if (TabEs.good())
|
||||
inizio_es= TabEs.get_date ("D0");
|
||||
inizio_es= TabEs.get_date ("D0");
|
||||
|
||||
return inizio_es;
|
||||
}
|
||||
@ -84,7 +80,7 @@ TDate FineEsercizio(int anno)
|
||||
TabEs.put ("CODTAB", codtab);
|
||||
TabEs.read();
|
||||
if (TabEs.good())
|
||||
fine_es= TabEs.get_date ("D1");
|
||||
fine_es= TabEs.get_date ("D1");
|
||||
|
||||
return fine_es;
|
||||
}
|
||||
@ -94,7 +90,7 @@ bool mask_newanno (TMask_field& f, KEY k)
|
||||
TTable TabEs ("ESC");
|
||||
TString codtab;
|
||||
|
||||
// if ( (k == K_TAB) && f.mask().is_running() )
|
||||
// if ( (k == K_TAB) && f.mask().is_running() )
|
||||
if ( (k == K_ENTER) && f.to_check(k) )
|
||||
{
|
||||
int newanno = f.mask().get_int(F_NUOVOANNO);
|
||||
@ -121,16 +117,16 @@ bool mask_newanno (TMask_field& f, KEY k)
|
||||
bool mask_annoiva (TMask_field& f, KEY k)
|
||||
{
|
||||
if ( (k == K_ENTER) && f.to_check(k) )
|
||||
//if ( (k == K_TAB) && f.mask().is_running() )
|
||||
//if ( (k == K_TAB) && f.mask().is_running() )
|
||||
{
|
||||
int annoiva = f.mask().get_int(F_ANNOIVA);
|
||||
TConfig conf(CONFIG_DITTA);
|
||||
int annoivap = atoi(conf.get("AnLiIv"));
|
||||
if (annoiva != annoivap + 1)
|
||||
{
|
||||
int annoiva = f.mask().get_int(F_ANNOIVA);
|
||||
TConfig conf(CONFIG_DITTA);
|
||||
int annoivap = atoi(conf.get("AnLiIv"));
|
||||
if (annoiva != annoivap + 1)
|
||||
{
|
||||
f.warning_box("Il nuovo anno esercizio IVA deve essere successivo all'anno esercizio IVA precedente");
|
||||
return FALSE;
|
||||
}
|
||||
}
|
||||
}
|
||||
return TRUE;
|
||||
}
|
||||
@ -142,12 +138,12 @@ bool mask_dataini (TMask_field& f, KEY k)
|
||||
TDate data(f.mask().get(F_DATAINI));
|
||||
TDate fine(f.mask().get(F_DATAFINC));
|
||||
/*
|
||||
if ( data.year() != FineEsercizio(anno).year() + 1 )
|
||||
{
|
||||
warning_box ("L'anno del nuovo esercizio deve essere successivo a quello della fine dell'esercizio precedente");
|
||||
return FALSE;
|
||||
}
|
||||
*/
|
||||
if ( data.year() != FineEsercizio(anno).year() + 1 )
|
||||
{
|
||||
warning_box ("L'anno del nuovo esercizio deve essere successivo a quello della fine dell'esercizio precedente");
|
||||
return FALSE;
|
||||
}
|
||||
*/
|
||||
if ( data <= fine )
|
||||
{
|
||||
f.warning_box ("La data di inizio del nuovo esercizio deve essere superiore alla data di fine esercizio precedente");
|
||||
@ -199,27 +195,27 @@ bool CG4500_application::set()
|
||||
KEY tasto;
|
||||
|
||||
/*
|
||||
if (TabEs.last() == NOERR)
|
||||
{
|
||||
int anno = TabEs.get_int ("CODTAB");
|
||||
TDate inizio = TabEs.get_date("D0"); //data inizio es. in corso
|
||||
TDate fine = TabEs.get_date("D1"); //data fine es. in corso
|
||||
if (TabEs.last() == NOERR)
|
||||
{
|
||||
int anno = TabEs.get_int ("CODTAB");
|
||||
TDate inizio = TabEs.get_date("D0"); //data inizio es. in corso
|
||||
TDate fine = TabEs.get_date("D1"); //data fine es. in corso
|
||||
|
||||
m.show (F_ANNO);
|
||||
m.show (F_DATAINIC);
|
||||
m.show (F_DATAFINC);
|
||||
m.show (F_ANNO);
|
||||
m.show (F_DATAINIC);
|
||||
m.show (F_DATAFINC);
|
||||
|
||||
m.set(F_ANNO, (long) anno);
|
||||
m.set(F_DATAINIC, inizio.string());
|
||||
m.set(F_DATAFINC, fine.string());
|
||||
}
|
||||
else
|
||||
{
|
||||
m.hide(F_ANNO);
|
||||
m.hide(F_DATAINIC);
|
||||
m.hide(F_DATAFINC);
|
||||
}
|
||||
*/
|
||||
m.set(F_ANNO, (long) anno);
|
||||
m.set(F_DATAINIC, inizio.string());
|
||||
m.set(F_DATAFINC, fine.string());
|
||||
}
|
||||
else
|
||||
{
|
||||
m.hide(F_ANNO);
|
||||
m.hide(F_DATAINIC);
|
||||
m.hide(F_DATAFINC);
|
||||
}
|
||||
*/
|
||||
|
||||
if (TabEs.last() != NOERR)
|
||||
{
|
||||
@ -270,20 +266,20 @@ bool CG4500_application::setta()
|
||||
TabLia.zero();
|
||||
TabLia.put("CODTAB", anno);
|
||||
if (TabLia.read() == NOERR)
|
||||
m.set(F_FREQUENZA, TabLia.get("S7"));
|
||||
m.set(F_FREQUENZA, TabLia.get("S7"));
|
||||
else
|
||||
{
|
||||
TabLia.zero();
|
||||
TabLia.put("CODTAB", _annop);
|
||||
if (TabLia.read() == NOERR)
|
||||
TabLia.zero();
|
||||
TabLia.put("CODTAB", _annop);
|
||||
if (TabLia.read() == NOERR)
|
||||
m.set(F_FREQUENZA, TabLia.get("S7"));
|
||||
else
|
||||
{
|
||||
nditte.zero();
|
||||
nditte.put("CODDITTA", MainApp()->get_firm());
|
||||
if (nditte.read() == NOERR)
|
||||
m.set(F_FREQUENZA, nditte.get(NDT_FREQVIVA));
|
||||
}
|
||||
else
|
||||
{
|
||||
nditte.zero();
|
||||
nditte.put("CODDITTA", MainApp()->get_firm());
|
||||
if (nditte.read() == NOERR)
|
||||
m.set(F_FREQUENZA, nditte.get(NDT_FREQVIVA));
|
||||
}
|
||||
}
|
||||
|
||||
m.set(F_ANNOIVA, aivap+1);
|
||||
@ -307,12 +303,12 @@ bool CG4500_application::menu(MENU_TAG m)
|
||||
{
|
||||
switch (m)
|
||||
{
|
||||
case BAR_ITEM(1):
|
||||
apertura_es();
|
||||
break;
|
||||
case BAR_ITEM(2):
|
||||
apertura_iva();
|
||||
break;
|
||||
case BAR_ITEM(1):
|
||||
apertura_es();
|
||||
break;
|
||||
case BAR_ITEM(2):
|
||||
apertura_iva();
|
||||
break;
|
||||
}
|
||||
//return TApplication::menu(m);
|
||||
return TRUE;
|
||||
@ -328,7 +324,7 @@ bool CG4500_application::apertura_es()
|
||||
bool ok = FALSE;
|
||||
|
||||
if (!set())
|
||||
return FALSE;
|
||||
return FALSE;
|
||||
|
||||
//viene aggiornata la tabella dei registri. Se esisteva gia' un record relativo al nuovo esercizio, viene cancellato.
|
||||
//In ogni caso ne viene creato uno nuovo relativo al nuovo esercizio.
|
||||
@ -347,7 +343,7 @@ bool CG4500_application::apertura_es()
|
||||
|
||||
int tiporeg = TabReg.get_int("I0");
|
||||
if (tiporeg == 5)
|
||||
TabReg.remove();
|
||||
TabReg.remove();
|
||||
}
|
||||
|
||||
TabReg.zero();
|
||||
@ -361,26 +357,26 @@ bool CG4500_application::apertura_es()
|
||||
|
||||
for (; !TabReg.eof(); TabReg.next())
|
||||
{
|
||||
if (TabReg.curr() != rec) break;
|
||||
if (TabReg.curr() != rec) break;
|
||||
|
||||
int tiporeg = TabReg.get_int("I0");
|
||||
TString cod_reg = TabReg.get("CODTAB");
|
||||
cod_reg = cod_reg.mid(4,3);
|
||||
if (tiporeg == 5)
|
||||
{
|
||||
ok = TRUE;
|
||||
nuovo = TabReg.curr();
|
||||
TString16 cod;
|
||||
cod << _newanno << cod_reg;
|
||||
nuovo.put("CODTAB", cod);
|
||||
nuovo.put("D2", data);
|
||||
nuovo.put("D3", data);
|
||||
nuovo.put("I6", 0L);
|
||||
nuovo.put("R1", real(0.0));
|
||||
nuovo.put("R2", real(0.0));
|
||||
int tiporeg = TabReg.get_int("I0");
|
||||
TString cod_reg = TabReg.get("CODTAB");
|
||||
cod_reg = cod_reg.mid(4,3);
|
||||
if (tiporeg == 5)
|
||||
{
|
||||
ok = TRUE;
|
||||
nuovo = TabReg.curr();
|
||||
TString16 cod;
|
||||
cod << _newanno << cod_reg;
|
||||
nuovo.put("CODTAB", cod);
|
||||
nuovo.put("D2", data);
|
||||
nuovo.put("D3", data);
|
||||
nuovo.put("I6", 0L);
|
||||
nuovo.put("R1", real(0.0));
|
||||
nuovo.put("R2", real(0.0));
|
||||
|
||||
TabReg.write(nuovo);
|
||||
}
|
||||
TabReg.write(nuovo);
|
||||
}
|
||||
}
|
||||
if (!ok)
|
||||
{
|
||||
@ -411,7 +407,7 @@ bool CG4500_application::apertura_iva()
|
||||
bool ok = FALSE;
|
||||
|
||||
if (!setta())
|
||||
return FALSE;
|
||||
return FALSE;
|
||||
|
||||
//viene aggiornata la tabella del libro unico. Se esisteva gia' un record relativo al nuovo esercizio IVA, viene cancellato.
|
||||
//In ogni caso ne viene creato uno nuovo relativo al nuovo esercizio.
|
||||
@ -478,7 +474,7 @@ bool CG4500_application::apertura_iva()
|
||||
|
||||
int tiporeg = TabReg.get_int("I0");
|
||||
if ( (tiporeg == 1)||(tiporeg == 2)||(tiporeg == 3) )
|
||||
TabReg.remove();
|
||||
TabReg.remove();
|
||||
}
|
||||
|
||||
ok = FALSE;
|
||||
@ -531,7 +527,7 @@ bool CG4500_application::apertura_iva()
|
||||
TabLia.zero();
|
||||
TabLia.put ("CODTAB", annoiva);
|
||||
if (TabLia.read() == NOERR)
|
||||
TabLia.remove();
|
||||
TabLia.remove();
|
||||
|
||||
ok = FALSE;
|
||||
TabLia.zero();
|
||||
@ -540,12 +536,12 @@ bool CG4500_application::apertura_iva()
|
||||
|
||||
if (TabLia.read() == NOERR)
|
||||
{
|
||||
ok = TRUE;
|
||||
newrec = TabLia.curr();
|
||||
newrec.put("CODTAB", annoiva);
|
||||
newrec.put("S7", _frequenza);
|
||||
ok = TRUE;
|
||||
newrec = TabLia.curr();
|
||||
newrec.put("CODTAB", annoiva);
|
||||
newrec.put("S7", _frequenza);
|
||||
|
||||
TabLia.write(newrec);
|
||||
TabLia.write(newrec);
|
||||
}
|
||||
if (!ok)
|
||||
{
|
||||
@ -554,7 +550,7 @@ bool CG4500_application::apertura_iva()
|
||||
}
|
||||
|
||||
//viene aggiornato l'anno iva sui parametri ditta
|
||||
TConfig conf(CONFIG_DITTA);
|
||||
TConfig conf(CONFIG_DITTA);
|
||||
conf.set("AnLiIv", _annoiva);
|
||||
|
||||
//sull'anagrafica ditte viene aggiornata la frequenza versamento
|
||||
|
@ -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);
|
||||
|
@ -3,17 +3,17 @@
|
||||
#include <xvt.h>
|
||||
|
||||
#include <applicat.h>
|
||||
#include <config.h>
|
||||
#include <extcdecl.h>
|
||||
#include <modaut.h>
|
||||
#include <mask.h>
|
||||
#include <prefix.h>
|
||||
#include <progind.h>
|
||||
#include <relation.h>
|
||||
#include <urldefid.h>
|
||||
#include <utility.h>
|
||||
#include <config.h>
|
||||
#include <mask.h>
|
||||
#include <relation.h>
|
||||
|
||||
#include <bagn002.h>
|
||||
#include <progind.h>
|
||||
|
||||
HIDDEN XVT_CONFIG cfg;
|
||||
HIDDEN TApplication* application = NULL;
|
||||
@ -21,8 +21,8 @@ HIDDEN long savefirm = 0;
|
||||
|
||||
TApplication* MainApp()
|
||||
{
|
||||
CHECK(application, "NULL application!");
|
||||
return application;
|
||||
CHECK(application, "NULL application!");
|
||||
return application;
|
||||
}
|
||||
|
||||
bool xvt_running() { return application != NULL; }
|
||||
@ -30,46 +30,46 @@ bool xvt_running() { return application != NULL; }
|
||||
HIDDEN long backdrop_eh( WINDOW win, EVENT* ep)
|
||||
{
|
||||
#if XVTWS == WMWS
|
||||
clear_window( win, COLOR_BLUE );
|
||||
clear_window( win, COLOR_BLUE );
|
||||
#else
|
||||
clear_window( win, COLOR_GRAY );
|
||||
/*
|
||||
const RCT& rct = ep->v.update.rct;
|
||||
bool even = FALSE;
|
||||
for (int y = 0; y < rct.bottom; y += 96)
|
||||
{
|
||||
const int sx = even ? 96 : 0;
|
||||
for (int x = sx; x < rct.right; x += 192)
|
||||
if (
|
||||
(y+64) > rct.top && y < rct.bottom &&
|
||||
(x+64) > rct.left && x < rct.right
|
||||
) win_draw_icon(win, x, y, ICON_RSRC);
|
||||
even = !even;
|
||||
}
|
||||
*/
|
||||
clear_window( win, COLOR_GRAY );
|
||||
/*
|
||||
const RCT& rct = ep->v.update.rct;
|
||||
bool even = FALSE;
|
||||
for (int y = 0; y < rct.bottom; y += 96)
|
||||
{
|
||||
const int sx = even ? 96 : 0;
|
||||
for (int x = sx; x < rct.right; x += 192)
|
||||
if (
|
||||
(y+64) > rct.top && y < rct.bottom &&
|
||||
(x+64) > rct.left && x < rct.right
|
||||
) win_draw_icon(win, x, y, ICON_RSRC);
|
||||
even = !even;
|
||||
}
|
||||
*/
|
||||
#endif
|
||||
|
||||
return 0L;
|
||||
return 0L;
|
||||
}
|
||||
|
||||
HIDDEN void create_backdrop( void )
|
||||
{
|
||||
#if XVTWS == WMWS
|
||||
xvt_escape(XVT_ESC_CH_COLOR, XVT_CH_CLR_MENU, COLOR_BLACK, COLOR_WHITE);
|
||||
xvt_escape(XVT_ESC_CH_COLOR, XVT_CH_CLR_DIALOG, COLOR_BLUE, COLOR_WHITE);
|
||||
xvt_escape(XVT_ESC_CH_COLOR, XVT_CH_CLR_WINDOW, COLOR_RED, COLOR_WHITE);
|
||||
xvt_escape(XVT_ESC_CH_COLOR, XVT_CH_CLR_CONTROL, COLOR_BLACK, COLOR_WHITE);
|
||||
xvt_escape(XVT_ESC_CH_COLOR, XVT_CH_CLR_DISABLED, COLOR_GRAY, COLOR_WHITE);
|
||||
xvt_escape(XVT_ESC_CH_COLOR, XVT_CH_CLR_MNEMONIC, COLOR_RED, COLOR_WHITE);
|
||||
xvt_escape(XVT_ESC_CH_COLOR, XVT_CH_CLR_MENU, COLOR_BLACK, COLOR_WHITE);
|
||||
xvt_escape(XVT_ESC_CH_COLOR, XVT_CH_CLR_DIALOG, COLOR_BLUE, COLOR_WHITE);
|
||||
xvt_escape(XVT_ESC_CH_COLOR, XVT_CH_CLR_WINDOW, COLOR_RED, COLOR_WHITE);
|
||||
xvt_escape(XVT_ESC_CH_COLOR, XVT_CH_CLR_CONTROL, COLOR_BLACK, COLOR_WHITE);
|
||||
xvt_escape(XVT_ESC_CH_COLOR, XVT_CH_CLR_DISABLED, COLOR_GRAY, COLOR_WHITE);
|
||||
xvt_escape(XVT_ESC_CH_COLOR, XVT_CH_CLR_MNEMONIC, COLOR_RED, COLOR_WHITE);
|
||||
|
||||
RCT rct;
|
||||
get_client_rect( SCREEN_WIN, &rct );
|
||||
create_window(W_PLAIN, &rct, (char*) "BACKDROP", 0, TASK_WIN,
|
||||
WSF_NO_MENUBAR | WSF_CH_BACKDROP , EM_UPDATE,
|
||||
backdrop_eh, 0L );
|
||||
RCT rct;
|
||||
get_client_rect( SCREEN_WIN, &rct );
|
||||
create_window(W_PLAIN, &rct, (char*) "BACKDROP", 0, TASK_WIN,
|
||||
WSF_NO_MENUBAR | WSF_CH_BACKDROP , EM_UPDATE,
|
||||
backdrop_eh, 0L );
|
||||
#else
|
||||
xvt_create_statbar();
|
||||
xvt_statbar_set("");
|
||||
xvt_create_statbar();
|
||||
xvt_statbar_set("");
|
||||
#endif
|
||||
}
|
||||
|
||||
@ -80,56 +80,56 @@ HIDDEN void create_backdrop( void )
|
||||
const word WM_WAKEUP = RegisterWindowMessage("WAKEUP");
|
||||
DWORD waiting_for = 0;
|
||||
|
||||
BOOLEAN event_hook(HWND, WORD msg, WORD,
|
||||
DWORD lparam, long far* ret)
|
||||
BOOLEAN waiting_event_hook(HWND, WORD msg, WORD,
|
||||
DWORD lparam, long far* ret)
|
||||
{
|
||||
if (msg == WM_WAKEUP)
|
||||
{
|
||||
if( lparam == waiting_for || lparam == 0)
|
||||
{
|
||||
waiting_for = 0L;
|
||||
TTemp_window tw(TASK_WIN);
|
||||
tw.maximize();
|
||||
}
|
||||
*ret = 0;
|
||||
return TRUE;
|
||||
}
|
||||
if (msg == WM_WAKEUP)
|
||||
{
|
||||
if( lparam == waiting_for || lparam == 0)
|
||||
{
|
||||
waiting_for = 0L;
|
||||
TTemp_window tw(TASK_WIN);
|
||||
tw.maximize();
|
||||
}
|
||||
*ret = 0;
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
return FALSE;
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
|
||||
HIDDEN DWORD name2id(const char* name)
|
||||
{
|
||||
waiting_for = 0L;
|
||||
for (int i = 0; i < 5 && name[i] > ' '; i++)
|
||||
{
|
||||
waiting_for <<= 6;
|
||||
waiting_for |= toupper(name[i]) - '0';
|
||||
}
|
||||
return waiting_for;
|
||||
waiting_for = 0L;
|
||||
for (int i = 0; i < 5 && name[i] > ' '; i++)
|
||||
{
|
||||
waiting_for <<= 6;
|
||||
waiting_for |= toupper(name[i]) - '0';
|
||||
}
|
||||
return waiting_for;
|
||||
}
|
||||
|
||||
|
||||
void TApplication::wait_for(const char* command)
|
||||
{
|
||||
TTemp_window tw(TASK_WIN);
|
||||
tw.iconize();
|
||||
name2id(cmd2name(command));
|
||||
set_value(TASK_WIN, ATTR_EVENT_HOOK, (long)event_hook);
|
||||
while (waiting_for) do_events();
|
||||
TTemp_window tw(TASK_WIN);
|
||||
tw.iconize();
|
||||
name2id(cmd2name(command));
|
||||
set_value(TASK_WIN, ATTR_EVENT_HOOK, (long)waiting_event_hook);
|
||||
while (waiting_for) do_events();
|
||||
|
||||
///////////////////////////////////////////////////////////
|
||||
// It seems necessary to restore these things
|
||||
///////////////////////////////////////////////////////////
|
||||
customize_controls(TRUE);
|
||||
xvt_statbar_refresh();
|
||||
///////////////////////////////////////////////////////////
|
||||
// It seems necessary to restore these things
|
||||
///////////////////////////////////////////////////////////
|
||||
customize_controls(TRUE);
|
||||
xvt_statbar_refresh();
|
||||
}
|
||||
|
||||
void TApplication::wake_up_caller() const
|
||||
{
|
||||
name2id(name());
|
||||
SendMessage(-1, WM_WAKEUP, 0, waiting_for);
|
||||
name2id(name());
|
||||
SendMessage(-1, WM_WAKEUP, 0, waiting_for);
|
||||
}
|
||||
|
||||
#endif
|
||||
@ -138,116 +138,127 @@ void TApplication::wake_up_caller() const
|
||||
void TApplication::print()
|
||||
{
|
||||
#ifdef DBG
|
||||
error_box("Non saprei bene cosa stampare!");
|
||||
error_box("Non saprei bene cosa stampare!");
|
||||
#endif
|
||||
}
|
||||
|
||||
|
||||
long TApplication::task_eh(WINDOW win, EVENT *ep)
|
||||
{
|
||||
switch (ep->type)
|
||||
{
|
||||
case E_CREATE:
|
||||
create_backdrop();
|
||||
switch (ep->type)
|
||||
{
|
||||
case E_CREATE:
|
||||
create_backdrop();
|
||||
#if defined(DBG) && XVT_OS == XVT_OS_SCOUNIX
|
||||
message_box("attach to process %d ...", getpid());
|
||||
message_box("Attach to process %d ...", getpid());
|
||||
#endif
|
||||
do_events();
|
||||
break;
|
||||
do_events();
|
||||
break;
|
||||
#if XVT_OS == XVT_OS_WIN
|
||||
case E_UPDATE:
|
||||
backdrop_eh(win, ep);
|
||||
break;
|
||||
case E_UPDATE:
|
||||
backdrop_eh(win, ep);
|
||||
break;
|
||||
#endif
|
||||
default:
|
||||
break;
|
||||
}
|
||||
default:
|
||||
break;
|
||||
}
|
||||
|
||||
return application->handler(win, ep);
|
||||
return application->handler(win, ep);
|
||||
}
|
||||
|
||||
void TApplication::about() const
|
||||
{
|
||||
#include <prassi.ver>
|
||||
message_box("PRASSI Version %g\nLibreria del %s", VERSION, __DATE__);
|
||||
#include <prassi.ver>
|
||||
message_box("PRASSI Versione %g\nProgramma %s\nLibreria del %s",
|
||||
VERSION, (const char*)name(), __DATE__);
|
||||
}
|
||||
|
||||
|
||||
long TApplication::handler(WINDOW, EVENT* ep)
|
||||
{
|
||||
switch (ep->type)
|
||||
{
|
||||
case E_CREATE:
|
||||
if (create() == FALSE)
|
||||
stop_run();
|
||||
break;
|
||||
case E_COMMAND:
|
||||
{
|
||||
MENU_TAG mt = ep->v.cmd.tag;
|
||||
switch(mt)
|
||||
{
|
||||
case M_FILE_QUIT:
|
||||
stop_run();
|
||||
break;
|
||||
case M_FILE_PG_SETUP:
|
||||
printer().set();
|
||||
break;
|
||||
case M_FILE_PRINT:
|
||||
print();
|
||||
break;
|
||||
case M_FILE_NEW:
|
||||
set_firm();
|
||||
break;
|
||||
case M_FILE_REVERT:
|
||||
config();
|
||||
break;
|
||||
case (M_FILE+11) :
|
||||
about();
|
||||
break;
|
||||
default:
|
||||
if (!menu(mt))
|
||||
stop_run();
|
||||
break;
|
||||
}
|
||||
}
|
||||
break;
|
||||
case E_CLOSE:
|
||||
if (can_close())
|
||||
stop_run();
|
||||
break;
|
||||
case E_QUIT:
|
||||
if (ep->v.query)
|
||||
{
|
||||
if (can_close())
|
||||
quit_OK();
|
||||
else
|
||||
error_box("Chiudere la finestra attiva prima di chiudere il programma");
|
||||
}
|
||||
else stop_run();
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
return 0L;
|
||||
switch (ep->type)
|
||||
{
|
||||
case E_CREATE:
|
||||
if (create() == FALSE)
|
||||
stop_run();
|
||||
break;
|
||||
case E_CHAR:
|
||||
{
|
||||
#ifdef DBG
|
||||
KEY k = e_char_to_key(ep);
|
||||
#endif
|
||||
}
|
||||
break;
|
||||
case E_COMMAND:
|
||||
{
|
||||
MENU_TAG mt = ep->v.cmd.tag;
|
||||
switch(mt)
|
||||
{
|
||||
case M_FILE_QUIT:
|
||||
stop_run();
|
||||
break;
|
||||
case M_FILE_PG_SETUP:
|
||||
printer().set();
|
||||
break;
|
||||
case M_FILE_PRINT:
|
||||
print();
|
||||
break;
|
||||
case M_FILE_NEW:
|
||||
set_firm();
|
||||
break;
|
||||
case M_FILE_REVERT:
|
||||
config();
|
||||
break;
|
||||
case (M_FILE+11) :
|
||||
about();
|
||||
break;
|
||||
default:
|
||||
if (mt >= BAR_ITEM(1))
|
||||
{
|
||||
if(!menu(mt))
|
||||
stop_run();
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
break;
|
||||
case E_CLOSE:
|
||||
if (can_close())
|
||||
stop_run();
|
||||
break;
|
||||
case E_QUIT:
|
||||
if (ep->v.query)
|
||||
{
|
||||
if (can_close())
|
||||
quit_OK();
|
||||
else
|
||||
error_box("Chiudere la finestra attiva prima di chiudere il programma");
|
||||
}
|
||||
else stop_run();
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
return 0L;
|
||||
}
|
||||
|
||||
|
||||
void TApplication::stop_run()
|
||||
{
|
||||
if (savefirm) prefhndl->set_codditta(savefirm);
|
||||
terminate();
|
||||
//#if XVT_OS == XVT_OS_WIN
|
||||
// xvt_escape(XVT_ESC_WIN_TERMINATE);
|
||||
//#else
|
||||
xvt_terminate();
|
||||
//#endif
|
||||
terminate();
|
||||
//#if XVT_OS == XVT_OS_WIN
|
||||
// xvt_escape(XVT_ESC_WIN_TERMINATE);
|
||||
//#else
|
||||
xvt_terminate();
|
||||
//#endif
|
||||
}
|
||||
|
||||
|
||||
TApplication::TApplication() : _printer(NULL)
|
||||
{
|
||||
init_global_vars();
|
||||
_bar = TASK_MENUBAR;
|
||||
init_global_vars();
|
||||
_bar = TASK_MENUBAR;
|
||||
}
|
||||
|
||||
|
||||
@ -257,71 +268,71 @@ TApplication::~TApplication()
|
||||
|
||||
TPrinter* TApplication::set_printer(TPrinter* p)
|
||||
{
|
||||
TPrinter* printer = _printer;
|
||||
_printer = p;
|
||||
return printer;
|
||||
TPrinter* printer = _printer;
|
||||
_printer = p;
|
||||
return printer;
|
||||
}
|
||||
|
||||
|
||||
TPrinter& TApplication::printer()
|
||||
{
|
||||
if (_printer == NULL) _printer = new TPrinter;
|
||||
return *_printer;
|
||||
if (_printer == NULL) _printer = new TPrinter;
|
||||
return *_printer;
|
||||
}
|
||||
|
||||
|
||||
bool TApplication::create()
|
||||
{
|
||||
// include_progind(); // TBC da eliminare quando il linker diventa furbo
|
||||
return TRUE;
|
||||
// include_progind(); // TBC da eliminare quando il linker diventa furbo
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
|
||||
bool TApplication::destroy()
|
||||
{
|
||||
return TRUE;
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
|
||||
void TApplication::terminate()
|
||||
{
|
||||
#if XVT_OS == XVT_OS_WIN
|
||||
wake_up_caller(); // Manda il segnale di risveglio al chiamante
|
||||
wake_up_caller(); // Manda il segnale di risveglio al chiamante
|
||||
#endif
|
||||
|
||||
close_all_dialogs();
|
||||
application->destroy(); // Distruzione files e maschere
|
||||
do_events();
|
||||
close_all_dialogs();
|
||||
application->destroy(); // Distruzione files e maschere
|
||||
do_events();
|
||||
|
||||
if (_printer) // Distruzione dell'eventuale stampante
|
||||
{
|
||||
if (printer().isopen())
|
||||
printer().close();
|
||||
delete _printer;
|
||||
_printer = NULL;
|
||||
}
|
||||
if (_printer) // Distruzione dell'eventuale stampante
|
||||
{
|
||||
if (printer().isopen())
|
||||
printer().close();
|
||||
delete _printer;
|
||||
_printer = NULL;
|
||||
}
|
||||
|
||||
free_global_vars(); // Distruzione variabili globali
|
||||
free_global_vars(); // Distruzione variabili globali
|
||||
|
||||
customize_controls(FALSE); // Rilascio eventuali DLL
|
||||
customize_controls(FALSE); // Rilascio eventuali DLL
|
||||
}
|
||||
|
||||
|
||||
const char* TApplication::get_module_name() const
|
||||
{
|
||||
TScanner scanner("prassi.aut");
|
||||
TScanner scanner("prassi.aut");
|
||||
|
||||
bool ok = FALSE;
|
||||
for (int aut = 0; scanner.line() != ""; aut++)
|
||||
if (strncmp(scanner.token(), _name, 2) == 0) { ok = TRUE; break; }
|
||||
bool ok = FALSE;
|
||||
for (int aut = 0; scanner.line() != ""; aut++)
|
||||
if (strncmp(scanner.token(), _name, 2) == 0) { ok = TRUE; break; }
|
||||
|
||||
const char* module = scanner.token().mid(3);
|
||||
if (ok) ok = has_module(aut);
|
||||
const char* module = scanner.token().mid(3);
|
||||
if (ok) ok = has_module(aut);
|
||||
|
||||
if (!ok)
|
||||
fatal_box("Il modulo '%s' non e' autorizzato", module);
|
||||
if (!ok)
|
||||
fatal_box("Il modulo '%s' non e' autorizzato", module);
|
||||
|
||||
return module;
|
||||
return module;
|
||||
}
|
||||
|
||||
void TApplication::set_title(const char* t)
|
||||
@ -332,57 +343,57 @@ const char* TApplication::title() const
|
||||
|
||||
void TApplication::run(int argc, char* argv[], const char* title)
|
||||
{
|
||||
TFilename base(argv[0]);
|
||||
base.ext(""); base.lower();
|
||||
TFilename base(argv[0]);
|
||||
base.ext(""); base.lower();
|
||||
|
||||
__argc = argc;
|
||||
__argv = (const char**)argv;
|
||||
__argc = argc;
|
||||
__argv = (const char**)argv;
|
||||
|
||||
int addbar;
|
||||
if (argc > 1)
|
||||
{
|
||||
addbar = atoi(argv[1]+1);
|
||||
_name = cmd2name(argv[0], argv[1]);
|
||||
}
|
||||
else
|
||||
{
|
||||
addbar = 0;
|
||||
_name = cmd2name(argv[0]);
|
||||
}
|
||||
int addbar;
|
||||
if (argc > 1)
|
||||
{
|
||||
addbar = atoi(argv[1]+1);
|
||||
_name = cmd2name(argv[0], argv[1]);
|
||||
}
|
||||
else
|
||||
{
|
||||
addbar = 0;
|
||||
_name = cmd2name(argv[0]);
|
||||
}
|
||||
|
||||
TString80 caption;
|
||||
caption << "PRASSI S.P.A. - " << get_module_name();
|
||||
TString80 caption;
|
||||
caption << "PRASSI S.P.A. - " << get_module_name();
|
||||
|
||||
cfg.base_appl_name = (char*) base.name();
|
||||
cfg.appl_name = (char*) title;
|
||||
cfg.taskwin_title = (char*)(const char*)caption;
|
||||
cfg.menu_bar_ID = TASK_MENUBAR+addbar;
|
||||
cfg.about_box_ID = 0;
|
||||
cfg.base_appl_name = (char*) base.name();
|
||||
cfg.appl_name = (char*) title;
|
||||
cfg.taskwin_title = (char*)(const char*)caption;
|
||||
cfg.menu_bar_ID = TASK_MENUBAR+addbar;
|
||||
cfg.about_box_ID = 0;
|
||||
|
||||
customize_controls(TRUE);
|
||||
customize_controls(TRUE);
|
||||
|
||||
application = this;
|
||||
xvt_system(argc, argv, 0L, task_eh, &cfg);
|
||||
application = this;
|
||||
xvt_system(argc, argv, 0L, task_eh, &cfg);
|
||||
}
|
||||
|
||||
void TApplication::check_menu_item(MENU_TAG item)
|
||||
{
|
||||
win_menu_check(TASK_WIN, item, TRUE);
|
||||
win_update_menu_bar(TASK_WIN);
|
||||
win_menu_check(TASK_WIN, item, TRUE);
|
||||
win_update_menu_bar(TASK_WIN);
|
||||
}
|
||||
|
||||
|
||||
void TApplication::uncheck_menu_item(MENU_TAG item)
|
||||
{
|
||||
win_menu_check(TASK_WIN, item, FALSE);
|
||||
win_update_menu_bar(TASK_WIN);
|
||||
win_menu_check(TASK_WIN, item, FALSE);
|
||||
win_update_menu_bar(TASK_WIN);
|
||||
}
|
||||
|
||||
|
||||
void TApplication::enable_menu_item(MENU_TAG item, bool on)
|
||||
{
|
||||
win_menu_enable(TASK_WIN, item, on);
|
||||
win_update_menu_bar(TASK_WIN);
|
||||
win_menu_enable(TASK_WIN, item, on);
|
||||
win_update_menu_bar(TASK_WIN);
|
||||
}
|
||||
|
||||
|
||||
@ -393,140 +404,139 @@ void TApplication::dispatch_e_menu(MENU_TAG item)
|
||||
HWND w = (HWND)get_value(TASK_WIN, ATTR_NATIVE_WINDOW);
|
||||
PostMessage(w, WM_COMMAND, item, 0L);
|
||||
#else
|
||||
EVENT e;
|
||||
e.type = E_COMMAND;
|
||||
e.v.cmd.tag = item;
|
||||
e.v.cmd.shift = e.v.cmd.control = 0;
|
||||
dispatch_event(TASK_WIN, &e);
|
||||
EVENT e;
|
||||
e.type = E_COMMAND;
|
||||
e.v.cmd.tag = item;
|
||||
e.v.cmd.shift = e.v.cmd.control = 0;
|
||||
dispatch_event(TASK_WIN, &e);
|
||||
#endif
|
||||
}
|
||||
|
||||
|
||||
bool TApplication::has_module(int module) const
|
||||
{
|
||||
return (bool)CGetAut(module);
|
||||
return (bool)CGetAut(module);
|
||||
}
|
||||
|
||||
|
||||
long TApplication::get_firm() const
|
||||
{
|
||||
return prefhndl->get_codditta();
|
||||
return prefhndl->get_codditta();
|
||||
}
|
||||
|
||||
const char* TApplication::get_firm_dir() const
|
||||
{
|
||||
// return prefhndl->name();
|
||||
return format("%s%s", __ptprf, prefhndl->name());
|
||||
return format("%s%s", __ptprf, prefhndl->name());
|
||||
}
|
||||
|
||||
|
||||
bool TApplication::set_firm(long newfirm)
|
||||
{
|
||||
disable_menu_item(M_FILE_NEW);
|
||||
const long oldfirm = get_firm();
|
||||
disable_menu_item(M_FILE_NEW);
|
||||
const long oldfirm = get_firm();
|
||||
|
||||
if (newfirm < 1)
|
||||
{
|
||||
TMask mask("bagn002");
|
||||
if (newfirm < 1)
|
||||
{
|
||||
TMask mask("bagn002");
|
||||
|
||||
mask.send_key(K_CTRL+K_SHIFT+(extended_firm() ? 's' : 'h'), -2);
|
||||
const KEY k = mask.run();
|
||||
mask.send_key(K_CTRL+K_SHIFT+(extended_firm() ? 's' : 'h'), -2);
|
||||
const KEY k = mask.run();
|
||||
|
||||
enable_menu_item(M_FILE_NEW);
|
||||
if (k == K_ENTER)
|
||||
{
|
||||
newfirm = atol(mask.get(F_CODDITTA));
|
||||
const int tipodir = atoi(mask.get(F_TIPO));
|
||||
enable_menu_item(M_FILE_NEW);
|
||||
if (k == K_ENTER)
|
||||
{
|
||||
newfirm = atol(mask.get(F_CODDITTA));
|
||||
const int tipodir = atoi(mask.get(F_TIPO));
|
||||
|
||||
if (tipodir > 0)
|
||||
{
|
||||
if (savefirm == 0) savefirm = oldfirm;
|
||||
prefhndl->set(tipodir == 1 ? "com" : "");
|
||||
return TRUE;
|
||||
}
|
||||
}
|
||||
}
|
||||
if (tipodir > 0)
|
||||
{
|
||||
if (savefirm == 0) savefirm = oldfirm;
|
||||
prefhndl->set(tipodir == 1 ? "com" : "");
|
||||
return TRUE;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (newfirm == oldfirm || newfirm < 1)
|
||||
return FALSE;
|
||||
if (newfirm == oldfirm || newfirm < 1)
|
||||
return FALSE;
|
||||
|
||||
if (prefhndl->test(newfirm))
|
||||
{
|
||||
prefhndl->set_codditta(newfirm);
|
||||
savefirm = 0;
|
||||
}
|
||||
if (prefhndl->test(newfirm))
|
||||
{
|
||||
prefhndl->set_codditta(newfirm);
|
||||
savefirm = 0;
|
||||
}
|
||||
|
||||
return TRUE;
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
bool TApplication::config()
|
||||
// gestisce le voci di configurazione
|
||||
// le si passa il file in cui cercare il proprio
|
||||
// paragrafo (comunque relativo alla ditta)
|
||||
// se non c'e', viene creato copiando il default
|
||||
// la variabile EdMask di quel paragrafo specifica
|
||||
// la maschera da usare
|
||||
// gestisce le voci di configurazione
|
||||
// le si passa il file in cui cercare il proprio
|
||||
// paragrafo (comunque relativo alla ditta)
|
||||
// se non c'e', viene creato copiando il default
|
||||
// la variabile EdMask di quel paragrafo specifica
|
||||
// la maschera da usare
|
||||
{
|
||||
TConfig cnf(CONFIG_DITTA);
|
||||
bool ok = FALSE;
|
||||
|
||||
TString80 maskname(cnf.get("EdMask"));
|
||||
if (!maskname.empty())
|
||||
{
|
||||
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_NEW);
|
||||
disable_menu_item(M_FILE_REVERT);
|
||||
|
||||
if (m.run() == K_ENTER)
|
||||
{
|
||||
// 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)
|
||||
{
|
||||
const char* fname = fref->name();
|
||||
const char* value = f.get();
|
||||
const char* oldvl = cnf.get(fname);
|
||||
if (change_config(fname,oldvl,value))
|
||||
cnf.set(fname, value, NULL, TRUE);
|
||||
}
|
||||
}
|
||||
}
|
||||
ok = TRUE;
|
||||
}
|
||||
else ok = FALSE;
|
||||
enable_menu_item(M_FILE_NEW);
|
||||
enable_menu_item(M_FILE_REVERT);
|
||||
return ok;
|
||||
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_NEW);
|
||||
disable_menu_item(M_FILE_REVERT);
|
||||
|
||||
if (m.run() == K_ENTER)
|
||||
{
|
||||
// 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)
|
||||
{
|
||||
const char* fname = fref->name();
|
||||
const char* value = f.get();
|
||||
const char* oldvl = cnf.get(fname);
|
||||
if (change_config(fname,oldvl,value))
|
||||
cnf.set(fname, value, NULL, TRUE);
|
||||
}
|
||||
}
|
||||
}
|
||||
ok = TRUE;
|
||||
}
|
||||
else ok = FALSE;
|
||||
enable_menu_item(M_FILE_NEW);
|
||||
enable_menu_item(M_FILE_REVERT);
|
||||
return ok;
|
||||
}
|
||||
return warning_box("Nessun parametro da configurare");
|
||||
}
|
||||
|
||||
bool TApplication::change_config(const char* var, const char* oldv,
|
||||
const char* newv)
|
||||
const char* newv)
|
||||
|
||||
{ return TRUE; }
|
||||
|
1173
include/controls.cpp
1173
include/controls.cpp
File diff suppressed because it is too large
Load Diff
@ -37,7 +37,6 @@ MENU MENU_ALT_EDIT
|
||||
ITEM M_EDIT_SEARCH "C~erca" DISABLED
|
||||
|
||||
ACCEL MENU_FILE "f" ALT
|
||||
ACCEL MENU_EDIT "g" ALT
|
||||
|
||||
#if XVTWS == WINWS
|
||||
#scan <xil.h>
|
||||
|
@ -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();
|
||||
|
@ -13,13 +13,14 @@
|
||||
#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_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_SAVE 'S'
|
||||
#define K_QUIT 'Q'
|
||||
#define K_YES 'Y'
|
||||
|
||||
/* @END */
|
||||
|
143
include/mask.cpp
143
include/mask.cpp
@ -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();
|
||||
}
|
||||
|
||||
@ -607,11 +653,10 @@ 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,17 +684,33 @@ 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"
|
||||
"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);
|
||||
}
|
||||
|
232
include/mask.h
232
include/mask.h
@ -17,8 +17,8 @@
|
||||
// @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 };
|
||||
MODE_VIS , MODE_QUERY, MODE_QUERYINS,
|
||||
MODE_SEARCH };
|
||||
// @END
|
||||
|
||||
// @C
|
||||
@ -27,161 +27,161 @@ enum TMaskmode { NO_MODE, MODE_INS , MODE_MOD , MODE_DEL ,
|
||||
|
||||
class TMask : public TWindow
|
||||
{
|
||||
// @DPRIV
|
||||
enum { MAX_PAGES = 12 }; // Massimo numero di pagine nella maschera
|
||||
WINDOW _pagewin[MAX_PAGES+1]; // Windows of the pages
|
||||
// @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
|
||||
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
|
||||
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
|
||||
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
|
||||
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
|
||||
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
|
||||
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]; }
|
||||
// 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
|
||||
int find_field_win(WINDOW win) const; // number of field with window win
|
||||
|
||||
void set_mask_fields() const; // update screen
|
||||
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 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();
|
||||
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);
|
||||
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);
|
||||
// @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);
|
||||
// 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();
|
||||
virtual ~TMask();
|
||||
|
||||
const TFilename& source_file() const { return _source_file; }
|
||||
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 = "");
|
||||
// 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 = "");
|
||||
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 fields() const { return _field.items(); }
|
||||
int sheets() const { return _sheets; }
|
||||
|
||||
void set_mode(int m) { _mode = m; }
|
||||
int mode() const { return _mode; }
|
||||
void set_mode(int m) { _mode = m; }
|
||||
int mode() const { return _mode; }
|
||||
|
||||
void set_exchange(const real& e);
|
||||
const real& exchange() const { return _exchange; }
|
||||
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
|
||||
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;
|
||||
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
|
||||
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;
|
||||
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;}
|
||||
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);
|
||||
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(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;
|
||||
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;
|
||||
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 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 reset(short fld_id = -1);
|
||||
void undo(short fld_id = -1);
|
||||
|
||||
void autoload(const TRelation* = NULL);
|
||||
void autosave(TRelation* = NULL) const;
|
||||
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);
|
||||
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
|
||||
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; }
|
||||
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);
|
||||
virtual const char* get_caption() const;
|
||||
virtual void set_caption(const char* c);
|
||||
};
|
||||
|
||||
#endif // __MASK_H
|
||||
|
@ -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
|
||||
|
||||
wincreate(WC_PUSHBUTTON, _width + 2, _size, _prompt, parent, flags);
|
||||
}
|
||||
|
||||
|
@ -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; }
|
||||
WINDOW parent() const;
|
||||
short dlg() const { return _dlg; }
|
||||
|
||||
virtual bool ok() const;
|
||||
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); }
|
||||
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;
|
||||
virtual const char* class_name() const;
|
||||
virtual word class_id() const;
|
||||
|
||||
int size() const { return _size; }
|
||||
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;
|
||||
void set(const char* s);
|
||||
TString& get() const;
|
||||
|
||||
virtual const char* picture_data(const char* data, bool video);
|
||||
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; }
|
||||
const TFieldref* field() const { return _field; }
|
||||
|
||||
void set_focus() const;
|
||||
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 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 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);
|
||||
};
|
||||
|
||||
|
||||
@ -484,20 +484,24 @@ public:
|
||||
|
||||
class TButton_field : public TMask_field
|
||||
{
|
||||
protected:
|
||||
// @FPROT
|
||||
virtual word class_id() const;
|
||||
virtual void create(WINDOW parent);
|
||||
KEY _virtual_key, _exit_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);
|
||||
protected:
|
||||
// @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);
|
||||
|
||||
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);
|
||||
};
|
||||
|
||||
|
@ -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;
|
||||
/*
|
||||
|
@ -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
@ -1,31 +1,36 @@
|
||||
|
||||
BUTTON DLG_SAVEREC 8 2
|
||||
BEGIN
|
||||
PROMPT -16 -1 ""
|
||||
PROMPT -16 -1 "~Registra"
|
||||
MESSAGE EXIT,K_SAVE
|
||||
END
|
||||
|
||||
BUTTON DLG_NEWREC 8 2
|
||||
BEGIN
|
||||
PROMPT -26 -1 "Nuovo"
|
||||
PROMPT -26 -1 "~Nuovo"
|
||||
MESSAGE EXIT,K_INS
|
||||
END
|
||||
|
||||
BUTTON DLG_DELREC 8 2
|
||||
BEGIN
|
||||
PROMPT -36 -1 "Elimina"
|
||||
PROMPT -36 -1 "~Elimina"
|
||||
MESSAGE EXIT,K_DEL
|
||||
END
|
||||
|
||||
BUTTON DLG_FINDREC 8 2
|
||||
BEGIN
|
||||
PROMPT -46 -1 "Ricerca"
|
||||
PROMPT -46 -1 "Ricerca"
|
||||
MESSAGE EXIT,K_F9
|
||||
END
|
||||
|
||||
BUTTON DLG_CANCEL 8 2
|
||||
BEGIN
|
||||
PROMPT -56 -1 ""
|
||||
PROMPT -56 -1 ""
|
||||
MESSAGE EXIT,K_ESC
|
||||
END
|
||||
|
||||
BUTTON DLG_QUIT 8 2
|
||||
BEGIN
|
||||
PROMPT -66 -1 ""
|
||||
PROMPT -66 -1 ""
|
||||
MESSAGE EXIT,K_QUIT
|
||||
END
|
||||
|
||||
|
@ -15,7 +15,7 @@ HIDDEN const TArray* _parms;
|
||||
|
||||
HIDDEN int get_val_param_num() { return _parms->items();}
|
||||
HIDDEN const char* get_val_param(int i)
|
||||
{ return i < _parms->items() ? (const char*)((const TString&) (*_parms)[i]):"" ;}
|
||||
{ return i < _parms->items() ? (const char*)((const TString&) (*_parms)[i]):"" ;}
|
||||
|
||||
|
||||
HIDDEN bool _expr_val(TEdit_field& f, KEY)
|
||||
@ -35,12 +35,12 @@ HIDDEN bool _expr_val(TEdit_field& f, KEY)
|
||||
const int fldid = atoi(s);
|
||||
if (type == _numexpr)
|
||||
{
|
||||
const real r(fldid == 0 ? f.get() : f.mask().get(fldid));
|
||||
e.setvar(i, r);
|
||||
const real r(fldid == 0 ? f.get() : f.mask().get(fldid));
|
||||
e.setvar(i, r);
|
||||
}
|
||||
else
|
||||
{
|
||||
const char* v = fldid == 0 ? f.get() : f.mask().get(fldid);
|
||||
const char* v = fldid == 0 ? f.get() : f.mask().get(fldid);
|
||||
e.setvar(i, v);
|
||||
}
|
||||
}
|
||||
@ -52,15 +52,15 @@ HIDDEN bool _emptycopy_val(TEdit_field& f, KEY)
|
||||
{
|
||||
if (f.get().empty())
|
||||
{
|
||||
const short id = atoi(get_val_param(0));
|
||||
const TFixed_string val(f.mask().get(id));
|
||||
if (val.not_empty())
|
||||
{
|
||||
f.set(val);
|
||||
f.on_hit();
|
||||
}
|
||||
const short id = atoi(get_val_param(0));
|
||||
const TFixed_string val(f.mask().get(id));
|
||||
if (val.not_empty())
|
||||
{
|
||||
f.set(val);
|
||||
f.on_hit();
|
||||
}
|
||||
}
|
||||
return TRUE;
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
|
||||
@ -106,20 +106,20 @@ HIDDEN bool _pi_val(TEdit_field& f, KEY)
|
||||
if (pi.empty()) return TRUE;
|
||||
if (pi.len() != 11)
|
||||
{
|
||||
f.error_box("Lunghezza partita IVA diversa da 11");
|
||||
return FALSE;
|
||||
f.error_box("Lunghezza partita IVA diversa da 11");
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
bool ok = pi_check (stato, pi);
|
||||
if (!ok)
|
||||
{
|
||||
if(f.dirty())
|
||||
if (!ok)
|
||||
{
|
||||
if(f.dirty())
|
||||
{
|
||||
ok = f.yesno_box("Partita IVA errata, la accetto ugualmente?");
|
||||
if (ok) f.set_dirty(FALSE);
|
||||
ok = f.yesno_box("Partita IVA errata, la accetto ugualmente?");
|
||||
if (ok) f.set_dirty(FALSE);
|
||||
}
|
||||
else ok = TRUE; // Era gia' errata e la ho accettata
|
||||
}
|
||||
}
|
||||
return ok;
|
||||
}
|
||||
|
||||
@ -185,7 +185,7 @@ bool cf_check (const char * stato, const char * codcf)
|
||||
{
|
||||
TFixed_string cf (codcf);
|
||||
if (cf.empty())
|
||||
return TRUE;
|
||||
return TRUE;
|
||||
const bool ok = (cf.len() == 11) ? pi_check(stato, cf) : __cf_check(cf);
|
||||
return ok;
|
||||
}
|
||||
@ -193,7 +193,7 @@ bool cf_check (const char * stato, const char * codcf)
|
||||
|
||||
HIDDEN bool _cf_val(TEdit_field& f, KEY key)
|
||||
{
|
||||
if (f.mask().query_mode()) return TRUE;
|
||||
if (f.mask().query_mode()) return TRUE;
|
||||
|
||||
const TFixed_string cf(f.get());
|
||||
if (cf.empty()) return TRUE;
|
||||
@ -203,12 +203,12 @@ HIDDEN bool _cf_val(TEdit_field& f, KEY key)
|
||||
bool ok = __cf_check(cf);
|
||||
if (!ok)
|
||||
{
|
||||
if(f.dirty())
|
||||
{
|
||||
ok = f.yesno_box("Codice fiscale errato: lo accetto ugualmente?");
|
||||
if (ok) f.set_dirty(FALSE);
|
||||
}
|
||||
else ok = TRUE; // Era gia' errato al caricamento quindi lo accetto
|
||||
if(f.dirty())
|
||||
{
|
||||
ok = f.yesno_box("Codice fiscale errato: lo accetto ugualmente?");
|
||||
if (ok) f.set_dirty(FALSE);
|
||||
}
|
||||
else ok = TRUE; // Era gia' errato al caricamento quindi lo accetto
|
||||
}
|
||||
return ok;
|
||||
}
|
||||
@ -218,7 +218,7 @@ HIDDEN bool _xt_pi_val(TEdit_field& f, KEY key)
|
||||
|
||||
{
|
||||
TMask& m = f.mask();
|
||||
if (m.query_mode()) return TRUE;
|
||||
if (m.query_mode()) return TRUE;
|
||||
|
||||
TString value(f.get());
|
||||
if (value.empty()) return f.error_box("Partita IVA obbligatoria");
|
||||
@ -234,32 +234,32 @@ HIDDEN bool _xt_pi_val(TEdit_field& f, KEY key)
|
||||
|
||||
for (int i = 1 ; i < 3; i++)
|
||||
{
|
||||
const int comune = atoi(get_val_param(i));
|
||||
if (comune)
|
||||
{
|
||||
const TString com(m.get(comune)); // Comune residenza fiscale e residenza
|
||||
if (com.not_empty())
|
||||
{
|
||||
c.zero();
|
||||
c.put("COM", com);
|
||||
if (c.read() == NOERR)
|
||||
{
|
||||
const int comune = atoi(get_val_param(i));
|
||||
if (comune)
|
||||
{
|
||||
const TString com(m.get(comune)); // Comune residenza fiscale e residenza
|
||||
if (com.not_empty())
|
||||
{
|
||||
c.zero();
|
||||
c.put("COM", com);
|
||||
if (c.read() == NOERR)
|
||||
{
|
||||
const int s1 = c.get_int("UFFIVA1");
|
||||
const int s2 = c.get_int("UFFIVA2");
|
||||
const int s3 = c.get_int("UFFIVA3");
|
||||
if (pi != s1 && pi != s2 && pi != s3)
|
||||
{
|
||||
const char* ui = format("%03d", s1);
|
||||
if (f.yesno_box("Ufficio IVA della partita IVA non congruente: correggere in %s?", ui))
|
||||
{
|
||||
value.overwrite(ui, 7);
|
||||
f.set(value);
|
||||
}
|
||||
if (f.yesno_box("Ufficio IVA della partita IVA non congruente: correggere in %s?", ui))
|
||||
{
|
||||
value.overwrite(ui, 7);
|
||||
f.set(value);
|
||||
}
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
return TRUE;
|
||||
}
|
||||
@ -268,17 +268,17 @@ HIDDEN bool _xt_pi_val(TEdit_field& f, KEY key)
|
||||
HIDDEN bool _xtz_pi_val(TEdit_field& f, KEY key)
|
||||
|
||||
{
|
||||
if (f.mask().query_mode()) return TRUE;
|
||||
TString pi(f.get());
|
||||
if (pi.empty()) return TRUE;
|
||||
return _xt_pi_val(f, key);
|
||||
if (f.mask().query_mode()) return TRUE;
|
||||
TString pi(f.get());
|
||||
if (pi.empty()) return TRUE;
|
||||
return _xt_pi_val(f, key);
|
||||
}
|
||||
|
||||
|
||||
HIDDEN bool _xt_cf_val(TEdit_field& f, KEY key)
|
||||
|
||||
{
|
||||
if (f.mask().query_mode()) return TRUE;
|
||||
if (f.mask().query_mode()) return TRUE;
|
||||
|
||||
const TString cf(f.get());
|
||||
if (cf.empty()) return f.error_box("Codice fiscale obbligatorio");
|
||||
@ -287,9 +287,9 @@ HIDDEN bool _xt_cf_val(TEdit_field& f, KEY key)
|
||||
|
||||
if (cf.len() == 11)
|
||||
{
|
||||
if (!_xt_pi_val(f, key)) return FALSE;
|
||||
TString stato(f.mask().get(atoi(get_val_param(0))));
|
||||
if ((stato.not_empty()) && (stato != "IT")) return TRUE;
|
||||
if (!_xt_pi_val(f, key)) return FALSE;
|
||||
TString stato(f.mask().get(atoi(get_val_param(0))));
|
||||
if ((stato.not_empty()) && (stato != "IT")) return TRUE;
|
||||
}
|
||||
|
||||
bool passed = __cf_check(cf);
|
||||
@ -316,12 +316,12 @@ HIDDEN bool _xt_cf_val(TEdit_field& f, KEY key)
|
||||
if ((p = wm.find(cf[14])) != -1) cf[14] = '0' + p;
|
||||
int gn = atoi(cf.mid(9,2));
|
||||
|
||||
if ((sesso == 'F' && gn <= 40) || (sesso == 'M' && gn >= 40))
|
||||
{
|
||||
passed = fld_sex.yesno_box("Sesso non congruente al codice fiscale: correzione automatica?");
|
||||
if (passed) fld_sex.set(sesso == 'M' ? "F" : "M");
|
||||
else return TRUE;
|
||||
}
|
||||
if ((sesso == 'F' && gn <= 40) || (sesso == 'M' && gn >= 40))
|
||||
{
|
||||
passed = fld_sex.yesno_box("Sesso non congruente al codice fiscale: correzione automatica?");
|
||||
if (passed) fld_sex.set(sesso == 'M' ? "F" : "M");
|
||||
else return TRUE;
|
||||
}
|
||||
|
||||
if (gn > 40) gn -= 40;
|
||||
|
||||
@ -331,38 +331,38 @@ HIDDEN bool _xt_cf_val(TEdit_field& f, KEY key)
|
||||
{
|
||||
const TDate d(data);
|
||||
int err = 0;
|
||||
if ((d.year() % 100) != atoi(cf.mid(6, 2)))
|
||||
err = 1;
|
||||
if (wm[d.month() - 1] != cf[8])
|
||||
err = 2;
|
||||
if (d.day() != gn)
|
||||
err = 3;
|
||||
if (err != 0)
|
||||
{
|
||||
const char* const what = err==1 ? "Anno" : (err==2 ? "Mese" : "Giorno");
|
||||
passed = fld_dat.yesno_box("%s di nascita non congruente al codice fiscale: correzione automatica?", what);
|
||||
if (passed) data = "";
|
||||
else return TRUE;
|
||||
}
|
||||
if ((d.year() % 100) != atoi(cf.mid(6, 2)))
|
||||
err = 1;
|
||||
if (wm[d.month() - 1] != cf[8])
|
||||
err = 2;
|
||||
if (d.day() != gn)
|
||||
err = 3;
|
||||
if (err != 0)
|
||||
{
|
||||
const char* const what = err==1 ? "Anno" : (err==2 ? "Mese" : "Giorno");
|
||||
passed = fld_dat.yesno_box("%s di nascita non congruente al codice fiscale: correzione automatica?", what);
|
||||
if (passed) data = "";
|
||||
else return TRUE;
|
||||
}
|
||||
}
|
||||
|
||||
if (data.empty())
|
||||
{
|
||||
const int mn = wm.find(cf[8]) + 1;
|
||||
if (mn > 0)
|
||||
{
|
||||
const TDate d(gn, mn, 1900 + atoi(cf.mid(6, 2)));
|
||||
fld_dat.set(d.string());
|
||||
}
|
||||
const int mn = wm.find(cf[8]) + 1;
|
||||
if (mn > 0)
|
||||
{
|
||||
const TDate d(gn, mn, 1900 + atoi(cf.mid(6, 2)));
|
||||
fld_dat.set(d.string());
|
||||
}
|
||||
}
|
||||
|
||||
// Controllo del comune di nascita
|
||||
const char* const codcom = cf.mid(11, 4);
|
||||
if (com.not_empty() && com != codcom)
|
||||
{
|
||||
passed = fld_com.yesno_box("Comune non congruente al codice fiscale: correzione automatica?");
|
||||
if (passed) com = "";
|
||||
else return TRUE;
|
||||
if (com.not_empty() && com != codcom)
|
||||
{
|
||||
passed = fld_com.yesno_box("Comune non congruente al codice fiscale: correzione automatica?");
|
||||
if (passed) com = "";
|
||||
else return TRUE;
|
||||
}
|
||||
if (com.empty())
|
||||
{
|
||||
@ -377,9 +377,9 @@ HIDDEN bool _xt_cf_val(TEdit_field& f, KEY key)
|
||||
HIDDEN bool _xtz_cf_val(TEdit_field& f, KEY key)
|
||||
|
||||
{
|
||||
if (f.mask().query_mode()) return TRUE;
|
||||
const char* cf = f.get();
|
||||
return (*cf == '\0') ? TRUE : _xt_cf_val(f, key);
|
||||
if (f.mask().query_mode()) return TRUE;
|
||||
const char* cf = f.get();
|
||||
return (*cf == '\0') ? TRUE : _xt_cf_val(f, key);
|
||||
}
|
||||
|
||||
|
||||
@ -416,77 +416,77 @@ HIDDEN bool _date_cmp(TEdit_field& f, KEY)
|
||||
|
||||
HIDDEN bool _fixlen_val(TEdit_field& f, KEY)
|
||||
{
|
||||
const TFixed_string s(f.get());
|
||||
const TFixed_string s(f.get());
|
||||
|
||||
if (s.empty()) return TRUE;
|
||||
if (s.empty()) return TRUE;
|
||||
|
||||
const int length = atoi(get_val_param(0));
|
||||
const bool ok = s.len() == length;
|
||||
if (!ok) f.error_box("Lunghezza errata: deve essere %d", length);
|
||||
return ok;
|
||||
const int length = atoi(get_val_param(0));
|
||||
const bool ok = s.len() == length;
|
||||
if (!ok) f.error_box("Lunghezza errata: deve essere %d", length);
|
||||
return ok;
|
||||
}
|
||||
|
||||
|
||||
HIDDEN bool _mtcheck_val(TEdit_field& f, KEY)
|
||||
{
|
||||
const int month = atoi(f.get());
|
||||
if (month < 1 || month > 13) return FALSE;
|
||||
const int month = atoi(f.get());
|
||||
if (month < 1 || month > 13) return FALSE;
|
||||
|
||||
TLocalisamfile d(LF_NDITTE);
|
||||
d.zero();
|
||||
d.put(NDT_CODDITTA, MainApp()->get_firm());
|
||||
d.read();
|
||||
if (d.bad()) return TRUE;
|
||||
if (d.get_char(NDT_FREQVIVA) == 'M') return TRUE;
|
||||
return month == 13 || (month % 3) == 0;
|
||||
TLocalisamfile d(LF_NDITTE);
|
||||
d.zero();
|
||||
d.put(NDT_CODDITTA, MainApp()->get_firm());
|
||||
d.read();
|
||||
if (d.bad()) return TRUE;
|
||||
if (d.get_char(NDT_FREQVIVA) == 'M') return TRUE;
|
||||
return month == 13 || (month % 3) == 0;
|
||||
}
|
||||
|
||||
|
||||
HIDDEN bool _reqif_val(TEdit_field& f, KEY)
|
||||
{
|
||||
if (f.get().not_empty()) return TRUE;
|
||||
const int nparms = get_val_param_num();
|
||||
for (int i = 0 ; i < nparms; i++)
|
||||
{
|
||||
const char* s = get_val_param(i);
|
||||
if (*s == '\0') break;
|
||||
if (f.mask().get(atoi(s)).not_empty()) return FALSE;
|
||||
}
|
||||
return TRUE;
|
||||
if (f.get().not_empty()) return TRUE;
|
||||
const int nparms = get_val_param_num();
|
||||
for (int i = 0 ; i < nparms; i++)
|
||||
{
|
||||
const char* s = get_val_param(i);
|
||||
if (*s == '\0') break;
|
||||
if (f.mask().get(atoi(s)).not_empty()) return FALSE;
|
||||
}
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
|
||||
HIDDEN bool _autoexit_val(TEdit_field& f, KEY key)
|
||||
{
|
||||
const int nparms = get_val_param_num();
|
||||
bool one_not_empty = FALSE;
|
||||
for (int i = nparms; i-- > 0;)
|
||||
{
|
||||
const short id = f.atodlg(get_val_param(i));
|
||||
const TMask_field& c = f.mask().field(id);
|
||||
const bool empty = c.get().empty();
|
||||
if (empty)
|
||||
{
|
||||
if (c.check_type() != CHECK_NONE || one_not_empty)
|
||||
return key == K_TAB;
|
||||
const int nparms = get_val_param_num();
|
||||
bool one_not_empty = FALSE;
|
||||
for (int i = nparms; i-- > 0;)
|
||||
{
|
||||
const short id = f.atodlg(get_val_param(i));
|
||||
const TMask_field& c = f.mask().field(id);
|
||||
const bool empty = c.get().empty();
|
||||
if (empty)
|
||||
{
|
||||
if (c.check_type() != CHECK_NONE || one_not_empty)
|
||||
return key == K_TAB;
|
||||
}
|
||||
else
|
||||
one_not_empty = TRUE;
|
||||
}
|
||||
}
|
||||
|
||||
bool ok = TRUE;
|
||||
if (key == K_TAB)
|
||||
f.mask().send_key(K_SHIFT_ENTER, 0);
|
||||
else
|
||||
ok = one_not_empty;
|
||||
bool ok = TRUE;
|
||||
if (key == K_TAB)
|
||||
f.mask().send_key(K_AUTO_ENTER, 0);
|
||||
else
|
||||
ok = one_not_empty;
|
||||
|
||||
return ok;
|
||||
return ok;
|
||||
}
|
||||
|
||||
|
||||
HIDDEN bool _numcalc_val(TEdit_field& f, KEY k)
|
||||
{
|
||||
if (k != K_TAB) return TRUE;
|
||||
if (k != K_TAB) return TRUE;
|
||||
TExpression e(get_val_param(0), _numexpr);
|
||||
|
||||
for (int i = 0 ; i < e.numvar(); i++)
|
||||
@ -499,7 +499,7 @@ HIDDEN bool _numcalc_val(TEdit_field& f, KEY k)
|
||||
}
|
||||
s++;
|
||||
const int fldid = atoi(s);
|
||||
e.setvar(i, fldid == 0 ? f.get() : f.mask().get(fldid));
|
||||
e.setvar(i, fldid == 0 ? f.get() : f.mask().get(fldid));
|
||||
}
|
||||
TFixed_string s((const char*) e);
|
||||
f.set(s);
|
||||
@ -509,7 +509,7 @@ HIDDEN bool _numcalc_val(TEdit_field& f, KEY k)
|
||||
|
||||
HIDDEN bool _strcalc_val(TEdit_field& f, KEY k)
|
||||
{
|
||||
if (k != K_TAB) return TRUE;
|
||||
if (k != K_TAB) return TRUE;
|
||||
TExpression e(get_val_param(0), _strexpr);
|
||||
|
||||
for (int i = 0 ; i < e.numvar(); i++)
|
||||
@ -522,7 +522,7 @@ HIDDEN bool _strcalc_val(TEdit_field& f, KEY k)
|
||||
}
|
||||
s++;
|
||||
const int fldid = atoi(s);
|
||||
e.setvar(i, fldid == 0 ? f.get() : f.mask().get(fldid));
|
||||
e.setvar(i, fldid == 0 ? f.get() : f.mask().get(fldid));
|
||||
}
|
||||
TFixed_string s((const char*) e);
|
||||
f.set(s);
|
||||
@ -533,24 +533,24 @@ HIDDEN bool _strcalc_val(TEdit_field& f, KEY k)
|
||||
#define MAX_FUNC 16
|
||||
|
||||
HIDDEN VAL_FUNC _global_val_func[MAX_FUNC] =
|
||||
{
|
||||
_expr_val,
|
||||
_emptycopy_val,
|
||||
_pi_val,
|
||||
_cf_val,
|
||||
_notempty_val,
|
||||
_date_cmp,
|
||||
_xt_pi_val,
|
||||
_xt_cf_val,
|
||||
_xtz_pi_val,
|
||||
_xtz_cf_val,
|
||||
_fixlen_val,
|
||||
_mtcheck_val,
|
||||
_reqif_val,
|
||||
_autoexit_val,
|
||||
_numcalc_val,
|
||||
_strcalc_val
|
||||
};
|
||||
{
|
||||
_expr_val,
|
||||
_emptycopy_val,
|
||||
_pi_val,
|
||||
_cf_val,
|
||||
_notempty_val,
|
||||
_date_cmp,
|
||||
_xt_pi_val,
|
||||
_xt_cf_val,
|
||||
_xtz_pi_val,
|
||||
_xtz_cf_val,
|
||||
_fixlen_val,
|
||||
_mtcheck_val,
|
||||
_reqif_val,
|
||||
_autoexit_val,
|
||||
_numcalc_val,
|
||||
_strcalc_val
|
||||
};
|
||||
|
||||
bool validate(int fn, TEdit_field& f, KEY k, const TArray& parms)
|
||||
{
|
||||
|
2568
include/viswin.cpp
2568
include/viswin.cpp
File diff suppressed because it is too large
Load Diff
@ -21,26 +21,26 @@
|
||||
|
||||
class TWindow_manager
|
||||
{
|
||||
// @DPRIV
|
||||
enum { MAX_WIN = 4 }; // Max number of modal windows
|
||||
// @DPRIV
|
||||
enum { MAX_WIN = 4 }; // Max number of modal windows
|
||||
|
||||
TWindow* _window[MAX_WIN]; // Stack of active windows
|
||||
char _current; // Stack pointer
|
||||
void menu_enable(bool) const; // Abilita o disabilita il menu della task window
|
||||
TWindow* _window[MAX_WIN]; // Stack of active windows
|
||||
char _current; // Stack pointer
|
||||
void menu_enable(bool) const; // Abilita o disabilita il menu della task window
|
||||
|
||||
public:
|
||||
// @FPUB
|
||||
TWindow_manager(); // Costruttore
|
||||
~TWindow_manager() { destroy(); }
|
||||
// @FPUB
|
||||
TWindow_manager(); // Costruttore
|
||||
~TWindow_manager() { destroy(); }
|
||||
|
||||
void reg(TWindow* m);
|
||||
// Registra la finestra corrente
|
||||
void unreg(const TWindow* m);
|
||||
// De-registra la finestra corrente
|
||||
void reg(TWindow* m);
|
||||
// Registra la finestra corrente
|
||||
void unreg(const TWindow* m);
|
||||
// De-registra la finestra corrente
|
||||
|
||||
TWindow* cur_win() const { return (_current < 0) ? NULL : _window[_current]; } // Ritorna il puntatore alla finestra corrente
|
||||
void destroy();
|
||||
bool can_close() const { return _current < 1; }
|
||||
TWindow* cur_win() const { return (_current < 0) ? NULL : _window[_current]; } // Ritorna il puntatore alla finestra corrente
|
||||
void destroy();
|
||||
bool can_close() const { return _current < 1; }
|
||||
} WinManager;
|
||||
|
||||
|
||||
@ -50,98 +50,98 @@ TWindow_manager::TWindow_manager() : _current(-1)
|
||||
|
||||
void TWindow_manager::destroy()
|
||||
{
|
||||
while (_current >= 0)
|
||||
{
|
||||
TWindow* w = cur_win();
|
||||
w->stop_run(K_QUIT);
|
||||
w->close_modal();
|
||||
}
|
||||
while (_current >= 0)
|
||||
{
|
||||
TWindow* w = cur_win();
|
||||
w->stop_run(K_QUIT);
|
||||
w->close_modal();
|
||||
}
|
||||
}
|
||||
|
||||
// Dis/abilitazione del menu principale
|
||||
HIDDEN void xvt_menu_enable(MENU_ITEM* m, bool on)
|
||||
{
|
||||
while (m->tag)
|
||||
{
|
||||
switch(m->tag)
|
||||
{
|
||||
case M_FILE:
|
||||
case MENU_FILE:
|
||||
case MENU_EDIT:
|
||||
case MENU_ALT_EDIT:
|
||||
if (m->child)
|
||||
xvt_menu_enable(m->child, on);
|
||||
break;
|
||||
case 65535: // Separator
|
||||
case M_FILE_NEW:
|
||||
case M_FILE_REVERT:
|
||||
case M_FILE_QUIT:
|
||||
case M_FILE_ABOUT:
|
||||
case M_FILE_PRINT:
|
||||
case M_FILE_PG_SETUP:
|
||||
case (M_FILE+11):
|
||||
case M_EDIT_SEARCH:
|
||||
break; // Leave them as they are
|
||||
default:
|
||||
win_menu_enable(TASK_WIN, m->tag, on);
|
||||
break;
|
||||
}
|
||||
m++;
|
||||
}
|
||||
while (m->tag)
|
||||
{
|
||||
switch(m->tag)
|
||||
{
|
||||
case M_FILE:
|
||||
case MENU_FILE:
|
||||
case MENU_EDIT:
|
||||
case MENU_ALT_EDIT:
|
||||
if (m->child)
|
||||
xvt_menu_enable(m->child, on);
|
||||
break;
|
||||
case 65535: // Separator
|
||||
case M_FILE_NEW:
|
||||
case M_FILE_REVERT:
|
||||
case M_FILE_QUIT:
|
||||
case M_FILE_ABOUT:
|
||||
case M_FILE_PRINT:
|
||||
case M_FILE_PG_SETUP:
|
||||
case (M_FILE+11):
|
||||
case M_EDIT_SEARCH:
|
||||
break; // Leave them as they are
|
||||
default:
|
||||
win_menu_enable(TASK_WIN, m->tag, on);
|
||||
break;
|
||||
}
|
||||
m++;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
void TWindow_manager::menu_enable(bool on) const
|
||||
{
|
||||
MENU_ITEM *mi = win_menu_fetch(TASK_WIN);
|
||||
xvt_menu_enable(mi, on);
|
||||
win_update_menu_bar(TASK_WIN);
|
||||
menu_free(mi);
|
||||
MENU_ITEM *mi = win_menu_fetch(TASK_WIN);
|
||||
xvt_menu_enable(mi, on);
|
||||
win_update_menu_bar(TASK_WIN);
|
||||
menu_free(mi);
|
||||
}
|
||||
|
||||
|
||||
void TWindow_manager::reg(TWindow* m)
|
||||
{
|
||||
_current++;
|
||||
CHECK(_current < MAX_WIN, "Too many windows");
|
||||
_current++;
|
||||
CHECK(_current < MAX_WIN, "Too many windows");
|
||||
|
||||
switch (_current)
|
||||
{
|
||||
case 0 : menu_enable(FALSE); break;
|
||||
case 1 : win_menu_enable(TASK_WIN, M_FILE_QUIT, FALSE);
|
||||
default: _window[_current-1]->disable(); break;
|
||||
}
|
||||
switch (_current)
|
||||
{
|
||||
case 0 : menu_enable(FALSE); break;
|
||||
case 1 : win_menu_enable(TASK_WIN, M_FILE_QUIT, FALSE);
|
||||
default: _window[_current-1]->disable(); break;
|
||||
}
|
||||
|
||||
_window[_current] = m;
|
||||
_window[_current] = m;
|
||||
}
|
||||
|
||||
|
||||
void TWindow_manager::unreg(const TWindow* m)
|
||||
{
|
||||
#ifdef DBG
|
||||
if (m != cur_win())
|
||||
{
|
||||
error_box("You can unregister the current window only");
|
||||
return;
|
||||
}
|
||||
if (m != cur_win())
|
||||
{
|
||||
error_box("You can unregister the current window only");
|
||||
return;
|
||||
}
|
||||
#endif
|
||||
|
||||
_current--;
|
||||
_current--;
|
||||
|
||||
if (_current < 0)
|
||||
menu_enable(TRUE);
|
||||
else
|
||||
{
|
||||
if (_current == 0)
|
||||
win_menu_enable(TASK_WIN, M_FILE_QUIT, TRUE);
|
||||
cur_win()->enable();
|
||||
}
|
||||
if (_current < 0)
|
||||
menu_enable(TRUE);
|
||||
else
|
||||
{
|
||||
if (_current == 0)
|
||||
win_menu_enable(TASK_WIN, M_FILE_QUIT, TRUE);
|
||||
cur_win()->enable();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
void close_all_dialogs()
|
||||
{
|
||||
WinManager.destroy();
|
||||
WinManager.destroy();
|
||||
}
|
||||
|
||||
bool can_close()
|
||||
@ -149,6 +149,12 @@ bool can_close()
|
||||
return WinManager.can_close();
|
||||
}
|
||||
|
||||
WINDOW cur_win()
|
||||
{
|
||||
const TWindow* w = WinManager.cur_win();
|
||||
return w ? w->win() : NULL_WIN;
|
||||
}
|
||||
|
||||
|
||||
///////////////////////////////////////////////////////////
|
||||
// TWindow
|
||||
@ -159,135 +165,135 @@ bool TWindow::_ctools_saved;
|
||||
|
||||
|
||||
TWindow::TWindow()
|
||||
: _win(NULL_WIN), _open(FALSE), _modal(FALSE),
|
||||
_running(FALSE), _lastkey(0)
|
||||
: _win(NULL_WIN), _open(FALSE), _modal(FALSE),
|
||||
_running(FALSE), _lastkey(0)
|
||||
{}
|
||||
|
||||
|
||||
long TWindow::window_handler(WINDOW win, EVENT* ep)
|
||||
{
|
||||
TWindow* w = (TWindow*)get_app_data(win);
|
||||
CHECK(w != NULL, "Invalid window");
|
||||
w->handler(win, ep);
|
||||
TWindow* w = (TWindow*)get_app_data(win);
|
||||
CHECK(w != NULL, "Invalid window");
|
||||
w->handler(win, ep);
|
||||
|
||||
return 0L;
|
||||
return 0L;
|
||||
}
|
||||
|
||||
|
||||
WINDOW TWindow::create(short x, short y, short dx, short dy,
|
||||
const char* title, long flags, WIN_TYPE wt, WINDOW parent)
|
||||
const char* title, long flags, WIN_TYPE wt, WINDOW parent)
|
||||
{
|
||||
flags |= WSF_NO_MENUBAR;
|
||||
flags |= WSF_NO_MENUBAR;
|
||||
|
||||
if (parent == NULL_WIN) parent = TASK_WIN;
|
||||
if (parent == TASK_WIN) flags |= WSF_INVISIBLE;
|
||||
if (parent == NULL_WIN) parent = TASK_WIN;
|
||||
if (parent == TASK_WIN) flags |= WSF_INVISIBLE;
|
||||
|
||||
_win = xvt_create_window(
|
||||
wt,
|
||||
x, y, dx, dy,
|
||||
title, parent,
|
||||
flags,
|
||||
window_handler,
|
||||
PTR_LONG(this)
|
||||
);
|
||||
_win = xvt_create_window(
|
||||
wt,
|
||||
x, y, dx, dy,
|
||||
title, parent,
|
||||
flags,
|
||||
window_handler,
|
||||
PTR_LONG(this)
|
||||
);
|
||||
|
||||
CHECK(_win, "Can't create a window");
|
||||
CHECK(_win, "Can't create a window");
|
||||
|
||||
return _win;
|
||||
return _win;
|
||||
}
|
||||
|
||||
|
||||
TWindow::~TWindow()
|
||||
{
|
||||
if (_win != NULL_WIN)
|
||||
{
|
||||
close_window(_win);
|
||||
_win = NULL_WIN;
|
||||
}
|
||||
if (_win != NULL_WIN)
|
||||
{
|
||||
close_window(_win);
|
||||
_win = NULL_WIN;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
void TWindow::open()
|
||||
{
|
||||
CHECK(win() != NULL_WIN, "Can't open a NULL window");
|
||||
show_window(win(), _open = TRUE);
|
||||
set_front_window(win());
|
||||
CHECK(win() != NULL_WIN, "Can't open a NULL window");
|
||||
show_window(win(), _open = TRUE);
|
||||
set_front_window(win());
|
||||
}
|
||||
|
||||
|
||||
void TWindow::open_modal()
|
||||
{
|
||||
set_modal(TRUE);
|
||||
_open = TRUE;
|
||||
open();
|
||||
set_modal(TRUE);
|
||||
_open = TRUE;
|
||||
open();
|
||||
|
||||
WinManager.reg(this);
|
||||
WinManager.reg(this);
|
||||
}
|
||||
|
||||
|
||||
void TWindow::close()
|
||||
{
|
||||
CHECK(_win != NULL_WIN, "Can't close a NULL window");
|
||||
show_window(_win, _open = FALSE);
|
||||
CHECK(_win != NULL_WIN, "Can't close a NULL window");
|
||||
show_window(_win, _open = FALSE);
|
||||
}
|
||||
|
||||
|
||||
void TWindow::close_modal()
|
||||
{
|
||||
WinManager.unreg(this);
|
||||
WinManager.unreg(this);
|
||||
|
||||
close();
|
||||
_open = FALSE;
|
||||
close();
|
||||
_open = FALSE;
|
||||
}
|
||||
|
||||
bool TWindow::stop_run(KEY key)
|
||||
{
|
||||
_running = FALSE;
|
||||
_lastkey = key;
|
||||
return TRUE;
|
||||
_running = FALSE;
|
||||
_lastkey = key;
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
|
||||
KEY TWindow::run()
|
||||
{
|
||||
const bool was_open = is_open();
|
||||
const bool was_open = is_open();
|
||||
|
||||
start_run();
|
||||
_running = TRUE;
|
||||
start_run();
|
||||
_running = TRUE;
|
||||
|
||||
if (!was_open) open_modal();
|
||||
else open();
|
||||
if (!was_open) open_modal();
|
||||
else open();
|
||||
|
||||
while (_running)
|
||||
do_events();
|
||||
while (_running)
|
||||
do_events();
|
||||
|
||||
if (!was_open) close_modal();
|
||||
if (!was_open) close_modal();
|
||||
|
||||
return last_key();
|
||||
return last_key();
|
||||
}
|
||||
|
||||
void TWindow::handler(WINDOW win, EVENT* ep)
|
||||
{
|
||||
switch(ep->type)
|
||||
{
|
||||
case E_CLOSE:
|
||||
stop_run(K_ESC);
|
||||
break;
|
||||
case E_UPDATE:
|
||||
{
|
||||
clear_window(win, NORMAL_BACK_COLOR);
|
||||
update();
|
||||
}
|
||||
break;
|
||||
case E_CHAR:
|
||||
on_key(e_char_to_key(ep));
|
||||
break;
|
||||
case E_DESTROY:
|
||||
_win = NULL_WIN;
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
switch(ep->type)
|
||||
{
|
||||
case E_CLOSE:
|
||||
stop_run(K_ESC);
|
||||
break;
|
||||
case E_UPDATE:
|
||||
{
|
||||
clear_window(win, NORMAL_BACK_COLOR);
|
||||
update();
|
||||
}
|
||||
break;
|
||||
case E_CHAR:
|
||||
on_key(e_char_to_key(ep));
|
||||
break;
|
||||
case E_DESTROY:
|
||||
_win = NULL_WIN;
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@ -300,7 +306,7 @@ TPoint TWindow::size() const
|
||||
|
||||
WINDOW TWindow::parent() const
|
||||
{
|
||||
return get_parent(win());
|
||||
return get_parent(win());
|
||||
}
|
||||
|
||||
|
||||
@ -314,46 +320,46 @@ void TWindow::set_focus()
|
||||
void TWindow::iconize() const
|
||||
{
|
||||
#if XVTWS != WMWS
|
||||
HWND hwnd = (HWND)get_value(win(), ATTR_NATIVE_WINDOW);
|
||||
ShowWindow(hwnd, SW_MINIMIZE);
|
||||
HWND hwnd = (HWND)get_value(win(), ATTR_NATIVE_WINDOW);
|
||||
ShowWindow(hwnd, SW_MINIMIZE);
|
||||
#endif
|
||||
}
|
||||
|
||||
void TWindow::maximize() const
|
||||
{
|
||||
#if XVTWS != WMWS
|
||||
HWND hwnd = (HWND)get_value(win(), ATTR_NATIVE_WINDOW);
|
||||
ShowWindow(hwnd, SW_SHOWMAXIMIZED);
|
||||
HWND hwnd = (HWND)get_value(win(), ATTR_NATIVE_WINDOW);
|
||||
ShowWindow(hwnd, SW_SHOWMAXIMIZED);
|
||||
#else
|
||||
RCT r; set_rect(&r, 1,1,79,23);
|
||||
move_window(win(),&r);
|
||||
RCT r; set_rect(&r, 1,1,79,23);
|
||||
move_window(win(),&r);
|
||||
#endif
|
||||
}
|
||||
|
||||
void TWindow::enable(bool on) const
|
||||
{
|
||||
enable_window(win(), on);
|
||||
enable_window(win(), on);
|
||||
}
|
||||
|
||||
|
||||
void TWindow::set_caption(const char* title)
|
||||
{
|
||||
set_title(win(), (char*)title);
|
||||
set_title(win(), (char*)title);
|
||||
}
|
||||
|
||||
|
||||
const char* TWindow::get_caption() const
|
||||
{
|
||||
char* title = &__tmp_string[512];
|
||||
get_title(win(), title, 80);
|
||||
return title;
|
||||
char* title = &__tmp_string[512];
|
||||
get_title(win(), title, 80);
|
||||
return title;
|
||||
}
|
||||
|
||||
|
||||
void TWindow::force_update()
|
||||
{
|
||||
if (win() != NULL_WIN)
|
||||
invalidate_rect(win(), NULL);
|
||||
if (win() != NULL_WIN)
|
||||
invalidate_rect(win(), NULL);
|
||||
}
|
||||
|
||||
|
||||
@ -376,7 +382,7 @@ bool TWindow::restore_ctools()
|
||||
_ctools_saved = FALSE;
|
||||
return TRUE;
|
||||
}
|
||||
return FALSE;
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
|
||||
@ -389,58 +395,58 @@ void TWindow::set_color(COLOR fore, COLOR back)
|
||||
|
||||
void TWindow::set_pen(COLOR color, int width, PAT_STYLE pat, PEN_STYLE style)
|
||||
{
|
||||
CPEN pen;
|
||||
CPEN pen;
|
||||
|
||||
pen.width = width;
|
||||
pen.pat = pat;
|
||||
pen.style = style;
|
||||
pen.color = color;
|
||||
pen.width = width;
|
||||
pen.pat = pat;
|
||||
pen.style = style;
|
||||
pen.color = color;
|
||||
|
||||
win_set_cpen(win(), &pen);
|
||||
win_set_cpen(win(), &pen);
|
||||
}
|
||||
|
||||
|
||||
void TWindow::hide_pen()
|
||||
{
|
||||
win_set_std_cpen(win(), TL_PEN_HOLLOW);
|
||||
win_set_std_cpen(win(), TL_PEN_HOLLOW);
|
||||
}
|
||||
|
||||
|
||||
void TWindow::set_brush(COLOR color, PAT_STYLE pat)
|
||||
{
|
||||
CBRUSH brush = { pat, color };
|
||||
win_set_cbrush(win(), &brush);
|
||||
CBRUSH brush = { pat, color };
|
||||
win_set_cbrush(win(), &brush);
|
||||
}
|
||||
|
||||
|
||||
void TWindow::hide_brush()
|
||||
{
|
||||
CBRUSH brush = { PAT_HOLLOW, COLOR_WHITE };
|
||||
win_set_cbrush(win(), &brush);
|
||||
CBRUSH brush = { PAT_HOLLOW, COLOR_WHITE };
|
||||
win_set_cbrush(win(), &brush);
|
||||
}
|
||||
|
||||
|
||||
HIDDEN void swap(short& a, short& b)
|
||||
{
|
||||
short tmp = a;
|
||||
short tmp = a;
|
||||
a = b;
|
||||
b = tmp;
|
||||
}
|
||||
|
||||
|
||||
void TWindow::frame(short left, short top, short right, short bottom,
|
||||
int flag)
|
||||
int flag)
|
||||
{
|
||||
if (left > right) swap(left, right);
|
||||
if (top > bottom) swap(top, bottom);
|
||||
|
||||
const bool saved = flag && save_ctools();
|
||||
|
||||
if (flag & 1) hide_pen();
|
||||
if (flag & 2) hide_brush();
|
||||
if (flag & 4)
|
||||
{
|
||||
set_mode(M_XOR);
|
||||
if (flag & 1) hide_pen();
|
||||
if (flag & 2) hide_brush();
|
||||
if (flag & 4)
|
||||
{
|
||||
set_mode(M_XOR);
|
||||
set_brush(COLOR_BLACK); // Needed for Windows
|
||||
}
|
||||
|
||||
@ -448,12 +454,12 @@ void TWindow::frame(short left, short top, short right, short bottom,
|
||||
const PNT f = log2dev(left,top);
|
||||
const PNT t = log2dev(right,bottom);
|
||||
RCT r;
|
||||
r.top = f.v; r.left = f.h;
|
||||
r.top = f.v; r.left = f.h;
|
||||
r.bottom = t.v; r.right = t.h;
|
||||
|
||||
#if XVTWS != WMWS
|
||||
if (flag & 2)
|
||||
{
|
||||
{
|
||||
r.left += CHARX>>1; r.top += CHARY>>1;
|
||||
r.right-= CHARX>>1; r.bottom -= CHARY>>1;
|
||||
}
|
||||
@ -484,15 +490,15 @@ void TWindow::invert_bar(short left, short top, short right, short bottom)
|
||||
|
||||
void TWindow::set_opaque_text(bool o)
|
||||
{
|
||||
DRAW_CTOOLS ct;
|
||||
DRAW_CTOOLS ct;
|
||||
win_get_draw_ctools(win(), &ct);
|
||||
ct.opaque_text = o;
|
||||
win_set_draw_ctools(win(), &ct);
|
||||
win_set_draw_ctools(win(), &ct);
|
||||
}
|
||||
|
||||
void TWindow::set_font(int family, int style, int dim)
|
||||
{
|
||||
xvt_set_font(win(), family, style, dim);
|
||||
xvt_set_font(win(), family, style, dim);
|
||||
}
|
||||
|
||||
PNT TWindow::log2dev(long x, long y) const
|
||||
@ -507,7 +513,7 @@ PNT TWindow::log2dev(long x, long y) const
|
||||
TPoint TWindow::dev2log(const PNT& p) const
|
||||
{
|
||||
TPoint pnt(p.h / CHARX, p.v / CHARY);
|
||||
return pnt;
|
||||
return pnt;
|
||||
}
|
||||
|
||||
|
||||
@ -525,7 +531,7 @@ void TWindow::printat(short x, short y, const char* fmt, ...)
|
||||
{
|
||||
va_list argptr;
|
||||
va_start(argptr, fmt);
|
||||
vsprintf(__tmp_string, fmt, argptr);
|
||||
vsprintf(__tmp_string, fmt, argptr);
|
||||
va_end(argptr);
|
||||
stringat(x, y, __tmp_string);
|
||||
}
|
||||
@ -533,26 +539,26 @@ void TWindow::printat(short x, short y, const char* fmt, ...)
|
||||
|
||||
void TWindow::line(short x0, short y0, short x1, short y1)
|
||||
{
|
||||
PNT f = log2dev(x0,y0);
|
||||
PNT t = log2dev(x1,y1);
|
||||
PNT f = log2dev(x0,y0);
|
||||
PNT t = log2dev(x1,y1);
|
||||
|
||||
if (f.h == 0) f.h = -CHARX; else f.h += CHARX>>1;
|
||||
if (f.v == 0) f.v = -CHARY; else f.v += CHARY>>1;
|
||||
if (t.h == 0) t.h = -CHARX; else t.h += CHARX>>1;
|
||||
if (t.v == 0) t.v = -CHARY; else t.v += CHARY>>1;
|
||||
if (f.h == 0) f.h = -CHARX; else f.h += CHARX>>1;
|
||||
if (f.v == 0) f.v = -CHARY; else f.v += CHARY>>1;
|
||||
if (t.h == 0) t.h = -CHARX; else t.h += CHARX>>1;
|
||||
if (t.v == 0) t.v = -CHARY; else t.v += CHARY>>1;
|
||||
|
||||
win_move_to(_win, f);
|
||||
win_draw_line(_win, t);
|
||||
win_move_to(_win, f);
|
||||
win_draw_line(_win, t);
|
||||
}
|
||||
|
||||
void TWindow::icon(short x0, short y0, int iconid)
|
||||
{
|
||||
#if XVTWS == WMWS
|
||||
bar(x0, y0, x0+1, y0+1);
|
||||
bar(x0, y0, x0+1, y0+1);
|
||||
#else
|
||||
PNT f = log2dev(x0,y0);
|
||||
if (iconid < 0) iconid = ICON_RSRC;
|
||||
win_draw_icon(win(), f.h, f.v, iconid);
|
||||
PNT f = log2dev(x0,y0);
|
||||
if (iconid < 0) iconid = ICON_RSRC;
|
||||
win_draw_icon(win(), f.h, f.v, iconid);
|
||||
#endif
|
||||
}
|
||||
|
||||
@ -567,7 +573,7 @@ TTemp_window::TTemp_window(WINDOW w)
|
||||
|
||||
TTemp_window::~TTemp_window()
|
||||
{
|
||||
set_win(NULL_WIN); // I don't want to be closed!
|
||||
set_win(NULL_WIN); // I don't want to be closed!
|
||||
}
|
||||
|
||||
///////////////////////////////////////////////////////////
|
||||
@ -575,44 +581,44 @@ TTemp_window::~TTemp_window()
|
||||
///////////////////////////////////////////////////////////
|
||||
|
||||
TScroll_window::TScroll_window()
|
||||
: _origin(0, 0), _max(0, 0), _shift(0), _autoscroll(TRUE),
|
||||
_has_hscroll(TRUE), _has_vscroll(TRUE)
|
||||
: _origin(0, 0), _max(0, 0), _shift(0), _autoscroll(TRUE),
|
||||
_has_hscroll(TRUE), _has_vscroll(TRUE)
|
||||
{
|
||||
}
|
||||
|
||||
WINDOW TScroll_window::create(short x, short y, short dx, short dy,
|
||||
const char* title, long flags, WIN_TYPE wt, WINDOW parent)
|
||||
const char* title, long flags, WIN_TYPE wt, WINDOW parent)
|
||||
{
|
||||
_has_hscroll = (flags & WSF_HSCROLL) != 0;
|
||||
_has_vscroll = (flags & WSF_VSCROLL) != 0 ;
|
||||
return TWindow::create(x, y, dx, dy, title, flags, wt, parent);
|
||||
_has_hscroll = (flags & WSF_HSCROLL) != 0;
|
||||
_has_vscroll = (flags & WSF_VSCROLL) != 0 ;
|
||||
return TWindow::create(x, y, dx, dy, title, flags, wt, parent);
|
||||
}
|
||||
|
||||
PNT TScroll_window::log2dev(long x, long y) const
|
||||
{
|
||||
if (_autoscroll)
|
||||
{
|
||||
x -= _origin.x;
|
||||
y -= _origin.y >> _shift;
|
||||
}
|
||||
return TWindow::log2dev(x,y);
|
||||
x -= _origin.x;
|
||||
y -= _origin.y >> _shift;
|
||||
}
|
||||
return TWindow::log2dev(x,y);
|
||||
}
|
||||
|
||||
|
||||
void TScroll_window::set_scroll_max(long maxx, long maxy)
|
||||
{
|
||||
if (_has_hscroll && maxx >= 0)
|
||||
{
|
||||
_max.x = maxx;
|
||||
set_scroll_range(win(), HSCROLL, 0, int(maxx));
|
||||
}
|
||||
if (_has_vscroll && maxy >= 0)
|
||||
{
|
||||
_shift = 0;
|
||||
while ((maxy >> _shift) > 0x7FFF) _shift++;
|
||||
_max.y = maxy;
|
||||
set_scroll_range(win(), VSCROLL, 0, int(maxy >> _shift));
|
||||
}
|
||||
if (_has_hscroll && maxx >= 0)
|
||||
{
|
||||
_max.x = maxx;
|
||||
set_scroll_range(win(), HSCROLL, 0, int(maxx));
|
||||
}
|
||||
if (_has_vscroll && maxy >= 0)
|
||||
{
|
||||
_shift = 0;
|
||||
while ((maxy >> _shift) > 0x7FFF) _shift++;
|
||||
_max.y = maxy;
|
||||
set_scroll_range(win(), VSCROLL, 0, int(maxy >> _shift));
|
||||
}
|
||||
}
|
||||
|
||||
void TScroll_window::update_thumb(long x, long y)
|
||||
@ -621,7 +627,7 @@ void TScroll_window::update_thumb(long x, long y)
|
||||
if (y >= 0 && y <= _max.y) _origin.y = y;
|
||||
|
||||
if (_has_hscroll)
|
||||
set_scroll_pos(win(), HSCROLL, int(_origin.x));
|
||||
set_scroll_pos(win(), HSCROLL, int(_origin.x));
|
||||
if (_has_vscroll)
|
||||
set_scroll_pos(win(), VSCROLL, int(_origin.y >> _shift));
|
||||
}
|
||||
@ -631,51 +637,51 @@ void TScroll_window::handler(WINDOW win, EVENT* ep)
|
||||
bool up = FALSE;
|
||||
|
||||
switch (ep->type)
|
||||
{
|
||||
case E_HSCROLL:
|
||||
{
|
||||
case E_HSCROLL:
|
||||
case E_VSCROLL:
|
||||
{
|
||||
long& pos = (ep->type == E_HSCROLL) ? _origin.x : _origin.y;
|
||||
long& max = (ep->type == E_HSCROLL) ? _max.x : _max.y;
|
||||
short pag = (ep->type == E_HSCROLL) ? columns()/2+1 : rows()/2+1;
|
||||
switch(ep->v.scroll.what)
|
||||
{
|
||||
long& pos = (ep->type == E_HSCROLL) ? _origin.x : _origin.y;
|
||||
long& max = (ep->type == E_HSCROLL) ? _max.x : _max.y;
|
||||
short pag = (ep->type == E_HSCROLL) ? columns()/2+1 : rows()/2+1;
|
||||
switch(ep->v.scroll.what)
|
||||
{
|
||||
case SC_PAGE_UP:
|
||||
pos -= pag;
|
||||
up = TRUE;
|
||||
break;
|
||||
case SC_LINE_UP:
|
||||
pos--;
|
||||
up = TRUE;
|
||||
break;
|
||||
case SC_PAGE_DOWN:
|
||||
pos += pag;
|
||||
up = TRUE;
|
||||
break;
|
||||
case SC_LINE_DOWN:
|
||||
pos++;
|
||||
up = TRUE;
|
||||
break;
|
||||
case SC_THUMB:
|
||||
pos = ep->v.scroll.pos;
|
||||
up = TRUE;
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
if (pos < 0) pos = 0;
|
||||
if (pos > max) pos = max;
|
||||
case SC_PAGE_UP:
|
||||
pos -= pag;
|
||||
up = TRUE;
|
||||
break;
|
||||
case SC_LINE_UP:
|
||||
pos--;
|
||||
up = TRUE;
|
||||
break;
|
||||
case SC_PAGE_DOWN:
|
||||
pos += pag;
|
||||
up = TRUE;
|
||||
break;
|
||||
case SC_LINE_DOWN:
|
||||
pos++;
|
||||
up = TRUE;
|
||||
break;
|
||||
case SC_THUMB:
|
||||
pos = ep->v.scroll.pos;
|
||||
up = TRUE;
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
if (pos < 0) pos = 0;
|
||||
if (pos > max) pos = max;
|
||||
}
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
|
||||
if (up)
|
||||
{
|
||||
update_thumb();
|
||||
force_update();
|
||||
}
|
||||
}
|
||||
|
||||
TWindow::handler(win, ep);
|
||||
}
|
||||
@ -686,37 +692,37 @@ bool TScroll_window::on_key(KEY key)
|
||||
{
|
||||
case K_LHOME:
|
||||
update_thumb(0,0);
|
||||
force_update();
|
||||
force_update();
|
||||
break;
|
||||
case K_LEND:
|
||||
update_thumb(0,range().y);
|
||||
force_update();
|
||||
break;
|
||||
case K_TAB:
|
||||
update_thumb(origin().x+8);
|
||||
update_thumb(origin().x+8);
|
||||
force_update();
|
||||
break;
|
||||
case K_BTAB:
|
||||
{
|
||||
long x = origin().x-8;
|
||||
if (x < 0) x = 0;
|
||||
update_thumb(x);
|
||||
force_update();
|
||||
}
|
||||
{
|
||||
long x = origin().x-8;
|
||||
if (x < 0) x = 0;
|
||||
update_thumb(x);
|
||||
force_update();
|
||||
}
|
||||
break;
|
||||
case K_UP:
|
||||
case K_UP:
|
||||
case K_DOWN:
|
||||
case K_PREV:
|
||||
case K_NEXT:
|
||||
case K_LEFT:
|
||||
case K_RIGHT:
|
||||
dispatch_e_scroll(win(), key);
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
|
||||
return TWindow::on_key(key);
|
||||
return TWindow::on_key(key);
|
||||
}
|
||||
|
||||
void TWindow::clear(COLOR color)
|
||||
|
147
include/window.h
147
include/window.h
@ -7,6 +7,7 @@
|
||||
|
||||
void close_all_dialogs();
|
||||
bool can_close();
|
||||
WINDOW cur_win();
|
||||
|
||||
// @C
|
||||
// Classe TPoint
|
||||
@ -18,13 +19,13 @@ bool can_close();
|
||||
|
||||
struct TPoint
|
||||
{
|
||||
// @DPUB
|
||||
// @DPUB
|
||||
long x, y;
|
||||
// Coordinate
|
||||
// Coordinate
|
||||
|
||||
// @FPUB
|
||||
// @FPUB
|
||||
TPoint(long sx = 0, long sy = 0) : x(sx), y(sy) {}
|
||||
// Costruttore
|
||||
// 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; }
|
||||
@ -43,82 +44,82 @@ struct TPoint
|
||||
class TWindow
|
||||
{
|
||||
|
||||
friend class TWindow_manager;
|
||||
friend class TWindow_manager;
|
||||
|
||||
// @DPRIV
|
||||
static DRAW_CTOOLS _ct; // Set di drawing tools (xvttype.h)
|
||||
static bool _ctools_saved; // E' stata salvata _ct ?
|
||||
// @DPRIV
|
||||
static DRAW_CTOOLS _ct; // Set di drawing tools (xvttype.h)
|
||||
static bool _ctools_saved; // E' stata salvata _ct ?
|
||||
|
||||
WINDOW _win; // Descrittore finestra
|
||||
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
|
||||
// @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
|
||||
// @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
|
||||
// @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) ;
|
||||
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_win(WINDOW w) { _win = w; } // Usare con cautela
|
||||
|
||||
void set_modal(bool m) { _modal = m; } // Modifica il flag _modal
|
||||
void set_modal(bool m) { _modal = m; } // Modifica il flag _modal
|
||||
|
||||
WINDOW parent() const;
|
||||
WINDOW parent() const;
|
||||
|
||||
virtual void update() {} // E_UPDATE
|
||||
virtual bool on_key(KEY) { return TRUE; } // E_CHAR
|
||||
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;
|
||||
virtual PNT log2dev(long x, long y) const;
|
||||
virtual TPoint dev2log(const PNT& p) const;
|
||||
|
||||
public:
|
||||
// @FPUB
|
||||
TWindow(); // Costruttore
|
||||
virtual ~TWindow();
|
||||
// @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
|
||||
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
|
||||
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
|
||||
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 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
|
||||
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 iconize() const;
|
||||
void maximize() const;
|
||||
virtual void enable(bool = TRUE) const;
|
||||
void disable() const { enable(FALSE); }
|
||||
|
||||
void open_modal(); // Mostra la finestra modale
|
||||
void open_modal(); // Mostra la finestra modale
|
||||
void close_modal(); // Nasconde la finestra modale
|
||||
|
||||
KEY run(); // Esegue la finestra
|
||||
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;
|
||||
virtual void set_caption(const char* title);
|
||||
virtual const char* get_caption() const;
|
||||
|
||||
// Riempie la finestra con il colore in color
|
||||
// Riempie la finestra con il colore in color
|
||||
void clear(COLOR color);
|
||||
|
||||
// Setta il draw mode
|
||||
@ -130,17 +131,17 @@ public:
|
||||
// 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
|
||||
// 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 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
|
||||
// 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
|
||||
// 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);
|
||||
@ -169,47 +170,47 @@ public:
|
||||
class TScroll_window : public TWindow
|
||||
{
|
||||
|
||||
// @DPRIV
|
||||
TPoint _origin;
|
||||
TPoint _max;
|
||||
short _shift;
|
||||
// @DPRIV
|
||||
TPoint _origin;
|
||||
TPoint _max;
|
||||
short _shift;
|
||||
|
||||
bool _autoscroll : 1;
|
||||
bool _has_hscroll : 1;
|
||||
bool _has_vscroll : 1;
|
||||
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
|
||||
// @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
|
||||
// @FPUB
|
||||
|
||||
TScroll_window();
|
||||
// Costruttore
|
||||
// Costruttore
|
||||
|
||||
virtual void handler(WINDOW win, EVENT* ep);
|
||||
|
||||
void set_scroll_max(long maxx, long maxy);
|
||||
// Setta punto di massimo scroll
|
||||
// Setta punto di massimo scroll
|
||||
void update_thumb(long x = -1, long y = -1);
|
||||
// Aggiorna la scrollbar
|
||||
// Aggiorna la scrollbar
|
||||
|
||||
void autoscroll(bool on) { _autoscroll = on; }
|
||||
// Setta autoscroll
|
||||
// Setta autoscroll
|
||||
|
||||
bool autoscrolling() const { return _autoscroll; }
|
||||
bool autoscrolling() const { return _autoscroll; }
|
||||
|
||||
const TPoint& origin() const { return _origin; }
|
||||
// Ritorna punto origine
|
||||
// Ritorna punto origine
|
||||
const TPoint& range() const { return _max; }
|
||||
// Ritorna punto massimo
|
||||
// Ritorna punto massimo
|
||||
};
|
||||
|
||||
#endif // __WINDOW_H
|
||||
|
@ -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()
|
||||
{
|
||||
@ -702,17 +725,22 @@ 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;
|
||||
}
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user