Rimessi i Tcursor_sheet normali e cancellati dalla faccia della

terra i TCursor_sheet_recno perche' inutili.


git-svn-id: svn://10.65.10.50/trunk@2228 c028cbd2-c16b-5b4b-a496-9718f37d4682
This commit is contained in:
angelo 1995-12-02 11:45:45 +00:00
parent 8cee43ddfe
commit 55402f08db
2 changed files with 18 additions and 88 deletions

View File

@ -1,54 +1,5 @@
#include "scselect.h" #include "scselect.h"
///////////////////////////////////////////////////////////////////////////////
// TCursor_sheet_recno //
///////////////////////////////////////////////////////////////////////////////
TCursor_sheet_recno::TCursor_sheet_recno(TCursor * cursor, const char* fields,
const char * title, const char * head, byte buttons)
: TCursor_sheet(cursor, fields, title, head, buttons)
{
_recnos.reset();
}
bool TCursor_sheet_recno::on_key(KEY k)
{
switch(k)
{
case K_SPACE:
{
*cursor() = selected(); // Posiziona il cursore
rec_check(cursor()->file().recno(), !checked(selected()));
break;
}
case K_F2:
rec_uncheck(-1);
break;
case K_F3:
rec_check(-1);
break;
default:
break;
}
return TCursor_sheet::on_key(k);
}
void TCursor_sheet_recno::rec_check(long n, bool on)
{
if (n < 0)
{
if (on)
{
_recnos.set(cursor()->size()); // Force the size of Bit_array
_recnos.set();
}
else
_recnos.reset();
}
else
_recnos.set(n, on);
}
/////////////////////////////////////////////////////////////////////////////// ///////////////////////////////////////////////////////////////////////////////
// TSelection_mask // // TSelection_mask //
/////////////////////////////////////////////////////////////////////////////// ///////////////////////////////////////////////////////////////////////////////
@ -64,18 +15,18 @@ TSelection_mask::TSelection_mask(const char* name)
_cli_cur_k2 = new TCursor(_clifo_rel, "TIPOCF=\"C\"", 2); _cli_cur_k2 = new TCursor(_clifo_rel, "TIPOCF=\"C\"", 2);
_cli_sh_k1 = new TCursor_sheet_recno(_cli_cur_k1, " |CODCF|RAGSOC", "Selezione clienti per codice", _cli_sh_k1 = new TCursor_sheet(_cli_cur_k1, " |CODCF|RAGSOC", "Selezione clienti per codice",
"@1|Codice|Ragione Sociale@50"); "@1|Codice|Ragione Sociale@50");
_cli_sh_k2 = new TCursor_sheet_recno(_cli_cur_k2, " |RAGSOC|CODCF", "Selezione clienti per ragione sociale", _cli_sh_k2 = new TCursor_sheet(_cli_cur_k2, " |RAGSOC|CODCF", "Selezione clienti per ragione sociale",
"@1|Ragione Sociale@50|Codice"); "@1|Ragione Sociale@50|Codice");
if (id2pos(SC_CLIFO) >= 0) if (id2pos(SC_CLIFO) >= 0)
{ {
_for_cur_k1 = new TCursor(_clifo_rel, "TIPOCF=\"F\"", 1); _for_cur_k1 = new TCursor(_clifo_rel, "TIPOCF=\"F\"", 1);
_for_cur_k2 = new TCursor(_clifo_rel, "TIPOCF=\"F\"", 2); _for_cur_k2 = new TCursor(_clifo_rel, "TIPOCF=\"F\"", 2);
_for_sh_k1 = new TCursor_sheet_recno(_for_cur_k1, " |CODCF|RAGSOC", "Selezione fornitori per codice", _for_sh_k1 = new TCursor_sheet(_for_cur_k1, " |CODCF|RAGSOC", "Selezione fornitori per codice",
"@1|Codice|Ragione Sociale@50"); "@1|Codice|Ragione Sociale@50");
_for_sh_k2 = new TCursor_sheet_recno(_for_cur_k2, " |RAGSOC|CODCF", "Selezione fornitori per ragione sociale", _for_sh_k2 = new TCursor_sheet(_for_cur_k2, " |RAGSOC|CODCF", "Selezione fornitori per ragione sociale",
"@1|Ragione Sociale@50|Codice"); "@1|Ragione Sociale@50|Codice");
} }
@ -111,28 +62,24 @@ void TSelection_mask::set_handler(short fld_id, CONTROL_HANDLER handler)
fld(pos).set_handler(handler); fld(pos).set_handler(handler);
} }
TCursor_sheet_recno& TSelection_mask::cur_sheet() TCursor_sheet& TSelection_mask::cur_sheet()
{ {
TCursor_sheet_recno* cs; TCursor_sheet* cs;
if (get_key() == 1) cs = get_who() == 'C' ? _cli_sh_k1 : _for_sh_k1; if (get_key() == 1) cs = get_who() == 'C' ? _cli_sh_k1 : _for_sh_k1;
else cs = get_who() == 'C' ? _cli_sh_k2 : _for_sh_k2; else cs = get_who() == 'C' ? _cli_sh_k2 : _for_sh_k2;
CHECK(cs, "Can't use a NULL TCursor_sheet_recno"); CHECK(cs, "Can't use a NULL TCursor_sheet");
return *cs; return *cs;
} }
void TSelection_mask::reset_sheets() void TSelection_mask::reset_sheets()
{ {
_cli_sh_k1->uncheck(-1); _cli_sh_k1->uncheck(-1);
_cli_sh_k1->rec_uncheck(-1);
_cli_sh_k2->uncheck(-1); _cli_sh_k2->uncheck(-1);
_cli_sh_k2->rec_uncheck(-1);
if (_for_sh_k1) if (_for_sh_k1)
{ {
_for_sh_k1->uncheck(-1); _for_sh_k1->uncheck(-1);
_for_sh_k1->rec_uncheck(-1);
_for_sh_k2->uncheck(-1); _for_sh_k2->uncheck(-1);
_for_sh_k2->rec_uncheck(-1);
} }
reset(SC_CFCODFR); reset(SC_CFCODFR);
reset(SC_CFCODTO); reset(SC_CFCODTO);
@ -143,7 +90,7 @@ void TSelection_mask::reset_sheets()
// Seleziona tutti i clienti con codice compreso tra due estremi // Seleziona tutti i clienti con codice compreso tra due estremi
void TSelection_mask::select_clifo_range(long from, long to) void TSelection_mask::select_clifo_range(long from, long to)
{ {
TCursor_sheet_recno& c = cur_sheet(); TCursor_sheet& c = cur_sheet();
const long items = c.items(); const long items = c.items();
const int key = get_key(); const int key = get_key();
@ -173,7 +120,6 @@ void TSelection_mask::select_clifo_range(long from, long to)
if (cod >= from && cod <= to) if (cod >= from && cod <= to)
{ {
c.check(i); c.check(i);
c.rec_check(i);
nsel ++; nsel ++;
if (firs == 0l) firs = cod; if (firs == 0l) firs = cod;
last = cod; last = cod;
@ -181,7 +127,6 @@ void TSelection_mask::select_clifo_range(long from, long to)
else else
{ {
c.uncheck(i); c.uncheck(i);
c.rec_uncheck(i);
} }
if (cod == from) cod1ok = TRUE; if (cod == from) cod1ok = TRUE;
if (cod == to) cod2ok = TRUE; if (cod == to) cod2ok = TRUE;
@ -200,7 +145,7 @@ void TSelection_mask::set_clifo_limits()
{ {
long first = 0, last = 0, nsel = 0; long first = 0, last = 0, nsel = 0;
TCursor_sheet_recno& c = cur_sheet(); TCursor_sheet& c = cur_sheet();
const long items = c.items(); const long items = c.items();
const int key = get_key(); const int key = get_key();
@ -231,7 +176,7 @@ bool TSelection_mask::bfrom_handler(TMask_field& f, KEY k)
if (k == K_SPACE) if (k == K_SPACE)
{ {
TSelection_mask& m = (TSelection_mask&)f.mask(); TSelection_mask& m = (TSelection_mask&)f.mask();
TCursor_sheet_recno& c = m.cur_sheet(); TCursor_sheet& c = m.cur_sheet();
c.disable_check(); c.disable_check();
if (c.run() == K_ENTER) if (c.run() == K_ENTER)
@ -251,7 +196,7 @@ bool TSelection_mask::bto_handler(TMask_field& f, KEY k)
if (k == K_SPACE) if (k == K_SPACE)
{ {
TSelection_mask& m = (TSelection_mask&)f.mask(); TSelection_mask& m = (TSelection_mask&)f.mask();
TCursor_sheet_recno& c = m.cur_sheet(); TCursor_sheet& c = m.cur_sheet();
c.disable_check(); c.disable_check();
if (c.run() == K_ENTER) if (c.run() == K_ENTER)
{ {
@ -319,7 +264,7 @@ bool TSelection_mask::bselect_handler(TMask_field& f, KEY k)
if (k == K_SPACE) if (k == K_SPACE)
{ {
TSelection_mask& m = (TSelection_mask&)f.mask(); TSelection_mask& m = (TSelection_mask&)f.mask();
TCursor_sheet_recno& c = m.cur_sheet(); TCursor_sheet& c = m.cur_sheet();
c.enable_check(); c.enable_check();
c.run(); c.run();
m.set_clifo_limits(); m.set_clifo_limits();

View File

@ -17,21 +17,6 @@
#include "scselmsk.h" #include "scselmsk.h"
#endif #endif
class TCursor_sheet_recno : public TCursor_sheet
{
TBit_array _recnos;
protected:
virtual bool on_key(KEY k);
public:
TCursor_sheet_recno(TCursor * cursor, const char* fields,
const char * title, const char * head, byte buttons = 0);
virtual ~TCursor_sheet_recno() {}
bool rec_checked(TRecnotype n) { return _recnos[n]; }
void rec_check(TRecnotype n, bool on = TRUE) ;
void rec_uncheck(TRecnotype n) { rec_check(n,FALSE); }
};
class TSelection_mask : public TMask class TSelection_mask : public TMask
{ {
TRelation* _clifo_rel; TRelation* _clifo_rel;
@ -40,10 +25,10 @@ class TSelection_mask : public TMask
TCursor* _for_cur_k1; TCursor* _for_cur_k1;
TCursor* _for_cur_k2; TCursor* _for_cur_k2;
TCursor_sheet_recno* _cli_sh_k1; TCursor_sheet* _cli_sh_k1;
TCursor_sheet_recno* _cli_sh_k2; TCursor_sheet* _cli_sh_k2;
TCursor_sheet_recno* _for_sh_k1; TCursor_sheet* _for_sh_k1;
TCursor_sheet_recno* _for_sh_k2; TCursor_sheet* _for_sh_k2;
char _who; char _who;
int _key; int _key;
@ -71,7 +56,7 @@ protected:
static bool rsortcf_handler(TMask_field& f, KEY k); static bool rsortcf_handler(TMask_field& f, KEY k);
public: public:
virtual TCursor_sheet_recno& cur_sheet(); virtual TCursor_sheet& cur_sheet();
char get_who() const { return _who; } char get_who() const { return _who; }
int get_key() const { return _key; } int get_key() const { return _key; }