CCorretta gestione numero copie
git-svn-id: svn://10.65.10.50/trunk@242 c028cbd2-c16b-5b4b-a496-9718f37d4682
This commit is contained in:
parent
7696ebc104
commit
c1e97ca1f9
@ -33,20 +33,6 @@ HIDDEN long backdrop_eh( WINDOW win, EVENT* ep)
|
||||
clear_window( win, COLOR_BLUE );
|
||||
#else
|
||||
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
|
||||
|
||||
return 0L;
|
||||
@ -57,7 +43,7 @@ HIDDEN void create_backdrop( void )
|
||||
#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_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_DISABLED, COLOR_GRAY, 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();
|
||||
|
||||
///////////////////////////////////////////////////////////
|
||||
// It seems necessary to restore these things
|
||||
// We need to restore these things
|
||||
///////////////////////////////////////////////////////////
|
||||
customize_controls(TRUE);
|
||||
xvt_statbar_refresh();
|
||||
|
@ -1,93 +1,94 @@
|
||||
#ifndef __APPLICATION_H
|
||||
#define __APPLICATION_H
|
||||
|
||||
#ifndef INCL_XVTH
|
||||
#include <xvt.h>
|
||||
#endif
|
||||
|
||||
#ifndef __PRINTER_H
|
||||
#include <printer.h>
|
||||
#endif
|
||||
|
||||
#ifndef __MODAUT_H
|
||||
//#include <modaut.h>
|
||||
#endif
|
||||
|
||||
// @C
|
||||
// Classe TApplication
|
||||
// @END
|
||||
|
||||
#define MSG_AI "AI" // message auto_insert (relapp)
|
||||
#define MSG_FS "FS" // message filtered start (relapp)
|
||||
#define MSG_LN "LN" // message (printapp -> relapp)
|
||||
|
||||
class TApplication
|
||||
{
|
||||
// @DPRIV
|
||||
int _bar;
|
||||
int __argc;
|
||||
const char** __argv;
|
||||
|
||||
TString80 _name, _title;
|
||||
TPrinter* _printer;
|
||||
|
||||
protected:
|
||||
const char* get_module_name() const;
|
||||
static long task_eh(WINDOW win, EVENT* ep);
|
||||
|
||||
virtual long handler(WINDOW win, EVENT* ep);
|
||||
virtual bool extended_firm() const { return FALSE; } // Extended set_firm dialog box?
|
||||
|
||||
void terminate();
|
||||
bool config();
|
||||
void about() const;
|
||||
|
||||
public:
|
||||
// @FPUB
|
||||
|
||||
void setbar(int menubar) { _bar = menubar;} // Modifica la menu-bar
|
||||
void run(int argc, char* argv[], const char* name);
|
||||
|
||||
// @DES Queste funzioni possono essere ridefinite da ogni applicazione
|
||||
// @FPUB
|
||||
virtual bool create(); // Crea la finestra principale
|
||||
virtual bool menu(MENU_TAG) { return TRUE; } // Controlla il menu
|
||||
virtual bool destroy(); // Rimuove l'applicazione
|
||||
virtual void print();
|
||||
void stop_run(); // Forza chiusura applicazione
|
||||
|
||||
void check_menu_item(MENU_TAG item); // Check menu
|
||||
void uncheck_menu_item(MENU_TAG item); // Uncheck
|
||||
void enable_menu_item(MENU_TAG item, bool on = TRUE);
|
||||
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 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 wait_for(const char* name);
|
||||
void wake_up_caller() const;
|
||||
|
||||
TPrinter* set_printer(TPrinter* p);
|
||||
TPrinter& printer();
|
||||
|
||||
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);
|
||||
long get_firm() const;
|
||||
const char* get_firm_dir() const;
|
||||
|
||||
TApplication();
|
||||
virtual ~TApplication();
|
||||
};
|
||||
|
||||
bool xvt_running(); // xvt is running?
|
||||
TApplication* MainApp(); // main application
|
||||
|
||||
#endif // __APPLICATION_H
|
||||
#ifndef __APPLICATION_H
|
||||
#define __APPLICATION_H
|
||||
|
||||
#ifndef INCL_XVTH
|
||||
#include <xvt.h>
|
||||
#endif
|
||||
|
||||
#ifndef __PRINTER_H
|
||||
#include <printer.h>
|
||||
#endif
|
||||
|
||||
#ifndef __MODAUT_H
|
||||
//#include <modaut.h>
|
||||
#endif
|
||||
|
||||
// @C
|
||||
// Classe TApplication
|
||||
// @END
|
||||
|
||||
#define MSG_AI "AI" // message auto_insert (relapp)
|
||||
#define MSG_FS "FS" // message filtered start (relapp)
|
||||
#define MSG_LN "LN" // message (printapp -> relapp)
|
||||
|
||||
class TApplication
|
||||
{
|
||||
// @DPRIV
|
||||
int _bar;
|
||||
int __argc;
|
||||
const char** __argv;
|
||||
|
||||
TString80 _name, _title;
|
||||
TPrinter* _printer;
|
||||
|
||||
protected:
|
||||
const char* get_module_name() const;
|
||||
static long task_eh(WINDOW win, EVENT* ep);
|
||||
|
||||
virtual long handler(WINDOW win, EVENT* ep);
|
||||
virtual bool extended_firm() const { return FALSE; } // Extended set_firm dialog box?
|
||||
|
||||
void terminate();
|
||||
bool config();
|
||||
void about() const;
|
||||
|
||||
public:
|
||||
// @FPUB
|
||||
|
||||
void setbar(int menubar) { _bar = menubar;} // Modifica la menu-bar
|
||||
void run(int argc, char* argv[], const char* name);
|
||||
|
||||
// @DES Queste funzioni possono essere ridefinite da ogni applicazione
|
||||
// @FPUB
|
||||
virtual bool create(); // Crea la finestra principale
|
||||
virtual bool menu(MENU_TAG) { return TRUE; } // Controlla il menu
|
||||
virtual bool destroy(); // Rimuove l'applicazione
|
||||
virtual void print();
|
||||
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 enable_menu_item(MENU_TAG item, bool on = TRUE);
|
||||
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 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 wait_for(const char* name);
|
||||
void wake_up_caller() const;
|
||||
|
||||
TPrinter* set_printer(TPrinter* p);
|
||||
TPrinter& printer();
|
||||
|
||||
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);
|
||||
long get_firm() const;
|
||||
const char* get_firm_dir() const;
|
||||
|
||||
TApplication();
|
||||
virtual ~TApplication();
|
||||
};
|
||||
|
||||
bool xvt_running(); // xvt is running?
|
||||
TApplication* MainApp(); // main application
|
||||
|
||||
#endif // __APPLICATION_H
|
||||
|
@ -15,6 +15,9 @@
|
||||
#define CLASS_FILENAME 12
|
||||
#define CLASS_TOKEN_STRING 13
|
||||
|
||||
#define CLASS_APPLICATION 40
|
||||
#define CLASS_PRINT_APPLICATION 41
|
||||
|
||||
#define CLASS_PRINTROW 50
|
||||
#define CLASS_PRINTER 51
|
||||
|
||||
|
@ -1,122 +1,128 @@
|
||||
// fv 6/10/93
|
||||
|
||||
#include <stdio.h>
|
||||
|
||||
#include <xvt.h>
|
||||
|
||||
#if XVT_OS == XVT_OS_SCOUNIX
|
||||
#include <sys/fcntl.h>
|
||||
#include <sys/wait.h>
|
||||
#endif
|
||||
|
||||
#if XVT_OS == XVT_OS_WIN
|
||||
#include <windows.h>
|
||||
#include <applicat.h>
|
||||
#endif
|
||||
|
||||
#if XVT_OS == XVT_OS_DOS
|
||||
#include <holdev.h>
|
||||
#endif
|
||||
|
||||
#include <execp.h>
|
||||
|
||||
|
||||
// char _path[120]; // app name
|
||||
// int _error; // last error
|
||||
// int _exitcode; // last exit code
|
||||
// int _count; // count of calls returning 0
|
||||
// int error() { return _error};
|
||||
// int exitcode() { return _exitcode};
|
||||
// int count() { return _count; };
|
||||
|
||||
int TExternal_app::run(bool async)
|
||||
{
|
||||
|
||||
_error = 0;
|
||||
_exitcode = 0;
|
||||
|
||||
// save cwd
|
||||
save_dir();
|
||||
|
||||
|
||||
#if XVT_OS == XVT_OS_DOS
|
||||
|
||||
// ems swap
|
||||
setems(1);
|
||||
// *** BLinker support; uncomment as needed
|
||||
// BLIUNHOOK();
|
||||
// *******************
|
||||
char* s = getenv("TMPDIR");
|
||||
if (s == NULL)
|
||||
_exitcode = holdev("\\tmp;",0,_path);
|
||||
else
|
||||
_exitcode = holdev(s,0,_path);
|
||||
// *** BLinker support; uncomment as needed
|
||||
// BLREINIT();
|
||||
// *******************
|
||||
if (!_exitcode)
|
||||
_exitcode = childret();
|
||||
else
|
||||
_exitcode = -_exitcode;
|
||||
xvt_escape(XVT_ESC_CH_REFRESH);
|
||||
|
||||
#elif XVT_OS == XVT_OS_WIN
|
||||
set_cursor(TASK_WIN, CURSOR_WAIT);
|
||||
_exitcode = WinExec((char*)_path, SW_SHOW);
|
||||
if (!async) MainApp()->wait_for(_path);
|
||||
set_cursor(TASK_WIN, CURSOR_ARROW);
|
||||
#else
|
||||
|
||||
switch (fork())
|
||||
{
|
||||
case -1:
|
||||
_error = errno;
|
||||
_exitcode = -1;
|
||||
break;
|
||||
case 0:
|
||||
const char* s = strdup(_path);
|
||||
char* p = strchr(s, ' ');
|
||||
if (p) *p = '\0';
|
||||
const char* pathn = strdup(s);
|
||||
const char* args[21];
|
||||
int i = 0;
|
||||
args[i++] = pathn;
|
||||
while ((i < 20) && (p))
|
||||
{
|
||||
s = p + 1;
|
||||
p = strchr(s, ' ');
|
||||
if (p) *p = '\0';
|
||||
args[i++] = strdup(s);
|
||||
}
|
||||
args[i] = NULL;
|
||||
for (i = 3; i < _NFILE; i++) fcntl(i,F_SETFD,1);
|
||||
// execvp(_path, NULL);
|
||||
execvp ( pathn , args );
|
||||
exit ( -1 );
|
||||
default:
|
||||
if(wait(&_exitcode) == -1)
|
||||
_exitcode = -1;
|
||||
else _exitcode = _exitcode >> 8;
|
||||
break;
|
||||
}
|
||||
_error = errno;
|
||||
xvt_escape(XVT_ESC_CH_REFRESH);
|
||||
|
||||
#endif
|
||||
|
||||
// restore cwd
|
||||
restore_dir();
|
||||
|
||||
// update counts
|
||||
if (_exitcode == 0)
|
||||
_count++;
|
||||
return _exitcode;
|
||||
}
|
||||
|
||||
TExternal_app::TExternal_app(const char* p)
|
||||
{
|
||||
_path = p;
|
||||
_count = 0;
|
||||
_error = 0;
|
||||
_exitcode = 0;
|
||||
}
|
||||
// fv 6/10/93
|
||||
|
||||
#include <stdio.h>
|
||||
|
||||
#include <xvt.h>
|
||||
|
||||
#if XVT_OS == XVT_OS_SCOUNIX
|
||||
#include <sys/fcntl.h>
|
||||
#include <sys/wait.h>
|
||||
#endif
|
||||
|
||||
#if XVT_OS == XVT_OS_WIN
|
||||
#include <windows.h>
|
||||
#include <applicat.h>
|
||||
#endif
|
||||
|
||||
#if XVT_OS == XVT_OS_DOS
|
||||
#include <holdev.h>
|
||||
#endif
|
||||
|
||||
#include <execp.h>
|
||||
|
||||
|
||||
// char _path[120]; // app name
|
||||
// int _error; // last error
|
||||
// int _exitcode; // last exit code
|
||||
// int _count; // count of calls returning 0
|
||||
// int error() { return _error};
|
||||
// int exitcode() { return _exitcode};
|
||||
// int count() { return _count; };
|
||||
|
||||
int TExternal_app::run(bool async)
|
||||
{
|
||||
|
||||
_error = 0;
|
||||
_exitcode = 0;
|
||||
|
||||
// save cwd
|
||||
save_dir();
|
||||
|
||||
|
||||
#if XVT_OS == XVT_OS_DOS
|
||||
|
||||
// ems swap
|
||||
setems(1);
|
||||
// *** BLinker support; uncomment as needed
|
||||
// BLIUNHOOK();
|
||||
// *******************
|
||||
char* s = getenv("TMPDIR");
|
||||
if (s == NULL)
|
||||
_exitcode = holdev("\\tmp;",0,_path);
|
||||
else
|
||||
_exitcode = holdev(s,0,_path);
|
||||
// *** BLinker support; uncomment as needed
|
||||
// BLREINIT();
|
||||
// *******************
|
||||
if (!_exitcode)
|
||||
_exitcode = childret();
|
||||
else
|
||||
_exitcode = -_exitcode;
|
||||
xvt_escape(XVT_ESC_CH_REFRESH);
|
||||
|
||||
#elif XVT_OS == XVT_OS_WIN
|
||||
set_cursor(TASK_WIN, CURSOR_WAIT);
|
||||
_exitcode = WinExec((char*)_path, SW_SHOW);
|
||||
if (_exitcode >= 32)
|
||||
{
|
||||
if (!async) MainApp()->wait_for(_path);
|
||||
_exitcode = 0;
|
||||
}
|
||||
else error_box("Impossibile eseguire %s", (const char*)_path);
|
||||
|
||||
set_cursor(TASK_WIN, CURSOR_ARROW);
|
||||
#else
|
||||
|
||||
switch (fork())
|
||||
{
|
||||
case -1:
|
||||
_error = errno;
|
||||
_exitcode = -1;
|
||||
break;
|
||||
case 0:
|
||||
const char* s = strdup(_path);
|
||||
char* p = strchr(s, ' ');
|
||||
if (p) *p = '\0';
|
||||
const char* pathn = strdup(s);
|
||||
const char* args[21];
|
||||
int i = 0;
|
||||
args[i++] = pathn;
|
||||
while ((i < 20) && (p))
|
||||
{
|
||||
s = p + 1;
|
||||
p = strchr(s, ' ');
|
||||
if (p) *p = '\0';
|
||||
args[i++] = strdup(s);
|
||||
}
|
||||
args[i] = NULL;
|
||||
for (i = 3; i < _NFILE; i++) fcntl(i,F_SETFD,1);
|
||||
// execvp(_path, NULL);
|
||||
execvp ( pathn , args );
|
||||
exit ( -1 );
|
||||
default:
|
||||
if(wait(&_exitcode) == -1)
|
||||
_exitcode = -1;
|
||||
else _exitcode = _exitcode >> 8;
|
||||
break;
|
||||
}
|
||||
_error = errno;
|
||||
xvt_escape(XVT_ESC_CH_REFRESH);
|
||||
|
||||
#endif
|
||||
|
||||
// restore cwd
|
||||
restore_dir();
|
||||
|
||||
// update counts
|
||||
if (_exitcode == 0)
|
||||
_count++;
|
||||
return _exitcode;
|
||||
}
|
||||
|
||||
TExternal_app::TExternal_app(const char* p)
|
||||
{
|
||||
_path = p;
|
||||
_count = 0;
|
||||
_error = 0;
|
||||
_exitcode = 0;
|
||||
}
|
||||
|
@ -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)
|
||||
{
|
||||
#ifdef DBG
|
||||
clock1 = clock();
|
||||
#endif
|
||||
|
||||
_source_file = name;
|
||||
_source_file.ext(MASK_EXT);
|
||||
@ -258,9 +256,7 @@ void TMask::read_mask(const char* name, int mode, int num)
|
||||
|
||||
add_buttons();
|
||||
|
||||
#ifdef DBG
|
||||
clock1 = clock()-clock1;
|
||||
#endif
|
||||
}
|
||||
|
||||
|
||||
@ -434,9 +430,7 @@ bool TMask::page_enabled(int page) const
|
||||
|
||||
void TMask::start_run()
|
||||
{
|
||||
#ifdef DBG
|
||||
clock2 = clock();
|
||||
#endif
|
||||
|
||||
load_checks();
|
||||
|
||||
@ -465,9 +459,7 @@ void TMask::start_run()
|
||||
}
|
||||
}
|
||||
|
||||
#ifdef DBG
|
||||
clock2 = clock() - clock2;
|
||||
#endif
|
||||
}
|
||||
|
||||
bool TMask::check_fields()
|
||||
|
@ -1,30 +1,30 @@
|
||||
#ifndef _FLD_MOV_H
|
||||
#define _FLD_MOV_H
|
||||
|
||||
#define MOV_ANNOES "ANNOES"
|
||||
#define MOV_ANNOIVA "ANNOIVA"
|
||||
#define MOV_NUMREG "NUMREG"
|
||||
#define MOV_DATAREG "DATAREG"
|
||||
#define MOV_TIPO "TIPO"
|
||||
#define MOV_CODCF "CODCF"
|
||||
#define MOV_DATADOC "DATADOC"
|
||||
#define MOV_NUMDOC "NUMDOC"
|
||||
#define MOV_TIPODOC "TIPODOC"
|
||||
#define MOV_TOTDOC "TOTDOC"
|
||||
#define MOV_CODCAUS "CODCAUS"
|
||||
#define MOV_DESCR "DESCR"
|
||||
#define MOV_TIPOMOV "TIPOMOV"
|
||||
#define MOV_REG "REG"
|
||||
#define MOV_PROTIVA "PROTIVA"
|
||||
#define MOV_UPROTIVA "UPROTIVA"
|
||||
#define MOV_CODVAL "CODVAL"
|
||||
#define MOV_CAMBIO "CAMBIO"
|
||||
#define MOV_STAMPATO "STAMPATO"
|
||||
#define MOV_NUMGIO "NUMGIO"
|
||||
#define MOV_PROVVIS "PROVVIS"
|
||||
#define MOV_OCFPI "OCFPI"
|
||||
#define MOV_CORRLIRE "CORRLIRE"
|
||||
#define MOV_CORRVALUTA "CORRVALUTA"
|
||||
|
||||
|
||||
#endif
|
||||
#ifndef _FLD_MOV_H
|
||||
#define _FLD_MOV_H
|
||||
|
||||
#define MOV_ANNOES "ANNOES"
|
||||
#define MOV_ANNOIVA "ANNOIVA"
|
||||
#define MOV_NUMREG "NUMREG"
|
||||
#define MOV_DATAREG "DATAREG"
|
||||
#define MOV_TIPO "TIPO"
|
||||
#define MOV_CODCF "CODCF"
|
||||
#define MOV_DATADOC "DATADOC"
|
||||
#define MOV_NUMDOC "NUMDOC"
|
||||
#define MOV_TIPODOC "TIPODOC"
|
||||
#define MOV_TOTDOC "TOTDOC"
|
||||
#define MOV_CODCAUS "CODCAUS"
|
||||
#define MOV_DESCR "DESCR"
|
||||
#define MOV_TIPOMOV "TIPOMOV"
|
||||
#define MOV_REG "REG"
|
||||
#define MOV_PROTIVA "PROTIVA"
|
||||
#define MOV_UPROTIVA "UPROTIVA"
|
||||
#define MOV_CODVAL "CODVAL"
|
||||
#define MOV_CAMBIO "CAMBIO"
|
||||
#define MOV_STAMPATO "STAMPATO"
|
||||
#define MOV_NUMGIO "NUMGIO"
|
||||
#define MOV_PROVVIS "PROVVIS"
|
||||
#define MOV_OCFPI "OCFPI"
|
||||
#define MOV_CORRLIRE "CORRLIRE"
|
||||
#define MOV_CORRVALUTA "CORRVALUTA"
|
||||
#define MOV_DATACOMP "DATACOMP"
|
||||
|
||||
#endif
|
||||
|
@ -616,11 +616,11 @@ break;
|
||||
if (ok) dispatch_e_char(parent(), k);
|
||||
}
|
||||
break;
|
||||
case K_ENTER:
|
||||
case K_ESC:
|
||||
case K_CTRL+K_ENTER:
|
||||
{
|
||||
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;
|
||||
|
||||
|
@ -1,473 +1,471 @@
|
||||
// trattasi di -*-c++-*-
|
||||
#ifndef __PRINTAPP_H
|
||||
#define __PRINTAPP_H
|
||||
|
||||
#ifndef __APPLICATION_H
|
||||
#include <applicat.h>
|
||||
#endif
|
||||
|
||||
#ifndef __PRINTER_H
|
||||
#include <printer.h>
|
||||
#endif
|
||||
|
||||
#ifndef __RELATION_H
|
||||
#include <relation.h>
|
||||
#endif
|
||||
|
||||
#ifndef __STRINGS_H
|
||||
#include <strings.h>
|
||||
#endif
|
||||
|
||||
// compatibility
|
||||
#define TPrintapp TPrint_application
|
||||
|
||||
|
||||
enum print_action { REPEAT_PAGE, NEXT_PAGE };
|
||||
|
||||
// user functions to pass field informations to setrow()
|
||||
// no class or nice C++ interface since varargs is nasty
|
||||
|
||||
// FLD(Num.logico, Nome campo [, da [, a]])
|
||||
const char* FLD(int lognum, const char* f, int from = -1, int to = -1);
|
||||
// FLD(Num. logico, Nome campo numerico, Picture string)
|
||||
const char* FLD(int lognum, const char* f, const char* picture);
|
||||
// FLD(Nome tabella, Nome campo numerico, Picture string)
|
||||
const char* FLD(const char* tabname, const char* f, const char* picture);
|
||||
// FLD(Num.logico, Nome campo [, da [, a]])
|
||||
const char* FLD(const char* tabname, const char* f, int from = -1, int to = -1);
|
||||
|
||||
struct link_item {
|
||||
int _logicnum;
|
||||
link_item* _son;
|
||||
link_item* _brother;
|
||||
int _cnt;
|
||||
|
||||
link_item(int l)
|
||||
{ _logicnum = l; _son = NULL; _brother = NULL; _cnt = 0; }
|
||||
};
|
||||
|
||||
class TProgind;
|
||||
|
||||
|
||||
class TPrint_application : public TApplication
|
||||
{
|
||||
TArray _rows; // rows descriptor
|
||||
TArray _cursors; // cursor array
|
||||
TCursor* _cur; // current cursor
|
||||
TArray _transtab; // field translation table
|
||||
TArray _header; // header lines
|
||||
TArray _footer; // footer lines
|
||||
int _currow; // current print row
|
||||
TPrintstyle _curstyle; // current print style
|
||||
bool _auto_ff; // automatic form feed after each page
|
||||
const char* _wmess; // wait message for progind
|
||||
bool _wbar; // bar y/n for progind
|
||||
bool _wcancel; // cancel button enabled
|
||||
int _wthr; // minimum # of items to show print progind
|
||||
const char* _confpr; // config filename for printer
|
||||
char _fillchar; // fill character for empty fields
|
||||
link_item* _pr_tree; // functions for autom. printing of relations
|
||||
int _maxrow; // reference to maxrow
|
||||
int _cur_file;
|
||||
bool _print_defined;
|
||||
bool _force_progind;
|
||||
bool _force_setpage;
|
||||
bool _print_zero;
|
||||
TProgind* _prind;
|
||||
const char* _picture;
|
||||
MENU_TAG _last_choice;
|
||||
int _ncopies;
|
||||
bool _repeat_print;
|
||||
|
||||
// set the printer
|
||||
void set_printer() { printer().set(); }
|
||||
// print a single record; does not advance cursor
|
||||
// returns failure or success
|
||||
bool print_one(int file);
|
||||
// to be documented but very fig
|
||||
bool print_tree(link_item* head);
|
||||
|
||||
static void _pp_header(TPrinter& pr);
|
||||
static void _pp_footer(TPrinter& pr);
|
||||
static void _pp_link(int id, const char* s);
|
||||
|
||||
link_item* _look_print_node(link_item* head, int logicnum);
|
||||
void _reset_tree(link_item* head);
|
||||
virtual bool create();
|
||||
virtual bool destroy();
|
||||
|
||||
|
||||
protected:
|
||||
|
||||
// ****************************************************
|
||||
// ISTRUZIONI PER l'USO
|
||||
// ****************************************************
|
||||
//
|
||||
// La Printapp, saggiamente, consente di operare su uno
|
||||
// o piu' cursori stampando automaticamente anche files
|
||||
// collegati. La sequenza delle operazioni e' la seguente:
|
||||
//
|
||||
// 1) Derivare una classe da TPrint_application
|
||||
// 2) Implementare user_create() e user_destroy();
|
||||
// Nella user_create() si creino i
|
||||
// necessari cursori, e li si dia in pasto a Printapp
|
||||
// usando add_cursor(). Si puo' fare add_cursor(new TCursor(...))
|
||||
// dato che il cursore viene distrutto automaticamente.
|
||||
// 3) Per ciascun file del cursore che si desidera porre
|
||||
// nell'albero di stampa, si faccia add_file(logicnum [,from]);
|
||||
// [from] sara' il file a cui e' collegato nella relazione.
|
||||
// add_file VA FATTA anche per il file principale, se no
|
||||
// non stampera' nulla;
|
||||
// *********************************************************
|
||||
// FUNZIONI VIRTUALI OBBLIGATORIE
|
||||
// *********************************************************
|
||||
// 4) Si definiscono le necessarie funzioni virtuali: e'
|
||||
// sicuramente necessaria la set_page(file) nella quale
|
||||
// si metteranno (sotto if o switch) le istruzioni
|
||||
// set_row (vedi sotto) corrispondenti alla pagina
|
||||
// logica relativa a ciascun record di ogni file da stampare.
|
||||
// Va definita anche set_print() in cui si presentera' ;a
|
||||
// maschera di scelta se necessaria o una box yes_no;
|
||||
// Ritornando TRUE da set_print la stampa viene eseguita
|
||||
// automaticamente (in genere ritorna FALSE se l'utente
|
||||
// annulla la stampa con ESC.)
|
||||
//
|
||||
// Alla set_page, come alle pre_ e post_ process, viene
|
||||
// passato 0 se il cursore attuale e' nullo (vedi sotto).
|
||||
// *********************************************************
|
||||
// FUNZIONI VIRTUALI FACOLTATIVE
|
||||
// *********************************************************
|
||||
// 5) Le varie funzioni pre_ e post_ process _page e _print
|
||||
// vengono chiamate prima e dopo la stampa di ogni record
|
||||
// o gruppo di record relativo alla relazione immessa;
|
||||
// ad esempio, postprocess_print() viene chiamata per il
|
||||
// file principale una volta dopo l'intera stampa; per
|
||||
// un file collegato nella relazione, e' chiamata tante
|
||||
// volte quanti gruppi di almeno un record esistono per
|
||||
// record del file genitore. Qui si possono modificare
|
||||
// righe, calcolare totali etc. A queste funzioni
|
||||
// viene sempre passato il file (logicnum) in corso di stampa e
|
||||
// un contatore che indica quante volte la stampa e' stata
|
||||
// ripetuta. le pre_ ritornano TRUE o FALSE, nell'ultimo
|
||||
// caso interrompono la stampa; le post_ ritornano
|
||||
// NEXT_PAGE (comportamento normale) o REPEAT_PAGE
|
||||
// (indovina cosa fa).
|
||||
// 6) set_print() viene chiamata dalla voce Selezione,
|
||||
// unica del secondo menu. E' il posto dove mettere
|
||||
// una buona maschera di selezione di cosa stampare.
|
||||
// Alla fine, si esegua enable_print_menu() per
|
||||
// abilitare la voce Stampa, inizialmente inattiva.
|
||||
// 7) cancel_hook() permette di intercettare la
|
||||
// cancellazione della stampa; ritornando TRUE
|
||||
// la stampa viene effettivamente cancellata
|
||||
// Tutti i parametri relativi al progress indicator
|
||||
// vengono settati da funzioni apposite (vedi oltre)
|
||||
// ****************************************************
|
||||
// Molte altre minchiatine (form feed automatici, header,
|
||||
// footer etc) sono spiegate nel seguito
|
||||
// ****************************************************
|
||||
|
||||
virtual void user_create() {}
|
||||
virtual void user_destroy() {}
|
||||
|
||||
// set print, bound to menu :Selezione:Stampa
|
||||
// chiamata automaticamente dopo user_create()
|
||||
virtual bool set_print(int i = 1) { return FALSE; }
|
||||
|
||||
// set_row functions MUST be called here in a switch
|
||||
// for each particular file being printed
|
||||
virtual void set_page(int file, int cnt) {}
|
||||
|
||||
// called before processing each page
|
||||
// used to set print strings from tables or files
|
||||
// not included in relation
|
||||
// returning FALSE cancels page printing
|
||||
// counter is the current print page number
|
||||
virtual bool preprocess_page(int file, int counter)
|
||||
{ return TRUE; }
|
||||
|
||||
// same before each print request
|
||||
// e.g. to initialize counters
|
||||
// returning FALSE cancels print request or subtree
|
||||
virtual bool preprocess_print(int file, int counter)
|
||||
{ return TRUE; }
|
||||
|
||||
// postprocessing; returning REPEAT_PAGE reprints the
|
||||
// whole page (after all sons are printed) or print
|
||||
// counter is the current page or print number
|
||||
virtual print_action postprocess_page(int file, int counter)
|
||||
{ return NEXT_PAGE; }
|
||||
virtual print_action postprocess_print(int file, int counter)
|
||||
{ return NEXT_PAGE; }
|
||||
// executed after all print job is completed
|
||||
virtual void postclose_print() {}
|
||||
|
||||
// called when LINK button is pressed with active selection in
|
||||
// preview window
|
||||
virtual void process_link(int id, const char* text) {}
|
||||
|
||||
|
||||
// called when user cancels print; returning TRUE
|
||||
// actually stops printing; not called if no cancel
|
||||
virtual bool cancel_hook() {return TRUE;}
|
||||
|
||||
// bound to TApplication print menu
|
||||
// redefined ONLY for very special purposes
|
||||
virtual void print();
|
||||
|
||||
// bound to <select> menu and automatically called after
|
||||
// user_create()
|
||||
void do_print(int n);
|
||||
|
||||
public:
|
||||
|
||||
// --------------------------------------------------------------
|
||||
// COME SETTARE LE RIGHE DI STAMPA
|
||||
// --------------------------------------------------------------
|
||||
// setrow() si usa come una printf per settare le righe di stampa
|
||||
// che vengono stampate da print()
|
||||
// I codici per gli argomenti variabili sono di 3 tipi:
|
||||
// @ si usa per stampare campi di database o informazioni di controllo
|
||||
// posizione carrello e font
|
||||
// ACHTUNG: i codici di formato sono diversi da quelli di printf e
|
||||
// sono elencati sotto. Per i campi di database occorre che il codice
|
||||
// sia accoppiato ad una delle funzioni FLD() passata come argomento;
|
||||
// questa provoca la stampa di campi della relazione corrente,
|
||||
// posizionata come e' stato deciso nell'inizializzazione
|
||||
// % si usa esattamente come in una printf con un plus: se il codice di
|
||||
// formato e' maiuscolo (es. S per stringa, D per intero) viene
|
||||
// ignorato il carattere di riempimento eventualmente specificato
|
||||
// con set_fillchar. Cio' vale anche per i codici @ (vedi)
|
||||
// E' possibile usare due codici aggiuntivi: r(R) e t(T). A questi
|
||||
// va fatto seguire un PUNTATORE a real o a TString. Il formato
|
||||
// viene interpretato con le stesse regole di %t in dsprintf per real
|
||||
// (come %d o %f) e di %s per TString. Il puntatore NON
|
||||
// viene memorizzato; per questo occorre il codice # (sotto).
|
||||
// # si usa come % (stessi codici di printf) ma memorizza gli argomenti
|
||||
// per riferimento: ovvero, ogni volta che la riga viene stampata
|
||||
// viene stampato il contenuto in quel momento (che si puo' cambiare
|
||||
// in una delle pre- o post- process). Cio' implica che:
|
||||
// 1) gli argomenti vanno passati per RIFERIMENTO (set_row(1,"#5d",&i))
|
||||
// 2) i puntatori devono rimanere validi e costanti tra la set_row e
|
||||
// la fine della stampa
|
||||
// Quindi, attenzione a %s con TString ridimensionate; si possono
|
||||
// usare solo se predimensionate alla dimensione massima, ma e' meglio
|
||||
// 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.
|
||||
// Comunque, il modo corretto di adoperare il codice # e'
|
||||
// usarlo solo per stampare MEMBRI della classe derivata da TPrint_application
|
||||
// ----------------------------------------------
|
||||
// field codes (match one of FLD() functions)
|
||||
// @@ -> @
|
||||
// @[n[,{l|c|r}]s -> STRING: n = pad, lcr = alignment
|
||||
// @{[n[.d=0]]|[n[,{l|c|r}]]p}n
|
||||
// -> NUMBER: n = digits, d = decimals
|
||||
// p = picture string (first matching arg)
|
||||
// @[l]d -> DATE: l = full year
|
||||
// @f -> BOOL: prints si/no
|
||||
// @[n,{l|c|r}]t -> Translated field (must set translation)
|
||||
//
|
||||
// Tutti questi codici possono essere usati anche maiuscoli, il che inibisce
|
||||
// l'uso del carattere di riempimento (set_fillchar) per uno specifico campo.
|
||||
// ---------------------------------------------
|
||||
// Per tutti i codici che riguardano la stampa di real (@n, %r, #r)
|
||||
// se non vengono date ulteriori specifiche di formato viene usata
|
||||
// una picture che e' "" per default, ma puo' essere modificata con
|
||||
// set_real_picture(). Anche questo e' assai carino.
|
||||
// Normalmente un real uguale a zero viene stampato come stringa vuota
|
||||
// a meno che non si specifichi set_print_zero([TRUE]).
|
||||
// ---------------------------------------------
|
||||
// codici posizionamento e movimento carrello
|
||||
// @<n>g vai a posizione n
|
||||
// @<n>j salta di n posizioni (in orizzontale)
|
||||
// codici stile
|
||||
// @b bold
|
||||
// @i italic
|
||||
// @u underlined
|
||||
// @r reset to normal
|
||||
// ---------------------------------------------------
|
||||
// CODICI COLORE PER VISUALIZZAZIONE E COLLEGAMENTO
|
||||
// ---------------------------------------------------
|
||||
// Se si vuole che in visualizzazione il testo sia colorato
|
||||
// si usa il codice $[]; tra le quadre si scrive il colore
|
||||
// di foreground, opzionalmente seguito da una virgola e dal
|
||||
// colore di background (bianco per default). I colori si
|
||||
// specificano con un singolo carattere come segue:
|
||||
// n nero
|
||||
// g verde
|
||||
// b blu
|
||||
// c cyan
|
||||
// y giallo
|
||||
// v magenta
|
||||
// m colore background maschere (azzurrotto)
|
||||
// d grigio scuro
|
||||
// l grigio chiaro
|
||||
// k grigio normale
|
||||
// ------------------------------------------------------
|
||||
// Se si fa enable_link(..) con un certo colore, tutto
|
||||
// cio; che e' scritto in quel colore diventa selezionabile
|
||||
// e alla sua selezione (premendo 'Collega') si puo' associare
|
||||
// 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
|
||||
// Includi ditte abilitato) per un esempio.
|
||||
// --------------------------------------------------------
|
||||
|
||||
void reset_row(int r);
|
||||
|
||||
// chiamare reset_print() durante la stampa forza la
|
||||
// rilettura di set_page() alla prossima volta
|
||||
void reset_print();
|
||||
|
||||
void set_row(int r, const char* fmt, ...);
|
||||
|
||||
// ---------------------------------------------
|
||||
// set translation values for field
|
||||
// called once for each translation: example
|
||||
// set_translation(12,"STATOCIV","1","Celibe")
|
||||
// provoca la stampa automatica di stringhe al
|
||||
// posto di determinati valori dei campi se e' dato
|
||||
// il codice @t
|
||||
// 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
|
||||
// nella create. L' ID ritornato viene passato a process_link
|
||||
// assieme al testo selezionato
|
||||
int enable_link (const char* descr, char fg, char bg = 'w');
|
||||
void disable_link(char fg, char bg = 'w');
|
||||
void disable_links() { printer().links().destroy(); }
|
||||
// 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
|
||||
void set_multiple_link(bool on);
|
||||
|
||||
|
||||
// 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
|
||||
void select_cursor(int i);
|
||||
|
||||
// return i-th cursor without making it current
|
||||
TCursor* get_cursor(int i);
|
||||
// returns maximum row defined
|
||||
int get_maxrow() { return _maxrow; }
|
||||
|
||||
// adds cursor to class; return identifier
|
||||
// cursor* can be NULL: no file is used but
|
||||
// print_one is called and iterations are performed
|
||||
// by pre_ and post_ process
|
||||
int add_cursor(TCursor* c);
|
||||
|
||||
// retrieve current cursor
|
||||
TCursor* current_cursor() { return _cur; }
|
||||
|
||||
// ---------------------------------------------
|
||||
// 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)
|
||||
void set_auto_ff( bool b = TRUE)
|
||||
{ _auto_ff = b; }
|
||||
|
||||
// il carattere specificato con set_fillchar (default ' ') viene
|
||||
// usato per riempire davanti e dietro i campi in cui si e' specificata
|
||||
// una dimensione maggiore della lunghezza effettiva del contenuto,
|
||||
// (a meno che non si sia usato un codice di formato maiuscolo)
|
||||
void set_fillchar(char c)
|
||||
{ _fillchar = c; }
|
||||
|
||||
// riempie di righe vuote la pagina corrente fino alla dimensione
|
||||
// della pagina
|
||||
void fill_page(int from = -1);
|
||||
|
||||
// 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();
|
||||
void disable_print_menu();
|
||||
void enable_setprint_menu();
|
||||
void disable_setprint_menu();
|
||||
|
||||
// header/footer (printf, not set_row analogues)
|
||||
// only understand @-codes for setting font attributes,
|
||||
// date and page number
|
||||
// plus every printf %-code
|
||||
|
||||
// con queste si possono ridefinire header e footer al
|
||||
// verificarsi di condizioni durante la stampa
|
||||
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 reset_header();
|
||||
void reset_footer();
|
||||
|
||||
// vedi sopra per capire
|
||||
void reset_files() { _reset_tree(_pr_tree); _pr_tree = NULL; }
|
||||
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; }
|
||||
void set_print_zero(bool b = TRUE) { _print_zero = b; }
|
||||
|
||||
// progress indicator control
|
||||
void set_wait_message(const char* m)
|
||||
{ _wmess = m; }
|
||||
void set_wait_bar(bool m)
|
||||
// default yes
|
||||
{ _wbar = m; }
|
||||
void set_wait_cancel(bool m)
|
||||
// default yes
|
||||
{ _wcancel = m; }
|
||||
void set_wait_threshold(int m)
|
||||
// minimum number of print items to show progress indicator;
|
||||
// default 2
|
||||
{ _wthr = m; }
|
||||
|
||||
// questa forza la progind anche se si stampa su video
|
||||
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
|
||||
// sempre quelli del record corrente anche se si usano codici %
|
||||
// s'intende che rallenta un po' la stampa
|
||||
void force_setpage(bool b = TRUE)
|
||||
{ _force_setpage = b; }
|
||||
|
||||
void set_config_file(const char* s)
|
||||
{ _confpr = s; }
|
||||
word get_page_number()
|
||||
{ return printer().getcurrentpage(); }
|
||||
void set_page_number(word n)
|
||||
{ printer().setcurrentpage(n); }
|
||||
|
||||
|
||||
void set_n_copies(int n) { _ncopies = n; }
|
||||
int get_n_copies() { return _ncopies; }
|
||||
void repeat_print() { _repeat_print = TRUE; }
|
||||
|
||||
TPrint_application();
|
||||
virtual ~TPrint_application();
|
||||
};
|
||||
|
||||
// buon divertimento
|
||||
|
||||
|
||||
#endif
|
||||
|
||||
// trattasi di -*-c++-*-
|
||||
#ifndef __PRINTAPP_H
|
||||
#define __PRINTAPP_H
|
||||
|
||||
#ifndef __APPLICATION_H
|
||||
#include <applicat.h>
|
||||
#endif
|
||||
|
||||
#ifndef __PRINTER_H
|
||||
#include <printer.h>
|
||||
#endif
|
||||
|
||||
#ifndef __RELATION_H
|
||||
#include <relation.h>
|
||||
#endif
|
||||
|
||||
// compatibility
|
||||
#define TPrintapp TPrint_application
|
||||
|
||||
|
||||
enum print_action { REPEAT_PAGE, NEXT_PAGE };
|
||||
|
||||
// user functions to pass field informations to setrow()
|
||||
// no class or nice C++ interface since varargs is nasty
|
||||
|
||||
// FLD(Num.logico, Nome campo [, da [, a]])
|
||||
const char* FLD(int lognum, const char* f, int from = -1, int to = -1);
|
||||
// FLD(Num. logico, Nome campo numerico, Picture string)
|
||||
const char* FLD(int lognum, const char* f, const char* picture);
|
||||
// FLD(Nome tabella, Nome campo numerico, Picture string)
|
||||
const char* FLD(const char* tabname, const char* f, const char* picture);
|
||||
// FLD(Num.logico, Nome campo [, da [, a]])
|
||||
const char* FLD(const char* tabname, const char* f, int from = -1, int to = -1);
|
||||
|
||||
struct link_item {
|
||||
int _logicnum;
|
||||
link_item* _son;
|
||||
link_item* _brother;
|
||||
int _cnt;
|
||||
|
||||
link_item(int l)
|
||||
{ _logicnum = l; _son = NULL; _brother = NULL; _cnt = 0; }
|
||||
};
|
||||
|
||||
class TProgind;
|
||||
|
||||
|
||||
class TPrint_application : public TApplication
|
||||
{
|
||||
TArray _rows; // rows descriptor
|
||||
TArray _cursors; // cursor array
|
||||
TCursor* _cur; // current cursor
|
||||
TArray _transtab; // field translation table
|
||||
TArray _header; // header lines
|
||||
TArray _footer; // footer lines
|
||||
int _currow; // current print row
|
||||
TPrintstyle _curstyle; // current print style
|
||||
bool _auto_ff; // automatic form feed after each page
|
||||
const char* _wmess; // wait message for progind
|
||||
bool _wbar; // bar y/n for progind
|
||||
bool _wcancel; // cancel button enabled
|
||||
int _wthr; // minimum # of items to show print progind
|
||||
const char* _confpr; // config filename for printer
|
||||
char _fillchar; // fill character for empty fields
|
||||
link_item* _pr_tree; // functions for autom. printing of relations
|
||||
int _maxrow; // reference to maxrow
|
||||
int _cur_file;
|
||||
bool _print_defined;
|
||||
bool _force_progind;
|
||||
bool _force_setpage;
|
||||
bool _print_zero;
|
||||
TProgind* _prind;
|
||||
const char* _picture;
|
||||
MENU_TAG _last_choice;
|
||||
int _ncopies;
|
||||
bool _repeat_print;
|
||||
|
||||
// set the printer
|
||||
void set_printer() { printer().set(); }
|
||||
// print a single record; does not advance cursor
|
||||
// returns failure or success
|
||||
bool print_one(int file);
|
||||
// to be documented but very fig
|
||||
bool print_tree(link_item* head);
|
||||
|
||||
static void _pp_header(TPrinter& pr);
|
||||
static void _pp_footer(TPrinter& pr);
|
||||
static void _pp_link(int id, const char* s);
|
||||
|
||||
link_item* _look_print_node(link_item* head, int logicnum);
|
||||
void _reset_tree(link_item* head);
|
||||
virtual bool create();
|
||||
virtual bool destroy();
|
||||
|
||||
|
||||
protected:
|
||||
|
||||
// ****************************************************
|
||||
// ISTRUZIONI PER l'USO
|
||||
// ****************************************************
|
||||
//
|
||||
// La Printapp, saggiamente, consente di operare su uno
|
||||
// o piu' cursori stampando automaticamente anche files
|
||||
// collegati. La sequenza delle operazioni e' la seguente:
|
||||
//
|
||||
// 1) Derivare una classe da TPrint_application
|
||||
// 2) Implementare user_create() e user_destroy();
|
||||
// Nella user_create() si creino i
|
||||
// necessari cursori, e li si dia in pasto a Printapp
|
||||
// usando add_cursor(). Si puo' fare add_cursor(new TCursor(...))
|
||||
// dato che il cursore viene distrutto automaticamente.
|
||||
// 3) Per ciascun file del cursore che si desidera porre
|
||||
// nell'albero di stampa, si faccia add_file(logicnum [,from]);
|
||||
// [from] sara' il file a cui e' collegato nella relazione.
|
||||
// add_file VA FATTA anche per il file principale, se no
|
||||
// non stampera' nulla;
|
||||
// *********************************************************
|
||||
// FUNZIONI VIRTUALI OBBLIGATORIE
|
||||
// *********************************************************
|
||||
// 4) Si definiscono le necessarie funzioni virtuali: e'
|
||||
// sicuramente necessaria la set_page(file) nella quale
|
||||
// si metteranno (sotto if o switch) le istruzioni
|
||||
// set_row (vedi sotto) corrispondenti alla pagina
|
||||
// logica relativa a ciascun record di ogni file da stampare.
|
||||
// Va definita anche set_print() in cui si presentera' ;a
|
||||
// maschera di scelta se necessaria o una box yes_no;
|
||||
// Ritornando TRUE da set_print la stampa viene eseguita
|
||||
// automaticamente (in genere ritorna FALSE se l'utente
|
||||
// annulla la stampa con ESC.)
|
||||
//
|
||||
// Alla set_page, come alle pre_ e post_ process, viene
|
||||
// passato 0 se il cursore attuale e' nullo (vedi sotto).
|
||||
// *********************************************************
|
||||
// FUNZIONI VIRTUALI FACOLTATIVE
|
||||
// *********************************************************
|
||||
// 5) Le varie funzioni pre_ e post_ process _page e _print
|
||||
// vengono chiamate prima e dopo la stampa di ogni record
|
||||
// o gruppo di record relativo alla relazione immessa;
|
||||
// ad esempio, postprocess_print() viene chiamata per il
|
||||
// file principale una volta dopo l'intera stampa; per
|
||||
// un file collegato nella relazione, e' chiamata tante
|
||||
// volte quanti gruppi di almeno un record esistono per
|
||||
// record del file genitore. Qui si possono modificare
|
||||
// righe, calcolare totali etc. A queste funzioni
|
||||
// viene sempre passato il file (logicnum) in corso di stampa e
|
||||
// un contatore che indica quante volte la stampa e' stata
|
||||
// ripetuta. le pre_ ritornano TRUE o FALSE, nell'ultimo
|
||||
// caso interrompono la stampa; le post_ ritornano
|
||||
// NEXT_PAGE (comportamento normale) o REPEAT_PAGE
|
||||
// (indovina cosa fa).
|
||||
// 6) set_print() viene chiamata dalla voce Selezione,
|
||||
// unica del secondo menu. E' il posto dove mettere
|
||||
// una buona maschera di selezione di cosa stampare.
|
||||
// Alla fine, si esegua enable_print_menu() per
|
||||
// abilitare la voce Stampa, inizialmente inattiva.
|
||||
// 7) cancel_hook() permette di intercettare la
|
||||
// cancellazione della stampa; ritornando TRUE
|
||||
// la stampa viene effettivamente cancellata
|
||||
// Tutti i parametri relativi al progress indicator
|
||||
// vengono settati da funzioni apposite (vedi oltre)
|
||||
// ****************************************************
|
||||
// Molte altre minchiatine (form feed automatici, header,
|
||||
// footer etc) sono spiegate nel seguito
|
||||
// ****************************************************
|
||||
|
||||
virtual void user_create() {}
|
||||
virtual void user_destroy() {}
|
||||
|
||||
// set print, bound to menu :Selezione:Stampa
|
||||
// chiamata automaticamente dopo user_create()
|
||||
virtual bool set_print(int i = 1) { return FALSE; }
|
||||
|
||||
// set_row functions MUST be called here in a switch
|
||||
// for each particular file being printed
|
||||
virtual void set_page(int file, int cnt) {}
|
||||
|
||||
// called before processing each page
|
||||
// used to set print strings from tables or files
|
||||
// not included in relation
|
||||
// returning FALSE cancels page printing
|
||||
// counter is the current print page number
|
||||
virtual bool preprocess_page(int file, int counter)
|
||||
{ return TRUE; }
|
||||
|
||||
// same before each print request
|
||||
// e.g. to initialize counters
|
||||
// returning FALSE cancels print request or subtree
|
||||
virtual bool preprocess_print(int file, int counter)
|
||||
{ return TRUE; }
|
||||
|
||||
// postprocessing; returning REPEAT_PAGE reprints the
|
||||
// whole page (after all sons are printed) or print
|
||||
// counter is the current page or print number
|
||||
virtual print_action postprocess_page(int file, int counter)
|
||||
{ return NEXT_PAGE; }
|
||||
virtual print_action postprocess_print(int file, int counter)
|
||||
{ return NEXT_PAGE; }
|
||||
// executed after all print job is completed
|
||||
virtual void postclose_print() {}
|
||||
|
||||
// called when LINK button is pressed with active selection in
|
||||
// preview window
|
||||
virtual void process_link(int id, const char* text) {}
|
||||
|
||||
|
||||
// called when user cancels print; returning TRUE
|
||||
// actually stops printing; not called if no cancel
|
||||
virtual bool cancel_hook() {return TRUE;}
|
||||
|
||||
// bound to TApplication print menu
|
||||
// redefined ONLY for very special purposes
|
||||
virtual void print();
|
||||
|
||||
// bound to <select> menu and automatically called after
|
||||
// user_create()
|
||||
void do_print(int n);
|
||||
|
||||
public:
|
||||
|
||||
// --------------------------------------------------------------
|
||||
// COME SETTARE LE RIGHE DI STAMPA
|
||||
// --------------------------------------------------------------
|
||||
// setrow() si usa come una printf per settare le righe di stampa
|
||||
// che vengono stampate da print()
|
||||
// I codici per gli argomenti variabili sono di 3 tipi:
|
||||
// @ si usa per stampare campi di database o informazioni di controllo
|
||||
// posizione carrello e font
|
||||
// ACHTUNG: i codici di formato sono diversi da quelli di printf e
|
||||
// sono elencati sotto. Per i campi di database occorre che il codice
|
||||
// sia accoppiato ad una delle funzioni FLD() passata come argomento;
|
||||
// questa provoca la stampa di campi della relazione corrente,
|
||||
// posizionata come e' stato deciso nell'inizializzazione
|
||||
// % si usa esattamente come in una printf con un plus: se il codice di
|
||||
// formato e' maiuscolo (es. S per stringa, D per intero) viene
|
||||
// ignorato il carattere di riempimento eventualmente specificato
|
||||
// con set_fillchar. Cio' vale anche per i codici @ (vedi)
|
||||
// E' possibile usare due codici aggiuntivi: r(R) e t(T). A questi
|
||||
// va fatto seguire un PUNTATORE a real o a TString. Il formato
|
||||
// viene interpretato con le stesse regole di %t in dsprintf per real
|
||||
// (come %d o %f) e di %s per TString. Il puntatore NON
|
||||
// viene memorizzato; per questo occorre il codice # (sotto).
|
||||
// # si usa come % (stessi codici di printf) ma memorizza gli argomenti
|
||||
// per riferimento: ovvero, ogni volta che la riga viene stampata
|
||||
// viene stampato il contenuto in quel momento (che si puo' cambiare
|
||||
// in una delle pre- o post- process). Cio' implica che:
|
||||
// 1) gli argomenti vanno passati per RIFERIMENTO (set_row(1,"#5d",&i))
|
||||
// 2) i puntatori devono rimanere validi e costanti tra la set_row e
|
||||
// la fine della stampa
|
||||
// Quindi, attenzione a %s con TString ridimensionate; si possono
|
||||
// usare solo se predimensionate alla dimensione massima, ma e' meglio
|
||||
// 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.
|
||||
// Comunque, il modo corretto di adoperare il codice # e'
|
||||
// usarlo solo per stampare MEMBRI della classe derivata da TPrint_application
|
||||
// ----------------------------------------------
|
||||
// field codes (match one of FLD() functions)
|
||||
// @@ -> @
|
||||
// @[n[,{l|c|r}]s -> STRING: n = pad, lcr = alignment
|
||||
// @{[n[.d=0]]|[n[,{l|c|r}]]p}n
|
||||
// -> NUMBER: n = digits, d = decimals
|
||||
// p = picture string (first matching arg)
|
||||
// @[l]d -> DATE: l = full year
|
||||
// @f -> BOOL: prints si/no
|
||||
// @[n,{l|c|r}]t -> Translated field (must set translation)
|
||||
//
|
||||
// Tutti questi codici possono essere usati anche maiuscoli, il che inibisce
|
||||
// l'uso del carattere di riempimento (set_fillchar) per uno specifico campo.
|
||||
// ---------------------------------------------
|
||||
// Per tutti i codici che riguardano la stampa di real (@n, %r, #r)
|
||||
// se non vengono date ulteriori specifiche di formato viene usata
|
||||
// una picture che e' "" per default, ma puo' essere modificata con
|
||||
// set_real_picture(). Anche questo e' assai carino.
|
||||
// Normalmente un real uguale a zero viene stampato come stringa vuota
|
||||
// a meno che non si specifichi set_print_zero([TRUE]).
|
||||
// ---------------------------------------------
|
||||
// codici posizionamento e movimento carrello
|
||||
// @<n>g vai a posizione n
|
||||
// @<n>j salta di n posizioni (in orizzontale)
|
||||
// codici stile
|
||||
// @b bold
|
||||
// @i italic
|
||||
// @u underlined
|
||||
// @r reset to normal
|
||||
// ---------------------------------------------------
|
||||
// CODICI COLORE PER VISUALIZZAZIONE E COLLEGAMENTO
|
||||
// ---------------------------------------------------
|
||||
// Se si vuole che in visualizzazione il testo sia colorato
|
||||
// si usa il codice $[]; tra le quadre si scrive il colore
|
||||
// di foreground, opzionalmente seguito da una virgola e dal
|
||||
// colore di background (bianco per default). I colori si
|
||||
// specificano con un singolo carattere come segue:
|
||||
// n nero
|
||||
// g verde
|
||||
// b blu
|
||||
// c cyan
|
||||
// y giallo
|
||||
// v magenta
|
||||
// m colore background maschere (azzurrotto)
|
||||
// d grigio scuro
|
||||
// l grigio chiaro
|
||||
// k grigio normale
|
||||
// ------------------------------------------------------
|
||||
// Se si fa enable_link(..) con un certo colore, tutto
|
||||
// cio; che e' scritto in quel colore diventa selezionabile
|
||||
// e alla sua selezione (premendo 'Collega') si puo' associare
|
||||
// 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
|
||||
// Includi ditte abilitato) per un esempio.
|
||||
// --------------------------------------------------------
|
||||
|
||||
void reset_row(int r);
|
||||
|
||||
// chiamare reset_print() durante la stampa forza la
|
||||
// rilettura di set_page() alla prossima volta
|
||||
void reset_print();
|
||||
|
||||
void set_row(int r, const char* fmt, ...);
|
||||
|
||||
// ---------------------------------------------
|
||||
// set translation values for field
|
||||
// called once for each translation: example
|
||||
// set_translation(12,"STATOCIV","1","Celibe")
|
||||
// provoca la stampa automatica di stringhe al
|
||||
// posto di determinati valori dei campi se e' dato
|
||||
// il codice @t
|
||||
// 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
|
||||
// nella create. L' ID ritornato viene passato a process_link
|
||||
// assieme al testo selezionato
|
||||
int enable_link (const char* descr, char fg, char bg = 'w');
|
||||
void disable_link(char fg, char bg = 'w');
|
||||
void disable_links() { printer().links().destroy(); }
|
||||
// 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
|
||||
void set_multiple_link(bool on);
|
||||
|
||||
|
||||
// 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
|
||||
void select_cursor(int i);
|
||||
|
||||
// return i-th cursor without making it current
|
||||
TCursor* get_cursor(int i);
|
||||
// returns maximum row defined
|
||||
int get_maxrow() { return _maxrow; }
|
||||
|
||||
// adds cursor to class; return identifier
|
||||
// cursor* can be NULL: no file is used but
|
||||
// print_one is called and iterations are performed
|
||||
// by pre_ and post_ process
|
||||
int add_cursor(TCursor* c);
|
||||
|
||||
// retrieve current cursor
|
||||
TCursor* current_cursor() { return _cur; }
|
||||
|
||||
// ---------------------------------------------
|
||||
// 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)
|
||||
void set_auto_ff( bool b = TRUE)
|
||||
{ _auto_ff = b; }
|
||||
|
||||
// il carattere specificato con set_fillchar (default ' ') viene
|
||||
// usato per riempire davanti e dietro i campi in cui si e' specificata
|
||||
// una dimensione maggiore della lunghezza effettiva del contenuto,
|
||||
// (a meno che non si sia usato un codice di formato maiuscolo)
|
||||
void set_fillchar(char c)
|
||||
{ _fillchar = c; }
|
||||
|
||||
// riempie di righe vuote la pagina corrente fino alla dimensione
|
||||
// della pagina
|
||||
void fill_page(int from = -1);
|
||||
|
||||
// di solito basta e avanza quella di default
|
||||
virtual bool menu(MENU_TAG m);
|
||||
|
||||
virtual word class_id() const { return CLASS_PRINT_APPLICATION; }
|
||||
|
||||
// print menu is enabled when set_print returns TRUE
|
||||
void enable_print_menu();
|
||||
void disable_print_menu();
|
||||
void enable_setprint_menu();
|
||||
void disable_setprint_menu();
|
||||
|
||||
// header/footer (printf, not set_row analogues)
|
||||
// only understand @-codes for setting font attributes,
|
||||
// date and page number
|
||||
// plus every printf %-code
|
||||
|
||||
// con queste si possono ridefinire header e footer al
|
||||
// verificarsi di condizioni durante la stampa
|
||||
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 reset_header();
|
||||
void reset_footer();
|
||||
|
||||
// vedi sopra per capire
|
||||
void reset_files() { _reset_tree(_pr_tree); _pr_tree = NULL; }
|
||||
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; }
|
||||
void set_print_zero(bool b = TRUE) { _print_zero = b; }
|
||||
|
||||
// progress indicator control
|
||||
void set_wait_message(const char* m)
|
||||
{ _wmess = m; }
|
||||
void set_wait_bar(bool m)
|
||||
// default yes
|
||||
{ _wbar = m; }
|
||||
void set_wait_cancel(bool m)
|
||||
// default yes
|
||||
{ _wcancel = m; }
|
||||
void set_wait_threshold(int m)
|
||||
// minimum number of print items to show progress indicator;
|
||||
// default 2
|
||||
{ _wthr = m; }
|
||||
|
||||
// questa forza la progind anche se si stampa su video
|
||||
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
|
||||
// sempre quelli del record corrente anche se si usano codici %
|
||||
// s'intende che rallenta un po' la stampa
|
||||
void force_setpage(bool b = TRUE)
|
||||
{ _force_setpage = b; }
|
||||
|
||||
void set_config_file(const char* s)
|
||||
{ _confpr = s; }
|
||||
word get_page_number()
|
||||
{ return printer().getcurrentpage(); }
|
||||
void set_page_number(word n)
|
||||
{ printer().setcurrentpage(n); }
|
||||
|
||||
|
||||
void set_n_copies(int n) { _ncopies = n; }
|
||||
int get_n_copies() { return _ncopies; }
|
||||
void repeat_print() { _repeat_print = TRUE; }
|
||||
|
||||
TPrint_application();
|
||||
virtual ~TPrint_application();
|
||||
};
|
||||
|
||||
// buon divertimento
|
||||
|
||||
|
||||
#endif
|
||||
|
||||
|
@ -39,8 +39,7 @@ PrintWhat;
|
||||
|
||||
#include <windows.h>
|
||||
|
||||
void TPrinter ::
|
||||
_get_windows_printer_names (TToken_string & t)
|
||||
void TPrinter::_get_windows_printer_names (TToken_string & t)
|
||||
{
|
||||
char *buf = new char[4096]; // ammazzao'
|
||||
|
||||
@ -57,8 +56,7 @@ _get_windows_printer_names (TToken_string & t)
|
||||
delete buf;
|
||||
}
|
||||
|
||||
BOOLEAN TPrinter ::
|
||||
start_winprint (long data)
|
||||
BOOLEAN TPrinter::start_winprint (long data)
|
||||
{
|
||||
PrDesc *pd = (PrDesc *) data;
|
||||
TTextfile & txt = *(pd->_txt);
|
||||
@ -70,8 +68,7 @@ start_winprint (long data)
|
||||
#endif
|
||||
|
||||
// utils del caz
|
||||
HIDDEN void
|
||||
read_int (const char *s, int &n, int &cnt)
|
||||
HIDDEN void read_int (const char *s, int &n, int &cnt)
|
||||
{
|
||||
static char nbuf[10];
|
||||
int j = 0;
|
||||
@ -84,8 +81,7 @@ read_int (const char *s, int &n, int &cnt)
|
||||
}
|
||||
|
||||
#if XVT_OS == XVT_OS_WIN
|
||||
void TPrinter ::
|
||||
set_win_formlen ()
|
||||
void TPrinter::set_win_formlen ()
|
||||
{
|
||||
long pw, ph, phr, pvr;
|
||||
xvt_escape (XVT_ESC_GET_PRINTER_INFO, _print_rcd, &ph, &pw, &pvr, &phr);
|
||||
@ -98,13 +94,12 @@ set_win_formlen ()
|
||||
|
||||
}
|
||||
else
|
||||
warning_box ("Il driver di stampante non e' valido. Non stampare prima di averlo"
|
||||
" reinstallato");
|
||||
warning_box ("Il driver di stampante non e' valido.\n"
|
||||
"Non stampare prima di averlo reinstallato");
|
||||
}
|
||||
#endif
|
||||
|
||||
void TPrinter ::
|
||||
_parse_background ()
|
||||
void TPrinter::_parse_background ()
|
||||
{
|
||||
char op;
|
||||
int x1, x2, y1, y2;
|
||||
@ -285,8 +280,7 @@ _parse_background ()
|
||||
}
|
||||
}
|
||||
|
||||
void TPrinter ::
|
||||
setbackground (const char *b)
|
||||
void TPrinter::setbackground (const char *b)
|
||||
{
|
||||
_background.destroy ();
|
||||
_bg_desc = b;
|
||||
@ -609,7 +603,7 @@ bool printers_on_key (TMask_field & f, KEY key)
|
||||
{
|
||||
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;
|
||||
int j = 0;
|
||||
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];
|
||||
if (key == K_SPACE)
|
||||
{
|
||||
if (MainApp ()->printer ().get_printrcd () != NULL)
|
||||
free_print_rcd (MainApp ()->printer ().get_printrcd ());
|
||||
TToken_string & pn = MainApp ()->printer ().getprinternames ();
|
||||
if (MainApp()->printer().get_printrcd() != NULL)
|
||||
free_print_rcd (MainApp ()->printer().get_printrcd ());
|
||||
TToken_string & pn = MainApp()->printer().getprinternames ();
|
||||
TString pdev (pn.get (atoi (f.get ())));
|
||||
GetProfileString ("devices", pdev, "", szDevice, sizeof (szDevice));
|
||||
pdev << "," << szDevice;
|
||||
// WriteProfileString("windows","device", pdev);
|
||||
// madonna bona
|
||||
MainApp ()->printer ().set_printrcd (get_print_rcd (&(MainApp ()->printer ().get_printrcdsize ())));
|
||||
MainApp ()->printer ().set_win_formlen ();
|
||||
MainApp()->printer().set_printrcd(get_print_rcd (&(MainApp ()->printer ().get_printrcdsize ())));
|
||||
MainApp()->printer().set_win_formlen();
|
||||
}
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
TPrinter :: TPrinter ():_date (TODAY), _multiple_link (FALSE), _frozen (FALSE), _isgraphics (TRUE),
|
||||
_lines_per_inch (6), _ch_size (12)
|
||||
TPrinter::TPrinter()
|
||||
: _date (TODAY), _multiple_link (FALSE), _frozen (FALSE), _isgraphics (TRUE),
|
||||
_lines_per_inch (6), _ch_size (12)
|
||||
|
||||
{
|
||||
_footerhandler = _headerhandler = NULL;
|
||||
@ -1140,7 +1135,7 @@ void TPrinter::set()
|
||||
TToken_string pn1 (50), pn2 (100);
|
||||
int i;
|
||||
|
||||
MainApp ()->disable_menu_item (M_FILE_PG_SETUP);
|
||||
MainApp()->disable_menu_item (M_FILE_PG_SETUP);
|
||||
|
||||
#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_CODES, format ("%d", _curcode));
|
||||
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);
|
||||
|
||||
if (mask.run () == K_ESC)
|
||||
@ -1195,8 +1195,10 @@ void TPrinter::set()
|
||||
// get user choices
|
||||
|
||||
_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);
|
||||
switch (atoi(mask.get (MSK_1_TYPE)))
|
||||
{
|
||||
@ -1237,13 +1239,17 @@ void TPrinter::set()
|
||||
for (i = 0; i < pn2.items (); i++)
|
||||
pn1.add(i);
|
||||
|
||||
((TList_field &) (mask.field (MSK_1_PRINTERS))).replace_items (pn1, pn2);
|
||||
mask.set (MSK_1_PRINTERS, pn1.get (_curprn));
|
||||
mask.hide (MSK_1_CODES);
|
||||
mask.set (MSK_1_ISGRAPHICS, _isgraphics ? "X" : "");
|
||||
mask.set (MSK_1_SIZE, format ("%d", _ch_size));
|
||||
mask.set (MSK_1_LINES, format ("%d", _lines_per_inch));
|
||||
mask.set (MSK_1_NPAGES, format("%d",((TPrint_application*)MainApp())->get_n_copies()));
|
||||
((TList_field &) (mask.field (MSK_1_PRINTERS))).replace_items(pn1, pn2);
|
||||
mask.set(MSK_1_PRINTERS, pn1.get(_curprn));
|
||||
mask.hide(MSK_1_CODES);
|
||||
mask.set(MSK_1_ISGRAPHICS, _isgraphics ? "X" : "");
|
||||
mask.set(MSK_1_SIZE, _ch_size);
|
||||
mask.set(MSK_1_LINES, _lines_per_inch);
|
||||
|
||||
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)
|
||||
mask.set (MSK_1_TYPE, "1");
|
||||
@ -1293,7 +1299,7 @@ void TPrinter::set()
|
||||
_curprn = oldprn;
|
||||
_print_rcd = get_print_rcd(&_print_rcd_size);
|
||||
set_win_formlen ();
|
||||
MainApp ()->enable_menu_item (M_FILE_PG_SETUP);
|
||||
MainApp()->enable_menu_item(M_FILE_PG_SETUP);
|
||||
return;
|
||||
}
|
||||
|
||||
@ -1304,8 +1310,11 @@ void TPrinter::set()
|
||||
TString s ("printer.def");
|
||||
mask.set_workfile (s);
|
||||
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)))
|
||||
{
|
||||
case 0: // stampante
|
||||
|
@ -100,7 +100,7 @@ class PrinterDef : public TObject
|
||||
TArray _codes; // print codes
|
||||
TArray _names; // name of print codes
|
||||
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:
|
||||
bool read(const char* name, FILE* fd); // read description from file;
|
||||
@ -157,7 +157,7 @@ class TPrinter : public TObject
|
||||
const char* _bg_desc;
|
||||
TToken_string _printer_names;
|
||||
bool _isgraphics;
|
||||
bool _frozen;
|
||||
bool _frozen;
|
||||
#if XVT_OS == XVT_OS_WIN
|
||||
PRINT_RCD* _print_rcd;
|
||||
int _print_rcd_size;
|
||||
@ -168,7 +168,7 @@ class TPrinter : public TObject
|
||||
int _dots_per_line;
|
||||
|
||||
void _parse_background();
|
||||
void _get_windows_printer_names(TToken_string& t);
|
||||
void _get_windows_printer_names(TToken_string& t);
|
||||
|
||||
PRINTSECTIONHANDLER _headerhandler, _footerhandler;
|
||||
LINKHANDLER _linkhandler;
|
||||
@ -227,11 +227,11 @@ public:
|
||||
void resetfooter();
|
||||
void setbackground(const char* bg);
|
||||
TArray* getbgdesc() { return &_background; }
|
||||
bool frozen() { return _frozen; }
|
||||
void freeze(bool b = TRUE) { _frozen = b; }
|
||||
bool frozen() { return _frozen; }
|
||||
void freeze(bool b = TRUE) { _frozen = b; }
|
||||
|
||||
TToken_string& getprinternames();
|
||||
TTextfile& get_txt() { return _txt; }
|
||||
TToken_string& getprinternames();
|
||||
TTextfile& get_txt() { return _txt; }
|
||||
|
||||
void setheaderhandler(PRINTSECTIONHANDLER h) { _headerhandler = h; }
|
||||
void setfooterhandler(PRINTSECTIONHANDLER h) { _footerhandler = h; }
|
||||
@ -241,7 +241,7 @@ public:
|
||||
// completamente anche da un'altra application
|
||||
void setlinkhandler(LINKHANDLER h) { _linkhandler = h; }
|
||||
LINKHANDLER getlinkhandler() { return _linkhandler; }
|
||||
TArray& links() { return _linksdescr; }
|
||||
TArray& links() { return _linksdescr; }
|
||||
void setmultiplelink(bool on) { _multiple_link = on; }
|
||||
bool ismultiplelink() { return _multiple_link; }
|
||||
|
||||
|
@ -1,36 +1,36 @@
|
||||
BUTTON DLG_SAVEREC 8 2
|
||||
BEGIN
|
||||
PROMPT -16 -1 "~Registra"
|
||||
MESSAGE EXIT,K_SAVE
|
||||
END
|
||||
|
||||
BUTTON DLG_NEWREC 8 2
|
||||
BEGIN
|
||||
PROMPT -26 -1 "~Nuovo"
|
||||
MESSAGE EXIT,K_INS
|
||||
END
|
||||
|
||||
BUTTON DLG_DELREC 8 2
|
||||
BEGIN
|
||||
PROMPT -36 -1 "~Elimina"
|
||||
MESSAGE EXIT,K_DEL
|
||||
END
|
||||
|
||||
BUTTON DLG_FINDREC 8 2
|
||||
BEGIN
|
||||
PROMPT -46 -1 "Ri~cerca"
|
||||
MESSAGE EXIT,K_F9
|
||||
END
|
||||
|
||||
BUTTON DLG_CANCEL 8 2
|
||||
BEGIN
|
||||
PROMPT -56 -1 ""
|
||||
MESSAGE EXIT,K_ESC
|
||||
END
|
||||
|
||||
BUTTON DLG_QUIT 8 2
|
||||
BEGIN
|
||||
PROMPT -66 -1 ""
|
||||
MESSAGE EXIT,K_QUIT
|
||||
END
|
||||
|
||||
BUTTON DLG_SAVEREC 8 2
|
||||
BEGIN
|
||||
PROMPT -16 -1 "~Registra"
|
||||
MESSAGE EXIT,K_SAVE
|
||||
END
|
||||
|
||||
BUTTON DLG_NEWREC 8 2
|
||||
BEGIN
|
||||
PROMPT -26 -1 "~Nuovo"
|
||||
MESSAGE EXIT,K_INS
|
||||
END
|
||||
|
||||
BUTTON DLG_DELREC 8 2
|
||||
BEGIN
|
||||
PROMPT -36 -1 "~Elimina"
|
||||
MESSAGE EXIT,K_DEL
|
||||
END
|
||||
|
||||
BUTTON DLG_FINDREC 8 2
|
||||
BEGIN
|
||||
PROMPT -46 -1 "Ri~cerca"
|
||||
MESSAGE EXIT,K_F9
|
||||
END
|
||||
|
||||
BUTTON DLG_CANCEL 8 2
|
||||
BEGIN
|
||||
PROMPT -56 -1 ""
|
||||
MESSAGE EXIT,K_ESC
|
||||
END
|
||||
|
||||
BUTTON DLG_QUIT 8 2
|
||||
BEGIN
|
||||
PROMPT -66 -1 ""
|
||||
MESSAGE EXIT,K_QUIT
|
||||
END
|
||||
|
||||
|
@ -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 (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);
|
||||
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());
|
||||
|
||||
#if XVT_OS == XVT_OS_WIN
|
||||
static bool set = TRUE;
|
||||
if (set)
|
||||
static bool to_set = TRUE;
|
||||
if (to_set)
|
||||
{
|
||||
HWND hwnd = (HWND)get_value(win, ATTR_NATIVE_WINDOW);
|
||||
word style = GetClassWord(hwnd, GCW_STYLE);
|
||||
style |= CS_BYTEALIGNCLIENT | CS_SAVEBITS;
|
||||
SetClassWord(hwnd, GCW_STYLE, style);
|
||||
set = FALSE;
|
||||
to_set = FALSE;
|
||||
}
|
||||
#endif
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user