Corretti filtri dei cursori e Trecord_array

Aggiunto STRICT prima di include windows.h
Corretta distruzione della TPrinter
Corretta traduzione in lettere dei numeri reali
Corretta visualizazzione immagini in anteprima di stampa
Cambiati i nomi die campi relativi al conto nelle partite e nelle scadenze


git-svn-id: svn://10.65.10.50/trunk@1282 c028cbd2-c16b-5b4b-a496-9718f37d4682
This commit is contained in:
guy 1995-04-20 14:35:14 +00:00
parent d0483278e1
commit f9397998d5
24 changed files with 431 additions and 284 deletions

View File

@ -3,6 +3,7 @@
#include <xvt.h>
#if XVT_OS == XVT_OS_WIN
#define STRICT
#include <windows.h>
#endif
@ -14,6 +15,7 @@
#include <config.h>
#include <mask.h>
#include <prefix.h>
#include <printer.h>
#include <progind.h>
#include <relation.h>
#include <urldefid.h>
@ -256,7 +258,7 @@ bool TApplication::remove_menu(MENU_TAG id)
}
TApplication::TApplication() : _printer(NULL), _savefirm(0), _create_ok(FALSE)
TApplication::TApplication() : _savefirm(0), _create_ok(FALSE)
, _bar(TASK_MENUBAR)
{}
@ -264,23 +266,6 @@ TApplication::TApplication() : _printer(NULL), _savefirm(0), _create_ok(FALSE)
TApplication::~TApplication()
{}
TPrinter* TApplication::set_printer(TPrinter* p)
{
TPrinter* printer = _printer;
_printer = p;
return printer;
}
TPrinter& TApplication::printer()
{
if (_printer == NULL)
_printer = new TPrinter;
return *_printer;
}
bool TApplication::create()
{
return TRUE;
@ -303,7 +288,7 @@ void TApplication::terminate()
#if XVT_OS == XVT_OS_WIN
const word WM_WAKEUP = RegisterWindowMessage("WAKEUP");
const HTASK ht = GetCurrentTask();
SendMessage(HWND_BROADCAST, WM_WAKEUP, ht, 0L);
SendMessage(HWND_BROADCAST, WM_WAKEUP, (unsigned int)ht, 0L);
if (fexist("prassi.hlp"))
{
@ -311,19 +296,13 @@ void TApplication::terminate()
WinHelp(hwnd, "prassi.hlp", HELP_QUIT, 0L);
}
#endif
if (_printer != NULL) // Distruzione dell'eventuale stampante
{
if (_printer->isopen())
_printer->close();
delete _printer;
_printer = NULL;
}
}
do_events();
if (use_files())
free_global_vars(); // Distruzione variabili globali
printer_destroy();
customize_controls(FALSE); // Rilascio eventuali DLL
}

View File

@ -5,8 +5,8 @@
#include <xvt.h>
#endif
#ifndef __PRINTER_H
#include <printer.h>
#ifndef __STRINGS_H
#include <strings.h>
#endif
// @C
@ -30,7 +30,6 @@ class TApplication
TBit_array _user_aut;
TString80 _name, _title;
TPrinter* _printer;
long _savefirm;
bool _create_ok; // Succesfully created
@ -87,9 +86,6 @@ public:
void set_title(const char* t) { _title = t; }
const TString& title() const { return _title; }
TPrinter* set_printer(TPrinter* p);
TPrinter& printer();
static void check_parameters(int & argc, char *argv[]);
bool has_module(int module, int checktype = CHK_ALL) const;

View File

