From 12c12c6318bb2b6f971c01a4e9dafd3ba6ba16c0 Mon Sep 17 00:00:00 2001 From: guy Date: Thu, 12 Oct 1995 15:04:26 +0000 Subject: [PATCH] date.cpp Corretta differenza tra due date date.h Segato operatore di conversione a long msksheet.cpp Modificata sheet_mask e corretta gestione XIE_SELECT git-svn-id: svn://10.65.10.50/trunk@1943 c028cbd2-c16b-5b4b-a496-9718f37d4682 --- include/date.cpp | 9 +++++++++ include/date.h | 9 +-------- include/msksheet.cpp | 10 ++++++---- 3 files changed, 16 insertions(+), 12 deletions(-) diff --git a/include/date.cpp b/include/date.cpp index 7dc52eae8..0950f6801 100755 --- a/include/date.cpp +++ b/include/date.cpp @@ -482,6 +482,15 @@ TDate& operator -( return __tmp_date; } +// @func TDate& | operator - | Calcola la differenza tra due date +long operator -( + const TDate& a, // @parm Data da decrementare + const TDate& b) // @parm Data da sottrarre +{ + const long diff = a.date2julian() - b.date2julian(); + return diff; +} + // @func Scambia la data

con la data

void swap( TDate& a, // @parm Prima data da scambiare diff --git a/include/date.h b/include/date.h index 4c8e20523..95640365d 100755 --- a/include/date.h +++ b/include/date.h @@ -119,14 +119,6 @@ public: // @cmember Legge dall'input passato la data void read_from(istream& in) ; - // @cmember Ritorna la data in valore numerico - operator long() const - { return _val; } - - // @cmember Ritorna l'indirizzo della data in valore numerico - operator long*() - { return &_val;} - // @cmember void | operator const char*() const | | Ritorna la data in formato stringa (chiama ) operator const char*() const ; // @cmember Assegna la data passata come stringa @@ -186,6 +178,7 @@ public: TDate& operator +(const TDate& a, long nday) ; TDate& operator +(const long nday, const TDate& b) ; TDate& operator -(const TDate& a, long nday) ; +long operator -(const TDate& a, const TDate& b) ; // @func inline bool | operator | Controlla se una data e' minore di un'altra // diff --git a/include/msksheet.cpp b/include/msksheet.cpp index 5c2594e4c..cfcc92dab 100755 --- a/include/msksheet.cpp +++ b/include/msksheet.cpp @@ -437,9 +437,11 @@ TSpreadsheet::~TSpreadsheet() } TMask& TSpreadsheet::sheet_mask() const -{ +{ TMask& m = ((TSpreadsheet*)this)->_mask; - return (_getmask != NULL) ? *_getmask((int)_cur_rec, m, FALSE ) : m; + if (_getmask != NULL && _cur_rec >= 0 && _cur_rec < items()) + return *_getmask((int)_cur_rec, m, FALSE); + return m; } @@ -802,7 +804,7 @@ void TSpreadsheet::list_handler(XI_EVENT *xiev) { _check_enabled = FALSE; - if (_edit_field != NULL && _cell_dirty) + if (_cell_dirty) { XI_OBJ cell; XI_MAKE_CELL(&cell, _list, _cur_row, _cur_col); @@ -814,7 +816,6 @@ void TSpreadsheet::list_handler(XI_EVENT *xiev) if (oldrec != _cur_rec) { _row_dirty = FALSE; - str2mask(_cur_rec); update(_cur_rec); // Forces update delayed by str2mask } @@ -823,6 +824,7 @@ void TSpreadsheet::list_handler(XI_EVENT *xiev) TMask_field& button = sheet_mask().field(FIRST_FIELD-1); if (button.active()) { + str2mask(_cur_rec); button.on_hit(); if (sheet_mask().dirty()) {