Risolto (elegantemente) il problema del funzionamento dei tasti PgUp e PgDn

(PG su e giu' a velocita' variabile) con maschere contenenti spreadsheet
nelle pagine successive alla prima.


git-svn-id: svn://10.65.10.50/trunk@696 c028cbd2-c16b-5b4b-a496-9718f37d4682
This commit is contained in:
guy 1994-11-28 11:01:27 +00:00
parent f86f671813
commit f8ca78abbf
8 changed files with 93 additions and 68 deletions

View File

@ -468,7 +468,6 @@ void TExpression::eval()
o1 = (real&) evalstack.pop();
evalstack.push(pow(o1, o2));
break;
case _min:
o2 = (real&)evalstack.pop();
o1 = (real&)evalstack.pop();
evalstack.push(fnc_min(o1, o2));
@ -483,6 +482,14 @@ void TExpression::eval()
s1.upper();
evalstack.push(s1);
break;
case _round:
{
const int ndec = (int)((real&) evalstack.pop()).integer();
o1 = (real&) evalstack.pop();
o1.round(ndec);
evalstack.push(o1);
}
break;
default:
break;
}
@ -499,11 +506,12 @@ HIDDEN const char* _s;
HIDDEN char _tok[81];
HIDDEN const char* _fntable[] = { "sqrt", "sqr", "exp10", "exp", "log10",
"log", "sin", "cos", "tan", "left",
"right", "pow", "min", "max", "mid", "upper", NULL };
"right", "pow", "min", "max", "mid", "upper",
"round", NULL };
HIDDEN TCodesym _fntok[] = { _sqrt, _sqr, _exp10, _exp, _log10, _log,
_sin, _cos, _tan, _left, _right, _pow,
_min, _max, _mid, _upper};
_min, _max, _mid, _upper, _round};
TCodesym TExpression::__gettoken(bool reduct)
@ -695,8 +703,7 @@ TCodesym TExpression::__factor(TCodesym startsym)
sym = __gettoken();
if (sym == _lpar) sym = __gettoken();
else break;
if ((sym == _number) || (sym == _variable)) sym = __factor(sym);
else break;
sym = __expression(sym);
if (sym == _rpar) sym = __gettoken();
else break;
_code.add(startsym);
@ -705,7 +712,7 @@ TCodesym TExpression::__factor(TCodesym startsym)
sym = __gettoken();
if (sym == _lpar) sym = __gettoken();
else break;
if ((sym == _string) || (sym == _variable)) sym = __factor(sym);
if ((sym == _string) || (sym == _variable)) sym = __expression(sym);
else break;
if (sym == _rpar) sym = __gettoken();
else break;
@ -716,15 +723,14 @@ TCodesym TExpression::__factor(TCodesym startsym)
case _pow:
case _min:
case _max:
case _round:
sym = __gettoken();
if (sym == _lpar) sym = __gettoken(TRUE);
else break;
if ((sym == _number) || (sym == _variable)) sym = __factor(sym);
else break;
sym = __expression(sym);
if (sym == _comma) sym = __gettoken(TRUE);
else break;
if ((sym == _number) || (sym == _variable)) sym = __factor(sym);
else break;
sym = __expression(sym);
if (sym == _rpar) sym = __gettoken();
else break;
_code.add(startsym);
@ -733,16 +739,14 @@ TCodesym TExpression::__factor(TCodesym startsym)
sym = __gettoken();
if (sym == _lpar) sym = __gettoken(TRUE);
else break;
if ((sym == _number) || (sym == _variable)) sym = __factor(sym);
if ((sym == _string) || (sym == _variable)) sym = __expression(sym);
else break;
if (sym == _comma) sym = __gettoken(TRUE);
else break;
if ((sym == _number) || (sym == _variable)) sym = __factor(sym);
else break;
sym = __expression(sym);
if (sym == _comma) sym = __gettoken(TRUE);
else break;
if ((sym == _number) || (sym == _variable)) sym = __factor(sym);
else break;
sym = __expression(sym);
if (sym == _rpar) sym = __gettoken();
else break;
_code.add(startsym);

View File

