applicat.cpp ~ Messa nell heap la maschera dei prametri ditta

mask.cpp         Corretta la first_focus
maskfld.cpp      Corretta gestione del bootone collega nelle ricerche
msksheet.cpp     Coreetta gestione sheet non editabili
sheet.cpp        MIgliorate posizioni campi editabili di ricerca


git-svn-id: svn://10.65.10.50/trunk@2923 c028cbd2-c16b-5b4b-a496-9718f37d4682
This commit is contained in:
guy 1996-05-28 15:47:35 +00:00
parent b5cc178347
commit b88a9be772
5 changed files with 46 additions and 29 deletions

View File

@ -404,9 +404,9 @@ void TApplication::set_perms()
users.put("USERNAME", utente);
if (users.read() == NOERR)
{
const TString& aut = users.get("AUTSTR");
for (int i = aut.len()-1; i > 0; i--)
_user_aut.set(i, aut[i] == 'X');
const TString& aut = users.get("AUTSTR");
for (int i = aut.len()-1; i > 0; i--)
_user_aut.set(i, aut[i] == 'X');
}
}
}
@ -665,15 +665,16 @@ bool TApplication::config()
// alla ditta) se non c'e', viene creato copiando il default la variabile EdMask
// di quel paragrafo specifica la maschera da usare.
{
TConfig cnf(CONFIG_DITTA);
{
bool ok = FALSE;
const TFilename maskname(cnf.get("EdMask"));
TConfig cnf(CONFIG_DITTA);
const TFilename maskname = cnf.get("EdMask");
if (maskname.empty())
return warning_box("Nessun parametro da configurare");
TMask m(maskname);
TMask* msk = new TMask(maskname); // Evito problemi di stack
TMask& m = *msk;
// carica campi
for (int i = 0; i < m.fields(); i++)
@ -711,6 +712,7 @@ bool TApplication::config()
ok = TRUE;
}
delete msk;
enable_menu_item(M_FILE_REVERT);
return ok;
}

View File

@ -206,16 +206,24 @@ int TMask::first_focus(short id)
int f = _first_focus;
if (id == 0)
{
{
if (tempfirstfocus >= 0)
{
f = tempfirstfocus;
if (fld(f).dirty() == FALSE)
fld(f).set_dirty();
tempfirstfocus = -1;
}
tempfirstfocus = -1;
if (f < 0)
f = _first_focus = find_first_active(_pagewin[0]);
else
{
if (f < 0 || !fld(f).active())
{
f = find_first_active(_pagewin[0]);
if (f < 0 && toolwin())
f = find_first_active(toolwin());
_first_focus = f;
}
}
}
else
{
@ -228,6 +236,7 @@ int TMask::first_focus(short id)
tempfirstfocus = id2pos(-id);
}
CHECKD(f >= 0 && f < fields() && fld(f).active(), "Invalid focus field ", f);
return f;
}

View File

@ -2202,7 +2202,6 @@ KEY TBrowse::run()
buttons = 0;
}
}
if (_cursor->items() == 0 && buttons == 3) buttons = 2; // Toglie il bottone collega se non ci sono elementi
}
for (const char* i = _inp_id.get(0); i; i = _inp_id.get())
{

View File

@ -120,7 +120,7 @@ public:
// @cmember Modifica a video la riga
void update(int row);
// @cmember Ritorna la disabilitazione della colonna <p col>
bool column_disabled(int col) { return _column_disabled[col]; }
bool column_disabled(int col) const { return _column_disabled[col]; }
// @cmember Ritorna il contenuto della riga <p n>-esima
TToken_string& row(int n)
@ -1503,7 +1503,7 @@ KEY TSpreadsheet::edit(int n)
str2mask(n);
KEY k = owner().run_editmask(n);
if (active)
if (active())
{
if (k == K_ENTER)
{
@ -1876,7 +1876,7 @@ void TSheet_field::mask2row(int n, TToken_string & rec)
const TMask& m = TSheet_field::sheet_mask();
rec.cut(0);
TSpreadsheet* s = (TSpreadsheet*)_ctl;
const TSpreadsheet& s = (const TSpreadsheet&)*_ctl;
for (short id = FIRST_FIELD; ; id++)
{
@ -1889,11 +1889,11 @@ void TSheet_field::mask2row(int n, TToken_string & rec)
if (f.shown() || f.ghost())
{
rec.add(f.get());
if (active())
if (s.active())
{
const int col = id-FIRST_FIELD;
if (!s->column_disabled(col))
if (!s.column_disabled(col))
{
const bool on = f.enabled();
enable_cell(n, col, on);
@ -1905,7 +1905,7 @@ void TSheet_field::mask2row(int n, TToken_string & rec)
if (pos < 0)
{
#ifdef DBG
if (s->cid2col(id) > 0)
if (s.cid2col(id) > 0)
yesnofatal_box("Mask2str: Non e' visibile il campo %d", dlg);
#endif
rec.add(" ");
@ -1921,7 +1921,8 @@ void TSheet_field::row2mask(int n, TToken_string & r)
TMask& m = TSheet_field::sheet_mask();
const int campi = m.fields();
const TSpreadsheet& s = (const TSpreadsheet&)*_ctl;
for (int i = 0; i < campi; i++)
{
TMask_field& f = m.fld(i);
@ -1931,7 +1932,7 @@ void TSheet_field::row2mask(int n, TToken_string & r)
const int index = (id % 100)-1;
val = r.get(index);
f.set(val);
const bool on = active() && !cell_disabled(n, index);
const bool on = s.active() && !cell_disabled(n, index);
if (f.enabled() != on)
f.enable(on);
}

View File

@ -330,7 +330,7 @@ void TSheet_control::make_current(long rec)
xi_cell_request(&o);
}
const int newrow = rec2row(rec);
if (newrow != oldrow && newrow >= 0)
if (newrow >= 0 && newrow != oldrow)
{
XI_MAKE_ROW(&o, _obj, newrow);
xi_cell_request(&o);
@ -740,11 +740,17 @@ void TSheet::repos_buttons() const
}
void TSheet::start_run()
{
{
const bool on = items() > 0 && _sheet->one_enabled();
// Abilita selezione se c'e' almeno un elemento
const int pos = id2pos(DLG_SELECT);
int pos = id2pos(DLG_SELECT);
if (pos >= 0)
fld(pos).enable(items() > 0 && _sheet->one_enabled());
fld(pos).enable(on);
pos = id2pos(DLG_LINK);
if (pos >= 0)
fld(pos).enable(on);
_parked = -1;
@ -877,8 +883,8 @@ bool TSheet::tutti_handler(TMask_field& f, KEY k)
if (k == K_SPACE)
{
TSheet& s = (TSheet&)f.mask();
if (s.check_enabled())
s.check(-1, !s.one_checked());
if (s.check_enabled())
s.check(-1, !s.one_checked());
}
return TRUE;
}
@ -1057,7 +1063,7 @@ TBrowse_sheet::TBrowse_sheet(TCursor* cursor, const char* fields,
TString80 p = c.prompt();
// Toglie spazi e simboli iniziali dal prompt
for (int a = 0; p[a] && !isalnum(p[a]); a++);
p.ltrim(a); p.left_just(20);
p.ltrim(a); p.left_just(16);
switch (c.class_id())
{
case CLASS_EDIT_FIELD: