date.cpp Corretta add_month per mesi maggiori di 12
mask.cpp Corretto ritorno da Winhelp mov.h Aggiunto #ifdef iniziale msksheet.cpp Corretta colorazione righe rmov.h Aggiunto #ifdef iniziale rmoviva.h Aggiunto #ifdef iniziale relapp.cpp Aggiunto messaggio di avvertimento in cancellazione rapida git-svn-id: svn://10.65.10.50/trunk@4753 c028cbd2-c16b-5b4b-a496-9718f37d4682
This commit is contained in:
parent
105546cebf
commit
a2439c25b1
@ -372,24 +372,22 @@ long TDate::julian2date(long julian) const
|
||||
|
||||
int TDate::day() const
|
||||
{
|
||||
return (int) (_val % 100L);
|
||||
return int(_val % 100L);
|
||||
}
|
||||
|
||||
int TDate::month() const
|
||||
{
|
||||
return (int) ((_val % 10000L) / 100L);
|
||||
return int((_val % 10000L) / 100L);
|
||||
}
|
||||
|
||||
|
||||
int TDate::year() const
|
||||
|
||||
{
|
||||
return (int) (_val / 10000L);
|
||||
return int(_val / 10000L);
|
||||
}
|
||||
|
||||
|
||||
int TDate::week() const
|
||||
|
||||
{
|
||||
TDate y(*this);
|
||||
y.set_day(1);
|
||||
@ -399,12 +397,11 @@ int TDate::week() const
|
||||
|
||||
|
||||
void TDate::addmonth(int nmonth)
|
||||
|
||||
{
|
||||
const int wday = day();
|
||||
int wmonth = month() + nmonth, wyear = year();
|
||||
|
||||
if (wmonth > 12)
|
||||
int wyear = year();
|
||||
int wmonth = month() + nmonth;
|
||||
while (wmonth > 12)
|
||||
{
|
||||
wmonth -= 12;
|
||||
wyear++;
|
||||
@ -412,13 +409,11 @@ void TDate::addmonth(int nmonth)
|
||||
_val = makedata(wday, wmonth, wyear);
|
||||
}
|
||||
|
||||
|
||||
void TDate::addyear(int nyear)
|
||||
|
||||
{
|
||||
const int wday = day(), wmonth = month();
|
||||
int wyear = year() + nyear;
|
||||
|
||||
const int wday = day();
|
||||
const int wmonth = month();
|
||||
const int wyear = year() + nyear;
|
||||
_val = makedata(wday, wmonth, wyear);
|
||||
}
|
||||
|
||||
|
@ -747,7 +747,6 @@ bool TMask::on_key(
|
||||
|
||||
HWND hwnd = (HWND)xvt_vobj_get_attr(TASK_WIN, ATTR_NATIVE_WINDOW);
|
||||
WinHelp(hwnd, hlp, HELP_MULTIKEY, (DWORD)&mk);
|
||||
next_page(0);
|
||||
}
|
||||
#endif
|
||||
break;
|
||||
@ -1318,12 +1317,12 @@ void TMask::autosave(TRelation& r) const
|
||||
{
|
||||
// tenta di effettuare il save dei campi Edit hidden:
|
||||
// salva il nuovo valore solo se il precedente era blank
|
||||
TEditable_field& e = (TEditable_field&)f;
|
||||
if (e.field() != NULL) {
|
||||
TString str;
|
||||
str = l.field()->read(r);
|
||||
save = str.empty();
|
||||
}
|
||||
TEditable_field& e = (TEditable_field&)f;
|
||||
if (e.field() != NULL) {
|
||||
TString str;
|
||||
str = l.field()->read(r);
|
||||
save = str.empty();
|
||||
}
|
||||
}
|
||||
if (save)
|
||||
l.autosave(r);
|
||||
@ -1877,30 +1876,30 @@ void TMask::set_exchange(
|
||||
TTimed_box::TTimed_box(const char * header,const char * message,int seconds,short button_id,int x,int y)
|
||||
: TMask(header,1,x,y)
|
||||
{
|
||||
// costruisce una maschera run time
|
||||
add_memo(FIRST_FIELD, 0, "", 1, 0,-1,-3);
|
||||
set(FIRST_FIELD, message);
|
||||
|
||||
// setta il timer per l'evento
|
||||
_timer_delay=seconds *1000+1;
|
||||
_timer_id=XVT_TIMER_ERROR;
|
||||
_button_id=button_id;
|
||||
// costruisce una maschera run time
|
||||
add_memo(FIRST_FIELD, 0, "", 1, 0,-1,-3);
|
||||
set(FIRST_FIELD, message);
|
||||
|
||||
// setta il timer per l'evento
|
||||
_timer_delay=seconds *1000+1;
|
||||
_timer_id=XVT_TIMER_ERROR;
|
||||
_button_id=button_id;
|
||||
}
|
||||
|
||||
void TTimed_box::start_run()
|
||||
{
|
||||
if (_timer_id!=XVT_TIMER_ERROR)
|
||||
xvt_timer_destroy(_timer_id);
|
||||
_timer_id=xvt_timer_create(win(),_timer_delay);
|
||||
TMask::start_run();
|
||||
if (_timer_id!=XVT_TIMER_ERROR)
|
||||
xvt_timer_destroy(_timer_id);
|
||||
_timer_id=xvt_timer_create(win(),_timer_delay);
|
||||
TMask::start_run();
|
||||
}
|
||||
void TTimed_box::handler(WINDOW win, EVENT* ep)
|
||||
{
|
||||
if (ep->type == E_TIMER && ep->v.timer.id==_timer_id)
|
||||
{
|
||||
send_key(K_SPACE,DLG_OK);
|
||||
}
|
||||
TMask::handler(win, ep);
|
||||
if (ep->type == E_TIMER && ep->v.timer.id==_timer_id)
|
||||
{
|
||||
send_key(K_SPACE,DLG_OK);
|
||||
}
|
||||
TMask::handler(win, ep);
|
||||
}
|
||||
|
||||
TTimed_box::~TTimed_box()
|
||||
@ -1909,8 +1908,8 @@ TTimed_box::~TTimed_box()
|
||||
TTimed_breakbox::TTimed_breakbox(const char * message,int seconds,int x,int y)
|
||||
: TTimed_box("Richiesta di interruzione",message,seconds,DLG_OK,x,y)
|
||||
{
|
||||
add_button(DLG_CANCEL, 0, "Interrompi", -22, -1, 12, 2,"",0);
|
||||
add_button(DLG_OK, 0, "Riprova", -12, -1, 12, 2,"",0);
|
||||
add_button(DLG_CANCEL, 0, "Interrompi", -22, -1, 12, 2,"",0);
|
||||
add_button(DLG_OK, 0, "Riprova", -12, -1, 12, 2,"",0);
|
||||
}
|
||||
|
||||
TTimed_breakbox::~TTimed_breakbox()
|
||||
|
@ -1,5 +1,5 @@
|
||||
#ifndef _FLD_MOV_H
|
||||
#define _FLD_MOV_H
|
||||
#ifndef __MOV_H
|
||||
#define __MOV_H
|
||||
|
||||
#define MOV_ANNOES "ANNOES"
|
||||
#define MOV_ANNOIVA "ANNOIVA"
|
||||
|
@ -10,8 +10,11 @@ extern "C"
|
||||
#include <config.h>
|
||||
#include <controls.h>
|
||||
#include <msksheet.h>
|
||||
#include <recarray.h>
|
||||
#include <relation.h>
|
||||
#include <urldefid.h>
|
||||
#include <utility.h>
|
||||
|
||||
///////////////////////////////////////////////////////////
|
||||
// TSpreadsheet
|
||||
///////////////////////////////////////////////////////////
|
||||
@ -1700,9 +1703,13 @@ void TSpreadsheet::set_back_and_fore_color(COLOR back, COLOR fore, int row)
|
||||
{
|
||||
if (back != COLOR_INVALID || fore != COLOR_INVALID)
|
||||
{
|
||||
int first = 0;
|
||||
int last = items()-1;
|
||||
if (row > 0)
|
||||
int first, last;
|
||||
if (row < 0)
|
||||
{
|
||||
first = 0;
|
||||
last = items()-1;
|
||||
}
|
||||
else
|
||||
first = last = row;
|
||||
|
||||
const bool crea = back != NORMAL_BACK_COLOR || fore != NORMAL_COLOR;
|
||||
@ -1730,13 +1737,13 @@ void TSpreadsheet::get_back_and_fore_color(COLOR& back, COLOR& fore, int row)
|
||||
if (prop->_fore != NORMAL_COLOR)
|
||||
fore = prop->_fore;
|
||||
}
|
||||
/*
|
||||
/*
|
||||
else
|
||||
{
|
||||
back = NORMAL_BACK_COLOR;
|
||||
fore = NORMAL_COLOR;
|
||||
}
|
||||
*/
|
||||
}
|
||||
*/
|
||||
}
|
||||
|
||||
// @doc INTERNAL
|
||||
@ -2713,34 +2720,34 @@ TRectype * TSheet_field::putkey(const TRelation& r)
|
||||
// Certified: ...under debug..
|
||||
bool TSheet_field::autoload_line(int i,TRectype & rec)
|
||||
{
|
||||
TToken_string &row= this->row(i-1);
|
||||
|
||||
row = "";
|
||||
// riempie le colonne dello sheet i cui campi hanno attributo "FIELD"
|
||||
/*for (int f=FIRST_FIELD; f<=_last_column_id; f++) {
|
||||
TFieldref const *dbfield=sheet_mask().field(f).field();
|
||||
if (dbfield) {
|
||||
row.add(dbfield->read(rec),cid2index(f));
|
||||
}
|
||||
// completa l'operazione con le funzioni definite dall'utente
|
||||
} */
|
||||
TToken_string &row= this->row(i-1);
|
||||
|
||||
row = "";
|
||||
// riempie le colonne dello sheet i cui campi hanno attributo "FIELD"
|
||||
/*for (int f=FIRST_FIELD; f<=_last_column_id; f++) {
|
||||
TFieldref const *dbfield=sheet_mask().field(f).field();
|
||||
if (dbfield) {
|
||||
row.add(dbfield->read(rec),cid2index(f));
|
||||
}
|
||||
// completa l'operazione con le funzioni definite dall'utente
|
||||
} */
|
||||
for (int j = 0; j < sheet_mask().fields(); j++)
|
||||
{
|
||||
TMask_field& mf = sheet_mask().fld(j);
|
||||
const short id = mf.dlg();
|
||||
TFieldref const *dbfield=mf.field();
|
||||
if (dbfield) {
|
||||
if (id>=FIRST_FIELD && id<=_last_column_id) {
|
||||
row.add(dbfield->read(rec),cid2index(id));
|
||||
} else {
|
||||
mf.set(dbfield->read(rec));
|
||||
}
|
||||
}
|
||||
}
|
||||
// completa l'operazione con le funzioni definite dall'utente
|
||||
if (_userget)
|
||||
_userget(*this,i);
|
||||
check_row(i-1);
|
||||
TFieldref const *dbfield=mf.field();
|
||||
if (dbfield) {
|
||||
if (id>=FIRST_FIELD && id<=_last_column_id) {
|
||||
row.add(dbfield->read(rec),cid2index(id));
|
||||
} else {
|
||||
mf.set(dbfield->read(rec));
|
||||
}
|
||||
}
|
||||
}
|
||||
// completa l'operazione con le funzioni definite dall'utente
|
||||
if (_userget)
|
||||
_userget(*this,i);
|
||||
check_row(i-1);
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
@ -2751,18 +2758,18 @@ bool TSheet_field::autosave_line(int i,TRectype & rec)
|
||||
{
|
||||
TMask_field& mf = sheet_mask().fld(j);
|
||||
const short id = mf.dlg();
|
||||
TFieldref const *dbfield=mf.field();
|
||||
if (dbfield)
|
||||
{
|
||||
if (id>=FIRST_FIELD && id<=_last_column_id)
|
||||
dbfield->write(cell(i-1,cid2index(id)),rec);
|
||||
else
|
||||
dbfield->write(mf.get(), rec);
|
||||
}
|
||||
}
|
||||
// completa l'operazione con le funzioni definite dall'utente
|
||||
if (_userput)
|
||||
_userput(*this,i);
|
||||
TFieldref const *dbfield=mf.field();
|
||||
if (dbfield)
|
||||
{
|
||||
if (id>=FIRST_FIELD && id<=_last_column_id)
|
||||
dbfield->write(cell(i-1,cid2index(id)),rec);
|
||||
else
|
||||
dbfield->write(mf.get(), rec);
|
||||
}
|
||||
}
|
||||
// completa l'operazione con le funzioni definite dall'utente
|
||||
if (_userput)
|
||||
_userput(*this,i);
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
@ -2811,7 +2818,7 @@ bool TSheet_field::autosave(TRelation& rel)
|
||||
// trasferisce le linee dallo sheet al record array (ignorando righe vuote alla fine)
|
||||
int i= items();
|
||||
while (i >= 1 && row(i-1).empty_items())
|
||||
i--;
|
||||
i--;
|
||||
for (; i >= 1; i--)
|
||||
{
|
||||
TRectype &rec = _linee_rec->row(i, TRUE);
|
||||
|
@ -1,20 +1,21 @@
|
||||
#ifndef __MSKSHEET_H
|
||||
#define __MSKSHEET_H
|
||||
|
||||
#ifndef __ISAM_H
|
||||
class TLocalisamfile;
|
||||
class TRectype;
|
||||
#endif
|
||||
|
||||
#ifndef __MASK_H
|
||||
#include <mask.h>
|
||||
#endif
|
||||
|
||||
#ifndef __ISAM_H
|
||||
#include <isam.h>
|
||||
#endif
|
||||
|
||||
#ifndef __RECARRAY_H
|
||||
#include <recarray.h>
|
||||
class TRecord_array;
|
||||
#endif
|
||||
|
||||
#ifndef __RELATION_H
|
||||
#include <relation.h>
|
||||
class TRelation;
|
||||
#endif
|
||||
|
||||
#define FIRST_FIELD 101
|
||||
@ -55,15 +56,15 @@ class TSheet_field : public TLoadable_field
|
||||
// @cmember:(INTERNAL) Campi di input sulla maschera (key field ids)
|
||||
TToken_string _file_k_ids;
|
||||
// @cmember:(INTERNAL) file delle righe
|
||||
TLocalisamfile * _sheetfile;
|
||||
TLocalisamfile * _sheetfile;
|
||||
// @cmember:(INTERNAL) record array delle righe
|
||||
TRecord_array *_linee_rec;
|
||||
TRecord_array* _linee_rec;
|
||||
// @cmember:(INTERNAL) indicatore di record array gestito esternamente
|
||||
bool _external_record;
|
||||
bool _external_record;
|
||||
// @cmember:(INTERNAL) funzioni utente per get tra record (array) e array righe
|
||||
SHEET_USERGETPUT _userput;
|
||||
SHEET_USERGETPUT _userput;
|
||||
// @cmember:(INTERNAL) funzioni utente per put tra righe e record (array)
|
||||
SHEET_USERGETPUT _userget;
|
||||
SHEET_USERGETPUT _userget;
|
||||
|
||||
// @access Protected Member
|
||||
protected:
|
||||
@ -83,8 +84,8 @@ protected:
|
||||
// @cmember Legge gli item dello spreadsheet da <p scanner>
|
||||
virtual bool parse_item(TScanner& scanner);
|
||||
// @cmember Legge gli input (campi chiave) dello spreadsheet da <p scanner>
|
||||
void parse_input(TScanner& scanner);
|
||||
// @cmember Crea lo spreadsheet
|
||||
void parse_input(TScanner& scanner);
|
||||
// @cmember Crea lo spreadsheet
|
||||
virtual void create(WINDOW parent);
|
||||
|
||||
// @cmember Setta il focus sul campo
|
||||
@ -103,29 +104,29 @@ public:
|
||||
|
||||
virtual bool is_sheet() const { return TRUE; }
|
||||
|
||||
// @cmember Legge automaticamente la linea dal record array assegnato
|
||||
// @cmember Legge automaticamente la linea dal record array assegnato
|
||||
virtual bool autoload_line(int i,TRectype & rec);
|
||||
// @cmember Salva automaticamente la linea nel record array assegnato
|
||||
// @cmember Salva automaticamente la linea nel record array assegnato
|
||||
virtual bool autosave_line(int i,TRectype & rec);
|
||||
|
||||
// @cmember Legge automaticamente lo sheet dal record array assegnato
|
||||
// @cmember Legge automaticamente lo sheet dal record array assegnato
|
||||
virtual bool autoload(const TRelation& r);
|
||||
// @cmember Salva automaticamente lo sheet nel record array assegnato
|
||||
virtual bool autosave(TRelation& r) ;
|
||||
// @cmember setta la funzione utente che Legge i campi dello sheet
|
||||
void set_userget(SHEET_USERGETPUT handler);
|
||||
// @cmember setta la funzione utente che scrive i campi dello sheet
|
||||
void set_userput(SHEET_USERGETPUT handler);
|
||||
// @cmember carica le chiavi del record array dello sheet
|
||||
TRectype * putkey(const TRelation& r);
|
||||
// @cmember restituisce il record array assegnato allo sheet
|
||||
TRecord_array * record() const {return _linee_rec;}
|
||||
// @cmember Salva automaticamente lo sheet nel record array assegnato
|
||||
virtual bool autosave(TRelation& r) ;
|
||||
// @cmember setta la funzione utente che Legge i campi dello sheet
|
||||
void set_userget(SHEET_USERGETPUT handler);
|
||||
// @cmember setta la funzione utente che scrive i campi dello sheet
|
||||
void set_userput(SHEET_USERGETPUT handler);
|
||||
// @cmember carica le chiavi del record array dello sheet
|
||||
TRectype * putkey(const TRelation& r);
|
||||
// @cmember restituisce il record array assegnato allo sheet
|
||||
TRecord_array * record() const {return _linee_rec;}
|
||||
// @cmember Imposta un record array esterno che contiene le righe dello sheet
|
||||
void set_lines_record(TRecord_array &);
|
||||
// @cmember Ritorna se il record assegnato è gestito esternamente (read/write/remove)
|
||||
bool external_record() const {return _external_record;}
|
||||
// @cmember Ritorna se il record assegnato è gestito esternamente (read/write/remove)
|
||||
bool external_record() const {return _external_record;}
|
||||
|
||||
// @cmember Ritorna una riga dello spreadsheet
|
||||
// @cmember Ritorna una riga dello spreadsheet
|
||||
TToken_string& row(int n);
|
||||
// @cmember Ritorna un array con tutte le righe dello spreadsheet
|
||||
TString_array& rows_array() const;
|
||||
|
@ -1,3 +1,6 @@
|
||||
#ifndef __PAGSCA_H
|
||||
#define __PAGSCA_H
|
||||
|
||||
#define PAGSCA_ANNO "ANNO"
|
||||
#define PAGSCA_NRIGA "NRIGA"
|
||||
#define PAGSCA_NRATA "NRATA"
|
||||
@ -28,3 +31,4 @@
|
||||
#define PAGSCA_CONTOC "CONTOC"
|
||||
#define PAGSCA_SOTTOCONTC "SOTTOCONTC"
|
||||
|
||||
#endif
|
||||
|
@ -3,6 +3,7 @@
|
||||
#include <sheet.h>
|
||||
#include <msksheet.h>
|
||||
#include <urldefid.h>
|
||||
#include <recarray.h>
|
||||
#include <relapp.h>
|
||||
#include <utility.h>
|
||||
|
||||
@ -465,6 +466,7 @@ int TRelation_application::delete_mode()
|
||||
if (yesno_box(msg))
|
||||
{
|
||||
TWait_cursor hourglass;
|
||||
long skipped = 0; // Record non cancellati perche' protetti
|
||||
cur->freeze(TRUE); // Congelo il cursore altrimenti si riaggiorna troppo
|
||||
for (long pos = 0; deleting > 0; pos++)
|
||||
{
|
||||
@ -475,17 +477,20 @@ int TRelation_application::delete_mode()
|
||||
if (find(1) && modify_mode())
|
||||
{
|
||||
_autodelete = 0x3;
|
||||
if (protected_record(get_relation()->curr()))
|
||||
warning_box("Documento non eliminabile");
|
||||
else
|
||||
remove();
|
||||
bool can_delete = !protected_record(get_relation()->curr());
|
||||
_autodelete = FALSE;
|
||||
if (can_delete)
|
||||
remove();
|
||||
else
|
||||
skipped++;
|
||||
query_mode();
|
||||
}
|
||||
deleting--;
|
||||
}
|
||||
}
|
||||
cur->freeze(FALSE);
|
||||
if (skipped > 0)
|
||||
warning_box("%ld documenti non sono stati cancellati in quanto protetti.");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -1,5 +1,5 @@
|
||||
#ifndef _FLD_RMOV_H
|
||||
#define _FLD_RMOV_H
|
||||
#ifndef __RMOV_H
|
||||
#define __RMOV_H
|
||||
|
||||
#define RMV_ANNOES "ANNOES"
|
||||
#define RMV_NUMREG "NUMREG"
|
||||
|
@ -1,5 +1,5 @@
|
||||
#ifndef _FLD_RMOVIVA_H
|
||||
#define _FLD_RMOVIVA_H
|
||||
#ifndef __RMOVIVA_H
|
||||
#define __RMOVIVA_H
|
||||
|
||||
#define RMI_ANNOES "ANNOES"
|
||||
#define RMI_NUMREG "NUMREG"
|
||||
|
Loading…
x
Reference in New Issue
Block a user