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;
|
||||
}
|
||||
}
|
||||
}
|
||||
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;
|
||||
|
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));
|
||||
}
|
||||
|
||||
/*
|
||||
|
@ -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,7 +20,7 @@
|
||||
#include <clifo.h>
|
||||
#include <occas.h>
|
||||
#include <causali.h>
|
||||
#include <cglib03.h>
|
||||
|
||||
|
||||
const int MAXSTR = 128;
|
||||
static char __tmp[MAXSTR];
|
||||
|
@ -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);
|
||||
@ -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,7 +117,7 @@ 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);
|
||||
|
@ -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;
|
||||
@ -33,7 +33,7 @@ HIDDEN long backdrop_eh( WINDOW win, EVENT* ep)
|
||||
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)
|
||||
@ -46,7 +46,7 @@ HIDDEN long backdrop_eh( WINDOW win, EVENT* ep)
|
||||
) win_draw_icon(win, x, y, ICON_RSRC);
|
||||
even = !even;
|
||||
}
|
||||
*/
|
||||
*/
|
||||
#endif
|
||||
|
||||
return 0L;
|
||||
@ -80,7 +80,7 @@ HIDDEN void create_backdrop( void )
|
||||
const word WM_WAKEUP = RegisterWindowMessage("WAKEUP");
|
||||
DWORD waiting_for = 0;
|
||||
|
||||
BOOLEAN event_hook(HWND, WORD msg, WORD,
|
||||
BOOLEAN waiting_event_hook(HWND, WORD msg, WORD,
|
||||
DWORD lparam, long far* ret)
|
||||
{
|
||||
if (msg == WM_WAKEUP)
|
||||
@ -116,12 +116,12 @@ 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);
|
||||
set_value(TASK_WIN, ATTR_EVENT_HOOK, (long)waiting_event_hook);
|
||||
while (waiting_for) do_events();
|
||||
|
||||
///////////////////////////////////////////////////////////
|
||||
// It seems necessary to restore these things
|
||||
///////////////////////////////////////////////////////////
|
||||
///////////////////////////////////////////////////////////
|
||||
// It seems necessary to restore these things
|
||||
///////////////////////////////////////////////////////////
|
||||
customize_controls(TRUE);
|
||||
xvt_statbar_refresh();
|
||||
}
|
||||
@ -150,7 +150,7 @@ long TApplication::task_eh(WINDOW win, EVENT *ep)
|
||||
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;
|
||||
@ -168,8 +168,9 @@ long TApplication::task_eh(WINDOW win, EVENT *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__);
|
||||
}
|
||||
|
||||
|
||||
@ -181,6 +182,13 @@ long TApplication::handler(WINDOW, EVENT* ep)
|
||||
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;
|
||||
@ -205,8 +213,11 @@ long TApplication::handler(WINDOW, EVENT* ep)
|
||||
about();
|
||||
break;
|
||||
default:
|
||||
if (!menu(mt))
|
||||
if (mt >= BAR_ITEM(1))
|
||||
{
|
||||
if(!menu(mt))
|
||||
stop_run();
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
@ -236,11 +247,11 @@ void TApplication::stop_run()
|
||||
{
|
||||
if (savefirm) prefhndl->set_codditta(savefirm);
|
||||
terminate();
|
||||
//#if XVT_OS == XVT_OS_WIN
|
||||
// xvt_escape(XVT_ESC_WIN_TERMINATE);
|
||||
//#else
|
||||
//#if XVT_OS == XVT_OS_WIN
|
||||
// xvt_escape(XVT_ESC_WIN_TERMINATE);
|
||||
//#else
|
||||
xvt_terminate();
|
||||
//#endif
|
||||
//#endif
|
||||
}
|
||||
|
||||
|
||||
@ -272,7 +283,7 @@ TPrinter& TApplication::printer()
|
||||
|
||||
bool TApplication::create()
|
||||
{
|
||||
// include_progind(); // TBC da eliminare quando il linker diventa furbo
|
||||
// include_progind(); // TBC da eliminare quando il linker diventa furbo
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
@ -415,7 +426,6 @@ long TApplication::get_firm() const
|
||||
|
||||
const char* TApplication::get_firm_dir() const
|
||||
{
|
||||
// return prefhndl->name();
|
||||
return format("%s%s", __ptprf, prefhndl->name());
|
||||
}
|
||||
|
||||
|
@ -382,7 +382,7 @@ public:
|
||||
TGroup::TGroup(short left, short top, short right, short bottom,
|
||||
const char* caption, WINDOW parent,
|
||||
long flags, long app_data, short id)
|
||||
: TText(left, top, right, bottom, caption, parent, flags, app_data,
|
||||
: TText(left, top, right, bottom, caption, parent, flags, app_data,
|
||||
(id < 0) ? -2 : id)
|
||||
{}
|
||||
|
||||
@ -520,7 +520,7 @@ public:
|
||||
TPush_button::TPush_button(short left, short top, short right, short bottom,
|
||||
const char* caption, WINDOW parent,
|
||||
long flags, long app_data, short id)
|
||||
: TButton(left-(id == DLG_F9), top, right, bottom,
|
||||
: TButton(left-(id == DLG_F9), top, right, bottom,
|
||||
caption, parent, flags, app_data, id),
|
||||
_picup(0L), _picdn(0L)
|
||||
{
|
||||
@ -546,7 +546,6 @@ TPush_button::TPush_button(short left, short top, short right, short bottom,
|
||||
caption = format("#%d#%d", BMP_DELREC, BMP_DELRECDN);
|
||||
break;
|
||||
case DLG_NEWREC:
|
||||
if (strcmp("Nuovo", caption) == 0)
|
||||
caption = format("#%d#%d", BMP_NEWREC, BMP_NEWRECDN);
|
||||
break;
|
||||
case DLG_FIRSTREC:
|
||||
@ -679,7 +678,7 @@ void TPush_button::update() const
|
||||
p.h = ex;
|
||||
win_draw_line(_hdc, p);
|
||||
}
|
||||
/*
|
||||
/*
|
||||
HWND hwnd = (HWND)get_value(_hdc, ATTR_NATIVE_WINDOW);
|
||||
HDC hdc = GetDC(hwnd);
|
||||
RECT r;
|
||||
@ -691,7 +690,7 @@ void TPush_button::update() const
|
||||
PatBlt(hdc, r.left, r.top, r.right-r.left, r.bottom-r.top, 0xFA0089); // Real magic number
|
||||
SelectObject(hdc, oldBrush);
|
||||
ReleaseDC(hwnd, hdc);
|
||||
*/
|
||||
*/
|
||||
}
|
||||
}
|
||||
|
||||
@ -743,7 +742,7 @@ void TPage_button::update() const
|
||||
|
||||
class TTag_button : public TControl
|
||||
{
|
||||
enum { height = 12, width = 32 };
|
||||
enum { height = 12, width = 32 };
|
||||
byte _curr;
|
||||
byte _page;
|
||||
byte _pages;
|
||||
@ -760,7 +759,7 @@ public:
|
||||
};
|
||||
|
||||
TTag_button::TTag_button(WINDOW parent, byte p, byte tot)
|
||||
: _parent(parent), _page(p), _pages(tot), _curr(p)
|
||||
: _parent(parent), _page(p), _pages(tot), _curr(p)
|
||||
{
|
||||
RCT r; get_client_rect(parent, &r);
|
||||
create(0, 0, r.right, CHARY, "", parent,0L,0L, DLG_PAGETAGS);
|
||||
@ -843,7 +842,7 @@ TCheckbox::TCheckbox(
|
||||
short left, short top, short right, short bottom,
|
||||
const char* caption, WINDOW parent,
|
||||
long flags, long app_data, short id)
|
||||
: TButton(left, top, right, bottom,
|
||||
: TButton(left, top, right, bottom,
|
||||
caption, parent, flags, app_data, id)
|
||||
{
|
||||
if (!_bmploaded)
|
||||
|
@ -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;
|
||||
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; }
|
||||
|
||||
#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
|
||||
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 */
|
||||
|
121
include/mask.cpp
121
include/mask.cpp
@ -97,22 +97,38 @@ 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_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_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);
|
||||
}
|
||||
@ -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);
|
||||
}
|
||||
|
@ -27,7 +27,7 @@ enum TMaskmode { NO_MODE, MODE_INS , MODE_MOD , MODE_DEL ,
|
||||
|
||||
class TMask : public TWindow
|
||||
{
|
||||
// @DPRIV
|
||||
// @DPRIV
|
||||
enum { MAX_PAGES = 12 }; // Massimo numero di pagine nella maschera
|
||||
WINDOW _pagewin[MAX_PAGES+1]; // Windows of the pages
|
||||
|
||||
@ -78,7 +78,7 @@ protected:
|
||||
void handler(WINDOW win, EVENT* ep);
|
||||
|
||||
public:
|
||||
// @FPUB
|
||||
// @FPUB
|
||||
// crea leggendo descrizione da file .msk
|
||||
TMask(const char* name, int mode = NO_MODE, int num = 0);
|
||||
|
||||
|
@ -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:
|
||||
if (_prompt.empty())
|
||||
_prompt = "Conferma";
|
||||
_virtual_key = _exit_key = K_ENTER;
|
||||
flags |= CTL_FLAG_DEFAULT;
|
||||
break;
|
||||
case DLG_CANCEL:
|
||||
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
|
||||
|
||||
@ -33,8 +33,8 @@ 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
|
||||
|
||||
@ -44,7 +44,7 @@ friend class TMask;
|
||||
TBit_array _groups; // The groups the field belongs to
|
||||
|
||||
protected:
|
||||
// @DPROT
|
||||
// @DPROT
|
||||
static int _x, _y; // Coordinate of the control
|
||||
static int _width; // Size of the control
|
||||
static TFixed_string _prompt;// Prompt of the field
|
||||
@ -108,7 +108,7 @@ protected:
|
||||
bool do_message(int n);
|
||||
|
||||
public:
|
||||
// @FPUB
|
||||
// @FPUB
|
||||
short atodlg(const char* s) const;
|
||||
|
||||
WINDOW parent() const;
|
||||
@ -184,7 +184,7 @@ public:
|
||||
|
||||
void set_focus() const;
|
||||
|
||||
// set focus, message-box, set focus
|
||||
// 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;
|
||||
@ -208,7 +208,7 @@ class TEdit_field : public TMask_field
|
||||
friend class TList_sheet;
|
||||
|
||||
protected:
|
||||
// @DPROT
|
||||
// @DPROT
|
||||
TString _str;
|
||||
TString _picture;
|
||||
TString _warning;
|
||||
@ -239,7 +239,7 @@ protected:
|
||||
|
||||
|
||||
public:
|
||||
// @FPUB
|
||||
// @FPUB
|
||||
virtual bool on_hit();
|
||||
virtual bool on_key(KEY key);
|
||||
virtual bool has_check() const;
|
||||
@ -330,7 +330,7 @@ class TReal_field : public TEdit_field
|
||||
int _decimals;
|
||||
|
||||
protected:
|
||||
// @FPROT
|
||||
// @FPROT
|
||||
virtual word class_id() const;
|
||||
|
||||
virtual const char* get_window_data() const;
|
||||
@ -341,7 +341,7 @@ protected:
|
||||
virtual bool on_key(KEY key);
|
||||
|
||||
public:
|
||||
// @FPUB
|
||||
// @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
|
||||
@ -357,13 +357,13 @@ public:
|
||||
class TDate_field : public TEdit_field
|
||||
{
|
||||
protected:
|
||||
// @FPROT
|
||||
// @FPROT
|
||||
virtual word class_id() const;
|
||||
virtual void create(WINDOW parent);
|
||||
virtual bool on_key(KEY key);
|
||||
|
||||
public:
|
||||
// @FPUB
|
||||
// @FPUB
|
||||
void parse_head(TScanner& scanner);
|
||||
TDate_field(TMask* mask);
|
||||
};
|
||||
@ -376,7 +376,7 @@ public:
|
||||
class TBoolean_field : public TMask_field
|
||||
{
|
||||
protected:
|
||||
// @DPROT
|
||||
// @DPROT
|
||||
bool _on;
|
||||
|
||||
virtual word class_id() const;
|
||||
@ -392,7 +392,7 @@ protected:
|
||||
virtual bool on_key(KEY key);
|
||||
|
||||
public:
|
||||
// @FPUB
|
||||
// @FPUB
|
||||
TBoolean_field(TMask* mask);
|
||||
};
|
||||
|
||||
@ -403,11 +403,11 @@ public:
|
||||
|
||||
class TList_field : public TMask_field
|
||||
{
|
||||
// @FPRIV
|
||||
// @FPRIV
|
||||
void add_list();
|
||||
|
||||
protected:
|
||||
// @FPROT
|
||||
// @FPROT
|
||||
TToken_string _values;
|
||||
TToken_string _codes;
|
||||
TString _str;
|
||||
@ -418,7 +418,7 @@ protected:
|
||||
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 const char* picture_data(const char* data, bool video);
|
||||
|
||||
virtual void create(WINDOW parent);
|
||||
|
||||
@ -434,7 +434,7 @@ protected:
|
||||
virtual bool parse_item(TScanner& scanner);
|
||||
|
||||
public:
|
||||
// @FPUB
|
||||
// @FPUB
|
||||
TList_field(TMask* mask);
|
||||
virtual void replace_items(const char* codes, const char* values);
|
||||
virtual void add_item(const char* code_value);
|
||||
@ -451,13 +451,13 @@ class TRadio_field : public TList_field
|
||||
{
|
||||
enum { MAX_RADIO = 8 };
|
||||
|
||||
// @FPRIV
|
||||
// @FPRIV
|
||||
int _nitems;
|
||||
int _active_item;
|
||||
WINDOW _radio_ctl_win[MAX_RADIO];
|
||||
|
||||
protected:
|
||||
// @FPROT
|
||||
// @FPROT
|
||||
virtual word class_id() const;
|
||||
virtual void create(WINDOW parent);
|
||||
virtual void destroy();
|
||||
@ -469,7 +469,7 @@ protected:
|
||||
WINDOW win() const { return _radio_ctl_win[_active_item]; }
|
||||
|
||||
public:
|
||||
// @FPUB
|
||||
// @FPUB
|
||||
TRadio_field(TMask* mask);
|
||||
|
||||
void check_radiobutton(WINDOW checked);
|
||||
@ -484,8 +484,10 @@ public:
|
||||
|
||||
class TButton_field : public TMask_field
|
||||
{
|
||||
KEY _virtual_key, _exit_key;
|
||||
|
||||
protected:
|
||||
// @FPROT
|
||||
// @FPROT
|
||||
virtual word class_id() const;
|
||||
virtual void create(WINDOW parent);
|
||||
|
||||
@ -496,8 +498,10 @@ protected:
|
||||
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
|
||||
{
|
||||
|
@ -9,7 +9,7 @@
|
||||
TSheet::TSheet(short x, short y, short dx, short dy,
|
||||
const char* title, const char* head, byte buttons,
|
||||
long first, WINDOW parent)
|
||||
: _curr(first), _last_update(-1), _checkable(FALSE),
|
||||
: _curr(first), _last_update(-1), _checkable(FALSE),
|
||||
_check_enabled(TRUE), _buttonmask(buttons)
|
||||
{
|
||||
const char* g;
|
||||
@ -76,13 +76,13 @@ TSheet::TSheet(short x, short y, short dx, short dy,
|
||||
|
||||
void TSheet::add_button(short id, const char* caption, KEY key)
|
||||
{
|
||||
const int BUT_HEIGHT =
|
||||
const int BUT_HEIGHT =
|
||||
#if XVT_OS == XVT_OS_WIN
|
||||
2
|
||||
#else
|
||||
1
|
||||
#endif
|
||||
;
|
||||
;
|
||||
WINDOW b = xvt_create_control(WC_PUSHBUTTON, 0, 0, 11, BUT_HEIGHT, caption, win(), 0, 0, id);
|
||||
for (int i = 0; i < MAX_BUT; i++)
|
||||
if (_button[i] == NULL_WIN)
|
||||
@ -193,7 +193,7 @@ void TSheet::handler(WINDOW win, EVENT* ep)
|
||||
long nuo = first()+y-f;
|
||||
select(nuo);
|
||||
if (ep->type == E_MOUSE_DBL)
|
||||
dispatch_e_char(win, K_SHIFT_ENTER);
|
||||
dispatch_e_char(win, K_ENTER);
|
||||
else if (_checkable && _check_enabled && vec == nuo)
|
||||
{
|
||||
_checked.not(nuo);
|
||||
@ -208,7 +208,7 @@ void TSheet::handler(WINDOW win, EVENT* ep)
|
||||
switch(ep->v.ctl.id)
|
||||
{
|
||||
case DLG_OK :
|
||||
case DLG_SELECT:dispatch_e_char(win, K_SHIFT_ENTER); break;
|
||||
case DLG_SELECT:dispatch_e_char(win, K_ENTER); break;
|
||||
case DLG_CANCEL:
|
||||
case DLG_QUIT :dispatch_e_char(win, K_ESC); break;
|
||||
case DLG_NEWREC:dispatch_e_char(win, K_INS); break;
|
||||
@ -257,8 +257,6 @@ bool TSheet::on_key(KEY key)
|
||||
{
|
||||
switch(key)
|
||||
{
|
||||
case K_SHIFT_ENTER:
|
||||
key = K_ENTER;
|
||||
case K_ENTER:
|
||||
if (items() < 1) key = K_ESC;
|
||||
case K_ESC:
|
||||
@ -526,7 +524,7 @@ void TSheet::print()
|
||||
|
||||
TArray_sheet::TArray_sheet(short x, short y, short dx, short dy,
|
||||
const char* caption, const char* head, byte buttons, WINDOW parent)
|
||||
: TSheet(x, y, dx, dy, caption, head, buttons, 0L, parent)
|
||||
: TSheet(x, y, dx, dy, caption, head, buttons, 0L, parent)
|
||||
{}
|
||||
|
||||
void TArray_sheet::page_build(long first, byte num)
|
||||
@ -556,7 +554,7 @@ long TArray_sheet::insert(const TToken_string& s, long n)
|
||||
|
||||
TCursor_sheet::TCursor_sheet(TCursor* cursor, const char* fields,
|
||||
const char* title, const char* head, byte buttons)
|
||||
: TSheet(-1,-1, 0, 0, title,head,buttons,cursor->pos()),
|
||||
: TSheet(-1,-1, 0, 0, title,head,buttons,cursor->pos()),
|
||||
_cursor(cursor), _records(cursor->items())
|
||||
{
|
||||
TToken_string fldlst(fields);
|
||||
@ -608,7 +606,7 @@ void TCursor_sheet::page_build(long first, byte rows)
|
||||
TBrowse_sheet::TBrowse_sheet(TCursor* cursor, const char* fields,
|
||||
const char* title, const char* head, byte buttons,
|
||||
TEdit_field* f, TToken_string* s)
|
||||
: TCursor_sheet(cursor, fields, title, head, buttons), _field(f)
|
||||
: TCursor_sheet(cursor, fields, title, head, buttons), _field(f)
|
||||
|
||||
{
|
||||
xvt_create_control(WC_EDIT, 1, -3, f->size()+1, 1, f->get(), win(),
|
||||
|
@ -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)
|
||||
@ -476,7 +476,7 @@ HIDDEN bool _autoexit_val(TEdit_field& f, KEY key)
|
||||
|
||||
bool ok = TRUE;
|
||||
if (key == K_TAB)
|
||||
f.mask().send_key(K_SHIFT_ENTER, 0);
|
||||
f.mask().send_key(K_AUTO_ENTER, 0);
|
||||
else
|
||||
ok = one_not_empty;
|
||||
|
||||
@ -533,7 +533,7 @@ 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,
|
||||
|
@ -209,15 +209,15 @@ check_link (TPoint * p)
|
||||
bool TViswin ::
|
||||
in_text (const TPoint & p)
|
||||
const
|
||||
{
|
||||
{
|
||||
if (p.x > 5 && p.x < columns () && p.y > 0 && p.y < (rows () - 3))
|
||||
return TRUE;
|
||||
return FALSE;
|
||||
}
|
||||
}
|
||||
|
||||
// general use, will probably move elsewhere
|
||||
|
||||
bool TViswin ::need_paint_sel (bool smart)
|
||||
bool TViswin ::need_paint_sel (bool smart)
|
||||
{
|
||||
TPoint p1, p2;
|
||||
adjust_selection (p1, p2);
|
||||
@ -356,7 +356,7 @@ open ()
|
||||
{
|
||||
set_scroll_max (MAXLEN, _txt.lines () <= _textrows ? _txt.lines () : _txt.lines () - _textrows);
|
||||
repos_buttons ();
|
||||
TScroll_window ::open ();
|
||||
TScroll_window ::open ();
|
||||
_need_update = TRUE;
|
||||
force_update ();
|
||||
}
|
||||
@ -498,7 +498,7 @@ paint_background (long j, int row)
|
||||
void TViswin ::
|
||||
paint_row (long j)
|
||||
{
|
||||
// int or = (int)origin().x;
|
||||
// int or = (int)origin().x;
|
||||
long y = origin ().y;
|
||||
TPoint p1, p2;
|
||||
if (need_paint_sel (FALSE))
|
||||
@ -818,7 +818,7 @@ update ()
|
||||
if (_isopen)
|
||||
paint_waitbar (FALSE);
|
||||
#if XVT_OS == XVT_OS_WIN
|
||||
else
|
||||
else
|
||||
cpb_win_picture_draw_at (win (), _modpic, 4,
|
||||
4 + (int) (rows () - 3l) * CHARY);
|
||||
#endif
|
||||
@ -1478,7 +1478,7 @@ on_key (KEY key)
|
||||
_curbut--;
|
||||
break;
|
||||
case K_SPACE:
|
||||
case K_SHIFT_ENTER:
|
||||
case K_CTRL_ENTER:
|
||||
if (_linkID != -1)
|
||||
{
|
||||
LINKHANDLER pl = MainApp ()->printer ().getlinkhandler ();
|
||||
@ -1665,7 +1665,7 @@ on_key (KEY key)
|
||||
{
|
||||
if (need_paint_sel ())
|
||||
erase_selection ();
|
||||
// check_link();
|
||||
// check_link();
|
||||
update_thumb (origin ().x, (++_point.y) - _textrows + 1);
|
||||
_need_scroll = up;
|
||||
}
|
||||
@ -1699,7 +1699,7 @@ on_key (KEY key)
|
||||
{
|
||||
if (need_paint_sel (FALSE))
|
||||
erase_selection ();
|
||||
// check_link();
|
||||
// check_link();
|
||||
update_thumb ((++_point.x) - _textcolumns + 1l, origin ().y);
|
||||
_need_scroll = left;
|
||||
}
|
||||
@ -1730,10 +1730,10 @@ on_key (KEY key)
|
||||
force_update ();
|
||||
}
|
||||
break;
|
||||
default:
|
||||
default:
|
||||
break;
|
||||
}
|
||||
return TWindow ::on_key (key);
|
||||
}
|
||||
return TWindow ::on_key (key);
|
||||
}
|
||||
|
||||
bool TViswin ::
|
||||
@ -1824,7 +1824,7 @@ TViswin ::TViswin (const char *fname,
|
||||
_link_displayed (FALSE), _point_displayed (FALSE), _selecting (FALSE),
|
||||
_scrolling (FALSE), _selflag (FALSE), _need_update (TRUE), _need_scroll (none),
|
||||
_multiple (FALSE),
|
||||
_frozen (FALSE)
|
||||
_frozen (FALSE)
|
||||
{
|
||||
if (title == NULL)
|
||||
title = (fname ? fname : "Anteprima di stampa");
|
||||
@ -1880,7 +1880,7 @@ _frozen (FALSE)
|
||||
_buttons++;
|
||||
}
|
||||
|
||||
//#if XVT_OS == XVT_OS_SCOUNIX
|
||||
//#if XVT_OS == XVT_OS_SCOUNIX
|
||||
// maximize();
|
||||
// #endif
|
||||
|
||||
|
@ -21,7 +21,7 @@
|
||||
|
||||
class TWindow_manager
|
||||
{
|
||||
// @DPRIV
|
||||
// @DPRIV
|
||||
enum { MAX_WIN = 4 }; // Max number of modal windows
|
||||
|
||||
TWindow* _window[MAX_WIN]; // Stack of active windows
|
||||
@ -29,7 +29,7 @@ class TWindow_manager
|
||||
void menu_enable(bool) const; // Abilita o disabilita il menu della task window
|
||||
|
||||
public:
|
||||
// @FPUB
|
||||
// @FPUB
|
||||
TWindow_manager(); // Costruttore
|
||||
~TWindow_manager() { destroy(); }
|
||||
|
||||
@ -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,7 +165,7 @@ bool TWindow::_ctools_saved;
|
||||
|
||||
|
||||
TWindow::TWindow()
|
||||
: _win(NULL_WIN), _open(FALSE), _modal(FALSE),
|
||||
: _win(NULL_WIN), _open(FALSE), _modal(FALSE),
|
||||
_running(FALSE), _lastkey(0)
|
||||
{}
|
||||
|
||||
@ -575,7 +581,7 @@ TTemp_window::~TTemp_window()
|
||||
///////////////////////////////////////////////////////////
|
||||
|
||||
TScroll_window::TScroll_window()
|
||||
: _origin(0, 0), _max(0, 0), _shift(0), _autoscroll(TRUE),
|
||||
: _origin(0, 0), _max(0, 0), _shift(0), _autoscroll(TRUE),
|
||||
_has_hscroll(TRUE), _has_vscroll(TRUE)
|
||||
{
|
||||
}
|
||||
@ -667,9 +673,9 @@ void TScroll_window::handler(WINDOW win, EVENT* ep)
|
||||
if (pos > max) pos = max;
|
||||
}
|
||||
break;
|
||||
default:
|
||||
default:
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if (up)
|
||||
{
|
||||
|
@ -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
|
||||
|
||||
// @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,26 +44,26 @@ 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
|
||||
KEY _lastkey; // Tasto di uscita
|
||||
|
||||
// @FPRIV
|
||||
// @FPRIV
|
||||
bool save_ctools(); // Compila la struct _ct con i valori correnti
|
||||
bool restore_ctools(); // Ripristina i valori DA _ct
|
||||
|
||||
protected:
|
||||
// @DPROT
|
||||
// @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,
|
||||
@ -81,7 +82,7 @@ protected:
|
||||
virtual TPoint dev2log(const PNT& p) const;
|
||||
|
||||
public:
|
||||
// @FPUB
|
||||
// @FPUB
|
||||
TWindow(); // Costruttore
|
||||
virtual ~TWindow();
|
||||
|
||||
@ -137,10 +138,10 @@ public:
|
||||
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,7 +170,7 @@ public:
|
||||
class TScroll_window : public TWindow
|
||||
{
|
||||
|
||||
// @DPRIV
|
||||
// @DPRIV
|
||||
TPoint _origin;
|
||||
TPoint _max;
|
||||
short _shift;
|
||||
@ -180,7 +181,7 @@ class TScroll_window : public TWindow
|
||||
|
||||
protected:
|
||||
|
||||
// @FPROT
|
||||
// @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
|
||||
@ -189,7 +190,7 @@ protected:
|
||||
virtual bool on_key(KEY key);
|
||||
|
||||
public:
|
||||
// @FPUB
|
||||
// @FPUB
|
||||
|
||||
TScroll_window();
|
||||
// Costruttore
|
||||
|
@ -107,7 +107,9 @@ HIDDEN BOOLEAN event_hook(HWND hwnd,
|
||||
ULONG lparam,
|
||||
long* ret)
|
||||
{
|
||||
if (msg == WM_CTLCOLOR)
|
||||
switch(msg)
|
||||
{
|
||||
case WM_CTLCOLOR:
|
||||
{
|
||||
const word type = HIWORD(lparam);
|
||||
|
||||
@ -137,44 +139,64 @@ HIDDEN BOOLEAN event_hook(HWND hwnd,
|
||||
*ret = focus ? FocusBrush : NormalBrush;
|
||||
return TRUE;
|
||||
}
|
||||
} else
|
||||
if (msg == WM_COMMAND)
|
||||
{
|
||||
word notify = HIWORD(lparam);
|
||||
}
|
||||
break;
|
||||
case WM_COMMAND:
|
||||
{
|
||||
const word notify = HIWORD(lparam);
|
||||
if (notify == EN_KILLFOCUS || notify == EN_SETFOCUS)
|
||||
{
|
||||
HWND hwnd = LOWORD(lparam);
|
||||
HWND hwnd = LOWORD(lparam); // Ridisegna BENE il campo
|
||||
InvalidateRect(hwnd, NULL, TRUE);
|
||||
}
|
||||
} else
|
||||
if (msg == WM_KEYUP)
|
||||
{
|
||||
}
|
||||
break;
|
||||
case WM_KEYDOWN:
|
||||
if (wparam == VK_PRIOR || wparam == VK_NEXT ||
|
||||
wparam == VK_UP || wparam == VK_DOWN )
|
||||
{
|
||||
{
|
||||
char name[16];
|
||||
GetClassName(hwnd, name, 15);
|
||||
GetClassName(hwnd, name, 5);
|
||||
if (stricmp(name, "Edit") == 0)
|
||||
{
|
||||
KEY key;
|
||||
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;
|
||||
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 (wparam)
|
||||
if (key > 0)
|
||||
{
|
||||
WINDOW w = xvtwi_hwnd_to_window(GetParent(hwnd));
|
||||
dispatch_e_char(w, wparam);
|
||||
}
|
||||
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