Sistemato numero di copie nella printer; la set() chiamata dalle applicazioni
non printapp nasconde la voce n. copie a meno che non si faccia enable_multiple_copies() git-svn-id: svn://10.65.10.50/trunk@243 c028cbd2-c16b-5b4b-a496-9718f37d4682
This commit is contained in:
parent
c1e97ca1f9
commit
7c792335de
@ -1,4 +1,4 @@
|
||||
// $Id: printapp.cpp,v 1.7 1994-09-14 10:43:51 villa Exp $
|
||||
// $Id: printapp.cpp,v 1.8 1994-09-15 07:52:43 villa Exp $
|
||||
#include <ctype.h>
|
||||
#include <stdarg.h>
|
||||
|
||||
@ -762,10 +762,11 @@ void TPrint_application::print()
|
||||
|
||||
// only external apps can change it
|
||||
_repeat_print = FALSE;
|
||||
ncopies = printer().n_copies();
|
||||
|
||||
// never print multiple copies if printer is viswin
|
||||
// only application may repeat printing by setting _repeat_print
|
||||
int nc = printer().printtype() == screenvis ? 1 : _ncopies;
|
||||
int nc = printer().printtype() == screenvis ? 1 : ncopies;
|
||||
|
||||
// NULL cursor passed only prints once
|
||||
// pre and post process do everything
|
||||
@ -1242,7 +1243,6 @@ TPrint_application::TPrint_application ():TApplication (), _transtab (10),
|
||||
{
|
||||
_cur = NULL;
|
||||
_repeat_print = FALSE;
|
||||
_ncopies = 1;
|
||||
_currow = _maxrow = 0;
|
||||
_auto_ff = FALSE;
|
||||
_wbar = _wcancel = TRUE;
|
||||
|
@ -72,7 +72,6 @@ class TPrint_application : public TApplication
|
||||
TProgind* _prind;
|
||||
const char* _picture;
|
||||
MENU_TAG _last_choice;
|
||||
int _ncopies;
|
||||
bool _repeat_print;
|
||||
|
||||
// set the printer
|
||||
@ -456,8 +455,6 @@ public:
|
||||
{ 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();
|
||||
|
@ -642,7 +642,7 @@ bool set_windows_print_device (TMask_field & f, KEY key)
|
||||
|
||||
TPrinter::TPrinter()
|
||||
: _date (TODAY), _multiple_link (FALSE), _frozen (FALSE), _isgraphics (TRUE),
|
||||
_lines_per_inch (6), _ch_size (12)
|
||||
_lines_per_inch (6), _ch_size (12), _ncopies(1)
|
||||
|
||||
{
|
||||
_footerhandler = _headerhandler = NULL;
|
||||
@ -662,6 +662,8 @@ TPrinter::TPrinter()
|
||||
_headersize = 0;
|
||||
_footersize = 0;
|
||||
_isopen = FALSE;
|
||||
_multiple_copies = MainApp()->class_id() == CLASS_PRINTER_APPLICATION;
|
||||
|
||||
// read configuration file
|
||||
read_configuration (_config);
|
||||
#if XVT_OS == XVT_OS_WIN
|
||||
@ -1149,6 +1151,7 @@ void TPrinter::set()
|
||||
mask.hide(MSK_1_SETUP);
|
||||
mask.hide(MSK_1_SIZE);
|
||||
mask.hide(MSK_1_LINES);
|
||||
if (!_multiple_copies) mask.hide(MSK_1_NPAGES);
|
||||
|
||||
pn1 = "";
|
||||
pn2 = "";
|
||||
@ -1171,11 +1174,7 @@ 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);
|
||||
|
||||
int nc = 1;
|
||||
if (MainApp()->class_id() == CLASS_PRINT_APPLICATION)
|
||||
nc = ((TPrint_application*)MainApp())->get_n_copies();
|
||||
mask.set(MSK_1_NPAGES, nc);
|
||||
mask.set(MSK_1_NPAGES, _ncopies);
|
||||
|
||||
mask.reset (MSK_1_SAVE);
|
||||
|
||||
@ -1195,9 +1194,7 @@ void TPrinter::set()
|
||||
// get user choices
|
||||
|
||||
_curprn = atoi(mask.get(MSK_1_PRINTERS));
|
||||
|
||||
if (MainApp()->class_id() == CLASS_PRINT_APPLICATION)
|
||||
((TPrint_application*)MainApp())->set_n_copies(atoi(mask.get(MSK_1_NPAGES)));
|
||||
_ncopies = atoi(mask.get(MSK_1_NPAGES));
|
||||
|
||||
PrinterDef& def = (PrinterDef &) get_description (_curprn);
|
||||
switch (atoi(mask.get (MSK_1_TYPE)))
|
||||
@ -1241,15 +1238,15 @@ void TPrinter::set()
|
||||
|
||||
((TList_field &) (mask.field (MSK_1_PRINTERS))).replace_items(pn1, pn2);
|
||||
mask.set(MSK_1_PRINTERS, pn1.get(_curprn));
|
||||
|
||||
mask.hide(MSK_1_CODES);
|
||||
if (!_multiple_copies) mask.hide(MSK_1_NPAGES);
|
||||
|
||||
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);
|
||||
mask.set(MSK_1_NPAGES, _ncopies);
|
||||
|
||||
if (_printertype == fileprinter)
|
||||
mask.set (MSK_1_TYPE, "1");
|
||||
@ -1312,8 +1309,7 @@ void TPrinter::set()
|
||||
mask.save ();
|
||||
}
|
||||
|
||||
if (MainApp()->class_id() == CLASS_PRINT_APPLICATION)
|
||||
((TPrint_application*)MainApp())->set_n_copies(atoi (mask.get (MSK_1_NPAGES)));
|
||||
_ncopies = atoi (mask.get (MSK_1_NPAGES));
|
||||
|
||||
switch (atoi (mask.get (MSK_1_TYPE)))
|
||||
{
|
||||
|
@ -35,7 +35,7 @@ enum TPrintstyle {
|
||||
boldstyle = 1,
|
||||
underlinedstyle = 2,
|
||||
italicstyle = 3
|
||||
};
|
||||
};
|
||||
|
||||
enum TPrtype {
|
||||
normprinter = 0,
|
||||
@ -44,7 +44,7 @@ enum TPrtype {
|
||||
localprinter = 3,
|
||||
screenvis = 4,
|
||||
winprinter = 5
|
||||
};
|
||||
};
|
||||
|
||||
|
||||
// @END
|
||||
@ -57,7 +57,7 @@ class TPrintrow : public TObject
|
||||
{
|
||||
enum { MAXSTR = 256 };
|
||||
|
||||
// @DPROT
|
||||
// @DPROT
|
||||
TString256 _row; // the actual string to print
|
||||
char _attr[MAXSTR]; // contains char attributes of _row
|
||||
int _cols[MAXSTR]; // contains color attributes of _row
|
||||
@ -66,12 +66,12 @@ class TPrintrow : public TObject
|
||||
int _lastpos; // last print position
|
||||
|
||||
public:
|
||||
// @FPUB
|
||||
// @FPUB
|
||||
TPrintrow();
|
||||
TPrintrow(const TPrintrow& pr);
|
||||
virtual ~TPrintrow() {}
|
||||
|
||||
// TPrintrow& center(const char* str, int position);
|
||||
// TPrintrow& center(const char* str, int position);
|
||||
virtual word class_id() const;
|
||||
virtual const char* class_name() const;
|
||||
virtual TObject* dup() const;
|
||||
@ -125,7 +125,7 @@ typedef void (*LINKHANDLER)(int, const char*);
|
||||
|
||||
class TPrinter : public TObject
|
||||
{
|
||||
// @DPROT
|
||||
// @DPROT
|
||||
|
||||
FILE* _cnfptr; // config file
|
||||
FILE* _fp; // pointer to the printer file
|
||||
@ -158,6 +158,7 @@ class TPrinter : public TObject
|
||||
TToken_string _printer_names;
|
||||
bool _isgraphics;
|
||||
bool _frozen;
|
||||
int _ncopies;
|
||||
#if XVT_OS == XVT_OS_WIN
|
||||
PRINT_RCD* _print_rcd;
|
||||
int _print_rcd_size;
|
||||
@ -169,13 +170,14 @@ class TPrinter : public TObject
|
||||
|
||||
void _parse_background();
|
||||
void _get_windows_printer_names(TToken_string& t);
|
||||
bool _multiple_copies;
|
||||
|
||||
PRINTSECTIONHANDLER _headerhandler, _footerhandler;
|
||||
LINKHANDLER _linkhandler;
|
||||
|
||||
// @END
|
||||
// @END
|
||||
|
||||
// @FPROT
|
||||
// @FPROT
|
||||
protected:
|
||||
virtual char newline() { return '\n'; }
|
||||
bool printrow (TPrintrow* rowtoprint=NULL); // base methods for printing
|
||||
@ -229,6 +231,8 @@ public:
|
||||
TArray* getbgdesc() { return &_background; }
|
||||
bool frozen() { return _frozen; }
|
||||
void freeze(bool b = TRUE) { _frozen = b; }
|
||||
int n_copies() { return _ncopies; }
|
||||
void enable_multiple_copies(bool b = TRUE) { _multiple_copies = b; }
|
||||
|
||||
TToken_string& getprinternames();
|
||||
TTextfile& get_txt() { return _txt; }
|
||||
@ -298,7 +302,7 @@ class TFile_printer : public TPrinter
|
||||
TArray _tmp_files; // array dei file temporanei generati
|
||||
FILE * _fd;
|
||||
|
||||
// bool scrivi_volume();
|
||||
// bool scrivi_volume();
|
||||
|
||||
public:
|
||||
|
||||
@ -332,19 +336,19 @@ public:
|
||||
void open();
|
||||
void close();
|
||||
|
||||
// void scrivi();
|
||||
// void scrivi();
|
||||
bool genera_dischetti();
|
||||
|
||||
virtual void set ();
|
||||
|
||||
//
|
||||
// tipo_disco:
|
||||
// 0 per 360
|
||||
// 1 per 1.2
|
||||
// 2 per 720
|
||||
// 3 per 1,44
|
||||
// 4 per 2,88
|
||||
//
|
||||
//
|
||||
// tipo_disco:
|
||||
// 0 per 360
|
||||
// 1 per 1.2
|
||||
// 2 per 720
|
||||
// 3 per 1,44
|
||||
// 4 per 2,88
|
||||
//
|
||||
TFile_printer (const char* file,
|
||||
const char* label,
|
||||
int len_rec,
|
||||
|
@ -1,36 +1,36 @@
|
||||
BUTTON DLG_SAVEREC 8 2
|
||||
BEGIN
|
||||
PROMPT -16 -1 "~Registra"
|
||||
MESSAGE EXIT,K_SAVE
|
||||
PROMPT -16 -1 "~Registra"
|
||||
MESSAGE EXIT,K_SAVE
|
||||
END
|
||||
|
||||
BUTTON DLG_NEWREC 8 2
|
||||
BEGIN
|
||||
PROMPT -26 -1 "~Nuovo"
|
||||
MESSAGE EXIT,K_INS
|
||||
PROMPT -26 -1 "~Nuovo"
|
||||
MESSAGE EXIT,K_INS
|
||||
END
|
||||
|
||||
BUTTON DLG_DELREC 8 2
|
||||
BEGIN
|
||||
PROMPT -36 -1 "~Elimina"
|
||||
MESSAGE EXIT,K_DEL
|
||||
PROMPT -36 -1 "~Elimina"
|
||||
MESSAGE EXIT,K_DEL
|
||||
END
|
||||
|
||||
BUTTON DLG_FINDREC 8 2
|
||||
BEGIN
|
||||
PROMPT -46 -1 "Ri~cerca"
|
||||
MESSAGE EXIT,K_F9
|
||||
PROMPT -46 -1 "Ri~cerca"
|
||||
MESSAGE EXIT,K_F9
|
||||
END
|
||||
|
||||
BUTTON DLG_CANCEL 8 2
|
||||
BEGIN
|
||||
PROMPT -56 -1 ""
|
||||
MESSAGE EXIT,K_ESC
|
||||
PROMPT -56 -1 ""
|
||||
MESSAGE EXIT,K_ESC
|
||||
END
|
||||
|
||||
BUTTON DLG_QUIT 8 2
|
||||
BEGIN
|
||||
PROMPT -66 -1 ""
|
||||
MESSAGE EXIT,K_QUIT
|
||||
PROMPT -66 -1 ""
|
||||
MESSAGE EXIT,K_QUIT
|
||||
END
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user