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,13 +559,25 @@ TConfig::TConfig(int which_config, const char* paragraph)
case CONFIG_STAMPE:
_file.add("print.ini");
break;
default:
if (user().not_empty())
_file.add(user());
else
_file.add("prassi");
_file.ext("ini");
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:
break;
}
break;
case CONFIG_FCONV:

View File

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

View File

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

View File

@ -59,6 +59,8 @@ class TSpreadsheet : public TControl
// @cmember:(INTERNAL) Numero della riga che necessita aggiornamento (vengono aggiornate
// nella <mf TSpreadsheet::on_idle>)
int _needs_update;
// @cmember:(INTERNAL) Numero della riga a cui saltare appena possibile
int _selection_posted;
// @cmember:(INTERNAL) Inizializza lo spreadsheet
void init();
@ -142,6 +144,8 @@ public:
// @cmember Trova una colonna abilitata a partire da colonna
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
void set_focus_cell(int riga, int colonna);
// @cmember Abilita/disabilita tutto lo spreadsheet (vedi <mf TMask::activate>)
@ -192,10 +196,13 @@ public:
{ return _cur_rec; }
// @cmember Seleziona una riga dandogli il focus
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
{ return _columns; }
// @cmember Seleziona una riga appena possibile
void post_select(int r);
// @cmember Controlla se e' stato modificato una cella dello spreadsheet
bool dirty() const
{ return owner().dirty(); }
@ -238,7 +245,7 @@ TSpreadsheet::TSpreadsheet(
_mask(maskname, maskno), _notify(NULL),
_cur_row(0), _cur_col(1), _cur_rec(0), _edit_field(NULL), _active(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 MAX_COL = 32;
@ -550,6 +557,16 @@ int TSpreadsheet::find_enabled_column(int rec, int colonna, int direction) const
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, ...)
void TSpreadsheet::set_focus_cell(int riga, int colonna)
{
@ -967,7 +984,17 @@ bool TSpreadsheet::event_handler(XI_OBJ* itf, XI_EVENT *xiev)
break;
case XIE_ON_ROW:
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
set_pos(xiev->v.xi_obj->v.row, _cur_col);
if (_cur_rec < items() && notify(_cur_rec, K_TAB))
@ -1325,6 +1352,11 @@ void TSpreadsheet::select(int rec, bool scrollto)
notify(rec, K_TAB);
}
void TSpreadsheet::post_select(int rec)
{
_selection_posted = rec;
}
void TSpreadsheet::on_idle()
{
if (_needs_update >= 0)
@ -1333,6 +1365,14 @@ void TSpreadsheet::on_idle()
update_rec(_needs_update);
_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

View File

@ -1064,6 +1064,13 @@ HIDDEN TBrowse_sheet* _cur_browse = NULL;
bool TBrowse_sheet::browse_field_handler(TMask_field& f, KEY k)
{
long rec = -1;
if (k == K_F2)
{
f.reset();
k = K_SPACE;
}
if (k == K_SPACE)
{
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());
TBrowse* b = e.browse();
if (b)
if (b != NULL)
{
b->do_input(FALSE);
rec = b->cursor()->read(_isgteq);
}
} else
if (k == K_F2)
rec = 0;
}
if (rec >= 0 && rec != _cur_browse->selected())
{
_cur_browse->select(rec); // Non mettere post_select