Corretta highlight degli sheet

Il file base delle relazioni non linka piu' la recinst per default!
Aggiunti timer al caricamento delle maschere


git-svn-id: svn://10.65.10.50/trunk@913 c028cbd2-c16b-5b4b-a496-9718f37d4682
This commit is contained in:
guy 1995-01-26 13:57:53 +00:00
parent ff2c0e1ec0
commit 83f1dc7076
9 changed files with 86 additions and 32 deletions

View File

@ -14,6 +14,7 @@
#define ANA_CAPRES "CAPRES" #define ANA_CAPRES "CAPRES"
#define ANA_INDRF "INDRF" #define ANA_INDRF "INDRF"
#define ANA_CIVRF "CIVRF" #define ANA_CIVRF "CIVRF"
#define ANA_CAPRF "CAPRF"
#endif #endif

View File

@ -1,3 +1,4 @@
#include <time.h>
#include <stdio.h> #include <stdio.h>
#include <applicat.h> #include <applicat.h>
@ -203,6 +204,10 @@ void TMask::read_mask(const char* name, int num, int max)
_sheetmask = num > 0; _sheetmask = num > 0;
long start_t = clock();
if (!_sheetmask)
_total_time = _build_time = _skip_time = 0;
for (int i = 0; i < num; i++) for (int i = 0; i < num; i++)
{ {
while (scanner.ok()) while (scanner.ok())
@ -233,6 +238,9 @@ void TMask::read_mask(const char* name, int num, int max)
fatal_box("Impossibile leggere la maschera %s", name); fatal_box("Impossibile leggere la maschera %s", name);
add_buttons(); add_buttons();
if (!_sheetmask)
_total_time = clock()-start_t;
} }
@ -421,6 +429,8 @@ bool TMask::page_enabled(byte page) const
void TMask::start_run() void TMask::start_run()
{ {
const long start = clock();
load_checks(); load_checks();
const int max = fields(); const int max = fields();
@ -450,6 +460,8 @@ void TMask::start_run()
f.set_dirty(FALSE); f.set_dirty(FALSE);
} }
} }
_skip_time = clock()-start;
} }
bool TMask::check_fields() bool TMask::check_fields()
@ -752,6 +764,12 @@ bool TMask::on_key(KEY key)
case K_NEXT: case K_NEXT:
next_page(+1); next_page(+1);
break; break;
case K_F12:
message_box("Carissimo cronometrista, eccoti i tempi:\n"
"lettura + creazione = totale : init\n"
"%ld + %ld + %ld = %ld : %ld",
_total_time-_build_time, _build_time, _total_time, _skip_time);
break;
default: default:
if (key > K_CTRL) if (key > K_CTRL)
{ {
@ -849,6 +867,7 @@ WINDOW TMask::read_page(TScanner& scanner, bool toolbar)
while (scanner.popkey() != "EN") while (scanner.popkey() != "EN")
{ {
TMask_field* f = parse_field(scanner); TMask_field* f = parse_field(scanner);
#ifdef DBG #ifdef DBG
if (f == NULL) if (f == NULL)
@ -859,8 +878,13 @@ WINDOW TMask::read_page(TScanner& scanner, bool toolbar)
fatal_box(e); fatal_box(e);
} }
#endif #endif
const long start = clock();
f->construct(scanner, w); f->construct(scanner, w);
_field.add(f); _field.add(f);
_build_time += clock()-start;
} }
set_win(NULL_WIN); set_win(NULL_WIN);

View File

@ -52,6 +52,8 @@ class TMask : public TWindow
real _exchange; // Current value exhange real _exchange; // Current value exhange
bool _sheetmask; // Mask owned by a sheet bool _sheetmask; // Mask owned by a sheet
long _total_time, _build_time, _skip_time;
protected: protected:
// Ritorna la finestra della pagina corrente (Usare con attenzione) // Ritorna la finestra della pagina corrente (Usare con attenzione)
WINDOW win() const { return _page == -1 ? NULL_WIN : _pagewin[_page]; } WINDOW win() const { return _page == -1 ? NULL_WIN : _pagewin[_page]; }

View File

@ -1,4 +1,4 @@
// $Id: maskfld.cpp,v 1.71 1995-01-24 08:52:30 guy Exp $ // $Id: maskfld.cpp,v 1.72 1995-01-26 13:57:35 guy Exp $
#include <xvt.h> #include <xvt.h>
#include <applicat.h> #include <applicat.h>
@ -725,8 +725,8 @@ bool TMask_field::do_message(int num)
bool TMask_field::test_focus_change() bool TMask_field::test_focus_change()
{ {
bool ok = TRUE; bool ok = TRUE;
if (focusdirty()) if (focusdirty()) on_key(K_TAB);
ok = on_key(K_TAB); else if (is_edit() && get().not_empty()) on_hit();
return ok; return ok;
} }
@ -2548,12 +2548,30 @@ void TReal_field::create(WINDOW w)
TEdit_field::create(w); TEdit_field::create(w);
if (_flags.firm) if (_flags.firm)
set(::format("%ld", main_app().get_firm())); else set(::format("%ld", main_app().get_firm()));
if (automagic()) else
{ if (automagic())
TDate d(TODAY); {
set(::format("%d", d.year())); TDate d(TODAY);
} set(::format("%d", d.year()));
}
}
bool TReal_field::autoload(const TRelation* r)
{
const bool ok = TMask_field::autoload(r);
if (ok && _flags.zerofilled && _str.not_empty())
{
int s = size();
if (roman())
{
s = decimals();
if (s < 1) s = 4;
}
_str.right_just(s, '0');
}
return ok;
} }
bool TReal_field::on_key(KEY key) bool TReal_field::on_key(KEY key)

