config.cpp Crea il config dei nuovi utenti copiandolo dll'utente prassi

isam.cpp       Messa fuori da un ciclo una Token_string!
maskfld.cpp    Corretto ripristino campi dopo una ricerca
msksheet.cpp   Migliorata gestione righe disabiliatate completamente
sheet.cpp


git-svn-id: svn://10.65.10.50/trunk@3509 c028cbd2-c16b-5b4b-a496-9718f37d4682
This commit is contained in:
guy 1996-09-04 07:53:02 +00:00
parent 8628b88ca1
commit ce88a273e3
5 changed files with 79 additions and 21 deletions

View File

@ -559,12 +559,24 @@ TConfig::TConfig(int which_config, const char* paragraph)
case CONFIG_STAMPE: case CONFIG_STAMPE:
_file.add("print.ini"); _file.add("print.ini");
break; break;
case CONFIG_USER:
{
TString16 u = user();
if (u.blank())
u = "PRASSI";
else
u.upper();
_file.add(u);
_file.ext("ini");
if (u != "PRASSI" && !fexist(_file))
{
TFilename prassi = _file.path();
prassi.add("prassi.ini");
fcopy(prassi, _file);
}
}
break;
default: default:
if (user().not_empty())
_file.add(user());
else
_file.add("prassi");
_file.ext("ini");
break; break;
} }
break; break;

View File

