Aggiunto metodo per device stampante e per riga corrente

git-svn-id: svn://10.65.10.50/trunk@2660 c028cbd2-c16b-5b4b-a496-9718f37d4682
This commit is contained in:
alex 1996-03-01 14:05:16 +00:00
parent 8e1aa76c3b
commit b365d2336d
2 changed files with 30 additions and 22 deletions

@ -1,11 +1,14 @@
#include <stdlib.h>
#if XVT_OS==XVT_OS_WIN
#define STRICT
#define XVT_INCL_NATIVE
#include <xvt.h>
#if XVT_OS == XVT_OS_WIN || XVT_OS == XVT_OS_NT
#include <strstrea.h>
#else
#include <strstream.h>
#endif
#include <xvt.h>
#if XVT_OS==XVT_OS_SCOUNIX
#include <unistd.h>
@ -223,9 +226,7 @@ struct PrDesc
}
PrintWhat;
#if XVT_OS == XVT_OS_WIN
#define STRICT
#include <windows.h>
#if XVT_OS == XVT_OS_WIN || XVT_OS == XVT_OS_NT
void TPrinter::_get_windows_printer_names (TToken_string & t)
{
@ -891,7 +892,7 @@ PRINT_RCD* TPrinter::get_printrcd(int *size)
return _print_rcd;
}
#if XVT_OS == XVT_OS_WIN
#if XVT_OS == XVT_OS_WIN || XVT_OS == XVT_OS_NT
// @doc EXTERNAL
@ -1035,7 +1036,7 @@ TPrinter::TPrinter()
: _date (TODAY), _multiple_link (FALSE), _frozen (FALSE), _isgraphics (TRUE),
_lines_per_inch (6), _ch_size (12), _ncopies(1), _export_header(FALSE),
_export_header_len(0), _vf(NULL), _l_offset(0), _c_offset(0)
#if XVT_OS == XVT_OS_WIN
#if XVT_OS == XVT_OS_WIN || XVT_OS == XVT_OS_NT
, _print_rcd(NULL)
#endif
@ -1061,7 +1062,7 @@ TPrinter::TPrinter()
// read configuration file
read_configuration ();
#if XVT_OS == XVT_OS_WIN
#if XVT_OS == XVT_OS_WIN || XVT_OS == XVT_OS_NT
// xvt_print_open ();
set_win_formlen ();
@ -1092,7 +1093,7 @@ TPrinter::TPrinter()
TToken_string& TPrinter::getprinternames ()
{
// per ora va solo in windows
#if XVT_OS == XVT_OS_WIN
#if XVT_OS == XVT_OS_WIN || XVT_OS == XVT_OS_NT
if (_printer_names.empty())
_get_windows_printer_names(_printer_names);
#endif
@ -1202,7 +1203,7 @@ void TPrinter::read_configuration(
{
case 0:
case 5:
#if XVT_OS == XVT_OS_WIN
#if XVT_OS == XVT_OS_WIN || XVT_OS == XVT_OS_NT
_printertype = winprinter;
#else
PrinterDef & def = (PrinterDef &) get_description (_curprn);
@ -1279,7 +1280,7 @@ void TPrinter::save_configuration()
TPrinter::~TPrinter ()
{
#if XVT_OS == XVT_OS_WIN
#if XVT_OS == XVT_OS_WIN || XVT_OS == XVT_OS_NT
if (_print_rcd != NULL)
{
xvt_print_destroy(_print_rcd);
@ -1437,7 +1438,7 @@ bool TPrinter::printrow(
return TRUE;
}
#if XVT_OS != XVT_OS_SCOUNIX
#if XVT_OS == XVT_OS_WIN || XVT_OS == XVT_OS_NT
if (_printertype == fileprinter)
{
@ -1535,7 +1536,7 @@ bool TPrinter::printfooter()
for (int i = 0; i < _footersize && ok; i++)
ok = printrow(getfooterline(i));
#if XVT_OS != XVT_OS_WIN
#if XVT_OS == XVT_OS_SCOUNIX
if (ok)
printformfeed();
#endif
@ -1616,7 +1617,7 @@ void TPrinter::reset()
bool TPrinter::printformfeed()
{
#if XVT_OS != XVT_OS_WIN
#if XVT_OS == XVT_OS_SCOUNIX
const PrinterDef & pd = get_description(_curprn);
if (_printertype != screenvis && _hwformfeed)
@ -1678,7 +1679,7 @@ bool TPrinter::open()
_vf->open_modal ();
}
else if (_printertype == winprinter || _printertype == export
#if XVT_OS != XVT_OS_SCOUNIX
#if XVT_OS == XVT_OS_WIN || XVT_OS == XVT_OS_NT
|| _printertype == fileprinter
#endif
)
@ -1848,7 +1849,7 @@ bool TPrinter::set()
if (k == DLG_SETPRINT)
{
// l'handler setta default di windows a quella nel listbox e ribecca l'rcd
#if XVT_OS == XVT_OS_WIN
#if XVT_OS == XVT_OS_WIN || XVT_OS == XVT_OS_NT
if (xvt_dm_post_page_setup(get_printrcd()))
{
// see if user has changed printer
@ -1973,7 +1974,7 @@ int TPrinter::set_bookmark(
void TPrinter::print_txt(TTextfile& txt)
{
#if XVT_OS == XVT_OS_WIN
#if XVT_OS == XVT_OS_WIN || XVT_OS == XVT_OS_NT
PrintWhat._prcd = _print_rcd;
PrintWhat._txt = &txt;
PrintWhat._graphics = _isgraphics;
@ -2028,7 +2029,7 @@ void TPrinter::close ()
txt.close();
}
}
#if XVT_OS == XVT_OS_WIN
#if XVT_OS == XVT_OS_WIN || XVT_OS == XVT_OS_NT
else if (_printertype == winprinter && _txt.lines() > 0L)
{
print_txt(_txt);
@ -2076,7 +2077,7 @@ _isopen = FALSE;
#include <bagn004.h>
#if XVT_OS == XVT_OS_WIN
#if XVT_OS == XVT_OS_WIN || XVT_OS == XVT_OS_NT
const char* const FORMAT_COMMAND = "FORMAT";
#else
const char* const FORMAT_COMMAND = "dosformat -fq";

@ -44,7 +44,7 @@ enum TPrtype
// @enum TGraphic_shape | Indica la forma grafica da utilizzare per la stampa
enum TGraphic_shape
{
line, // @emem Disgna una linea
line, // @emem Disgna una linea
box // @emem Disgna un box
};
@ -384,7 +384,7 @@ public:
virtual ~TPrinter();
#if XVT_OS == XVT_OS_WIN
#if XVT_OS == XVT_OS_WIN || XVT_OS == XVT_OS_NT
// @cmember Inizia una nuova sessione di stampa. Viene passata alla <mf TPrintwin::do_print>
static BOOLEAN XVT_CALLCONV1 start_winprint(long);
#endif
@ -427,6 +427,9 @@ public:
// @cmember Ritorna il numero dell'ultima pagina da stampare
word topage () const
{ return _topage; }
// @cmember Ritorna la riga corrente all' interno della pagina
int current_row () const
{ return _currentrow; }
// @cmember Ritorna la dimensione dell'header
int headersize () const
{ return _headersize; }
@ -616,7 +619,7 @@ public:
void set_printrcd();
// @cmember Ritorna il record per la descrizione dello stato dell stampante
PRINT_RCD* get_printrcd(int* size = NULL);
#if XVT_OS == XVT_OS_WIN
#if XVT_OS == XVT_OS_WIN || XVT_OS == XVT_OS_NT
// @cmember Setta le caratteristiche della stampante leggendole da <p _print_rcd>
void set_win_formlen(WINDOW prwin = NULL_WIN);
#endif
@ -656,6 +659,10 @@ public:
char* fontname() const
{ return (char*)(const char*)_fontname; }
// @cmember Ritorna il nome della stampante
const char* printername() const
{ return (const char*)get_description (_curprn)._devicename; }
// @cmember Setta la dimensione dei caratteri da stampare
void set_char_size(int size)
{ _ch_size = size; }