CCorretta gestione numero copie

git-svn-id: svn://10.65.10.50/trunk@242 c028cbd2-c16b-5b4b-a496-9718f37d4682
This commit is contained in:
guy 1994-09-14 16:47:19 +00:00
parent 7696ebc104
commit c1e97ca1f9
12 changed files with 823 additions and 828 deletions

View File

@ -33,20 +33,6 @@ HIDDEN long backdrop_eh( WINDOW win, EVENT* ep)
clear_window( win, COLOR_BLUE ); clear_window( win, COLOR_BLUE );
#else #else
clear_window( win, COLOR_GRAY ); clear_window( win, COLOR_GRAY );
/*
const RCT& rct = ep->v.update.rct;
bool even = FALSE;
for (int y = 0; y < rct.bottom; y += 96)
{
const int sx = even ? 96 : 0;
for (int x = sx; x < rct.right; x += 192)
if (
(y+64) > rct.top && y < rct.bottom &&
(x+64) > rct.left && x < rct.right
) win_draw_icon(win, x, y, ICON_RSRC);
even = !even;
}
*/
#endif #endif
return 0L; return 0L;
@ -57,7 +43,7 @@ HIDDEN void create_backdrop( void )
#if XVTWS == WMWS #if XVTWS == WMWS
xvt_escape(XVT_ESC_CH_COLOR, XVT_CH_CLR_MENU, COLOR_BLACK, COLOR_WHITE); xvt_escape(XVT_ESC_CH_COLOR, XVT_CH_CLR_MENU, COLOR_BLACK, COLOR_WHITE);
xvt_escape(XVT_ESC_CH_COLOR, XVT_CH_CLR_DIALOG, COLOR_BLUE, COLOR_WHITE); xvt_escape(XVT_ESC_CH_COLOR, XVT_CH_CLR_DIALOG, COLOR_BLUE, COLOR_WHITE);
xvt_escape(XVT_ESC_CH_COLOR, XVT_CH_CLR_WINDOW, COLOR_RED, COLOR_WHITE); xvt_escape(XVT_ESC_CH_COLOR, XVT_CH_CLR_WINDOW, COLOR_RED, COLOR_WHITE);
xvt_escape(XVT_ESC_CH_COLOR, XVT_CH_CLR_CONTROL, COLOR_BLACK, COLOR_WHITE); xvt_escape(XVT_ESC_CH_COLOR, XVT_CH_CLR_CONTROL, COLOR_BLACK, COLOR_WHITE);
xvt_escape(XVT_ESC_CH_COLOR, XVT_CH_CLR_DISABLED, COLOR_GRAY, COLOR_WHITE); xvt_escape(XVT_ESC_CH_COLOR, XVT_CH_CLR_DISABLED, COLOR_GRAY, COLOR_WHITE);
xvt_escape(XVT_ESC_CH_COLOR, XVT_CH_CLR_MNEMONIC, COLOR_RED, COLOR_WHITE); xvt_escape(XVT_ESC_CH_COLOR, XVT_CH_CLR_MNEMONIC, COLOR_RED, COLOR_WHITE);
@ -120,7 +106,7 @@ void TApplication::wait_for(const char* command)
while (waiting_for) do_events(); while (waiting_for) do_events();
/////////////////////////////////////////////////////////// ///////////////////////////////////////////////////////////
// It seems necessary to restore these things // We need to restore these things
/////////////////////////////////////////////////////////// ///////////////////////////////////////////////////////////
customize_controls(TRUE); customize_controls(TRUE);
xvt_statbar_refresh(); xvt_statbar_refresh();

View File

@ -1,93 +1,94 @@
#ifndef __APPLICATION_H #ifndef __APPLICATION_H
#define __APPLICATION_H #define __APPLICATION_H
#ifndef INCL_XVTH #ifndef INCL_XVTH
#include <xvt.h> #include <xvt.h>
#endif #endif
#ifndef __PRINTER_H #ifndef __PRINTER_H
#include <printer.h> #include <printer.h>
#endif #endif
#ifndef __MODAUT_H #ifndef __MODAUT_H
//#include <modaut.h> //#include <modaut.h>
#endif #endif
// @C // @C
// Classe TApplication // Classe TApplication
// @END // @END
#define MSG_AI "AI" // message auto_insert (relapp) #define MSG_AI "AI" // message auto_insert (relapp)
#define MSG_FS "FS" // message filtered start (relapp) #define MSG_FS "FS" // message filtered start (relapp)
#define MSG_LN "LN" // message (printapp -> relapp) #define MSG_LN "LN" // message (printapp -> relapp)
class TApplication class TApplication
{ {
// @DPRIV // @DPRIV
int _bar; int _bar;
int __argc; int __argc;
const char** __argv; const char** __argv;
TString80 _name, _title; TString80 _name, _title;
TPrinter* _printer; TPrinter* _printer;
protected: protected:
const char* get_module_name() const; const char* get_module_name() const;
static long task_eh(WINDOW win, EVENT* ep); static long task_eh(WINDOW win, EVENT* ep);
virtual long handler(WINDOW win, EVENT* ep); virtual long handler(WINDOW win, EVENT* ep);
virtual bool extended_firm() const { return FALSE; } // Extended set_firm dialog box? virtual bool extended_firm() const { return FALSE; } // Extended set_firm dialog box?
void terminate(); void terminate();
bool config(); bool config();
void about() const; void about() const;
public: public:
// @FPUB // @FPUB
void setbar(int menubar) { _bar = menubar;} // Modifica la menu-bar void setbar(int menubar) { _bar = menubar;} // Modifica la menu-bar
void run(int argc, char* argv[], const char* name); void run(int argc, char* argv[], const char* name);
// @DES Queste funzioni possono essere ridefinite da ogni applicazione // @DES Queste funzioni possono essere ridefinite da ogni applicazione
// @FPUB // @FPUB
virtual bool create(); // Crea la finestra principale virtual bool create(); // Crea la finestra principale
virtual bool menu(MENU_TAG) { return TRUE; } // Controlla il menu virtual bool menu(MENU_TAG) { return TRUE; } // Controlla il menu
virtual bool destroy(); // Rimuove l'applicazione virtual bool destroy(); // Rimuove l'applicazione
virtual void print(); virtual void print();
void stop_run(); // Forza chiusura applicazione virtual word class_id() const { return CLASS_APPLICATION; }
void stop_run(); // Forza chiusura applicazione
void check_menu_item(MENU_TAG item); // Check menu
void uncheck_menu_item(MENU_TAG item); // Uncheck void check_menu_item(MENU_TAG item); // Check menu
void enable_menu_item(MENU_TAG item, bool on = TRUE); void uncheck_menu_item(MENU_TAG item); // Uncheck
void disable_menu_item(MENU_TAG item) { enable_menu_item(item, FALSE); } void enable_menu_item(MENU_TAG item, bool on = TRUE);
void dispatch_e_menu(MENU_TAG item); void disable_menu_item(MENU_TAG item) { enable_menu_item(item, FALSE); }
void dispatch_e_menu(MENU_TAG item);
const TString& name() const { return _name; }
const char** argv() const { return __argv; } const TString& name() const { return _name; }
const char* argv(int i) const { return __argv[i]; } const char** argv() const { return __argv; }
int argc() const { return __argc; } const char* argv(int i) const { return __argv[i]; }
int argc() const { return __argc; }
void set_title(const char* t) { _title = t; }
const char* title() const { return _title; } void set_title(const char* t) { _title = t; }
const char* title() const { return _title; }
void wait_for(const char* name);
void wake_up_caller() const; void wait_for(const char* name);
void wake_up_caller() const;
TPrinter* set_printer(TPrinter* p);
TPrinter& printer(); TPrinter* set_printer(TPrinter* p);
TPrinter& printer();
virtual bool change_config(const char* var, const char* oldv, const char* newv);
virtual bool change_config(const char* var, const char* oldv, const char* newv);
bool has_module(int module) const;
bool set_firm(long cod = -1); bool has_module(int module) const;
long get_firm() const; bool set_firm(long cod = -1);
const char* get_firm_dir() const; long get_firm() const;
const char* get_firm_dir() const;
TApplication();
virtual ~TApplication(); TApplication();
}; virtual ~TApplication();
};
bool xvt_running(); // xvt is running?
TApplication* MainApp(); // main application bool xvt_running(); // xvt is running?
TApplication* MainApp(); // main application
#endif // __APPLICATION_H
#endif // __APPLICATION_H

View File

