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:
parent
981f75391f
commit
e82f80768b
@ -218,11 +218,12 @@ void TPrint_intersector::clear()
|
|||||||
struct PrDesc
|
struct PrDesc
|
||||||
{
|
{
|
||||||
TTextfile *_txt;
|
TTextfile *_txt;
|
||||||
PRINT_RCD *_prcd;
|
// PRINT_RCD *_prcd;
|
||||||
bool _graphics;
|
// bool _graphics;
|
||||||
int _formlen;
|
// int _formlen;
|
||||||
int _charsize;
|
// int _charsize;
|
||||||
int _lines_per_inch;
|
// int _lines_per_inch;
|
||||||
|
TPrinter * _p;
|
||||||
}
|
}
|
||||||
PrintWhat;
|
PrintWhat;
|
||||||
|
|
||||||
@ -250,9 +251,61 @@ BOOLEAN XVT_CALLCONV1 TPrinter::start_winprint (long data)
|
|||||||
{
|
{
|
||||||
PrDesc *pd = (PrDesc *) data;
|
PrDesc *pd = (PrDesc *) data;
|
||||||
TTextfile& txt = *(pd->_txt);
|
TTextfile& txt = *(pd->_txt);
|
||||||
TPrintwin pw(txt);
|
const int vofs = pd->_p->get_line_offset();
|
||||||
pw.do_print();
|
const int hofs = pd->_p->get_column_offset();
|
||||||
return pw.aborted();
|
|
||||||
|
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
|
#endif
|
||||||
|
|
||||||
@ -2006,10 +2059,11 @@ void TPrinter::print_txt(TTextfile& txt)
|
|||||||
#if XVT_OS == XVT_OS_WIN || XVT_OS == XVT_OS_WIN32
|
#if XVT_OS == XVT_OS_WIN || XVT_OS == XVT_OS_WIN32
|
||||||
if (txt.lines() > 0)
|
if (txt.lines() > 0)
|
||||||
{
|
{
|
||||||
PrintWhat._prcd = _print_rcd;
|
// PrintWhat._prcd = _print_rcd;
|
||||||
PrintWhat._txt = &txt;
|
PrintWhat._txt = &txt;
|
||||||
PrintWhat._graphics = _isgraphics;
|
// PrintWhat._graphics = _isgraphics;
|
||||||
PrintWhat._charsize = _ch_size;
|
// PrintWhat._charsize = _ch_size;
|
||||||
|
PrintWhat._p = this;
|
||||||
xvt_print_open();
|
xvt_print_open();
|
||||||
xvt_print_start_thread (start_winprint, (long) (&PrintWhat));
|
xvt_print_start_thread (start_winprint, (long) (&PrintWhat));
|
||||||
xvt_print_close();
|
xvt_print_close();
|
||||||
|
@ -222,17 +222,10 @@ void TPrintwin::paint_row(long j)
|
|||||||
{
|
{
|
||||||
_frlc++;
|
_frlc++;
|
||||||
xvt_dwin_draw_text(win(), 0, y , "", -1);
|
xvt_dwin_draw_text(win(), 0, y , "", -1);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
if (_blank_lines_to_print > 0)
|
|
||||||
{
|
|
||||||
_frlc++;
|
|
||||||
xvt_dwin_draw_text(win(), 0, y , "", -1);
|
|
||||||
_blank_lines_to_print--;
|
|
||||||
}
|
|
||||||
else
|
|
||||||
#endif
|
#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();
|
// int i,l_ofst = printer().get_line_offset();
|
||||||
// const int offset = l_ofst < 0 ? abs(l_ofst) + 1: 0;
|
// const int offset = l_ofst < 0 ? abs(l_ofst) + 1: 0;
|
||||||
const int offset = printer().get_line_offset();
|
// const int offset = printer().get_line_offset();
|
||||||
const bool generic = _chary == 1;
|
// const bool generic = _chary == 1;
|
||||||
|
|
||||||
const long j = ((long)page) * _formlen;
|
const long j = ((long)page) * _formlen;
|
||||||
const int rows = (r.bottom - r.top) / _chary;
|
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++)
|
for (int k = top; k < top+rows; k++)
|
||||||
{
|
{
|
||||||
if (generic && k < _formlen && (j + k) % _pagelen == 0)
|
long row = j + k;
|
||||||
{
|
|
||||||
if (offset < 0)
|
if (row < _txt.lines() + _frlc && k < _formlen)
|
||||||
_frlc += offset;
|
paint_row(row);
|
||||||
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);
|
|
||||||
else
|
else
|
||||||
break;
|
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)
|
return (j + k < _txt.lines() + _frlc);
|
||||||
_blank_lines_to_print += abs(offset);
|
|
||||||
const bool cont = (j+k < _txt.lines() + _frlc) || _blank_lines_to_print > 0;
|
|
||||||
return cont;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// @doc INTERNAL
|
// @doc INTERNAL
|
||||||
|
Loading…
x
Reference in New Issue
Block a user