Modifica 95/3

Modificato l' append delle righe per poterle inserire anche in mezzo ad uno sheet


git-svn-id: svn://10.65.10.50/trunk@1668 c028cbd2-c16b-5b4b-a496-9718f37d4682
This commit is contained in:
alex 1995-08-03 13:56:34 +00:00
parent f8f6d26de7
commit 0d179a37c6
2 changed files with 18 additions and 6 deletions

View File

@ -400,7 +400,9 @@ void TSpreadsheet::set_focus_cell(int riga, int colonna)
int TSpreadsheet::insert(int rec) int TSpreadsheet::insert(int rec)
{ {
if (items() >= 999 || !_active) if (items() >= 999 || !_active)
return -1; return -1;
if (rec < 0 && items() > 0 && !_owner->append() )
rec = _cur_rec + 1;
const int r = _str.insert(new TToken_string(80), rec); const int r = _str.insert(new TToken_string(80), rec);
const bool ok = notify(r, K_INS); const bool ok = notify(r, K_INS);
@ -411,10 +413,13 @@ int TSpreadsheet::insert(int rec)
return -1; return -1;
} }
_disabled.insert(NULL, r); _disabled.insert(NULL, r);
xi_insert_row(_list, INT_MAX); xi_insert_row(_list, INT_MAX);
xi_cell_request(_list); xi_cell_request(_list);
if (rec < 0) _cur_row = items() - 1;
else
_cur_row = rec;
return r; return r;
} }
@ -628,10 +633,14 @@ void TSpreadsheet::list_handler(XI_EVENT *xiev)
update_rec(_cur_rec); update_rec(_cur_rec);
_row_dirty = TRUE; _row_dirty = TRUE;
} else } else
if (k == K_DEL) if (k == K_DEL)
{
_row_dirty = _cell_dirty = FALSE; _row_dirty = _cell_dirty = FALSE;
if (_cur_rec >= items())
_cur_rec = items() - 1;
}
if (!cell_disabled(_cur_rec, _cur_col-1)) if (_cur_rec >= 0 && !cell_disabled(_cur_rec, _cur_col-1))
set_focus_cell(_cur_row, _cur_col); set_focus_cell(_cur_row, _cur_col);
_check_enabled = TRUE; _check_enabled = TRUE;
} }
@ -1224,7 +1233,7 @@ else
// Certified 100% // Certified 100%
TSheet_field::TSheet_field(TMask* m) TSheet_field::TSheet_field(TMask* m)
: TMask_field(m), _sheet(NULL) : TMask_field(m), _sheet(NULL), _append(TRUE)
{} {}
// Certified 100% // Certified 100%

View File

@ -14,6 +14,7 @@ class TSheet_field : public TMask_field
{ {
TSpreadsheet* _sheet; TSpreadsheet* _sheet;
TToken_string _head; TToken_string _head;
bool _append;
protected: protected:
virtual word class_id() const; virtual word class_id() const;
@ -50,6 +51,8 @@ public:
void enable_cell(int row, int column, bool on = TRUE); void enable_cell(int row, int column, bool on = TRUE);
void disable_cell(int row, int column) { enable_cell(row, column, FALSE); } void disable_cell(int row, int column) { enable_cell(row, column, FALSE); }
bool cell_disabled(int row, int column) const; bool cell_disabled(int row, int column) const;
void set_append(bool on = TRUE) { _append = on;}
bool append() const { return _append;}
TSheet_field(TMask* m); TSheet_field(TMask* m);
virtual ~TSheet_field(); virtual ~TSheet_field();