@ -127,18 +127,16 @@ Se si utilizza spiegarne dettagliatamente il motivo.
int lockmode; /* tipo di lock effettuato sul record */
int dirflg; /* flag per file comuni */
{
do
{
CRead(&fdir[dirflg],(RecType) filed,(long) logicname, lockmode);
{
do
{
CRead(&fdir[dirflg],(RecType) filed,(long) logicname, lockmode);
if (TESTLOCK(fdir[dirflg].IOR))
message_box("Sono in attesa della directory n.ro %d", logicname);
}
while TESTLOCK(fdir[dirflg].IOR) ;
strcpy(filed->SysName, CAddPref(filed->SysName)) ;
} ;
if (TESTLOCK(fdir[dirflg].IOR))
message_box("Sono in attesa della directory n.ro %d", logicname);
} while TESTLOCK(fdir[dirflg].IOR) ;
strcpy(filed->SysName, CAddPref(filed->SysName)) ;
}
/*
@(#) CCloseFile FILES
@ -1533,29 +1531,29 @@ Se si utilizza spiegarne dettagliatamente il motivo.
@(FN)
*/
char *CAddPref(name)
char *name; /* nome file */
char *CAddPref(name)
char *name; /* nome file */
{
static PathSt s;
if (*name == '$')
{
name++;
return(CInsPref(name, NORDIR)) ;
}
else
if (*name == '%')
{
static PathSt s;
if (*name == '$')
{
name++;
return(CInsPref(name, NORDIR)) ;
}
else
if (*name == '%')
{
name++;
return(CInsPref(name, COMDIR)) ;
}
else
{
strcpy(s, name);
return(s);
}
name++;
return(CInsPref(name, COMDIR)) ;
}
else
{
sprintf(s, "%s%s", __ptprf, name);
return(s);
}
}
/*
@($) CInsPref FILES

View File

@ -8,6 +8,7 @@
#endif
#if XVT_OS == XVT_OS_WIN
#define STRICT
#include <windows.h>
#include <keys.h>
#else

View File

@ -3,9 +3,10 @@
#include <applicat.h>
#include <config.h>
#include <date.h>
#include <scanner.h>
#include <prefix.h>
#include <utility.h>
#include <scanner.h>
extern "C"
{

View File

@ -14,6 +14,7 @@ extern "C"
#include <utility.h>
#include <window.h>
#define STRICT
#include <windows.h>
///////////////////////////////////////////////////////////

View File

@ -9,6 +9,7 @@
#endif
#if XVT_OS == XVT_OS_WIN
#define STRICT
#include <windows.h>
#include <toolhelp.h>
#endif
@ -16,6 +17,7 @@
#include <applicat.h>
#include <execp.h>
#include <prefix.h>
#include <window.h>
bool TExternal_app::can_run() const
{
@ -67,7 +69,7 @@ int TExternal_app::run(bool async, bool utente)
if (te.hInst == (HINSTANCE)_exitcode) child = te.hTask;
CHECK(child, "Can't find child task");
main_app().wait_for(child);
main_app().wait_for((word)child);
for (byte i = 0; main_app().waiting(); i++)
{
if (i == 0 && TaskFindHandle(&te, child) == FALSE)

View File

@ -4,6 +4,7 @@
#include <applicat.h>
#include <form.h>
#include <msksheet.h>
#include <printer.h>
#include <relation.h>
#include <sheet.h>
#include <utility.h>
@ -667,7 +668,7 @@ bool TForm_date::read()
{
bool ok = TForm_string::read();
if (ok && !get()[0] && automagic())
set(main_app().printer().getdate());
set(printer().getdate());
return ok;
}
@ -1122,7 +1123,7 @@ bool TGraphic_section::update()
{
_back.cut(0);
const bool ok = TPrint_section::update();
main_app().printer().setbackground(_back);
printer().setbackground(_back);
return ok;
}
@ -1244,7 +1245,7 @@ word TForm::set_background(word p, bool u)
{
TPrint_section& graph = section('G', p);
graph.update();
len = main_app().printer().formlen();
len = printer().formlen();
}
return len;
@ -1252,8 +1253,8 @@ word TForm::set_background(word p, bool u)
word TForm::set_header(word p, bool u)
{
TPrinter& printer = main_app().printer();
printer.resetheader();
TPrinter& pr = printer();
pr.resetheader();
TPrint_section& head = section('H', p);
@ -1261,11 +1262,11 @@ word TForm::set_header(word p, bool u)
else
{
head.reset();
printer.headerlen(head.height());
pr.headerlen(head.height());
}
for (word j = 0; j < head.height(); j++)
printer.setheaderline(j, head.row(j));
pr.setheaderline(j, head.row(j));
return head.height();
}
@ -1279,9 +1280,9 @@ word TForm::set_body(word p, bool u)
if (u)
{
TPrinter& printer = main_app().printer();
TPrinter& pr = printer();
for (word j = 0; j < body.height(); j++)
printer.print(body.row(j));
pr.print(body.row(j));
}
return body.height();
@ -1289,8 +1290,8 @@ word TForm::set_body(word p, bool u)
word TForm::set_footer(word p, bool u)
{
TPrinter& printer = main_app().printer();
printer.resetfooter();
TPrinter& pr = printer();
pr.resetfooter();
TPrint_section& foot = section('F', p);
@ -1298,11 +1299,11 @@ word TForm::set_footer(word p, bool u)
else
{
foot.reset();
printer.footerlen(foot.height());
pr.footerlen(foot.height());
}
for (word j = 0; j < foot.height(); j++)
printer.setfooterline(j, foot.row(j));
pr.setfooterline(j, foot.row(j));
return foot.height();
}
@ -1342,17 +1343,17 @@ bool TForm::print(long from, long to)
{
_form = this; // Setta il form corrente
TPrinter& printer = main_app().printer(); // Setta handlers
printer.setheaderhandler(header_handler);
printer.setfooterhandler(footer_handler);
printer.formlen(height());
const bool was_open = printer.isopen();
TPrinter& pr = printer(); // Setta handlers
pr.setheaderhandler(header_handler);
pr.setfooterhandler(footer_handler);
pr.formlen(height());
const bool was_open = pr.isopen();
_lastpage = FALSE; // non e' l'ultima pagina
set_background(1, TRUE);
if (!was_open && !printer.open())
if (!was_open && !pr.open())
return FALSE;
do_events();
@ -1365,11 +1366,11 @@ bool TForm::print(long from, long to)
if (from < 0) to = from;
else if (_cursor) *_cursor = i;
const word h = set_body(page(printer), FALSE);
if (h > printer.rows_left())
printer.formfeed();
const word h = set_body(page(pr), FALSE);
if (h > pr.rows_left())
pr.formfeed();
set_body(page(printer), TRUE);
set_body(page(pr), TRUE);
}
if (i > records())
@ -1380,16 +1381,16 @@ bool TForm::print(long from, long to)
set_background(0, TRUE);
set_header(0, TRUE);
set_body(0, TRUE);
printer.formfeed();
pr.formfeed();
}
}
if (!was_open)
printer.close();
pr.close();
_form = NULL; // resetta handlers
printer.setheaderhandler(NULL);
printer.setfooterhandler(NULL);
pr.setheaderhandler(NULL);
pr.setfooterhandler(NULL);
return ok;
}
@ -1404,11 +1405,15 @@ void TForm::print_section(ostream& out, char s) const
const char* name;
switch (s)
{
case 'F': name = "FOOTER"; break;
case 'G': name = "GRAPHICS"; break;
case 'H': name = "HEADER"; break;
default : name = "BODY"; break;
}
case 'F':
name = "FOOTER"; break;
case 'G':
name = "GRAPHICS"; break;
case 'H':
name = "HEADER"; break;
default :
name = "BODY"; break;
}
out << "SECTION " << name << ' ' << int(t);
out << *sec;
out << "END\n" << endl;
@ -1451,7 +1456,7 @@ word TForm::height()
h += section('F', 1).height();
}
else
h = main_app().printer().formlen();
h = printer().formlen();
return h;
}

View File

@ -31,7 +31,7 @@
#define NOT_LINKED(i,f) CHECKS(i != NULL, "Record senza tracciato: impossibile eseguire ", f)
#define NOT_OPEN() CHECKS(_isamfile != NULL, "File chiuso: ", (const char*)name())
HIDDEN TString256 _isam_string;
HIDDEN char _isam_string[257];
HIDDEN void UNKNOWN_FIELD(int num, const char* name)
{ yesnofatal_box("Il campo '%s' non appartiene al file %d", name, num); }
@ -208,7 +208,7 @@ long TBaseisamfile::items() const
const char* TBaseisamfile::name() const
{
_isam_string.format("%d", num());
sprintf(_isam_string, "%d", num());
return _isam_string;
}
@ -218,7 +218,7 @@ const char* TBaseisamfile::filename() const
{
TDir d;
d.get(num());
_isam_string = d.name();
strcpy(_isam_string, d.name());
return _isam_string;
}
return _isamfile->d->SysName;
@ -230,7 +230,7 @@ const char* TBaseisamfile::description() const
{
TDir d;
d.get(num());
_isam_string = d.des();
strcpy(_isam_string, d.des());
return _isam_string;
}
return _isamfile->d->Des;
@ -1438,10 +1438,13 @@ void TBaseisamfile::recover()
isdef * fh = filehnd();
const TRecnotype nitems = fh->i.Base[0].PEOX;
CHECKD(getkey() == 1, "La chiave corrente non e' 1 ma ", getkey());
TFilename fn = filename();
fn = fn.name();
if (getkey() != 1)
fatal_box("La chiave per il recover dell'archivio %s deve essere 1 non %d",
(const char *)fn, getkey());
#ifndef FOXPRO
if (yesno_box("La dimensione dell'archivio %s e' errata. Cerco di recuperarlo?", (const char *)fn))
{
@ -1695,13 +1698,35 @@ const char* TRectype::fieldname(int i) const
return i >= 0 && i < rd->NFields ? rd->Fd[i].Name : NULL;
}
const char* TRectype::get_str(const char* fieldname) const
{
RecDes* rd = rec_des();
if (CFieldType((char*) fieldname, rd) == _datefld)
{
const TRecfield f((TRectype&)*this, fieldname);
strcpy(_isam_string, (const char*) f);
}
else
if (CGetFieldBuff((char*) fieldname, rd, _rec, _isam_string) == -1)
UNKNOWN_FIELD(num(), fieldname);
return _isam_string;
}
#ifndef FOXPRO
const TString& TRectype::get(const char* fieldname) const
{
static TFixed_string tmp(_isam_string, sizeof(_isam_string));
get_str(fieldname);
return tmp;
}
int TRectype::get_int(const char* fieldname) const
{
// NOT_LINKED(_i, "get_int");
if (CGetFieldBuff((char*) fieldname, rec_des(), _rec, (char*)(const char*)_isam_string) == -1)
if (CGetFieldBuff((char*) fieldname, rec_des(), _rec, _isam_string) == -1)
UNKNOWN_FIELD(num(), fieldname);
return atoi(_isam_string);
}
@ -1710,7 +1735,7 @@ int TRectype::get_int(const char* fieldname) const
long TRectype::get_long(const char* fieldname) const
{
// NOT_LINKED(_i, "get_long");
if (CGetFieldBuff((char*) fieldname, rec_des(), _rec, (char*)(const char*)_isam_string) == -1)
if (CGetFieldBuff((char*) fieldname, rec_des(), _rec, _isam_string) == -1)
UNKNOWN_FIELD(num(), fieldname);
return atol(_isam_string);
}
@ -1720,7 +1745,7 @@ word TRectype::get_word(const char* fieldname) const
{
// NOT_LINKED(_i, "get_word");
if (CGetFieldBuff((char*) fieldname, rec_des(), _rec, (char*)(const char*)_isam_string) == -1)
if (CGetFieldBuff((char*) fieldname, rec_des(), _rec, _isam_string) == -1)
UNKNOWN_FIELD(num(), fieldname);
return (word)atoi(_isam_string);
}
@ -1729,7 +1754,7 @@ real TRectype::get_real(const char* fieldname) const
{
// NOT_LINKED(_i, "get_real");
if (CGetFieldBuff((char*) fieldname, rec_des(), _rec, (char*)(const char*)_isam_string) == -1)
if (CGetFieldBuff((char*) fieldname, rec_des(), _rec, _isam_string) == -1)
UNKNOWN_FIELD(num(), fieldname);
real r(_isam_string);
return r;
@ -1741,7 +1766,7 @@ char TRectype::get_char(const char* fieldname) const
{
// NOT_LINKED(_i, "get_char");
if (CGetFieldBuff((char*) fieldname, rec_des(), _rec, (char*)(const char*)_isam_string) == -1)
if (CGetFieldBuff((char*) fieldname, rec_des(), _rec, _isam_string) == -1)
UNKNOWN_FIELD(num(), fieldname);
return *_isam_string;
}
@ -1751,11 +1776,18 @@ bool TRectype::get_bool(const char* fieldname) const
{
// NOT_LINKED(_i, "get_bool");
if (CGetFieldBuff((char*) fieldname, rec_des(), _rec, (char*)(const char*)_isam_string) == -1)
if (CGetFieldBuff((char*) fieldname, rec_des(), _rec, _isam_string) == -1)
UNKNOWN_FIELD(num(), fieldname);
return *_isam_string == 'X';
}
#else
const char* TRectype::get(const char* fieldname) const
{
return get_str(fieldname);
}
#endif // FOXPRO
@ -1769,23 +1801,6 @@ TDate TRectype::get_date(const char* fieldname) const
}
const TString& TRectype::get(const char* fieldname) const
{
RecDes* rd = rec_des();
if (CFieldType((char*) fieldname, rd) == _datefld)
{
const TRecfield f((TRectype&)*this, fieldname);
_isam_string = (const char*) f;
}
else
if (CGetFieldBuff((char*) fieldname, rd, _rec, (char*)(const char*)_isam_string) == -1)
UNKNOWN_FIELD(num(), fieldname);
return _isam_string;
}
#ifndef FOXPRO
void TRectype::put(const char* fieldname, int val)
@ -1948,7 +1963,7 @@ TRectype& TRectype::operator =(const char* rec)
const char* TRectype::key(int numkey) const
{
// NOT_LINKED(_i, "key");
CBuildKey(rec_des(), numkey, _rec, (char*)(const char*)_isam_string);
CBuildKey(rec_des(), numkey, _rec, _isam_string);
return _isam_string;
}
@ -2086,9 +2101,9 @@ int TRecfield::operator =(int i)
{
if (_type == _intzerofld)
_isam_string.format("%0*d", _len, i);
sprintf(_isam_string, "%0*d", _len, i);
else
_isam_string.format("%d", i);
sprintf(_isam_string, "%d", i);
__putfieldbuff( _len, _dec, _type, _isam_string, _p);
_rec->setempty(FALSE);
return i;
@ -2099,9 +2114,9 @@ long TRecfield::operator =(long l)
{
if (_type == _longzerofld)
_isam_string.format("%0*ld", _len, l);
sprintf(_isam_string, "%0*ld", _len, l);
else
_isam_string.format("%ld", l);
sprintf(_isam_string, "%ld", l);
__putfieldbuff( _len, _dec, _type, _isam_string, _p);
_rec->setempty(FALSE);
return l;
@ -2112,18 +2127,37 @@ long TRecfield::operator =(long l)
const real& TRecfield::operator =(const real& r)
{
_isam_string = r.string();
strcpy(_isam_string, r.string());
__putfieldbuff( _len, _dec, _type, _isam_string, _p);
_rec->setempty(FALSE);
return r;
}
#else
const char* TRectype::get(const char* fieldname) const
{
RecDes* rd = rec_des();
if (CFieldType((char*) fieldname, rd) == _datefld)
{
const TRecfield f((TRectype&)*this, fieldname);
strcpy(_isam_string, (const char*) f);
}
else
if (CGetFieldBuff((char*) fieldname, rd, _rec, _isam_string) == -1)
UNKNOWN_FIELD(num(), fieldname);
return _isam_string;
}
#endif // FOXPRO
const TDate& TRecfield::operator =(const TDate& d)
{
_isam_string = (const char*)d;
strcpy(_isam_string, (const char*)d);
__putfieldbuff( _len, _dec, _type, _isam_string, _p);
_rec->setempty(FALSE);
return d;
@ -2162,7 +2196,7 @@ void TRecfield::setptr(TRecnotype r)
TRecfield::operator int() const
{
__getfieldbuff( _len, _type, _p, (char*)(const char*)_isam_string);
__getfieldbuff( _len, _type, _p, _isam_string);
return atoi(_isam_string);
}
@ -2170,7 +2204,7 @@ TRecfield::operator int() const
TRecfield::operator long() const
{
__getfieldbuff( _len, _type, _p, (char*)(const char*)_isam_string);
__getfieldbuff( _len, _type, _p, _isam_string);
return atol(_isam_string);
}
@ -2180,7 +2214,7 @@ TRecfield::operator long() const
TRecfield::operator const real() const
{
__getfieldbuff( _len, _type, _p, (char*)(const char*)_isam_string);
__getfieldbuff( _len, _type, _p, _isam_string);
real r(_isam_string);
return r;
}
@ -2191,7 +2225,7 @@ TRecfield::operator TDate() const
{
static TDate d;
__getfieldbuff( _len, _type, _p, (char*)(const char*)_isam_string);
__getfieldbuff( _len, _type, _p, _isam_string);
d = _isam_string;
return d;
}
@ -2200,7 +2234,7 @@ TRecfield::operator TDate() const
TRecfield::operator const char*() const
{
__getfieldbuff( _len, _type, _p, (char*)(const char*)_isam_string);
__getfieldbuff( _len, _type, _p, _isam_string);
return _isam_string;
}

View File

@ -86,22 +86,21 @@ public:
int ndec(const char* fieldname) const; // Ritorna numero di decimali
bool exist(const char* fieldname) const; // Ritorna l'esistenza del campo
const char* fieldname(int i) const; // Ritorna il nome del campo i
// @DES Get tipizzata. Ritorna il contenuto del campo nei vari tipi
// @FPUB
const char* get_str(const char* fieldname) const ;
#ifndef FOXPRO
const TString& get(const char* fieldname) const ;
int get_int(const char* fieldname) const ;
long get_long(const char* fieldname) const ;
word get_word(const char* fieldname) const ;
char get_char(const char* fieldname) const ;
bool get_bool(const char* fieldname) const ;
real get_real(const char* fieldname) const ;
#else
const char* get(const char* fieldname) const ;
#endif
TDate get_date(const char* fieldname) const ;
// @DES Get non tipizzata. Il campo e' ritornato come TString&
// @FPUB
const TString& get(const char* fieldname) const ;
// @DES Put tipizzata
// @FPUB
@ -114,6 +113,7 @@ public:
void put(const char* fieldname, char val);
void put(const char* fieldname, bool val);
void put(const char* fieldname, const real& val);
#else
#endif
// @DES Put NON tipizzata
@ -260,14 +260,9 @@ public:
TDate get_date(const char* fieldname) const
{ return curr().get_date(fieldname);}
// @DES Get non tipizzata. Il campo e' ritornato come TString&
// @FPUB
#ifndef FOXPRO
const TString& get(const char* fieldname) const
{ return curr().get(fieldname);}
// @DES Put NON tipizzata
// @FPUB
#ifndef FOXPRO
void put(const char* fieldname, int val)
{ curr().put(fieldname, val);}
void put(const char* fieldname, long val)
@ -282,6 +277,9 @@ public:
{ curr().put(fieldname, val);}
void put(const char* fieldname, const real& val)
{ curr().put(fieldname, val);}
#else
const char* get(const char* fieldname) const
{ return curr().get(fieldname);}
#endif
// @DES Put NON tipizzata

View File

@ -459,9 +459,6 @@ void TMask_field::set_prompt(const char* p)
void TMask_field::set(const char* s)
{
if (_dlg == 108)
_dlg = 108;
if (mask().is_running())
{
set_window_data(s);

View File

@ -1,44 +1,44 @@
#ifndef __PARTITE_H
#define __PARTITE_H
#define PART_ANNO "ANNO"
#define PART_NUMPART "NUMPART"
#define PART_NRIGA "NRIGA"
#define PART_TIPOMOV "TIPOMOV"
#define PART_NREG "NREG"
#define PART_NUMRIG "NUMRIG"
#define PART_DATAREG "DATAREG"
#define PART_DATADOC "DATADOC"
#define PART_NUMDOC "NUMDOC"
#define PART_DESCR "DESCR"
#define PART_REG "REG"
#define PART_PROTIVA "PROTIVA"
#define PART_CODCAUS "CODCAUS"
#define PART_SEZ "SEZ"
#define PART_IMPORTO "IMPORTO"
#define PART_IMPOSTA "IMPOSTA"
#define PART_SPESE "SPESE"
#define PART_CODPAG "CODPAG"
#define PART_CODVAL "CODVAL"
#define PART_CAMBIO "CAMBIO"
#define PART_IMPORTOVAL "IMPORTOVAL"
#define PART_DATACAM "DATACAM"
#define PART_TIPOCF "TIPOCF"
#define PART_GRUPPO "GRUPPO"
#define PART_CONTO "CONTO"
#define PART_SOTTOCONTO "SOTTOCONTO"
#define PART_CODABI "CODABI"
#define PART_CODCAB "CODCAB"
#define PART_CODAG "CODAG"
#define PART_IMPTOTPAG "IMPTOTPAG"
#define PART_RITENUTE "RITENUTE"
#define PART_SALACC "SALACC"
#define PART_TIPOPAG "TIPOPAG"
#define PART_DATARIFPAG "DATARIFPAG"
#define PART_NUMRIFPAG "NUMRIFPAG"
#define PART_NRATA "NRATA"
#define PART_CHIUSA "CHIUSA"
#define PART_CODABIPR "CODABIPR"
#define PART_CODCABPR "CODCABPR"
#endif
#ifndef __PARTITE_H
#define __PARTITE_H
#define PART_ANNO "ANNO"
#define PART_NUMPART "NUMPART"
#define PART_NRIGA "NRIGA"
#define PART_TIPOMOV "TIPOMOV"
#define PART_NREG "NREG"
#define PART_NUMRIG "NUMRIG"
#define PART_DATAREG "DATAREG"
#define PART_DATADOC "DATADOC"
#define PART_NUMDOC "NUMDOC"
#define PART_DESCR "DESCR"
#define PART_REG "REG"
#define PART_PROTIVA "PROTIVA"
#define PART_CODCAUS "CODCAUS"
#define PART_SEZ "SEZ"
#define PART_IMPORTO "IMPORTO"
#define PART_IMPOSTA "IMPOSTA"
#define PART_SPESE "SPESE"
#define PART_CODPAG "CODPAG"
#define PART_CODVAL "CODVAL"
#define PART_CAMBIO "CAMBIO"
#define PART_IMPORTOVAL "IMPORTOVAL"
#define PART_DATACAM "DATACAM"
#define PART_TIPOCF "TIPOC"
#define PART_GRUPPO "GRUPPO"
#define PART_CONTO "CONTO"
#define PART_SOTTOCONTO "SOTTOCONTO"
#define PART_CODABI "CODABI"
#define PART_CODCAB "CODCAB"
#define PART_CODAG "CODAG"
#define PART_IMPTOTPAG "IMPTOTPAG"
#define PART_RITENUTE "RITENUTE"
#define PART_SALACC "SALACC"
#define PART_TIPOPAG "TIPOPAG"
#define PART_DATARIFPAG "DATARIFPAG"
#define PART_NUMRIFPAG "NUMRIFPAG"
#define PART_NRATA "NRATA"
#define PART_CHIUSA "CHIUSA"
#define PART_CODABIPR "CODABIPR"
#define PART_CODCABPR "CODCABPR"
#endif

View File

@ -1,4 +1,4 @@
// $Id: printapp.cpp,v 1.22 1995-04-14 17:11:07 alex Exp $
// $Id: printapp.cpp,v 1.23 1995-04-20 14:33:40 guy Exp $
#include <ctype.h>
#include <stdarg.h>
@ -220,7 +220,7 @@ static char tb[120];
int TPrint_application::find_link(const char* descr) const
{
const TArray& arr = main_app().printer().links();
const TArray& arr = printer().links();
for (int i = 0; i < arr.items(); i++)
{
TToken_string& tt = (TToken_string&)arr[i];
@ -279,12 +279,12 @@ void TPrint_application::_pp_header (TPrinter &)
{
TPrint_application& prapp = (TPrint_application&)main_app();
prapp.preprocess_header();
prapp.printer().resetheader();
printer().resetheader();
const int ii = prapp._header.last();
// reset and add header/footer lines
for (int i = 0; i <= ii; i++)
if (prapp._header.objptr(i) != NULL)
prapp.printer().setheaderline (i, new TPrintrow((TPrintrow &)prapp._header[i]));
printer().setheaderline (i, new TPrintrow((TPrintrow &)prapp._header[i]));
}
void TPrint_application::_pp_footer (TPrinter &)
@ -292,11 +292,11 @@ void TPrint_application::_pp_footer (TPrinter &)
TPrint_application& prapp = (TPrint_application&)main_app();
prapp.preprocess_footer ();
prapp.printer().resetfooter ();
printer().resetfooter ();
int ii = prapp._footer.last();
for (int i = 0; i <= ii; i++)
if (prapp._footer.objptr(i) != NULL)
prapp.printer().setfooterline (i,
printer().setfooterline (i,
new TPrintrow ((TPrintrow &) (prapp._footer)[i]));
}

View File

@ -1,6 +1,5 @@
#include <stdlib.h>
#include <strstream.h>
#include <xvt.h>
@ -15,17 +14,35 @@
#define STYLE_NUM 4
#include <applicat.h>
#include <config.h>
#include <execp.h>
#include <mask.h>
#include <printer.h>
#include <printwin.h>
#include <urldefid.h>
#include <utility.h>
#include <viswin.h>
#include <config.h>
#include <bagn001a.h>
HIDDEN TPrinter* _printer = NULL;
TPrinter& printer()
{
if (_printer == NULL)
_printer = new TPrinter;
return *_printer;
}
void printer_destroy()
{
if (_printer != NULL)
{
delete _printer;
_printer = NULL;
}
}
///////////////////////////////////////////////////////////
// PrDesc
///////////////////////////////////////////////////////////
@ -41,10 +58,8 @@ struct PrDesc
}
PrintWhat;
#define LINES_PER_INCH (6.0)
#if XVT_OS == XVT_OS_WIN
#define STRICT
#include <windows.h>
void TPrinter::_get_windows_printer_names (TToken_string & t)
@ -617,7 +632,7 @@ bool printers_on_key (TMask_field & f, KEY key)
{
TToken_string pn1 (10), pn2 (20);
const PrinterDef & def = main_app().printer().get_description(atoi(f.get ()));
const PrinterDef & def = printer().get_description(atoi(f.get ()));
const char *s;
int j = 0;
while ((s = def.get_codenames (j)) != NULL)
@ -686,17 +701,17 @@ HIDDEN bool set_windows_print_device (TMask_field& f, KEY key)
{
if (key == K_SPACE && f.mask().is_running())
{
TPrinter& printer = main_app().printer();
TPrinter& pr = printer();
char szDevice[80];
TToken_string & pn = printer.getprinternames ();
TToken_string & pn = pr.getprinternames ();
TString pdev (pn.get (atoi (f.get())));
GetProfileString ("devices", pdev, "", szDevice, sizeof (szDevice));
pdev << "," << szDevice;
// scrivi (e semmai lo si risistema poi)
WriteProfileString("windows", "device", pdev);
printer.set_printrcd();
printer.set_win_formlen();
pr.set_printrcd();
pr.set_win_formlen();
}
return TRUE;
}
@ -739,9 +754,7 @@ TPrinter::TPrinter()
_ch_size = cnf.get_int("Size", NULL, -1, 12);
_lines_per_inch = cnf.get_int("Lines", NULL, -1, 6);
xvt_print_open ();
set_printrcd();
// xvt_print_open ();
set_win_formlen ();
char defPrinter[80];
@ -848,11 +861,9 @@ void TPrinter::read_configuration(const char *conf)
#endif
break;
case 1: // file
_printertype = fileprinter;
break;
case 2: // video
_printertype = screenvis;
_curcode = 0;
break;
@ -863,8 +874,11 @@ void TPrinter::read_configuration(const char *conf)
TPrinter::~TPrinter ()
{
#if XVT_OS == XVT_OS_WIN
xvt_print_destroy(_print_rcd);
xvt_print_close();
if (_print_rcd != NULL)
{
xvt_print_destroy(_print_rcd);
_print_rcd = NULL;
}
#endif
}

View File

@ -387,4 +387,7 @@ public:
virtual ~TFile_printer();
};
TPrinter& printer();
void printer_destroy();
#endif // __PRINTER_H

View File

@ -1,4 +1,5 @@
#include <applicat.h>
#include <printer.h>
#include <printwin.h>
#include <xvtility.h>
@ -23,7 +24,7 @@ HIDDEN int LEN_SPACES(WINDOW win, int x)
void TPrintwin::paint_background(long j)
{
const bool isbackground = _bg->items() > 0 && main_app().printer().isgraphics();
const bool isbackground = _bg->items() > 0 && printer().isgraphics();
if (!isbackground) return;
int rw = (int)(j % _formlen);
@ -93,7 +94,7 @@ void TPrintwin::paint_background(long j)
TImage* i = (TImage*)_images.objptr(id);
if (i == NULL)
{
const TString_array& a = main_app().printer().image_names();
const TString_array& a = printer().image_names();
const TImage src(a.row(id));
if (src.ok())
{
@ -228,7 +229,7 @@ bool TPrintwin::do_print()
TPrintwin::TPrintwin(TTextfile& txt)
: _txt(txt), _inited(FALSE), _aborted(FALSE)
{
TPrinter& p = main_app().printer();
TPrinter& p = printer();
#if XVT_OS != XVT_OS_SCOUNIX
_printrcd = p.get_printrcd();

View File

@ -273,7 +273,7 @@ char *real ::literals () const
if (c > 1)
centinaia = primi20[c];
else
centinaia.cut (0);
centinaia.cut(0);
v -= c * 100;
centinaia << "cento";
} else centinaia.cut(0);
@ -283,20 +283,24 @@ char *real ::literals () const
centinaia << decine[d];
v -= d * 10;
}
if (v != 1)
if (v > 0)
{
centinaia << primi20[v] << potenze[migliaia];
if (v > 1)
{
centinaia << primi20[v] << potenze[migliaia];
}
else if (val > 1)
{
if (d > 1)
centinaia.cut (centinaia.len() - 1);
centinaia << "un" << (migliaia ? potenze[migliaia] : "o");
}
else
centinaia = uni[migliaia];
}
else if (val > 1)
{
if (d > 1)
centinaia.cut (centinaia.len () - 1);
centinaia << "un" << (migliaia ? potenze[migliaia] : "o");
}
else
centinaia = uni[migliaia];
risultato.insert (centinaia, 0);
risultato.insert(centinaia, 0);
}
if (negativo)
@ -788,3 +792,84 @@ void TDistrib::init (const real & r, bool zap)
_tot = r; _ready = FALSE;
if (zap) _slices.destroy();
}
///////////////////////////////////////////////////////////
// Importo
///////////////////////////////////////////////////////////
const TImporto& TImporto::add_to(TToken_string& s) const
{
const bool dare = sezione() == 'D';
const char* v = valore().string();
s.add(dare ? v : "", 0);
s.add(dare ? "" : v, 1);
return *this;
}
// Cerified 99%
// Ambigous section for ZERO
const TImporto& TImporto::operator =(TToken_string& sv)
{
_valore = real(sv.get(0));
if (_valore == ZERO)
{
_valore = real(sv.get());
_sezione = 'A';
}
else
_sezione = 'D';
return *this;
}
const TImporto& TImporto::set(char s, const real& v)
{
CHECKD(s == 'D' || s == 'A', "Sezione errata per importo: codice ", (int)s);
_sezione = s; _valore = v;
return *this;
}
const TImporto& TImporto::operator += (const TImporto& i)
{
if (_valore.is_zero())
_sezione = i._sezione;
if (_sezione == i._sezione)
_valore += i._valore;
else
_valore -= i._valore;
return *this;
}
const TImporto& TImporto::operator -= (const TImporto& i)
{
if (_valore.is_zero())
_sezione = i._sezione;
if (_sezione == i._sezione)
_valore -= i._valore;
else
_valore += i._valore;
return *this;
}
const TImporto& TImporto::swap_section()
{
_sezione = (_sezione == 'D') ? 'A' : 'D';
return *this;
}
const TImporto& TImporto::normalize()
{
if (_valore.sign() < 0)
{
_valore = -_valore;
swap_section();
}
return *this;
}

View File

@ -14,8 +14,8 @@
#include <stdtypes.h>
#endif
#ifndef __ARRAY_H
#include <array.h>
#ifndef __STRINGS_H
#include <strings.h>
#endif
// @C
class real : public TObject
@ -156,5 +156,29 @@ public:
};
class TImporto : public TObject
{
char _sezione;
real _valore;
public:
char sezione() const { return _sezione; }
const real& valore() const { return _valore; }
bool is_zero() const { return _valore.is_zero(); }
const TImporto& operator=(const TImporto& i) { return set(i.sezione(), i.valore()); }
const TImporto& operator=(TToken_string& sv);
const TImporto& operator+=(const TImporto& i);
const TImporto& operator-=(const TImporto& i);
const TImporto& normalize();
const TImporto& swap_section();
const TImporto& set(char s, const real& v);
const TImporto& add_to(TToken_string& s) const;
TImporto(char s = 'D', const real& v = ZERO) { set(s, v); }
TImporto(const TImporto& i) : _sezione(i._sezione), _valore(i._valore) {}
};
#endif // __REAL_H

View File

@ -1,4 +1,4 @@
// $Id: relation.cpp,v 1.38 1995-04-19 13:39:17 alex Exp $
// $Id: relation.cpp,v 1.39 1995-04-20 14:34:26 guy Exp $
// relation.cpp
// fv 12/8/93
// relation class for isam files
@ -919,9 +919,9 @@ void TCursor::filter(const char* fil, const TRectype *from,
{
CHECK(!_frozen, "Impossibile filtrare un cursore congelato");
TString kf(_keyfrom), kto(_keyto), filter(fil);
TString kf(_keyfrom), kto(_keyto);
const bool filterchanged = _filter != filter;
const bool filterchanged = (fil != NULL) && (_filter != fil);
if (file().tab())
{
@ -948,7 +948,7 @@ void TCursor::filter(const char* fil, const TRectype *from,
_lastrec = 0;
if (filterchanged)
{
_filter = filter;
_filter = fil;
if (_fexpr) delete _fexpr;
TTypeexp type = (_filter.find('"') != -1) ? _strexpr : _numexpr;
if (_filter.not_empty())

View File

@ -1,29 +1,29 @@
#ifndef __SCADENZE_H
#define __SCADENZE_H
#define SCAD_ANNO "ANNO"
#define SCAD_NUMPART "NUMPART"
#define SCAD_NRATA "NRATA"
#define SCAD_CODPAG "CODPAG"
#define SCAD_TIPOPAG "TIPOPAG"
#define SCAD_ULTCLASS "ULTCLASS"
#define SCAD_IMPORTO "IMPORTO"
#define SCAD_CODVAL "CODVAL"
#define SCAD_CAMBIO "CAMBIO"
#define SCAD_IMPORTOVAL "IMPORTOVAL"
#define SCAD_DATACAMBIO "DATACAM"
#define SCAD_DATASCAD "DATASCAD"
#define SCAD_TIPOCF "TIPOCF"
#define SCAD_GRUPPO "GRUPPO"
#define SCAD_CONTO "CONTO"
#define SCAD_SOTTOCONTO "SOTTOCONTO"
#define SCAD_NSOLL "NSOLL"
#define SCAD_DATASOLL "DATASOLL"
#define SCAD_GGRIT "GGRIT"
#define SCAD_PAGATA "PAGATA"
#define SCAD_IMPORTOPAG "IMPORTOPAG"
#define SCAD_CODABIPR "CODABIPR"
#define SCAD_CODCABPR "CODCABPR"
#endif
#ifndef __SCADENZE_H
#define __SCADENZE_H
#define SCAD_ANNO "ANNO"
#define SCAD_NUMPART "NUMPART"
#define SCAD_NRATA "NRATA"
#define SCAD_CODPAG "CODPAG"
#define SCAD_TIPOPAG "TIPOPAG"
#define SCAD_ULTCLASS "ULTCLASS"
#define SCAD_IMPORTO "IMPORTO"
#define SCAD_CODVAL "CODVAL"
#define SCAD_CAMBIO "CAMBIO"
#define SCAD_IMPORTOVAL "IMPORTOVAL"
#define SCAD_DATACAMBIO "DATACAM"
#define SCAD_DATASCAD "DATASCAD"
#define SCAD_TIPOCF "TIPOC"
#define SCAD_GRUPPO "GRUPPO"
#define SCAD_CONTO "CONTO"
#define SCAD_SOTTOCONTO "SOTTOCONTO"
#define SCAD_NSOLL "NSOLL"
#define SCAD_DATASOLL "DATASOLL"
#define SCAD_GGRIT "GGRIT"
#define SCAD_PAGATA "PAGATA"
#define SCAD_IMPORTOPAG "IMPORTOPAG"
#define SCAD_CODABIPR "CODABIPR"
#define SCAD_CODCABPR "CODCABPR"
#endif

View File

@ -1,6 +1,7 @@
#include <applicat.h>
#include <colors.h>
#include <mask.h>
#include <printer.h>
#include <relation.h>
#include <sheet.h>
#include <urldefid.h>
@ -579,7 +580,7 @@ void TSheet::update()
void TSheet::print()
{
TPrinter& pr = main_app().printer();
TPrinter& pr = printer();
TPrintrow row;
bool ok = pr.open();

View File

@ -221,7 +221,7 @@ void TViswin::exec_link()
}
else
{
LINKHANDLER pl = main_app().printer().getlinkhandler();
LINKHANDLER pl = printer().getlinkhandler();
if (pl)
pl(_linkID, _multiple ? (const char*)_multiple_link :
(const char*)_linktxt);
@ -698,7 +698,7 @@ void TViswin::paint_background (long j, int row)
TImage* i = (TImage*)_images.objptr(id);
if (i == NULL && y1 == 0)
{
const TString_array& a = main_app().printer().image_names();
const TString_array& a = printer().image_names();
const TImage src(a.row(id));
if (src.ok())
{
@ -1050,6 +1050,7 @@ void TViswin::update ()
set_mode (M_COPY);
set_brush (BACKGROUND);
autoscroll (FALSE);
if (_rulers)
{
bar (0, 0, columns() + 1, 1);
@ -2108,6 +2109,10 @@ void TViswin::close_print ()
if (_bookmarks->items() > 0)
build_index_menu();
}
const TImage* i = (TImage*)_images.objptr(0);
if (i != NULL) i->set_palette(win());
force_update ();
}
@ -2363,13 +2368,13 @@ TViswin::TViswin(const char *fname,
_textcolumns = TEXTCOLUMNS;
autoscroll (TRUE);
_links = _toplevel ? &(main_app().printer().links()) : &(_brwfld->_links);
_multiple = _toplevel ? (main_app().printer ().ismultiplelink()) :
_links = _toplevel ? &(printer().links()) : &(_brwfld->_links);
_multiple = _toplevel ? (printer ().ismultiplelink()) :
(_brwfld->is_multiple_link());
_bookmarks = &(main_app().printer().get_bookmarks());
_bookmarks = &(printer().get_bookmarks());
_bg = _toplevel ? &(main_app().printer().getbgdesc()) : _brwfld->get_bg_desc();
_formlen = _toplevel ? main_app().printer().formlen() : maxalt;
_bg = _toplevel ? &(printer().getbgdesc()) : _brwfld->get_bg_desc();
_formlen = _toplevel ? printer().formlen() : maxalt;
_linkID = -1;
_inside_linkexec = FALSE;
@ -2520,7 +2525,7 @@ void TBrowsefile_field::disable_link(char fg, char bg)
void TBrowsefile_field::set_background(const char* bg)
{
main_app().printer().parse_background(bg,_background);
printer().parse_background(bg,_background);
}
void TBrowsefile_field::add_line(const char* l)

View File

@ -7,6 +7,7 @@
#include <colors.h>
#if XVT_OS == XVT_OS_WIN
#define STRICT
#include <windows.h>
#endif

View File

@ -1,9 +1,10 @@
#include <applicat.h>
#include <colors.h>
#include <config.h>
#include <date.h>
#include <urldefid.h>
#include <utility.h>
#include <window.h>
#if XVT_OS == XVT_OS_SCOUNIX
extern "C" { long nap(long period); }