@ -132,12 +132,12 @@ int get_error(int err)
HIDDEN bool lf_has_memo( const TTrec& r ) HIDDEN bool lf_has_memo( const TTrec& r )
{ {
bool ret = FALSE; bool ret = FALSE;
int nfields = r.fields( ); const int nfields = r.fields( );
TToken_string s;
for( int i = 0; i < nfields && !ret; i ++ ) for( int i = 0; i < nfields && !ret; i ++ )
{ {
TToken_string s( r.fielddef( i ) ); s = r.fielddef( i );
if ( s.get_int( 1 ) == _memofld ) if ( s.get_int( 1 ) == _memofld )
ret = TRUE; ret = TRUE;
} }
@ -157,9 +157,11 @@ HIDDEN bool lf_has_memo( const int lffile )
r.get( lffile ); r.get( lffile );
bool ret = FALSE; bool ret = FALSE;
int nfields = r.fields( ); int nfields = r.fields( );
TToken_string s;
for( int i = 0; i < nfields && !ret; i ++ ) for( int i = 0; i < nfields && !ret; i ++ )
{ {
TToken_string s( r.fielddef( i ) ); s = r.fielddef( i );
if ( s.get_int( 1 ) == _memofld ) if ( s.get_int( 1 ) == _memofld )
ret = TRUE; ret = TRUE;
} }

View File

@ -2265,8 +2265,8 @@ KEY TBrowse::run()
*_cursor = selected; *_cursor = selected;
do_output(); do_output();
break; break;
case K_ESC: default:
{ {
for (const char* i = vals.get(0); i && *i; i = vals.get()) for (const char* i = vals.get(0); i && *i; i = vals.get())
{ {
const short id = field().atodlg(i); const short id = field().atodlg(i);
@ -2275,8 +2275,6 @@ KEY TBrowse::run()
f.set_dirty(vals.get_int()); f.set_dirty(vals.get_int());
} }
} }
break;
default:
if (k >= K_CTRL) if (k >= K_CTRL)
{ {
TMask& m = field().mask(); TMask& m = field().mask();

View File

@ -59,6 +59,8 @@ class TSpreadsheet : public TControl
// @cmember:(INTERNAL) Numero della riga che necessita aggiornamento (vengono aggiornate // @cmember:(INTERNAL) Numero della riga che necessita aggiornamento (vengono aggiornate
// nella <mf TSpreadsheet::on_idle>) // nella <mf TSpreadsheet::on_idle>)
int _needs_update; int _needs_update;
// @cmember:(INTERNAL) Numero della riga a cui saltare appena possibile
int _selection_posted;
// @cmember:(INTERNAL) Inizializza lo spreadsheet // @cmember:(INTERNAL) Inizializza lo spreadsheet
void init(); void init();
@ -142,6 +144,8 @@ public:
// @cmember Trova una colonna abilitata a partire da colonna // @cmember Trova una colonna abilitata a partire da colonna
int find_enabled_column(int rec, int colonna, int direction) const; int find_enabled_column(int rec, int colonna, int direction) const;
// @cmember Trova un record abilitato a partire da rec
int find_enabled_record(int rec, int direction) const;
// @cmember Permette di mettere il focus su una cella // @cmember Permette di mettere il focus su una cella
void set_focus_cell(int riga, int colonna); void set_focus_cell(int riga, int colonna);
// @cmember Abilita/disabilita tutto lo spreadsheet (vedi <mf TMask::activate>) // @cmember Abilita/disabilita tutto lo spreadsheet (vedi <mf TMask::activate>)
@ -192,10 +196,13 @@ public:
{ return _cur_rec; } { return _cur_rec; }
// @cmember Seleziona una riga dandogli il focus // @cmember Seleziona una riga dandogli il focus
void select(int r, bool scrollto); void select(int r, bool scrollto);
// @cmember Ritorna il numero di colonne presenti enllo spreadsheet // @cmember Ritorna il numero di colonne presenti nello spreadsheet
int columns() const int columns() const
{ return _columns; } { return _columns; }
// @cmember Seleziona una riga appena possibile
void post_select(int r);
// @cmember Controlla se e' stato modificato una cella dello spreadsheet // @cmember Controlla se e' stato modificato una cella dello spreadsheet
bool dirty() const bool dirty() const
{ return owner().dirty(); } { return owner().dirty(); }
@ -238,7 +245,7 @@ TSpreadsheet::TSpreadsheet(
_mask(maskname, maskno), _notify(NULL), _mask(maskname, maskno), _notify(NULL),
_cur_row(0), _cur_col(1), _cur_rec(0), _edit_field(NULL), _active(TRUE), _cur_row(0), _cur_col(1), _cur_rec(0), _edit_field(NULL), _active(TRUE),
_row_dirty(FALSE), _cell_dirty(FALSE), _check_enabled(TRUE), _row_dirty(FALSE), _cell_dirty(FALSE), _check_enabled(TRUE),
_needs_update(-1) _needs_update(-1), _selection_posted(-1)
{ {
const int NUMBER_WIDTH = 3; const int NUMBER_WIDTH = 3;
const int MAX_COL = 32; const int MAX_COL = 32;
@ -550,6 +557,16 @@ int TSpreadsheet::find_enabled_column(int rec, int colonna, int direction) const
return 0; return 0;
} }
int TSpreadsheet::find_enabled_record(int rec, int direction) const
{
for (int r = rec+direction; r >= 0 && r < items(); r += direction)
{
if (find_enabled_column(r, 1, +1) > 0)
return r;
}
return -1;
}
// riga (da 0), colonna (0 = numero, 1 = prima cella, ...) // riga (da 0), colonna (0 = numero, 1 = prima cella, ...)
void TSpreadsheet::set_focus_cell(int riga, int colonna) void TSpreadsheet::set_focus_cell(int riga, int colonna)
{ {
@ -968,6 +985,16 @@ bool TSpreadsheet::event_handler(XI_OBJ* itf, XI_EVENT *xiev)
case XIE_ON_ROW: case XIE_ON_ROW:
if (_check_enabled) if (_check_enabled)
{ {
int row = xiev->v.xi_obj->v.row;
int next_rec = row2rec(row);
if (find_enabled_column(next_rec, 1, +1) <= 0)
{
next_rec = find_enabled_record(next_rec, next_rec >= _cur_rec ? +1 : -1);
post_select(next_rec);
refused = TRUE;
break;
}
// Setta _cur_rec in base a alla riga e cella correnti // Setta _cur_rec in base a alla riga e cella correnti
set_pos(xiev->v.xi_obj->v.row, _cur_col); set_pos(xiev->v.xi_obj->v.row, _cur_col);
if (_cur_rec < items() && notify(_cur_rec, K_TAB)) if (_cur_rec < items() && notify(_cur_rec, K_TAB))
@ -1325,6 +1352,11 @@ void TSpreadsheet::select(int rec, bool scrollto)
notify(rec, K_TAB); notify(rec, K_TAB);
} }
void TSpreadsheet::post_select(int rec)
{
_selection_posted = rec;
}
void TSpreadsheet::on_idle() void TSpreadsheet::on_idle()
{ {
if (_needs_update >= 0) if (_needs_update >= 0)
@ -1333,6 +1365,14 @@ void TSpreadsheet::on_idle()
update_rec(_needs_update); update_rec(_needs_update);
_needs_update = -1; _needs_update = -1;
} }
if (_selection_posted >= 0)
{
const int next_row = _selection_posted;
_selection_posted = -1;
if (next_row < items())
select(next_row, FALSE);
}
} }
// @doc INTERNAL // @doc INTERNAL

View File

@ -1064,6 +1064,13 @@ HIDDEN TBrowse_sheet* _cur_browse = NULL;
bool TBrowse_sheet::browse_field_handler(TMask_field& f, KEY k) bool TBrowse_sheet::browse_field_handler(TMask_field& f, KEY k)
{ {
long rec = -1; long rec = -1;
if (k == K_F2)
{
f.reset();
k = K_SPACE;
}
if (k == K_SPACE) if (k == K_SPACE)
{ {
TEdit_field& e = _cur_browse->field(); // Campo padre dello sheet TEdit_field& e = _cur_browse->field(); // Campo padre dello sheet
@ -1081,14 +1088,13 @@ bool TBrowse_sheet::browse_field_handler(TMask_field& f, KEY k)
c.set(f.get()); c.set(f.get());
TBrowse* b = e.browse(); TBrowse* b = e.browse();
if (b) if (b != NULL)
{ {
b->do_input(FALSE); b->do_input(FALSE);
rec = b->cursor()->read(_isgteq); rec = b->cursor()->read(_isgteq);
} }
} else }
if (k == K_F2)
rec = 0;
if (rec >= 0 && rec != _cur_browse->selected()) if (rec >= 0 && rec != _cur_browse->selected())
{ {
_cur_browse->select(rec); // Non mettere post_select _cur_browse->select(rec); // Non mettere post_select