@ -22,7 +22,7 @@ enum TCodesym { _invalid, _endsym, _comma, _lpar, _rpar, _variable,
_chgs, _and, _or, _not, _equal, _match, _noteq, _lt, _gt,
_lteq, _gteq, _sqrt, _sqr, _exp10, _exp, _log10, _log,
_sin, _cos, _tan, _left, _right, _pow, _min, _max, _mid,
_upper } ;
_upper, _round } ;
// @DES I tipi di espressioni definiti
// @T

View File

@ -653,7 +653,7 @@ void TMask::set_focus()
if (pw) show_window(pw, FALSE); // hide old page
}
set_front_window(f.win());
f.highlight();
}

View File

@ -1,4 +1,4 @@
// $Id: maskfld.cpp,v 1.52 1994-11-24 14:01:01 guy Exp $
// $Id: maskfld.cpp,v 1.53 1994-11-28 11:01:17 guy Exp $
#include <xvt.h>
#include <applicat.h>
@ -774,6 +774,10 @@ bool TMask_field::on_key(KEY key)
return TRUE;
}
void TMask_field::highlight() const
{
set_front_window(win());
}
void TMask_field::set_focus() const
{

View File

@ -1,4 +1,4 @@
/* $Id: maskfld.h,v 1.12 1994-11-24 14:01:07 guy Exp $ */
/* $Id: maskfld.h,v 1.13 1994-11-28 11:01:22 guy Exp $ */
#ifndef __MASKFLD_H
#define __MASKFLD_H
@ -101,6 +101,7 @@ protected:
virtual void create(WINDOW parent);
virtual void destroy();
virtual void highlight() const;
virtual const char* get_window_data() const;
virtual void set_window_data(const char* data);

View File

@ -47,8 +47,6 @@ protected:
TMask_field* cell2field(const XI_OBJ* cell) const;
void update_rec(int rec);
void set_focus_cell(int riga, int colonna);
TMask_field* field(short id) const;
int rec2row(int rec);
@ -65,6 +63,7 @@ public:
int insert(int rec);
bool destroy(int rec = -1);
void set_focus_cell(int riga, int colonna);
void enable(bool on);
void enable_column(int col, bool on = TRUE);
void enable_cell(int row, int column, bool on = TRUE);
@ -322,10 +321,12 @@ void TSpreadsheet::update_rec(int rec)
}
void TSpreadsheet::set_focus_cell(int riga, int colonna)
{
{
_firstfocus = FALSE;
set_front_window(win()); // It seems necessary to make xi_set_focus work properly
XI_OBJ cell;
XI_MAKE_CELL(&cell, _list, rec2row(riga), colonna);
const int r = rec2row(riga);
XI_OBJ cell;
XI_MAKE_CELL(&cell, _list, r, colonna);
xi_set_focus(&cell);
}
@ -621,7 +622,7 @@ break;
switch (ep->type)
{
case E_FOCUS:
if (ep->v.active == FALSE)
if (_check_enabled && ep->v.active == FALSE)
{
const bool ok = (bool)xi_move_focus(_itf);
if (!ok)
@ -906,14 +907,17 @@ void TSpreadsheet::enable_cell(int row, int column, bool on)
void TSpreadsheet::enable(bool on)
{
const dword old = xi_get_attrib(_list);
const dword att = on ? (old & ~XI_ATR_READONLY) : (old | XI_ATR_READONLY);
dword att = on ? (old & ~XI_ATR_NAVIGATE) : (old | XI_ATR_NAVIGATE);
if (old != att)
{
int num;
XI_OBJ** columns = xi_get_member_list(_list, &num);
xi_move_focus(_itf); // Set focus to interface
xi_move_focus(_itf); // Set focus to interface
att = on ? (att | XI_ATR_TABWRAP) : (att & ~XI_ATR_TABWRAP);
xi_set_attrib(_list, att);
for (int col = 1; col < num; col++)
{
XI_OBJ* column = columns[col];
@ -1164,13 +1168,11 @@ void TSheet_field::force_update(int r)
#endif
}
int TSheet_field::items() const
{
return (int)_sheet->items();
}
int TSheet_field::selected() const
{
return _sheet->selected();
@ -1181,6 +1183,15 @@ void TSheet_field::set_notify(SPREADSHEET_NOTIFY n)
_sheet->set_notify(n);
}
void TSheet_field::highlight() const
{
#if XVT_OS == XVT_OS_WIN
if (items())
_sheet->set_focus_cell(0, 1);
#else
TMask_field::highlight();
#endif
}
void TSheet_field::enable(bool on)
{

View File

@ -24,6 +24,7 @@ protected:
virtual bool parse_item(TScanner& scanner);
virtual void create(WINDOW parent);
virtual void highlight() const;
virtual void exchange(bool show_value, const real& n);
public:

View File

@ -19,52 +19,56 @@ RCT& resize_rect(short x, short y, short dx, short dy, WIN_TYPE wt, WINDOW paren
void xvt_draw_rect(WINDOW w, const RCT& r, COLOR c1, COLOR c2, short depth = 1);
WINDOW xvt_create_window(WIN_TYPE wt,
short x, short y, short dx, short dy,
const char* caption, WINDOW parent,
long flags,
EVENT_HANDLER eh,
long app_data
);
WINDOW xvt_create_window
(
WIN_TYPE wt,
short x, short y, short dx, short dy,
const char* caption, WINDOW parent,
long flags,
EVENT_HANDLER eh,
long app_data
);
WINDOW xvt_create_control(WIN_TYPE wt,
short x, short y, short dx, short dy,
const char* caption,
WINDOW parent,
long flags,
long app_data,
int id
);
WINDOW xvt_create_control
(
WIN_TYPE wt,
short x, short y, short dx, short dy,
const char* caption,
WINDOW parent,
long flags,
long app_data,
int id
);
WINDOW xvt_create_statbar();
void xvt_statbar_set(const char* text, bool def = FALSE);
void xvt_statbar_refresh();
WINDOW xvt_create_statbar();
void xvt_statbar_set(const char* text, bool def = FALSE);
void xvt_statbar_refresh();
void beep();
void do_events();
void customize_controls(bool on);
KEY e_char_to_key(const EVENT* ep);
void dispatch_e_char(WINDOW win, KEY key);
void dispatch_e_scroll(WINDOW win, KEY key);
void beep();
void do_events();
void customize_controls(bool on);
KEY e_char_to_key(const EVENT* ep);
void dispatch_e_char(WINDOW win, KEY key);
void dispatch_e_scroll(WINDOW win, KEY key);
void xvt_set_font(WINDOW win, int family, int style, int dim = 0);
void xvt_set_front_control(WINDOW win);
const char* xvt_get_title(WINDOW win);
void xvt_enable_control(WINDOW win, bool on);
void xvt_check_box(WINDOW win, bool on);
bool xvt_get_checked_state(WINDOW win);
void xvt_check_radio_button(WINDOW win, const WINDOW* ctls, int count);
int xvt_get_checked_radio(const WINDOW* ctls, int count);
void xvt_change_page_tags(WINDOW pag, bool on, WINDOW tag, byte p);
void xvt_set_font(WINDOW win, int family, int style, int dim = 0);
void xvt_set_front_control(WINDOW win);
const char* xvt_get_title(WINDOW win);
void xvt_enable_control(WINDOW win, bool on);
void xvt_check_box(WINDOW win, bool on);
bool xvt_get_checked_state(WINDOW win);
void xvt_check_radio_button(WINDOW win, const WINDOW* ctls, int count);
int xvt_get_checked_radio(const WINDOW* ctls, int count);
void xvt_change_page_tags(WINDOW pag, bool on, WINDOW tag, byte p);
bool xvt_test_menu_tag(MENU_TAG tag);
bool xvt_test_menu_tag(MENU_TAG tag);
COLOR trans_color(char c);
PAT_STYLE trans_brush(char p);
PEN_STYLE trans_pen (char p);
COLOR trans_color(char c);
PAT_STYLE trans_brush(char p);
PEN_STYLE trans_pen (char p);
extern short CHARX, CHARY, BASEY, ROWY;
extern short CHARX, CHARY, BASEY, ROWY;
/* @END */
/* @END */
#endif