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 <stdlib.h>
#if XVT_OS == XVT_OS_WIN
#if XVT_OS == XVT_OS_WIN || XVT_OS == XVT_OS_NT
#define STRICT
#include <windows.h>
#endif
@ -12,7 +12,8 @@
#include <printer.h>
#include <relation.h>
#include <sheet.h>
#include <utility.h>
#include <utility.h>
#include <spool.h>
#ifndef __DEFMASK_H
#include <defmask.h>
@ -641,7 +642,7 @@ TToken_string& TForm_item::message(int m)
}
// @doc EXTERNAL
// @mfunc Manda il messaggio al campo <p dest>
void TForm_item::send_message(
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!
{
TString device;
#if XVT_OS == XVT_OS_WIN
int i, x;
TString str_pos;
TMask m("ba2100c");
#if XVT_OS == XVT_OS_WIN || XVT_OS == XVT_OS_NT
/*
char defPrinter[80];
char szDevice[50];
@ -3416,22 +3421,28 @@ void TForm::arrange_form()
GetProfileString ("devices", pdev, "", szDevice, sizeof(szDevice));
pdev.add(szDevice);
device = pdev.get(2);
device = device.left(4); //Legge solo LPTx...
#endif
device = device.left(4); //Legge solo LPTx...
*/
#else
TString device(printer.printername());
FILE* lpt = fopen(device,"w");
int i, x;
TString str_pos;
if (lpt == NULL) fatal_box("Non rieso ad aprire il device %s.",device);
TMask m("ba2100c");
if (lpt == NULL)
fatal_box("Non rieso ad aprire il device %s.",device);
#endif
// _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";
#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);
fflush(lpt); // Salta le righe...
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...
if (_ipx > 0 && _ipy > 0)
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 << " ";
if (_fpx > 0)
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
{
#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");
if (lpt == NULL) fatal_box("Non rieso ad aprire il device %s.",device);
// fprintf(lpt,"%s",(const char*) bspc);
fprintf(lpt,"%s\n",(const char*) str_pos);
fprintf(lpt,"%s\r",(const char*) str_pos);
fflush(lpt);
fclose(lpt);
fclose(lpt);
#endif
} 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);
for (i=0; i < h; i++) str_pos << "\n";
lpt = fopen(device,"w");
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
fclose (lpt);
#if XVT_OS != XVT_OS_WIN
#pragma message ("Voglio proprio vedere come fai a gestire il posizionamento sotto Unix!")
#endif
fclose (lpt); */
printer().set_offset(_ipy - 1, printer().get_column_offset());
}
long TForm::records() const
@ -3759,7 +3773,7 @@ bool TForm::print(
set_body(page(pr), TRUE);
}
if (i == lastrec)
if (i == lastrec && from >= 0)
{
if (cursor()) *cursor() = i;
set_last_page(TRUE);