Patch level : 2.0 476

Files correlati     : ba4.exe cg0.exe ve0.exe
Ricompilazione Demo : [ ]
Commento            :

Eliminato metodo force_cursor_usage()


git-svn-id: svn://10.65.10.50/trunk@11168 c028cbd2-c16b-5b4b-a496-9718f37d4682
This commit is contained in:
guy 2003-05-22 15:08:27 +00:00
parent 5d8e9d48f3
commit fb5601ff32
2 changed files with 68 additions and 66 deletions

View File

@ -87,7 +87,7 @@ void TRelation_application::set_limits(
if (cur)
{
cur->setkey();
f.browse()->do_input(TRUE);
b->do_input(TRUE);
if (cur->items() == 0)
_first = _last = -1;
else
@ -236,65 +236,63 @@ void TRelation_application::enable_query()
}
void TRelation_application::set_toolbar(bool all)
void TRelation_application::set_toolbar()
{
if (all)
const int mode = _mask->mode();
const bool can_edit_some = user_can_write(NULL);
int pos = _mask->id2pos(DLG_SAVEREC);
if (pos >= 0)
{
const int mode = _mask->mode();
const bool can_edit_some = user_can_write(NULL);
int pos = _mask->id2pos(DLG_SAVEREC);
if (pos >= 0)
{
bool enabsave=mode != MODE_QUERY;
if (enabsave)
enabsave = user_can_write(get_relation());
_mask->fld(pos).enable(enabsave);
}
pos = _mask->id2pos(DLG_DELREC);
if (pos >= 0)
{
bool enabdel = (mode == MODE_QUERY && can_edit_some) || (mode == MODE_MOD);
if (enabdel && mode == MODE_MOD)
{
TRelation& r = *get_relation();
const TRecnotype oldpos = r.lfile().recno();
enabdel = !protected_record(r);
if (r.lfile().recno() != oldpos)
r.lfile().readat(oldpos);
}
_mask->fld(pos).enable(enabdel);
}
pos = _mask->id2pos(DLG_FINDREC);
if (pos >= 0)
{
_mask->fld(pos).enable(_lnflag == 0);
pos = _mask->id2pos(DLG_FIRSTREC);
if (pos >= 0)
_mask->fld(pos).enable(_lnflag == 0 && _first > 0);
pos = _mask->id2pos(DLG_PREVREC);
const long recno = get_relation()->lfile().recno();
const bool enable_next_prev = _mask->edit_mode();
if (pos >= 0)
_mask->fld(pos).enable(_lnflag == 0 && enable_next_prev && _first > 0 && _first != recno);
pos = _mask->id2pos(DLG_NEXTREC);
if (pos >= 0)
_mask->fld(pos).enable(_lnflag == 0 && enable_next_prev && _last > 0 && _last != recno);
pos = _mask->id2pos(DLG_LASTREC);
if (pos >= 0)
_mask->fld(pos).enable(_lnflag == 0 && _last > 0);
}
pos = _mask->id2pos(DLG_NEWREC);
if (pos >= 0)
{
bool enabins = (mode == MODE_QUERY || _lnflag == 0) && can_edit_some;
_mask->fld(pos).enable(enabins);
}
bool enabsave=mode != MODE_QUERY;
if (enabsave)
enabsave = user_can_write(get_relation());
_mask->fld(pos).enable(enabsave);
}
set_find_button();
pos = _mask->id2pos(DLG_DELREC);
if (pos >= 0)
{
bool enabdel = (mode == MODE_QUERY && can_edit_some) || (mode == MODE_MOD);
if (enabdel && mode == MODE_MOD)
{
TRelation& r = *get_relation();
const TRecnotype oldpos = r.lfile().recno();
enabdel = !protected_record(r);
if (r.lfile().recno() != oldpos)
r.lfile().readat(oldpos);
}
_mask->fld(pos).enable(enabdel);
}
pos = _mask->id2pos(DLG_FINDREC);
if (pos >= 0)
{
_mask->fld(pos).enable(_lnflag == 0);
pos = _mask->id2pos(DLG_FIRSTREC);
if (pos >= 0)
_mask->fld(pos).enable(_lnflag == 0 && _first > 0);
pos = _mask->id2pos(DLG_PREVREC);
const long recno = get_relation()->lfile().recno();
const bool enable_next_prev = _mask->edit_mode();
if (pos >= 0)
_mask->fld(pos).enable(_lnflag == 0 && enable_next_prev && _first > 0 && _first != recno);
pos = _mask->id2pos(DLG_NEXTREC);
if (pos >= 0)
_mask->fld(pos).enable(_lnflag == 0 && enable_next_prev && _last > 0 && _last != recno);
pos = _mask->id2pos(DLG_LASTREC);
if (pos >= 0)
_mask->fld(pos).enable(_lnflag == 0 && _last > 0);
}
pos = _mask->id2pos(DLG_NEWREC);
if (pos >= 0)
{
bool enabins = (mode == MODE_QUERY || _lnflag == 0) && can_edit_some;
_mask->fld(pos).enable(enabins);
}
set_find_button();
enable_query();
}
@ -310,8 +308,8 @@ int TRelation_application::set_mode(int mode)
const int m = ((TMaskmode)mode == NO_MODE) ? (int) MODE_QUERY : mode;
_mask->set_mode(m);
set_toolbar(TRUE); // Full buttons update
_mode = mode;
set_toolbar();
_mode = mode;
const char* t = "";
switch(mode)
@ -412,6 +410,13 @@ void TRelation_application::query_mode(
{
set_mode(MODE_QUERY);
init_query_mode(*_mask);
// Aggiorna bottoni di ricerca: utile soprattutto per ve0 che imposta CODNUM
if (has_filtered_cursor())
{
set_limits();
set_toolbar();
}
}
}

View File

@ -81,8 +81,8 @@ private:
bool test_key(word k, bool err);
// @cmember:(INTERNAL) Abilita la ricerca sulla maschera
void enable_query();
// @cmember:(INTERNAL) UNUSED
void set_toolbar(bool all);
// @cmember:(INTERNAL) Abilita i vari bottoni di ricerca della toolbar
void set_toolbar();
// @Setta i filtri di lettura
void set_key_filter();
@ -99,8 +99,8 @@ private:
// @cmember:(INTERNAL) Permette di autonumerare un record
bool autonum(TMask* m, bool rec);
// @cmember:(INTERNAL) Controlla se il <c TCursor> ha un filtro
bool has_filtered_cursor() const
{ return filtered() || force_cursor_usage();}
virtual bool has_filtered_cursor() const
{ return filtered(); }
// @cmember:(INTERNAL) Sistema il bottone ricerca se necessario
void set_find_button();
@ -204,9 +204,6 @@ protected:
virtual void init_modify_mode(TMask&)
{ }
// @cmember Simula l'utilizzo di un filtro da un'altra applicazione
virtual bool force_cursor_usage() const
{ return FALSE;}
// @cmember Indica se abilitare/disabilitare la scrittura sul file
// principale (vedi <mf TRealtion::write_enable>)
virtual void write_enable(bool on = TRUE)