@ -15,6 +15,9 @@
#define CLASS_FILENAME 12 #define CLASS_FILENAME 12
#define CLASS_TOKEN_STRING 13 #define CLASS_TOKEN_STRING 13
#define CLASS_APPLICATION 40
#define CLASS_PRINT_APPLICATION 41
#define CLASS_PRINTROW 50 #define CLASS_PRINTROW 50
#define CLASS_PRINTER 51 #define CLASS_PRINTER 51

View File

@ -1,122 +1,128 @@
// fv 6/10/93 // fv 6/10/93
#include <stdio.h> #include <stdio.h>
#include <xvt.h> #include <xvt.h>
#if XVT_OS == XVT_OS_SCOUNIX #if XVT_OS == XVT_OS_SCOUNIX
#include <sys/fcntl.h> #include <sys/fcntl.h>
#include <sys/wait.h> #include <sys/wait.h>
#endif #endif
#if XVT_OS == XVT_OS_WIN #if XVT_OS == XVT_OS_WIN
#include <windows.h> #include <windows.h>
#include <applicat.h> #include <applicat.h>
#endif #endif
#if XVT_OS == XVT_OS_DOS #if XVT_OS == XVT_OS_DOS
#include <holdev.h> #include <holdev.h>
#endif #endif
#include <execp.h> #include <execp.h>
// char _path[120]; // app name // char _path[120]; // app name
// int _error; // last error // int _error; // last error
// int _exitcode; // last exit code // int _exitcode; // last exit code
// int _count; // count of calls returning 0 // int _count; // count of calls returning 0
// int error() { return _error}; // int error() { return _error};
// int exitcode() { return _exitcode}; // int exitcode() { return _exitcode};
// int count() { return _count; }; // int count() { return _count; };
int TExternal_app::run(bool async) int TExternal_app::run(bool async)
{ {
_error = 0; _error = 0;
_exitcode = 0; _exitcode = 0;
// save cwd // save cwd
save_dir(); save_dir();
#if XVT_OS == XVT_OS_DOS #if XVT_OS == XVT_OS_DOS
// ems swap // ems swap
setems(1); setems(1);
// *** BLinker support; uncomment as needed // *** BLinker support; uncomment as needed
// BLIUNHOOK(); // BLIUNHOOK();
// ******************* // *******************
char* s = getenv("TMPDIR"); char* s = getenv("TMPDIR");
if (s == NULL) if (s == NULL)
_exitcode = holdev("\\tmp;",0,_path); _exitcode = holdev("\\tmp;",0,_path);
else else
_exitcode = holdev(s,0,_path); _exitcode = holdev(s,0,_path);
// *** BLinker support; uncomment as needed // *** BLinker support; uncomment as needed
// BLREINIT(); // BLREINIT();
// ******************* // *******************
if (!_exitcode) if (!_exitcode)
_exitcode = childret(); _exitcode = childret();
else else
_exitcode = -_exitcode; _exitcode = -_exitcode;
xvt_escape(XVT_ESC_CH_REFRESH); xvt_escape(XVT_ESC_CH_REFRESH);
#elif XVT_OS == XVT_OS_WIN #elif XVT_OS == XVT_OS_WIN
set_cursor(TASK_WIN, CURSOR_WAIT); set_cursor(TASK_WIN, CURSOR_WAIT);
_exitcode = WinExec((char*)_path, SW_SHOW); _exitcode = WinExec((char*)_path, SW_SHOW);
if (!async) MainApp()->wait_for(_path); if (_exitcode >= 32)
set_cursor(TASK_WIN, CURSOR_ARROW); {
#else if (!async) MainApp()->wait_for(_path);
_exitcode = 0;
switch (fork()) }
{ else error_box("Impossibile eseguire %s", (const char*)_path);
case -1:
_error = errno; set_cursor(TASK_WIN, CURSOR_ARROW);
_exitcode = -1; #else
break;
case 0: switch (fork())
const char* s = strdup(_path); {
char* p = strchr(s, ' '); case -1:
if (p) *p = '\0'; _error = errno;
const char* pathn = strdup(s); _exitcode = -1;
const char* args[21]; break;
int i = 0; case 0:
args[i++] = pathn; const char* s = strdup(_path);
while ((i < 20) && (p)) char* p = strchr(s, ' ');
{ if (p) *p = '\0';
s = p + 1; const char* pathn = strdup(s);
p = strchr(s, ' '); const char* args[21];
if (p) *p = '\0'; int i = 0;
args[i++] = strdup(s); args[i++] = pathn;
} while ((i < 20) && (p))
args[i] = NULL; {
for (i = 3; i < _NFILE; i++) fcntl(i,F_SETFD,1); s = p + 1;
// execvp(_path, NULL); p = strchr(s, ' ');
execvp ( pathn , args ); if (p) *p = '\0';
exit ( -1 ); args[i++] = strdup(s);
default: }
if(wait(&_exitcode) == -1) args[i] = NULL;
_exitcode = -1; for (i = 3; i < _NFILE; i++) fcntl(i,F_SETFD,1);
else _exitcode = _exitcode >> 8; // execvp(_path, NULL);
break; execvp ( pathn , args );
} exit ( -1 );
_error = errno; default:
xvt_escape(XVT_ESC_CH_REFRESH); if(wait(&_exitcode) == -1)
_exitcode = -1;
#endif else _exitcode = _exitcode >> 8;
break;
// restore cwd }
restore_dir(); _error = errno;
xvt_escape(XVT_ESC_CH_REFRESH);
// update counts
if (_exitcode == 0) #endif
_count++;
return _exitcode; // restore cwd
} restore_dir();
TExternal_app::TExternal_app(const char* p) // update counts
{ if (_exitcode == 0)
_path = p; _count++;
_count = 0; return _exitcode;
_error = 0; }
_exitcode = 0;
} TExternal_app::TExternal_app(const char* p)
{
_path = p;
_count = 0;
_error = 0;
_exitcode = 0;
}

View File

@ -218,9 +218,7 @@ TMask::TMask(const char* title, int pages, int cols, int rows, int xpos,
void TMask::read_mask(const char* name, int mode, int num) void TMask::read_mask(const char* name, int mode, int num)
{ {
#ifdef DBG
clock1 = clock(); clock1 = clock();
#endif
_source_file = name; _source_file = name;
_source_file.ext(MASK_EXT); _source_file.ext(MASK_EXT);
@ -258,9 +256,7 @@ void TMask::read_mask(const char* name, int mode, int num)
add_buttons(); add_buttons();
#ifdef DBG
clock1 = clock()-clock1; clock1 = clock()-clock1;
#endif
} }
@ -434,9 +430,7 @@ bool TMask::page_enabled(int page) const
void TMask::start_run() void TMask::start_run()
{ {
#ifdef DBG
clock2 = clock(); clock2 = clock();
#endif
load_checks(); load_checks();
@ -465,9 +459,7 @@ void TMask::start_run()
} }
} }
#ifdef DBG
clock2 = clock() - clock2; clock2 = clock() - clock2;
#endif
} }
bool TMask::check_fields() bool TMask::check_fields()

View File

@ -1,30 +1,30 @@
#ifndef _FLD_MOV_H #ifndef _FLD_MOV_H
#define _FLD_MOV_H #define _FLD_MOV_H
#define MOV_ANNOES "ANNOES" #define MOV_ANNOES "ANNOES"
#define MOV_ANNOIVA "ANNOIVA" #define MOV_ANNOIVA "ANNOIVA"
#define MOV_NUMREG "NUMREG" #define MOV_NUMREG "NUMREG"
#define MOV_DATAREG "DATAREG" #define MOV_DATAREG "DATAREG"
#define MOV_TIPO "TIPO" #define MOV_TIPO "TIPO"
#define MOV_CODCF "CODCF" #define MOV_CODCF "CODCF"
#define MOV_DATADOC "DATADOC" #define MOV_DATADOC "DATADOC"
#define MOV_NUMDOC "NUMDOC" #define MOV_NUMDOC "NUMDOC"
#define MOV_TIPODOC "TIPODOC" #define MOV_TIPODOC "TIPODOC"
#define MOV_TOTDOC "TOTDOC" #define MOV_TOTDOC "TOTDOC"
#define MOV_CODCAUS "CODCAUS" #define MOV_CODCAUS "CODCAUS"
#define MOV_DESCR "DESCR" #define MOV_DESCR "DESCR"
#define MOV_TIPOMOV "TIPOMOV" #define MOV_TIPOMOV "TIPOMOV"
#define MOV_REG "REG" #define MOV_REG "REG"
#define MOV_PROTIVA "PROTIVA" #define MOV_PROTIVA "PROTIVA"
#define MOV_UPROTIVA "UPROTIVA" #define MOV_UPROTIVA "UPROTIVA"
#define MOV_CODVAL "CODVAL" #define MOV_CODVAL "CODVAL"
#define MOV_CAMBIO "CAMBIO" #define MOV_CAMBIO "CAMBIO"
#define MOV_STAMPATO "STAMPATO" #define MOV_STAMPATO "STAMPATO"
#define MOV_NUMGIO "NUMGIO" #define MOV_NUMGIO "NUMGIO"
#define MOV_PROVVIS "PROVVIS" #define MOV_PROVVIS "PROVVIS"
#define MOV_OCFPI "OCFPI" #define MOV_OCFPI "OCFPI"
#define MOV_CORRLIRE "CORRLIRE" #define MOV_CORRLIRE "CORRLIRE"
#define MOV_CORRVALUTA "CORRVALUTA" #define MOV_CORRVALUTA "CORRVALUTA"
#define MOV_DATACOMP "DATACOMP"
#endif #endif