View File

@ -1,4 +1,4 @@
/* $Id: maskfld.h,v 1.20 1995-01-16 15:10:36 guy Exp $ */ /* $Id: maskfld.h,v 1.21 1995-01-26 13:57:41 guy Exp $ */
#ifndef __MASKFLD_H #ifndef __MASKFLD_H
#define __MASKFLD_H #define __MASKFLD_H
@ -171,7 +171,7 @@ public:
virtual const char* picture_data(const char* data, bool video); virtual const char* picture_data(const char* data, bool video);
virtual const char * warning() { return "";} virtual const char * warning() { return "";}
bool autoload(const TRelation* r = NULL); virtual bool autoload(const TRelation* r = NULL);
bool autosave(TRelation* r = NULL) const; bool autosave(TRelation* r = NULL) const;
void undo(); void undo();
@ -384,9 +384,11 @@ protected:
virtual void create(WINDOW parent); virtual void create(WINDOW parent);
virtual void parse_head(TScanner& scanner); virtual void parse_head(TScanner& scanner);
virtual bool on_key(KEY key); virtual bool on_key(KEY key);
virtual bool autoload(const TRelation* r);
public: public:
// @FPUB // @FPUB
void set_decimals(int d); // Set precision & picture void set_decimals(int d); // Set precision & picture
int decimals() const { return _decimals; } // Get precision int decimals() const { return _decimals; } // Get precision

View File

@ -298,13 +298,13 @@ int TSpreadsheet::row2rec(int row)
int rows; int rows;
const long* rec = xi_get_list_info(_list, &rows); const long* rec = xi_get_list_info(_list, &rows);
#ifdef DBG
if (row < 0 || row >= rows) if (row < 0 || row >= rows)
{ {
error_box("Line %d is not visible", row); #ifdef DBG
return 0L; error_box("Line %d is not visible: the last one is %d", row, rows);
}
#endif #endif
return 0;
}
return (int)rec[row]; return (int)rec[row];
} }
@ -365,7 +365,8 @@ void TSpreadsheet::update_rec(int rec)
void TSpreadsheet::set_focus_cell(int riga, int colonna) void TSpreadsheet::set_focus_cell(int riga, int colonna)
{ {
set_front_window(win()); // It seems necessary set_front_window(win()); // It seems necessary
const int r = rec2row(riga);
const int r = row2rec(riga);
for (; colonna < _columns; colonna++) for (; colonna < _columns; colonna++)
if (!cell_disabled(r, colonna-1)) if (!cell_disabled(r, colonna-1))
@ -376,6 +377,15 @@ void TSpreadsheet::set_focus_cell(int riga, int colonna)
XI_OBJ cell; XI_OBJ cell;
XI_MAKE_CELL(&cell, _list, r, colonna); XI_MAKE_CELL(&cell, _list, r, colonna);
xi_set_focus(&cell); xi_set_focus(&cell);
if (!_edit_field)
{
_cur_row = riga;
_cur_col = colonna;
_cur_rec = r;
_edit_field = col2field(colonna);
_row_dirty = FALSE;
}
} }
} }

View File

@ -1,4 +1,4 @@
// $Id: relapp.cpp,v 1.46 1995-01-24 08:52:43 guy Exp $ // $Id: relapp.cpp,v 1.47 1995-01-26 13:57:48 guy Exp $
#include <mailbox.h> #include <mailbox.h>
#include <sheet.h> #include <sheet.h>
#include <urldefid.h> #include <urldefid.h>
@ -596,11 +596,8 @@ bool TRelation_application::save(bool check_dirty)
{ {
if (annulla) if (annulla)
{ {
const char* pr = _mask->field(dirty).prompt(); k = yesno_box("Campo inconsistente: annullare?") ? K_NO : K_ESC;
TString256 e("Il campo "); if (k == K_NO) _mask->first_focus(-_mask->field(dirty).dlg());
if (isalnum(*pr)) e << pr; else e << dirty;
e << " e' errato:\nAnnullare " << ms;
k = yesno_box(e) ? K_NO : K_ESC;
} }
else k = K_ESC; else k = K_ESC;
} }

View File

@ -1,4 +1,4 @@
/* $Id: relation.h,v 1.10 1995-01-09 16:51:20 guy Exp $ */ /* $Id: relation.h,v 1.11 1995-01-26 13:57:51 guy Exp $ */
// join.h // join.h
// fv 12/8/93 // fv 12/8/93
// join class for isam files // join class for isam files
@ -131,7 +131,7 @@ public:
void print_on(TArray& a) const; // Mette la descrizione in un array di TToken_string void print_on(TArray& a) const; // Mette la descrizione in un array di TToken_string
TRelation(int logicnum, bool linkrecinst = TRUE); TRelation(int logicnum, bool linkrecinst = FALSE);
TRelation(const char* tabname, bool linkrecinst = FALSE); TRelation(const char* tabname, bool linkrecinst = FALSE);
virtual ~TRelation(); virtual ~TRelation();
}; };

View File

@ -859,8 +859,8 @@ void xvt_statbar_set(const char* text, bool def)
{ {
#if XVT_OS == XVT_OS_WIN #if XVT_OS == XVT_OS_WIN
const TDate oggi(TODAY); const TDate oggi(TODAY);
TString t(80); TString256 t(text);
t << text << '\t' << oggi.string() << " - " << main_app().title(); t << '\t' << oggi.string() << " - " << main_app().title();
if (def) if (def)
statbar_set_default_title(statbar, (char*)(const char*)t); statbar_set_default_title(statbar, (char*)(const char*)t);
statbar_set_title(statbar, (char*)(const char*)t); statbar_set_title(statbar, (char*)(const char*)t);