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_INDRF "INDRF"
#define ANA_CIVRF "CIVRF"
#define ANA_CAPRF "CAPRF"
#endif

View File

@ -1,3 +1,4 @@
#include <time.h>
#include <stdio.h>
#include <applicat.h>
@ -203,6 +204,10 @@ void TMask::read_mask(const char* name, int num, int max)
_sheetmask = num > 0;
long start_t = clock();
if (!_sheetmask)
_total_time = _build_time = _skip_time = 0;
for (int i = 0; i < num; i++)
{
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);
add_buttons();
if (!_sheetmask)
_total_time = clock()-start_t;
}
@ -421,6 +429,8 @@ bool TMask::page_enabled(byte page) const
void TMask::start_run()
{
const long start = clock();
load_checks();
const int max = fields();
@ -450,6 +460,8 @@ void TMask::start_run()
f.set_dirty(FALSE);
}
}
_skip_time = clock()-start;
}
bool TMask::check_fields()
@ -751,6 +763,12 @@ bool TMask::on_key(KEY key)
break;
case K_NEXT:
next_page(+1);
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:
if (key > K_CTRL)
@ -848,7 +866,8 @@ WINDOW TMask::read_page(TScanner& scanner, bool toolbar)
}
while (scanner.popkey() != "EN")
{
{
TMask_field* f = parse_field(scanner);
#ifdef DBG
if (f == NULL)
@ -859,10 +878,15 @@ WINDOW TMask::read_page(TScanner& scanner, bool toolbar)
fatal_box(e);
}
#endif
const long start = clock();
f->construct(scanner, w);
_field.add(f);
_build_time += clock()-start;
}
set_win(NULL_WIN);
return w;
}

View File

@ -51,6 +51,8 @@ class TMask : public TWindow
real _exchange; // Current value exhange
bool _sheetmask; // Mask owned by a sheet
long _total_time, _build_time, _skip_time;
protected:
// Ritorna la finestra della pagina corrente (Usare con attenzione)

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 <applicat.h>
@ -490,7 +490,7 @@ void TMask_field::undo()
bool TMask_field::autoload(const TRelation* r)
{
if (_field)
{
{
set(_field->read(r));
return TRUE;
}
@ -724,9 +724,9 @@ bool TMask_field::do_message(int num)
bool TMask_field::test_focus_change()
{
bool ok = TRUE;
if (focusdirty())
ok = on_key(K_TAB);
bool ok = TRUE;
if (focusdirty()) on_key(K_TAB);
else if (is_edit() && get().not_empty()) on_hit();
return ok;
}
@ -2548,12 +2548,30 @@ void TReal_field::create(WINDOW w)
TEdit_field::create(w);
if (_flags.firm)
set(::format("%ld", main_app().get_firm())); else
if (automagic())
{
TDate d(TODAY);
set(::format("%d", d.year()));
}
set(::format("%ld", main_app().get_firm()));
else
if (automagic())
{
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)

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
#define __MASKFLD_H
@ -171,7 +171,7 @@ public:
virtual const char* picture_data(const char* data, bool video);
virtual const char * warning() { return "";}
bool autoload(const TRelation* r = NULL);
virtual bool autoload(const TRelation* r = NULL);
bool autosave(TRelation* r = NULL) const;
void undo();
@ -384,9 +384,11 @@ protected:
virtual void create(WINDOW parent);
virtual void parse_head(TScanner& scanner);
virtual bool on_key(KEY key);
virtual bool autoload(const TRelation* r);
public:
// @FPUB
void set_decimals(int d); // Set precision & picture
int decimals() const { return _decimals; } // Get precision

View File

@ -298,13 +298,13 @@ int TSpreadsheet::row2rec(int row)
int rows;
const long* rec = xi_get_list_info(_list, &rows);
#ifdef DBG
if (row < 0 || row >= rows)
{
error_box("Line %d is not visible", row);
return 0L;
}
#ifdef DBG
error_box("Line %d is not visible: the last one is %d", row, rows);
#endif
return 0;
}
return (int)rec[row];
}
@ -365,7 +365,8 @@ void TSpreadsheet::update_rec(int rec)
void TSpreadsheet::set_focus_cell(int riga, int colonna)
{
set_front_window(win()); // It seems necessary
const int r = rec2row(riga);
const int r = row2rec(riga);
for (; colonna < _columns; colonna++)
if (!cell_disabled(r, colonna-1))
@ -375,8 +376,17 @@ void TSpreadsheet::set_focus_cell(int riga, int colonna)
{
XI_OBJ cell;
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 <sheet.h>
#include <urldefid.h>
@ -596,11 +596,8 @@ bool TRelation_application::save(bool check_dirty)
{
if (annulla)
{
const char* pr = _mask->field(dirty).prompt();
TString256 e("Il campo ");
if (isalnum(*pr)) e << pr; else e << dirty;
e << " e' errato:\nAnnullare " << ms;
k = yesno_box(e) ? K_NO : K_ESC;
k = yesno_box("Campo inconsistente: annullare?") ? K_NO : K_ESC;
if (k == K_NO) _mask->first_focus(-_mask->field(dirty).dlg());
}
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
// fv 12/8/93
// 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
TRelation(int logicnum, bool linkrecinst = TRUE);
TRelation(int logicnum, bool linkrecinst = FALSE);
TRelation(const char* tabname, bool linkrecinst = FALSE);
virtual ~TRelation();
};

View File

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