View File

@ -616,11 +616,11 @@ break;
if (ok) dispatch_e_char(parent(), k); if (ok) dispatch_e_char(parent(), k);
} }
break; break;
case K_ENTER: case K_ESC:
case K_CTRL+K_ENTER: case K_CTRL+K_ENTER:
{ {
const bool ok = (bool)xi_move_focus(_itf); const bool ok = (bool)xi_move_focus(_itf);
if (ok) dispatch_e_char(parent(), k == K_ENTER ? K_TAB : K_BTAB); dispatch_e_char(parent(), k == K_ESC ? K_ESC : K_TAB);
} }
break; break;

View File

@ -1,473 +1,471 @@
// trattasi di -*-c++-*- // trattasi di -*-c++-*-
#ifndef __PRINTAPP_H #ifndef __PRINTAPP_H
#define __PRINTAPP_H #define __PRINTAPP_H
#ifndef __APPLICATION_H #ifndef __APPLICATION_H
#include <applicat.h> #include <applicat.h>
#endif #endif
#ifndef __PRINTER_H #ifndef __PRINTER_H
#include <printer.h> #include <printer.h>
#endif #endif
#ifndef __RELATION_H #ifndef __RELATION_H
#include <relation.h> #include <relation.h>
#endif #endif
#ifndef __STRINGS_H // compatibility
#include <strings.h> #define TPrintapp TPrint_application
#endif
// compatibility enum print_action { REPEAT_PAGE, NEXT_PAGE };
#define TPrintapp TPrint_application
// user functions to pass field informations to setrow()
// no class or nice C++ interface since varargs is nasty
enum print_action { REPEAT_PAGE, NEXT_PAGE };
// FLD(Num.logico, Nome campo [, da [, a]])
// user functions to pass field informations to setrow() const char* FLD(int lognum, const char* f, int from = -1, int to = -1);
// no class or nice C++ interface since varargs is nasty // FLD(Num. logico, Nome campo numerico, Picture string)
const char* FLD(int lognum, const char* f, const char* picture);
// FLD(Num.logico, Nome campo [, da [, a]]) // FLD(Nome tabella, Nome campo numerico, Picture string)
const char* FLD(int lognum, const char* f, int from = -1, int to = -1); const char* FLD(const char* tabname, const char* f, const char* picture);
// FLD(Num. logico, Nome campo numerico, Picture string) // FLD(Num.logico, Nome campo [, da [, a]])
const char* FLD(int lognum, const char* f, const char* picture); const char* FLD(const char* tabname, const char* f, int from = -1, int to = -1);
// FLD(Nome tabella, Nome campo numerico, Picture string)
const char* FLD(const char* tabname, const char* f, const char* picture); struct link_item {
// FLD(Num.logico, Nome campo [, da [, a]]) int _logicnum;
const char* FLD(const char* tabname, const char* f, int from = -1, int to = -1); link_item* _son;
link_item* _brother;
struct link_item { int _cnt;
int _logicnum;
link_item* _son; link_item(int l)
link_item* _brother; { _logicnum = l; _son = NULL; _brother = NULL; _cnt = 0; }
int _cnt; };
link_item(int l) class TProgind;
{ _logicnum = l; _son = NULL; _brother = NULL; _cnt = 0; }
};
class TPrint_application : public TApplication
class TProgind; {
TArray _rows; // rows descriptor
TArray _cursors; // cursor array
class TPrint_application : public TApplication TCursor* _cur; // current cursor
{ TArray _transtab; // field translation table
TArray _rows; // rows descriptor TArray _header; // header lines
TArray _cursors; // cursor array TArray _footer; // footer lines
TCursor* _cur; // current cursor int _currow; // current print row
TArray _transtab; // field translation table TPrintstyle _curstyle; // current print style
TArray _header; // header lines bool _auto_ff; // automatic form feed after each page
TArray _footer; // footer lines const char* _wmess; // wait message for progind
int _currow; // current print row bool _wbar; // bar y/n for progind
TPrintstyle _curstyle; // current print style bool _wcancel; // cancel button enabled
bool _auto_ff; // automatic form feed after each page int _wthr; // minimum # of items to show print progind
const char* _wmess; // wait message for progind const char* _confpr; // config filename for printer
bool _wbar; // bar y/n for progind char _fillchar; // fill character for empty fields
bool _wcancel; // cancel button enabled link_item* _pr_tree; // functions for autom. printing of relations
int _wthr; // minimum # of items to show print progind int _maxrow; // reference to maxrow
const char* _confpr; // config filename for printer int _cur_file;
char _fillchar; // fill character for empty fields bool _print_defined;
link_item* _pr_tree; // functions for autom. printing of relations bool _force_progind;
int _maxrow; // reference to maxrow bool _force_setpage;
int _cur_file; bool _print_zero;
bool _print_defined; TProgind* _prind;
bool _force_progind; const char* _picture;
bool _force_setpage; MENU_TAG _last_choice;
bool _print_zero; int _ncopies;
TProgind* _prind; bool _repeat_print;
const char* _picture;
MENU_TAG _last_choice; // set the printer
int _ncopies; void set_printer() { printer().set(); }
bool _repeat_print; // print a single record; does not advance cursor
// returns failure or success
// set the printer bool print_one(int file);
void set_printer() { printer().set(); } // to be documented but very fig
// print a single record; does not advance cursor bool print_tree(link_item* head);
// returns failure or success
bool print_one(int file); static void _pp_header(TPrinter& pr);
// to be documented but very fig static void _pp_footer(TPrinter& pr);
bool print_tree(link_item* head); static void _pp_link(int id, const char* s);
static void _pp_header(TPrinter& pr); link_item* _look_print_node(link_item* head, int logicnum);
static void _pp_footer(TPrinter& pr); void _reset_tree(link_item* head);
static void _pp_link(int id, const char* s); virtual bool create();
virtual bool destroy();
link_item* _look_print_node(link_item* head, int logicnum);
void _reset_tree(link_item* head);
virtual bool create(); protected:
virtual bool destroy();
// ****************************************************
// ISTRUZIONI PER l'USO
protected: // ****************************************************
//
// **************************************************** // La Printapp, saggiamente, consente di operare su uno
// ISTRUZIONI PER l'USO // o piu' cursori stampando automaticamente anche files
// **************************************************** // collegati. La sequenza delle operazioni e' la seguente:
// //
// La Printapp, saggiamente, consente di operare su uno // 1) Derivare una classe da TPrint_application
// o piu' cursori stampando automaticamente anche files // 2) Implementare user_create() e user_destroy();
// collegati. La sequenza delle operazioni e' la seguente: // Nella user_create() si creino i
// // necessari cursori, e li si dia in pasto a Printapp
// 1) Derivare una classe da TPrint_application // usando add_cursor(). Si puo' fare add_cursor(new TCursor(...))
// 2) Implementare user_create() e user_destroy(); // dato che il cursore viene distrutto automaticamente.
// Nella user_create() si creino i // 3) Per ciascun file del cursore che si desidera porre
// necessari cursori, e li si dia in pasto a Printapp // nell'albero di stampa, si faccia add_file(logicnum [,from]);
// usando add_cursor(). Si puo' fare add_cursor(new TCursor(...)) // [from] sara' il file a cui e' collegato nella relazione.
// dato che il cursore viene distrutto automaticamente. // add_file VA FATTA anche per il file principale, se no
// 3) Per ciascun file del cursore che si desidera porre // non stampera' nulla;
// nell'albero di stampa, si faccia add_file(logicnum [,from]); // *********************************************************
// [from] sara' il file a cui e' collegato nella relazione. // FUNZIONI VIRTUALI OBBLIGATORIE
// add_file VA FATTA anche per il file principale, se no // *********************************************************
// non stampera' nulla; // 4) Si definiscono le necessarie funzioni virtuali: e'
// ********************************************************* // sicuramente necessaria la set_page(file) nella quale
// FUNZIONI VIRTUALI OBBLIGATORIE // si metteranno (sotto if o switch) le istruzioni
// ********************************************************* // set_row (vedi sotto) corrispondenti alla pagina
// 4) Si definiscono le necessarie funzioni virtuali: e' // logica relativa a ciascun record di ogni file da stampare.
// sicuramente necessaria la set_page(file) nella quale // Va definita anche set_print() in cui si presentera' ;a
// si metteranno (sotto if o switch) le istruzioni // maschera di scelta se necessaria o una box yes_no;
// set_row (vedi sotto) corrispondenti alla pagina // Ritornando TRUE da set_print la stampa viene eseguita
// logica relativa a ciascun record di ogni file da stampare. // automaticamente (in genere ritorna FALSE se l'utente
// Va definita anche set_print() in cui si presentera' ;a // annulla la stampa con ESC.)
// maschera di scelta se necessaria o una box yes_no; //
// Ritornando TRUE da set_print la stampa viene eseguita // Alla set_page, come alle pre_ e post_ process, viene
// automaticamente (in genere ritorna FALSE se l'utente // passato 0 se il cursore attuale e' nullo (vedi sotto).
// annulla la stampa con ESC.) // *********************************************************
// // FUNZIONI VIRTUALI FACOLTATIVE
// Alla set_page, come alle pre_ e post_ process, viene // *********************************************************
// passato 0 se il cursore attuale e' nullo (vedi sotto). // 5) Le varie funzioni pre_ e post_ process _page e _print
// ********************************************************* // vengono chiamate prima e dopo la stampa di ogni record
// FUNZIONI VIRTUALI FACOLTATIVE // o gruppo di record relativo alla relazione immessa;
// ********************************************************* // ad esempio, postprocess_print() viene chiamata per il
// 5) Le varie funzioni pre_ e post_ process _page e _print // file principale una volta dopo l'intera stampa; per
// vengono chiamate prima e dopo la stampa di ogni record // un file collegato nella relazione, e' chiamata tante
// o gruppo di record relativo alla relazione immessa; // volte quanti gruppi di almeno un record esistono per
// ad esempio, postprocess_print() viene chiamata per il // record del file genitore. Qui si possono modificare
// file principale una volta dopo l'intera stampa; per // righe, calcolare totali etc. A queste funzioni
// un file collegato nella relazione, e' chiamata tante // viene sempre passato il file (logicnum) in corso di stampa e
// volte quanti gruppi di almeno un record esistono per // un contatore che indica quante volte la stampa e' stata
// record del file genitore. Qui si possono modificare // ripetuta. le pre_ ritornano TRUE o FALSE, nell'ultimo
// righe, calcolare totali etc. A queste funzioni // caso interrompono la stampa; le post_ ritornano
// viene sempre passato il file (logicnum) in corso di stampa e // NEXT_PAGE (comportamento normale) o REPEAT_PAGE
// un contatore che indica quante volte la stampa e' stata // (indovina cosa fa).
// ripetuta. le pre_ ritornano TRUE o FALSE, nell'ultimo // 6) set_print() viene chiamata dalla voce Selezione,
// caso interrompono la stampa; le post_ ritornano // unica del secondo menu. E' il posto dove mettere
// NEXT_PAGE (comportamento normale) o REPEAT_PAGE // una buona maschera di selezione di cosa stampare.
// (indovina cosa fa). // Alla fine, si esegua enable_print_menu() per
// 6) set_print() viene chiamata dalla voce Selezione, // abilitare la voce Stampa, inizialmente inattiva.
// unica del secondo menu. E' il posto dove mettere // 7) cancel_hook() permette di intercettare la
// una buona maschera di selezione di cosa stampare. // cancellazione della stampa; ritornando TRUE
// Alla fine, si esegua enable_print_menu() per // la stampa viene effettivamente cancellata
// abilitare la voce Stampa, inizialmente inattiva. // Tutti i parametri relativi al progress indicator
// 7) cancel_hook() permette di intercettare la // vengono settati da funzioni apposite (vedi oltre)
// cancellazione della stampa; ritornando TRUE // ****************************************************
// la stampa viene effettivamente cancellata // Molte altre minchiatine (form feed automatici, header,
// Tutti i parametri relativi al progress indicator // footer etc) sono spiegate nel seguito
// vengono settati da funzioni apposite (vedi oltre) // ****************************************************
// ****************************************************
// Molte altre minchiatine (form feed automatici, header, virtual void user_create() {}
// footer etc) sono spiegate nel seguito virtual void user_destroy() {}
// ****************************************************
// set print, bound to menu :Selezione:Stampa
virtual void user_create() {} // chiamata automaticamente dopo user_create()
virtual void user_destroy() {} virtual bool set_print(int i = 1) { return FALSE; }
// set print, bound to menu :Selezione:Stampa // set_row functions MUST be called here in a switch
// chiamata automaticamente dopo user_create() // for each particular file being printed
virtual bool set_print(int i = 1) { return FALSE; } virtual void set_page(int file, int cnt) {}
// set_row functions MUST be called here in a switch // called before processing each page
// for each particular file being printed // used to set print strings from tables or files
virtual void set_page(int file, int cnt) {} // not included in relation
// returning FALSE cancels page printing
// called before processing each page // counter is the current print page number
// used to set print strings from tables or files virtual bool preprocess_page(int file, int counter)
// not included in relation { return TRUE; }
// returning FALSE cancels page printing
// counter is the current print page number // same before each print request
virtual bool preprocess_page(int file, int counter) // e.g. to initialize counters
{ return TRUE; } // returning FALSE cancels print request or subtree
virtual bool preprocess_print(int file, int counter)
// same before each print request { return TRUE; }
// e.g. to initialize counters
// returning FALSE cancels print request or subtree // postprocessing; returning REPEAT_PAGE reprints the
virtual bool preprocess_print(int file, int counter) // whole page (after all sons are printed) or print
{ return TRUE; } // counter is the current page or print number
virtual print_action postprocess_page(int file, int counter)
// postprocessing; returning REPEAT_PAGE reprints the { return NEXT_PAGE; }
// whole page (after all sons are printed) or print virtual print_action postprocess_print(int file, int counter)
// counter is the current page or print number { return NEXT_PAGE; }
virtual print_action postprocess_page(int file, int counter) // executed after all print job is completed
{ return NEXT_PAGE; } virtual void postclose_print() {}
virtual print_action postprocess_print(int file, int counter)
{ return NEXT_PAGE; } // called when LINK button is pressed with active selection in
// executed after all print job is completed // preview window
virtual void postclose_print() {} virtual void process_link(int id, const char* text) {}
// called when LINK button is pressed with active selection in
// preview window // called when user cancels print; returning TRUE
virtual void process_link(int id, const char* text) {} // actually stops printing; not called if no cancel
virtual bool cancel_hook() {return TRUE;}
// called when user cancels print; returning TRUE // bound to TApplication print menu
// actually stops printing; not called if no cancel // redefined ONLY for very special purposes
virtual bool cancel_hook() {return TRUE;} virtual void print();
// bound to TApplication print menu // bound to <select> menu and automatically called after
// redefined ONLY for very special purposes // user_create()
virtual void print(); void do_print(int n);
// bound to <select> menu and automatically called after public:
// user_create()
void do_print(int n); // --------------------------------------------------------------
// COME SETTARE LE RIGHE DI STAMPA
public: // --------------------------------------------------------------
// setrow() si usa come una printf per settare le righe di stampa
// -------------------------------------------------------------- // che vengono stampate da print()
// COME SETTARE LE RIGHE DI STAMPA // I codici per gli argomenti variabili sono di 3 tipi:
// -------------------------------------------------------------- // @ si usa per stampare campi di database o informazioni di controllo
// setrow() si usa come una printf per settare le righe di stampa // posizione carrello e font
// che vengono stampate da print() // ACHTUNG: i codici di formato sono diversi da quelli di printf e
// I codici per gli argomenti variabili sono di 3 tipi: // sono elencati sotto. Per i campi di database occorre che il codice
// @ si usa per stampare campi di database o informazioni di controllo // sia accoppiato ad una delle funzioni FLD() passata come argomento;
// posizione carrello e font // questa provoca la stampa di campi della relazione corrente,
// ACHTUNG: i codici di formato sono diversi da quelli di printf e // posizionata come e' stato deciso nell'inizializzazione
// sono elencati sotto. Per i campi di database occorre che il codice // % si usa esattamente come in una printf con un plus: se il codice di
// sia accoppiato ad una delle funzioni FLD() passata come argomento; // formato e' maiuscolo (es. S per stringa, D per intero) viene
// questa provoca la stampa di campi della relazione corrente, // ignorato il carattere di riempimento eventualmente specificato
// posizionata come e' stato deciso nell'inizializzazione // con set_fillchar. Cio' vale anche per i codici @ (vedi)
// % si usa esattamente come in una printf con un plus: se il codice di // E' possibile usare due codici aggiuntivi: r(R) e t(T). A questi
// formato e' maiuscolo (es. S per stringa, D per intero) viene // va fatto seguire un PUNTATORE a real o a TString. Il formato
// ignorato il carattere di riempimento eventualmente specificato // viene interpretato con le stesse regole di %t in dsprintf per real
// con set_fillchar. Cio' vale anche per i codici @ (vedi) // (come %d o %f) e di %s per TString. Il puntatore NON
// E' possibile usare due codici aggiuntivi: r(R) e t(T). A questi // viene memorizzato; per questo occorre il codice # (sotto).
// va fatto seguire un PUNTATORE a real o a TString. Il formato // # si usa come % (stessi codici di printf) ma memorizza gli argomenti
// viene interpretato con le stesse regole di %t in dsprintf per real // per riferimento: ovvero, ogni volta che la riga viene stampata
// (come %d o %f) e di %s per TString. Il puntatore NON // viene stampato il contenuto in quel momento (che si puo' cambiare
// viene memorizzato; per questo occorre il codice # (sotto). // in una delle pre- o post- process). Cio' implica che:
// # si usa come % (stessi codici di printf) ma memorizza gli argomenti // 1) gli argomenti vanno passati per RIFERIMENTO (set_row(1,"#5d",&i))
// per riferimento: ovvero, ogni volta che la riga viene stampata // 2) i puntatori devono rimanere validi e costanti tra la set_row e
// viene stampato il contenuto in quel momento (che si puo' cambiare // la fine della stampa
// in una delle pre- o post- process). Cio' implica che: // Quindi, attenzione a %s con TString ridimensionate; si possono
// 1) gli argomenti vanno passati per RIFERIMENTO (set_row(1,"#5d",&i)) // usare solo se predimensionate alla dimensione massima, ma e' meglio
// 2) i puntatori devono rimanere validi e costanti tra la set_row e // usare char* o il codice apposito. I codici #r e #t prendono puntatori a
// la fine della stampa // real e a TString, memorizzandoli. Non ci sono problemi con la resize.
// Quindi, attenzione a %s con TString ridimensionate; si possono // Comunque, il modo corretto di adoperare il codice # e'
// usare solo se predimensionate alla dimensione massima, ma e' meglio // usarlo solo per stampare MEMBRI della classe derivata da TPrint_application
// usare char* o il codice apposito. I codici #r e #t prendono puntatori a // ----------------------------------------------
// real e a TString, memorizzandoli. Non ci sono problemi con la resize. // field codes (match one of FLD() functions)
// Comunque, il modo corretto di adoperare il codice # e' // @@ -> @
// usarlo solo per stampare MEMBRI della classe derivata da TPrint_application // @[n[,{l|c|r}]s -> STRING: n = pad, lcr = alignment
// ---------------------------------------------- // @{[n[.d=0]]|[n[,{l|c|r}]]p}n
// field codes (match one of FLD() functions) // -> NUMBER: n = digits, d = decimals
// @@ -> @ // p = picture string (first matching arg)
// @[n[,{l|c|r}]s -> STRING: n = pad, lcr = alignment // @[l]d -> DATE: l = full year
// @{[n[.d=0]]|[n[,{l|c|r}]]p}n // @f -> BOOL: prints si/no
// -> NUMBER: n = digits, d = decimals // @[n,{l|c|r}]t -> Translated field (must set translation)
// p = picture string (first matching arg) //
// @[l]d -> DATE: l = full year // Tutti questi codici possono essere usati anche maiuscoli, il che inibisce
// @f -> BOOL: prints si/no // l'uso del carattere di riempimento (set_fillchar) per uno specifico campo.
// @[n,{l|c|r}]t -> Translated field (must set translation) // ---------------------------------------------
// // Per tutti i codici che riguardano la stampa di real (@n, %r, #r)
// Tutti questi codici possono essere usati anche maiuscoli, il che inibisce // se non vengono date ulteriori specifiche di formato viene usata
// l'uso del carattere di riempimento (set_fillchar) per uno specifico campo. // una picture che e' "" per default, ma puo' essere modificata con
// --------------------------------------------- // set_real_picture(). Anche questo e' assai carino.
// Per tutti i codici che riguardano la stampa di real (@n, %r, #r) // Normalmente un real uguale a zero viene stampato come stringa vuota
// se non vengono date ulteriori specifiche di formato viene usata // a meno che non si specifichi set_print_zero([TRUE]).
// una picture che e' "" per default, ma puo' essere modificata con // ---------------------------------------------
// set_real_picture(). Anche questo e' assai carino. // codici posizionamento e movimento carrello
// Normalmente un real uguale a zero viene stampato come stringa vuota // @<n>g vai a posizione n
// a meno che non si specifichi set_print_zero([TRUE]). // @<n>j salta di n posizioni (in orizzontale)
// --------------------------------------------- // codici stile
// codici posizionamento e movimento carrello // @b bold
// @<n>g vai a posizione n // @i italic
// @<n>j salta di n posizioni (in orizzontale) // @u underlined
// codici stile // @r reset to normal
// @b bold // ---------------------------------------------------
// @i italic // CODICI COLORE PER VISUALIZZAZIONE E COLLEGAMENTO
// @u underlined // ---------------------------------------------------
// @r reset to normal // Se si vuole che in visualizzazione il testo sia colorato
// --------------------------------------------------- // si usa il codice $[]; tra le quadre si scrive il colore
// CODICI COLORE PER VISUALIZZAZIONE E COLLEGAMENTO // di foreground, opzionalmente seguito da una virgola e dal
// --------------------------------------------------- // colore di background (bianco per default). I colori si
// Se si vuole che in visualizzazione il testo sia colorato // specificano con un singolo carattere come segue:
// si usa il codice $[]; tra le quadre si scrive il colore // n nero
// di foreground, opzionalmente seguito da una virgola e dal // g verde
// colore di background (bianco per default). I colori si // b blu
// specificano con un singolo carattere come segue: // c cyan
// n nero // y giallo
// g verde // v magenta
// b blu // m colore background maschere (azzurrotto)
// c cyan // d grigio scuro
// y giallo // l grigio chiaro
// v magenta // k grigio normale
// m colore background maschere (azzurrotto) // ------------------------------------------------------
// d grigio scuro // Se si fa enable_link(..) con un certo colore, tutto
// l grigio chiaro // cio; che e' scritto in quel colore diventa selezionabile
// k grigio normale // e alla sua selezione (premendo 'Collega') si puo' associare
// ------------------------------------------------------ // un'azione in process_link. A quest'ultima viene passata
// Se si fa enable_link(..) con un certo colore, tutto // l'ID ritornata da enable_link() e il testo selezionato alla
// cio; che e' scritto in quel colore diventa selezionabile // pressione di Collega. Vedere ba6 e stampare l'elenco (con
// e alla sua selezione (premendo 'Collega') si puo' associare // Includi ditte abilitato) per un esempio.
// un'azione in process_link. A quest'ultima viene passata // --------------------------------------------------------
// l'ID ritornata da enable_link() e il testo selezionato alla
// pressione di Collega. Vedere ba6 e stampare l'elenco (con void reset_row(int r);
// Includi ditte abilitato) per un esempio.
// -------------------------------------------------------- // chiamare reset_print() durante la stampa forza la
// rilettura di set_page() alla prossima volta
void reset_row(int r); void reset_print();
// chiamare reset_print() durante la stampa forza la void set_row(int r, const char* fmt, ...);
// rilettura di set_page() alla prossima volta
void reset_print(); // ---------------------------------------------
// set translation values for field
void set_row(int r, const char* fmt, ...); // called once for each translation: example
// set_translation(12,"STATOCIV","1","Celibe")
// --------------------------------------------- // provoca la stampa automatica di stringhe al
// set translation values for field // posto di determinati valori dei campi se e' dato
// called once for each translation: example // il codice @t
// set_translation(12,"STATOCIV","1","Celibe") // Il posto giusto per chiamarla: user_create()
// provoca la stampa automatica di stringhe al // ---------------------------------------------
// posto di determinati valori dei campi se e' dato void set_translation(int lognum, const char* field,
// il codice @t const char* from, const char* to);
// Il posto giusto per chiamarla: user_create()
// ---------------------------------------------
void set_translation(int lognum, const char* field, // --------------------------------------------------------
const char* from, const char* to); // hypertext interface for viswin
// --------------------------------------------------------
// Quando si vogliono abilitare determinati colori come
// -------------------------------------------------------- // indicatori di legame ipertestuale, si faccia enable_link
// hypertext interface for viswin // nella create. L' ID ritornato viene passato a process_link
// -------------------------------------------------------- // assieme al testo selezionato
// Quando si vogliono abilitare determinati colori come int enable_link (const char* descr, char fg, char bg = 'w');
// indicatori di legame ipertestuale, si faccia enable_link void disable_link(char fg, char bg = 'w');
// nella create. L' ID ritornato viene passato a process_link void disable_links() { printer().links().destroy(); }
// assieme al testo selezionato // se si setta multiple a TRUE anziche' la descrizione del testo selezionato
int enable_link (const char* descr, char fg, char bg = 'w'); // viene passata a enable_link una tokenstring con tutte i 'bottoni' dello
void disable_link(char fg, char bg = 'w'); // stesso colore presenti sulla riga
void disable_links() { printer().links().destroy(); } void set_multiple_link(bool on);
// se si setta multiple a TRUE anziche' la descrizione del testo selezionato
// viene passata a enable_link una tokenstring con tutte i 'bottoni' dello
// stesso colore presenti sulla riga // BACKGROUND PAINTING! Chefigata! poi vi spiego....
void set_multiple_link(bool on); void set_background(const char* bgdesc = NULL);
// BACKGROUND PAINTING! Chefigata! poi vi spiego.... // ---------------------------------------------
void set_background(const char* bgdesc = NULL); // set/select cursor
// ---------------------------------------------
// selects i-th cursor
// --------------------------------------------- // inutile se c'e' un cursore solo
// set/select cursor void select_cursor(int i);
// ---------------------------------------------
// selects i-th cursor // return i-th cursor without making it current
// inutile se c'e' un cursore solo TCursor* get_cursor(int i);
void select_cursor(int i); // returns maximum row defined
int get_maxrow() { return _maxrow; }
// return i-th cursor without making it current
TCursor* get_cursor(int i); // adds cursor to class; return identifier
// returns maximum row defined // cursor* can be NULL: no file is used but
int get_maxrow() { return _maxrow; } // print_one is called and iterations are performed
// by pre_ and post_ process
// adds cursor to class; return identifier int add_cursor(TCursor* c);
// cursor* can be NULL: no file is used but
// print_one is called and iterations are performed // retrieve current cursor
// by pre_ and post_ process TCursor* current_cursor() { return _cur; }
int add_cursor(TCursor* c);
// ---------------------------------------------
// retrieve current cursor // set_auto_ff(TRUE) fa si' che dopo ogni pagina logica (relativa ad
TCursor* current_cursor() { return _cur; } // un record) si stampi un form feed. (anche se il cursore e' nullo)
void set_auto_ff( bool b = TRUE)
// --------------------------------------------- { _auto_ff = b; }
// set_auto_ff(TRUE) fa si' che dopo ogni pagina logica (relativa ad
// un record) si stampi un form feed. (anche se il cursore e' nullo) // il carattere specificato con set_fillchar (default ' ') viene
void set_auto_ff( bool b = TRUE) // usato per riempire davanti e dietro i campi in cui si e' specificata
{ _auto_ff = b; } // una dimensione maggiore della lunghezza effettiva del contenuto,
// (a meno che non si sia usato un codice di formato maiuscolo)
// il carattere specificato con set_fillchar (default ' ') viene void set_fillchar(char c)
// usato per riempire davanti e dietro i campi in cui si e' specificata { _fillchar = c; }
// una dimensione maggiore della lunghezza effettiva del contenuto,
// (a meno che non si sia usato un codice di formato maiuscolo) // riempie di righe vuote la pagina corrente fino alla dimensione
void set_fillchar(char c) // della pagina
{ _fillchar = c; } void fill_page(int from = -1);
// riempie di righe vuote la pagina corrente fino alla dimensione // di solito basta e avanza quella di default
// della pagina virtual bool menu(MENU_TAG m);
void fill_page(int from = -1);
virtual word class_id() const { return CLASS_PRINT_APPLICATION; }
// di solito basta e avanza quella di default
virtual bool menu(MENU_TAG m); // print menu is enabled when set_print returns TRUE
void enable_print_menu();
// print menu is enabled when set_print returns TRUE void disable_print_menu();
void enable_print_menu(); void enable_setprint_menu();
void disable_print_menu(); void disable_setprint_menu();
void enable_setprint_menu();
void disable_setprint_menu(); // header/footer (printf, not set_row analogues)
// only understand @-codes for setting font attributes,
// header/footer (printf, not set_row analogues) // date and page number
// only understand @-codes for setting font attributes, // plus every printf %-code
// date and page number
// plus every printf %-code // con queste si possono ridefinire header e footer al
// verificarsi di condizioni durante la stampa
// con queste si possono ridefinire header e footer al virtual void preprocess_header() {}
// verificarsi di condizioni durante la stampa virtual void preprocess_footer() {}
virtual void preprocess_header() {}
virtual void preprocess_footer() {} void set_header(int row, const char* fmt, ...);
void set_footer(int row, const char* fmt, ...);
void set_header(int row, const char* fmt, ...); void reset_header();
void set_footer(int row, const char* fmt, ...); void reset_footer();
void reset_header();
void reset_footer(); // vedi sopra per capire
void reset_files() { _reset_tree(_pr_tree); _pr_tree = NULL; }
// vedi sopra per capire void add_file(int file, int from = 0);
void reset_files() { _reset_tree(_pr_tree); _pr_tree = NULL; } void add_file(const char* tab, int from = 0);
void add_file(int file, int from = 0);
void add_file(const char* tab, int from = 0); // set default picture for reals
void set_real_picture(const char* p) { _picture = p; }
// set default picture for reals void set_print_zero(bool b = TRUE) { _print_zero = b; }
void set_real_picture(const char* p) { _picture = p; }
void set_print_zero(bool b = TRUE) { _print_zero = b; } // progress indicator control
void set_wait_message(const char* m)
// progress indicator control { _wmess = m; }
void set_wait_message(const char* m) void set_wait_bar(bool m)
{ _wmess = m; } // default yes
void set_wait_bar(bool m) { _wbar = m; }
// default yes void set_wait_cancel(bool m)
{ _wbar = m; } // default yes
void set_wait_cancel(bool m) { _wcancel = m; }
// default yes void set_wait_threshold(int m)
{ _wcancel = m; } // minimum number of print items to show progress indicator;
void set_wait_threshold(int m) // default 2
// minimum number of print items to show progress indicator; { _wthr = m; }
// default 2
{ _wthr = m; } // questa forza la progind anche se si stampa su video
void force_progind(bool b = TRUE)
// questa forza la progind anche se si stampa su video { _force_progind = b; }
void force_progind(bool b = TRUE)
{ _force_progind = b; } // questa forza la rilettura delle setrow in set_page ad ogni
// record stampato, in modo che i dati siano
// questa forza la rilettura delle setrow in set_page ad ogni // sempre quelli del record corrente anche se si usano codici %
// record stampato, in modo che i dati siano // s'intende che rallenta un po' la stampa
// sempre quelli del record corrente anche se si usano codici % void force_setpage(bool b = TRUE)
// s'intende che rallenta un po' la stampa { _force_setpage = b; }
void force_setpage(bool b = TRUE)
{ _force_setpage = b; } void set_config_file(const char* s)
{ _confpr = s; }
void set_config_file(const char* s) word get_page_number()
{ _confpr = s; } { return printer().getcurrentpage(); }
word get_page_number() void set_page_number(word n)
{ return printer().getcurrentpage(); } { printer().setcurrentpage(n); }
void set_page_number(word n)
{ printer().setcurrentpage(n); }
void set_n_copies(int n) { _ncopies = n; }
int get_n_copies() { return _ncopies; }
void set_n_copies(int n) { _ncopies = n; } void repeat_print() { _repeat_print = TRUE; }
int get_n_copies() { return _ncopies; }
void repeat_print() { _repeat_print = TRUE; } TPrint_application();
virtual ~TPrint_application();
TPrint_application(); };
virtual ~TPrint_application();
}; // buon divertimento
// buon divertimento
#endif
#endif

