Gestione tasti rapidi.

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

View File

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

View File

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

View File

@ -21,28 +21,28 @@ public:
bool TTest_application::menu(MENU_TAG)
{
TLocalisamfile tab(LF_TABCOM);
TLocalisamfile tab(LF_COMUNI);
const TRecnotype n = tab.items();
time_t start;
clock_t start;
TRecnotype r = 1;
TString80 msg;
{
TProgind p(n, "Lettura file tabelle comuni", TRUE, TRUE, 32);
start = time(NULL);
TProgind p(n, "Lettura file comuni", TRUE, TRUE, 32);
start = clock();
for (tab.first(); tab.good(); tab.next(), r++)
{
if ((r % 50) == 0)
if ((r % 100) == 0)
{
msg.format("%ld records %ld sec", r, time(NULL) - start);
msg.format("%ld records %ld msec", r, clock() - start);
p.setstatus(r);
p.set_text(msg);
}
if (p.iscancelled()) break;
}
}
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;

View File

@ -1,23 +1,21 @@
#include <xvt.h>
#include <strings.h>
#include <checks.h>
#include "ba6.h"
#define usage "Error - usage : %s -0"
#define usage "Errore - uso : %s -{0,1}"
int main(int argc,char** argv)
{
int rt = 0 ;
TString p = argv[0], s = argv[1] ;
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;
}

View File

@ -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

View File

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

View File

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

View File

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

View File

@ -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];

View File

@ -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);

View File

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

View File

@ -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;
@ -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,7 +116,7 @@ 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();
///////////////////////////////////////////////////////////
@ -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;
@ -169,7 +169,8 @@ 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__);
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 (mt >= BAR_ITEM(1))
{
if(!menu(mt))
stop_run();
}
break;
}
}
@ -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());
}

View File

@ -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:

View File

@ -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>

View File

@ -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();

View File

@ -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 */

View File

@ -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);
}

View File

@ -1,4 +1,4 @@
// $Id: maskfld.cpp,v 1.2 1994-08-17 14:05:45 guy Exp $
// $Id: maskfld.cpp,v 1.3 1994-08-23 13:52:21 guy Exp $
#include <xvt.h>
#include <applicat.h>
@ -1823,7 +1823,7 @@ bool TEdit_field::on_key(KEY key)
{
for (int fld = m.get_key_field(i, TRUE); fld != -1; fld = m.get_key_field(i, FALSE))
m.field(fld).set_dirty(FALSE);
dispatch_e_char(get_parent(win()), K_SHIFT_ENTER);
dispatch_e_char(get_parent(win()), K_AUTO_ENTER);
break;
}
}
@ -2053,29 +2053,49 @@ void TButton_field::create(WINDOW parent)
{
long flags = CTL_FLAG_CENTER_JUST;
if (_prompt.empty()) switch (dlg())
switch (dlg())
{
case DLG_OK:
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);
}

View File

@ -1,4 +1,4 @@
/* $Id: maskfld.h,v 1.1.1.1 1994-08-12 10:51:57 alex Exp $ */
/* $Id: maskfld.h,v 1.2 1994-08-23 13:52:23 guy Exp $ */
#ifndef __MASKFLD_H
#define __MASKFLD_H
@ -484,6 +484,8 @@ public:
class TButton_field : public TMask_field
{
KEY _virtual_key, _exit_key;
protected:
// @FPROT
virtual word class_id() const;
@ -498,6 +500,8 @@ protected:
public:
// @FPUB
TButton_field(TMask* mask);
KEY virtual_key() const { return _virtual_key; }
KEY exit_key() const { return _exit_key; }
};

View File

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

View File

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

View File

@ -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:

View File

@ -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"
MESSAGE EXIT,K_F9
END
BUTTON DLG_CANCEL 8 2
BEGIN
PROMPT -56 -1 ""
MESSAGE EXIT,K_ESC
END
BUTTON DLG_QUIT 8 2
BEGIN
PROMPT -66 -1 ""
MESSAGE EXIT,K_QUIT
END

View File

@ -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;

View File

@ -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 ();

View File

@ -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

View File

@ -7,6 +7,7 @@
void close_all_dialogs();
bool can_close();
WINDOW cur_win();
// @C
// Classe TPoint

View File

@ -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,42 +139,62 @@ HIDDEN BOOLEAN event_hook(HWND hwnd,
*ret = focus ? FocusBrush : NormalBrush;
return TRUE;
}
} else
if (msg == WM_COMMAND)
}
break;
case WM_COMMAND:
{
word notify = HIWORD(lparam);
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;
}
@ -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;
}