Corretta gestione ultima pagina

git-svn-id: svn://10.65.10.50/trunk@2643 c028cbd2-c16b-5b4b-a496-9718f37d4682
This commit is contained in:
alex 1996-02-26 13:25:34 +00:00
parent 0fb31ef39c
commit 3a5d57c310

View File

@ -1,7 +1,7 @@
#include <ctype.h> #include <ctype.h>
#include <stdlib.h> #include <stdlib.h>
#if XVT_OS == XVT_OS_WIN #if XVT_OS == XVT_OS_WIN || XVT_OS == XVT_OS_NT
#define STRICT #define STRICT
#include <windows.h> #include <windows.h>
#endif #endif
@ -12,7 +12,8 @@
#include <printer.h> #include <printer.h>
#include <relation.h> #include <relation.h>
#include <sheet.h> #include <sheet.h>
#include <utility.h> #include <utility.h>
#include <spool.h>
#ifndef __DEFMASK_H #ifndef __DEFMASK_H
#include <defmask.h> #include <defmask.h>
@ -641,7 +642,7 @@ TToken_string& TForm_item::message(int m)
} }
// @doc EXTERNAL // @doc EXTERNAL
// @mfunc Manda il messaggio al campo <p dest> // @mfunc Manda il messaggio al campo <p dest>
void TForm_item::send_message( void TForm_item::send_message(
const TString& cmd, // @parm Messaggio di comando const TString& cmd, // @parm Messaggio di comando
@ -3405,8 +3406,12 @@ void TForm::arrange_form()
// CHR(15), allora prima del posizionamento scrivo il chr(15) sulla stampante! // CHR(15), allora prima del posizionamento scrivo il chr(15) sulla stampante!
{ {
TString device; int i, x;
#if XVT_OS == XVT_OS_WIN TString str_pos;
TMask m("ba2100c");
#if XVT_OS == XVT_OS_WIN || XVT_OS == XVT_OS_NT
/*
char defPrinter[80]; char defPrinter[80];
char szDevice[50]; char szDevice[50];
@ -3416,22 +3421,28 @@ void TForm::arrange_form()
GetProfileString ("devices", pdev, "", szDevice, sizeof(szDevice)); GetProfileString ("devices", pdev, "", szDevice, sizeof(szDevice));
pdev.add(szDevice); pdev.add(szDevice);
device = pdev.get(2); device = pdev.get(2);
device = device.left(4); //Legge solo LPTx... device = device.left(4); //Legge solo LPTx...
#endif */
#else
TString device(printer.printername());
FILE* lpt = fopen(device,"w"); FILE* lpt = fopen(device,"w");
int i, x; if (lpt == NULL)
TString str_pos; fatal_box("Non rieso ad aprire il device %s.",device);
if (lpt == NULL) fatal_box("Non rieso ad aprire il device %s.",device); #endif
TMask m("ba2100c");
// _ipy viene assunto uguale per entrambi i posizionamneti // _ipy viene assunto uguale per entrambi i posizionamneti
str_pos << "\017"; // Questo e' 15 in ottale... str_pos = "\017"; // Questo e' 15 in ottale...
for (i=1; i < _ipy; i++) str_pos << "\n"; for (i=1; i < _ipy; i++) str_pos << "\n";
#if XVT_OS == XVT_OS_WIN || XVT_OS == XVT_OS_NT
SpoolRow((char *) (const char *) str_pos, str_pos.len());
#else
fprintf(lpt,"%s",(const char*) str_pos); fprintf(lpt,"%s",(const char*) str_pos);
fflush(lpt); // Salta le righe... fflush(lpt); // Salta le righe...
fclose(lpt); fclose(lpt);
str_pos.cut(0); //Azzera la stringa di posizionamento #endif
str_pos = ""; //Azzera la stringa di posizionamento
for (i=1; i < _ipx; i++) str_pos << " "; //Aggiunge gli spazi necessari... for (i=1; i < _ipx; i++) str_pos << " "; //Aggiunge gli spazi necessari...
if (_ipx > 0 && _ipy > 0) if (_ipx > 0 && _ipy > 0)
str_pos << _char_to_pos; // aggiunge il primo carattere di posizionamento... str_pos << _char_to_pos; // aggiunge il primo carattere di posizionamento...
@ -3439,26 +3450,29 @@ void TForm::arrange_form()
for (i=1; i < x; i++) str_pos << " "; for (i=1; i < x; i++) str_pos << " ";
if (_fpx > 0) if (_fpx > 0)
str_pos << _char_to_pos; // aggiunge il secondo carattere di posizionamento str_pos << _char_to_pos; // aggiunge il secondo carattere di posizionamento
TString bspc; bspc.fill('\b',str_pos.len()); // Questi servono per tornare indietro... str_pos << '\r';
// TString bspc; bspc.fill('\b',str_pos.len()); // Questi servono per tornare indietro...
do do
{ {
#if XVT_OS == XVT_OS_WIN || XVT_OS == XVT_OS_NT
SpoolRow((char *)(const char *) str_pos, str_pos.len());
#else
lpt = fopen(device,"w"); lpt = fopen(device,"w");
if (lpt == NULL) fatal_box("Non rieso ad aprire il device %s.",device); if (lpt == NULL) fatal_box("Non rieso ad aprire il device %s.",device);
// fprintf(lpt,"%s",(const char*) bspc); // fprintf(lpt,"%s",(const char*) bspc);
fprintf(lpt,"%s\n",(const char*) str_pos); fprintf(lpt,"%s\r",(const char*) str_pos);
fflush(lpt); fflush(lpt);
fclose(lpt); fclose(lpt);
#endif
} while (m.run() == K_ESC); // cicla sulla stampa posizionamento... } while (m.run() == K_ESC); // cicla sulla stampa posizionamento...
const int h = height(odd_page); /* const int h = height(odd_page);
str_pos.cut(0); str_pos.cut(0);
for (i=0; i < h; i++) str_pos << "\n"; for (i=0; i < h; i++) str_pos << "\n";
lpt = fopen(device,"w"); lpt = fopen(device,"w");
if (lpt == NULL) fatal_box("Non rieso ad aprire il device %s.",device); if (lpt == NULL) fatal_box("Non rieso ad aprire il device %s.",device);
fprintf(lpt, "%s", (const char*) str_pos); // Salta tante righe quanto e' lungo il form standard fprintf(lpt, "%s", (const char*) str_pos); // Salta tante righe quanto e' lungo il form standard
fclose (lpt); fclose (lpt); */
#if XVT_OS != XVT_OS_WIN printer().set_offset(_ipy - 1, printer().get_column_offset());
#pragma message ("Voglio proprio vedere come fai a gestire il posizionamento sotto Unix!")
#endif
} }
long TForm::records() const long TForm::records() const
@ -3759,7 +3773,7 @@ bool TForm::print(
set_body(page(pr), TRUE); set_body(page(pr), TRUE);
} }
if (i == lastrec) if (i == lastrec && from >= 0)
{ {
if (cursor()) *cursor() = i; if (cursor()) *cursor() = i;
set_last_page(TRUE); set_last_page(TRUE);