View File

@ -39,8 +39,7 @@ PrintWhat;
#include <windows.h> #include <windows.h>
void TPrinter :: void TPrinter::_get_windows_printer_names (TToken_string & t)
_get_windows_printer_names (TToken_string & t)
{ {
char *buf = new char[4096]; // ammazzao' char *buf = new char[4096]; // ammazzao'
@ -57,8 +56,7 @@ _get_windows_printer_names (TToken_string & t)
delete buf; delete buf;
} }
BOOLEAN TPrinter :: BOOLEAN TPrinter::start_winprint (long data)
start_winprint (long data)
{ {
PrDesc *pd = (PrDesc *) data; PrDesc *pd = (PrDesc *) data;
TTextfile & txt = *(pd->_txt); TTextfile & txt = *(pd->_txt);
@ -70,8 +68,7 @@ start_winprint (long data)
#endif #endif
// utils del caz // utils del caz
HIDDEN void HIDDEN void read_int (const char *s, int &n, int &cnt)
read_int (const char *s, int &n, int &cnt)
{ {
static char nbuf[10]; static char nbuf[10];
int j = 0; int j = 0;
@ -84,8 +81,7 @@ read_int (const char *s, int &n, int &cnt)
} }
#if XVT_OS == XVT_OS_WIN #if XVT_OS == XVT_OS_WIN
void TPrinter :: void TPrinter::set_win_formlen ()
set_win_formlen ()
{ {
long pw, ph, phr, pvr; long pw, ph, phr, pvr;
xvt_escape (XVT_ESC_GET_PRINTER_INFO, _print_rcd, &ph, &pw, &pvr, &phr); xvt_escape (XVT_ESC_GET_PRINTER_INFO, _print_rcd, &ph, &pw, &pvr, &phr);
@ -98,13 +94,12 @@ set_win_formlen ()
} }
else else
warning_box ("Il driver di stampante non e' valido. Non stampare prima di averlo" warning_box ("Il driver di stampante non e' valido.\n"
" reinstallato"); "Non stampare prima di averlo reinstallato");
} }
#endif #endif
void TPrinter :: void TPrinter::_parse_background ()
_parse_background ()
{ {
char op; char op;
int x1, x2, y1, y2; int x1, x2, y1, y2;
@ -285,8 +280,7 @@ _parse_background ()
} }
} }
void TPrinter :: void TPrinter::setbackground (const char *b)
setbackground (const char *b)
{ {
_background.destroy (); _background.destroy ();
_bg_desc = b; _bg_desc = b;
@ -609,7 +603,7 @@ bool printers_on_key (TMask_field & f, KEY key)
{ {
TToken_string pn1 (10), pn2 (20); TToken_string pn1 (10), pn2 (20);
const PrinterDef & def = MainApp ()->printer ().get_description (atoi (f.get ())); const PrinterDef & def = MainApp()->printer().get_description(atoi(f.get ()));
const char *s; const char *s;
int j = 0; int j = 0;
while ((s = def.get_codenames (j)) != NULL) while ((s = def.get_codenames (j)) != NULL)
@ -630,24 +624,25 @@ bool set_windows_print_device (TMask_field & f, KEY key)
static char szDevice[80]; static char szDevice[80];
if (key == K_SPACE) if (key == K_SPACE)
{ {
if (MainApp ()->printer ().get_printrcd () != NULL) if (MainApp()->printer().get_printrcd() != NULL)
free_print_rcd (MainApp ()->printer ().get_printrcd ()); free_print_rcd (MainApp ()->printer().get_printrcd ());
TToken_string & pn = MainApp ()->printer ().getprinternames (); TToken_string & pn = MainApp()->printer().getprinternames ();
TString pdev (pn.get (atoi (f.get ()))); TString pdev (pn.get (atoi (f.get ())));
GetProfileString ("devices", pdev, "", szDevice, sizeof (szDevice)); GetProfileString ("devices", pdev, "", szDevice, sizeof (szDevice));
pdev << "," << szDevice; pdev << "," << szDevice;
// WriteProfileString("windows","device", pdev); // WriteProfileString("windows","device", pdev);
// madonna bona // madonna bona
MainApp ()->printer ().set_printrcd (get_print_rcd (&(MainApp ()->printer ().get_printrcdsize ()))); MainApp()->printer().set_printrcd(get_print_rcd (&(MainApp ()->printer ().get_printrcdsize ())));
MainApp ()->printer ().set_win_formlen (); MainApp()->printer().set_win_formlen();
} }
return TRUE; return TRUE;
} }
#endif #endif
TPrinter :: TPrinter ():_date (TODAY), _multiple_link (FALSE), _frozen (FALSE), _isgraphics (TRUE), TPrinter::TPrinter()
_lines_per_inch (6), _ch_size (12) : _date (TODAY), _multiple_link (FALSE), _frozen (FALSE), _isgraphics (TRUE),
_lines_per_inch (6), _ch_size (12)
{ {
_footerhandler = _headerhandler = NULL; _footerhandler = _headerhandler = NULL;
@ -1140,7 +1135,7 @@ void TPrinter::set()
TToken_string pn1 (50), pn2 (100); TToken_string pn1 (50), pn2 (100);
int i; int i;
MainApp ()->disable_menu_item (M_FILE_PG_SETUP); MainApp()->disable_menu_item (M_FILE_PG_SETUP);
#if XVT_OS != XVT_OS_WIN #if XVT_OS != XVT_OS_WIN
@ -1176,7 +1171,12 @@ void TPrinter::set()
mask.set (MSK_1_PRINTERS, format ("%d", _curprn)); mask.set (MSK_1_PRINTERS, format ("%d", _curprn));
mask.set (MSK_1_CODES, format ("%d", _curcode)); mask.set (MSK_1_CODES, format ("%d", _curcode));
mask.set (MSK_1_FILENAME, _printerfile); mask.set (MSK_1_FILENAME, _printerfile);
mask.set (MSK_1_NPAGES, format("%d",((TPrint_application*)MainApp())->get_n_copies()));
int nc = 1;
if (MainApp()->class_id() == CLASS_PRINT_APPLICATION)
nc = ((TPrint_application*)MainApp())->get_n_copies();
mask.set(MSK_1_NPAGES, nc);
mask.reset (MSK_1_SAVE); mask.reset (MSK_1_SAVE);
if (mask.run () == K_ESC) if (mask.run () == K_ESC)
@ -1195,8 +1195,10 @@ void TPrinter::set()
// get user choices // get user choices
_curprn = atoi(mask.get(MSK_1_PRINTERS)); _curprn = atoi(mask.get(MSK_1_PRINTERS));
((TPrint_application*)MainApp())->set_n_copies(atoi (mask.get (MSK_1_NPAGES))); if (MainApp()->class_id() == CLASS_PRINT_APPLICATION)
((TPrint_application*)MainApp())->set_n_copies(atoi(mask.get(MSK_1_NPAGES)));
PrinterDef& def = (PrinterDef &) get_description (_curprn); PrinterDef& def = (PrinterDef &) get_description (_curprn);
switch (atoi(mask.get (MSK_1_TYPE))) switch (atoi(mask.get (MSK_1_TYPE)))
{ {
@ -1237,13 +1239,17 @@ void TPrinter::set()
for (i = 0; i < pn2.items (); i++) for (i = 0; i < pn2.items (); i++)
pn1.add(i); pn1.add(i);
((TList_field &) (mask.field (MSK_1_PRINTERS))).replace_items (pn1, pn2); ((TList_field &) (mask.field (MSK_1_PRINTERS))).replace_items(pn1, pn2);
mask.set (MSK_1_PRINTERS, pn1.get (_curprn)); mask.set(MSK_1_PRINTERS, pn1.get(_curprn));
mask.hide (MSK_1_CODES); mask.hide(MSK_1_CODES);
mask.set (MSK_1_ISGRAPHICS, _isgraphics ? "X" : ""); mask.set(MSK_1_ISGRAPHICS, _isgraphics ? "X" : "");
mask.set (MSK_1_SIZE, format ("%d", _ch_size)); mask.set(MSK_1_SIZE, _ch_size);
mask.set (MSK_1_LINES, format ("%d", _lines_per_inch)); mask.set(MSK_1_LINES, _lines_per_inch);
mask.set (MSK_1_NPAGES, format("%d",((TPrint_application*)MainApp())->get_n_copies()));
int nc = 1;
if (MainApp()->class_id() == CLASS_PRINT_APPLICATION)
nc = ((TPrint_application*)MainApp())->get_n_copies();
mask.set(MSK_1_NPAGES, nc);
if (_printertype == fileprinter) if (_printertype == fileprinter)
mask.set (MSK_1_TYPE, "1"); mask.set (MSK_1_TYPE, "1");
@ -1293,7 +1299,7 @@ void TPrinter::set()
_curprn = oldprn; _curprn = oldprn;
_print_rcd = get_print_rcd(&_print_rcd_size); _print_rcd = get_print_rcd(&_print_rcd_size);
set_win_formlen (); set_win_formlen ();
MainApp ()->enable_menu_item (M_FILE_PG_SETUP); MainApp()->enable_menu_item(M_FILE_PG_SETUP);
return; return;
} }
@ -1304,8 +1310,11 @@ void TPrinter::set()
TString s ("printer.def"); TString s ("printer.def");
mask.set_workfile (s); mask.set_workfile (s);
mask.save (); mask.save ();
} }
((TPrint_application*)MainApp())->set_n_copies(atoi (mask.get (MSK_1_NPAGES)));
if (MainApp()->class_id() == CLASS_PRINT_APPLICATION)
((TPrint_application*)MainApp())->set_n_copies(atoi (mask.get (MSK_1_NPAGES)));
switch (atoi (mask.get (MSK_1_TYPE))) switch (atoi (mask.get (MSK_1_TYPE)))
{ {
case 0: // stampante case 0: // stampante

View File

@ -100,7 +100,7 @@ class PrinterDef : public TObject
TArray _codes; // print codes TArray _codes; // print codes
TArray _names; // name of print codes TArray _names; // name of print codes
TString _ffcode; // formfeed code for the current printer TString _ffcode; // formfeed code for the current printer
TString _nlcode; // special newline code for the current printer TString _nlcode; // special newline code for the current printer
public: public:
bool read(const char* name, FILE* fd); // read description from file; bool read(const char* name, FILE* fd); // read description from file;
@ -157,7 +157,7 @@ class TPrinter : public TObject
const char* _bg_desc; const char* _bg_desc;
TToken_string _printer_names; TToken_string _printer_names;
bool _isgraphics; bool _isgraphics;
bool _frozen; bool _frozen;
#if XVT_OS == XVT_OS_WIN #if XVT_OS == XVT_OS_WIN
PRINT_RCD* _print_rcd; PRINT_RCD* _print_rcd;
int _print_rcd_size; int _print_rcd_size;
@ -168,7 +168,7 @@ class TPrinter : public TObject
int _dots_per_line; int _dots_per_line;
void _parse_background(); void _parse_background();
void _get_windows_printer_names(TToken_string& t); void _get_windows_printer_names(TToken_string& t);
PRINTSECTIONHANDLER _headerhandler, _footerhandler; PRINTSECTIONHANDLER _headerhandler, _footerhandler;
LINKHANDLER _linkhandler; LINKHANDLER _linkhandler;
@ -227,11 +227,11 @@ public:
void resetfooter(); void resetfooter();
void setbackground(const char* bg); void setbackground(const char* bg);
TArray* getbgdesc() { return &_background; } TArray* getbgdesc() { return &_background; }
bool frozen() { return _frozen; } bool frozen() { return _frozen; }
void freeze(bool b = TRUE) { _frozen = b; } void freeze(bool b = TRUE) { _frozen = b; }
TToken_string& getprinternames(); TToken_string& getprinternames();
TTextfile& get_txt() { return _txt; } TTextfile& get_txt() { return _txt; }
void setheaderhandler(PRINTSECTIONHANDLER h) { _headerhandler = h; } void setheaderhandler(PRINTSECTIONHANDLER h) { _headerhandler = h; }
void setfooterhandler(PRINTSECTIONHANDLER h) { _footerhandler = h; } void setfooterhandler(PRINTSECTIONHANDLER h) { _footerhandler = h; }
@ -241,7 +241,7 @@ public:
// completamente anche da un'altra application // completamente anche da un'altra application
void setlinkhandler(LINKHANDLER h) { _linkhandler = h; } void setlinkhandler(LINKHANDLER h) { _linkhandler = h; }
LINKHANDLER getlinkhandler() { return _linkhandler; } LINKHANDLER getlinkhandler() { return _linkhandler; }
TArray& links() { return _linksdescr; } TArray& links() { return _linksdescr; }
void setmultiplelink(bool on) { _multiple_link = on; } void setmultiplelink(bool on) { _multiple_link = on; }
bool ismultiplelink() { return _multiple_link; } bool ismultiplelink() { return _multiple_link; }

View File

@ -1,36 +1,36 @@
BUTTON DLG_SAVEREC 8 2 BUTTON DLG_SAVEREC 8 2
BEGIN BEGIN
PROMPT -16 -1 "~Registra" PROMPT -16 -1 "~Registra"
MESSAGE EXIT,K_SAVE MESSAGE EXIT,K_SAVE
END END
BUTTON DLG_NEWREC 8 2 BUTTON DLG_NEWREC 8 2
BEGIN BEGIN
PROMPT -26 -1 "~Nuovo" PROMPT -26 -1 "~Nuovo"
MESSAGE EXIT,K_INS MESSAGE EXIT,K_INS
END END
BUTTON DLG_DELREC 8 2 BUTTON DLG_DELREC 8 2
BEGIN BEGIN
PROMPT -36 -1 "~Elimina" PROMPT -36 -1 "~Elimina"
MESSAGE EXIT,K_DEL MESSAGE EXIT,K_DEL
END END
BUTTON DLG_FINDREC 8 2 BUTTON DLG_FINDREC 8 2
BEGIN BEGIN
PROMPT -46 -1 "Ri~cerca" PROMPT -46 -1 "Ri~cerca"
MESSAGE EXIT,K_F9 MESSAGE EXIT,K_F9
END END
BUTTON DLG_CANCEL 8 2 BUTTON DLG_CANCEL 8 2
BEGIN BEGIN
PROMPT -56 -1 "" PROMPT -56 -1 ""
MESSAGE EXIT,K_ESC MESSAGE EXIT,K_ESC
END END
BUTTON DLG_QUIT 8 2 BUTTON DLG_QUIT 8 2
BEGIN BEGIN
PROMPT -66 -1 "" PROMPT -66 -1 ""
MESSAGE EXIT,K_QUIT MESSAGE EXIT,K_QUIT
END END

View File

@ -211,7 +211,7 @@ RCT& resize_rect(short x, short y, short dx, short dy, WIN_TYPE wt, WINDOW paren
if (get_window_type(parent) == W_PLAIN) // Mask with Toolbar if (get_window_type(parent) == W_PLAIN) // Mask with Toolbar
{ {
if (y >= 0) y++; if (y >= 0) y++;
if (x >= 0 && wt != WO_TE) if (x > 0 || (wt != WO_TE && x == 0))
{ {
const int width = (int)get_value(NULL_WIN, ATTR_SCREEN_WIDTH); const int width = (int)get_value(NULL_WIN, ATTR_SCREEN_WIDTH);
if (width > 640) x += (width-640) / (2*COLX); if (width > 640) x += (width-640) / (2*COLX);
@ -526,14 +526,14 @@ WINDOW xvt_create_window(WIN_TYPE wt,
CHECKD(win, "Can't create a window: XVT error ", get_xvterrno()); CHECKD(win, "Can't create a window: XVT error ", get_xvterrno());
#if XVT_OS == XVT_OS_WIN #if XVT_OS == XVT_OS_WIN
static bool set = TRUE; static bool to_set = TRUE;
if (set) if (to_set)
{ {
HWND hwnd = (HWND)get_value(win, ATTR_NATIVE_WINDOW); HWND hwnd = (HWND)get_value(win, ATTR_NATIVE_WINDOW);
word style = GetClassWord(hwnd, GCW_STYLE); word style = GetClassWord(hwnd, GCW_STYLE);
style |= CS_BYTEALIGNCLIENT | CS_SAVEBITS; style |= CS_BYTEALIGNCLIENT | CS_SAVEBITS;
SetClassWord(hwnd, GCW_STYLE, style); SetClassWord(hwnd, GCW_STYLE, style);
set = FALSE; to_set = FALSE;
} }
#endif #endif