Continua la storia precedente (fralc) (S.C.D.C.L.M.B.)

git-svn-id: svn://10.65.10.50/trunk@5277 c028cbd2-c16b-5b4b-a496-9718f37d4682
This commit is contained in:
alex 1997-09-26 08:37:29 +00:00
parent 981f75391f
commit e82f80768b
2 changed files with 76 additions and 48 deletions

View File

@ -218,11 +218,12 @@ void TPrint_intersector::clear()
struct PrDesc
{
TTextfile *_txt;
PRINT_RCD *_prcd;
bool _graphics;
int _formlen;
int _charsize;
int _lines_per_inch;
// PRINT_RCD *_prcd;
// bool _graphics;
// int _formlen;
// int _charsize;
// int _lines_per_inch;
TPrinter * _p;
}
PrintWhat;
@ -250,9 +251,61 @@ BOOLEAN XVT_CALLCONV1 TPrinter::start_winprint (long data)
{
PrDesc *pd = (PrDesc *) data;
TTextfile& txt = *(pd->_txt);
TPrintwin pw(txt);
pw.do_print();
return pw.aborted();
const int vofs = pd->_p->get_line_offset();
const int hofs = pd->_p->get_column_offset();
if (pd->_p->is_generic() && (vofs != 0 || hofs != 0))
{
TTextfile new_txt;
TString s(256);
const long last_row = txt.lines();
long out_row = 0;
for (long row = (vofs < 0 ? -vofs : 0); row < last_row; row++)
{
const int pagelen = pd->_p->formlen();
const int page_row = (int) (out_row % pagelen);
if (vofs > 0 && page_row == 0)
{
const int page = (int) (out_row / pagelen);
for (int i = vofs; i > 0; i--)
{
out_row++;
if (page > 0)
row++;
new_txt.append("");
}
}
if (vofs < 0 && page_row == pagelen + vofs)
{
for (int i = -vofs; i > 0; i--)
{
out_row++;
row++;
new_txt.append("");
}
}
s = txt.line(row);
if (hofs < 0)
s.ltrim(-hofs);
else
if(hofs > 0)
s.lpad(s.len() + hofs);
new_txt.append(s);
out_row++;
}
TPrintwin pw(new_txt);
pw.do_print();
return pw.aborted();
}
else
{
TPrintwin pw(txt);
pw.do_print();
return pw.aborted();
}
}
#endif
@ -2006,10 +2059,11 @@ void TPrinter::print_txt(TTextfile& txt)
#if XVT_OS == XVT_OS_WIN || XVT_OS == XVT_OS_WIN32
if (txt.lines() > 0)
{
PrintWhat._prcd = _print_rcd;
// PrintWhat._prcd = _print_rcd;
PrintWhat._txt = &txt;
PrintWhat._graphics = _isgraphics;
PrintWhat._charsize = _ch_size;
// PrintWhat._graphics = _isgraphics;
// PrintWhat._charsize = _ch_size;
PrintWhat._p = this;
xvt_print_open();
xvt_print_start_thread (start_winprint, (long) (&PrintWhat));
xvt_print_close();

View File

@ -222,17 +222,10 @@ void TPrintwin::paint_row(long j)
{
_frlc++;
xvt_dwin_draw_text(win(), 0, y , "", -1);
}
}
else
if (_blank_lines_to_print > 0)
{
_frlc++;
xvt_dwin_draw_text(win(), 0, y , "", -1);
_blank_lines_to_print--;
}
else
#endif
xvt_dwin_draw_text(win(), 0, y /* + _frlc_cnst */, (char*)(const char*)_txt.line(j - _frlc), -1);
xvt_dwin_draw_text(win(), 0, y /* + _frlc_cnst */, (char*)(const char*)_txt.line(j - _frlc), -1);
}
}
@ -249,42 +242,23 @@ bool TPrintwin::print_band(
{
// int i,l_ofst = printer().get_line_offset();
// const int offset = l_ofst < 0 ? abs(l_ofst) + 1: 0;
const int offset = printer().get_line_offset();
const bool generic = _chary == 1;
// const int offset = printer().get_line_offset();
// const bool generic = _chary == 1;
const long j = ((long)page) * _formlen;
const int rows = (r.bottom - r.top) / _chary;
const int top = r.top / _chary;
const int top = r.top / _chary;
for (int k = top; k < top+rows; k++)
{
if (generic && k < _formlen && (j + k) % _pagelen == 0)
{
if (offset < 0)
_frlc += offset;
else
{
if ((j + k) / _pagelen > 0)
_frlc -= offset;
_blank_lines_to_print += offset;
}
}
if ((j+k) < _txt.lines() + _frlc && k < _formlen || _blank_lines_to_print > 0)
paint_row(j+k);
long row = j + k;
if (row < _txt.lines() + _frlc && k < _formlen)
paint_row(row);
else
break;
if (generic && offset < 0 && (j + k + 1) % _pagelen == 0)
{
if (k + 1 < _realformlen)
_blank_lines_to_print += abs(offset);
else
break;
}
}
if (generic && offset < 0 && (j + k + 1) % _pagelen == 0)
_blank_lines_to_print += abs(offset);
const bool cont = (j+k < _txt.lines() + _frlc) || _blank_lines_to_print > 0;
return cont;
return (j + k < _txt.lines() + _frlc);
}
// @doc INTERNAL