From cc9fb00ff9fc6cdf03088113f02411cbf8dc9019 Mon Sep 17 00:00:00 2001 From: guy Date: Thu, 15 May 2003 09:51:23 +0000 Subject: [PATCH] Patch level : 2.0 nopatch Files correlati : Ricompilazione Demo : [ ] Commento : Migliorato calcolo pagine da stampare git-svn-id: svn://10.65.10.50/trunk@11134 c028cbd2-c16b-5b4b-a496-9718f37d4682 --- include/printer.cpp | 11 +++++++---- include/progind.cpp | 5 ++++- 2 files changed, 11 insertions(+), 5 deletions(-) diff --git a/include/printer.cpp b/include/printer.cpp index 6784d8e1c..8b54c0a7d 100755 --- a/include/printer.cpp +++ b/include/printer.cpp @@ -199,6 +199,7 @@ struct TPrint_txt_info word _copies; word _pagefrom; word _pageto; + word _lastpage; bool edit(); TPrint_txt_info(TTextfile& txt); @@ -213,14 +214,16 @@ bool TPrint_txt_info::edit() msk.set(F_SIZE, p.get_char_size()); msk.set(F_ISGRAPHICS, p.isgraphics() ? "X" : ""); msk.set(F_FROMPAGE, _pagefrom); - msk.set(F_TOPAGE, _pageto); + msk.set(F_TOPAGE, _lastpage); msk.set(F_COPIES, _copies); - bool ok = msk.run() == K_ENTER; + const bool ok = msk.run() == K_ENTER; if (ok) { _copies = msk.get_int(F_COPIES); _pagefrom = msk.get_int(F_FROMPAGE); _pageto = msk.get_int(F_TOPAGE); + if (_pageto < _pagefrom || _pageto >= _lastpage) + _pageto = 0; } return ok; } @@ -228,9 +231,9 @@ bool TPrint_txt_info::edit() TPrint_txt_info::TPrint_txt_info(TTextfile& txt) : _txt(&txt), _copies(1), _pagefrom(1), _pageto(0) { - const word ps = txt.page_size(); + const word ps = printer().formlen(); const long li = txt.lines(); - _pageto = (li+ps-1) / ps; + _lastpage = (li+ps-1) / ps; } BOOLEAN TPrinter::start_print(long data) diff --git a/include/progind.cpp b/include/progind.cpp index 4c5ffccc7..377dc831e 100755 --- a/include/progind.cpp +++ b/include/progind.cpp @@ -284,7 +284,10 @@ TTimerind::TTimerind(long msec, const char* txt, } TTimerind::~TTimerind() -{ xvt_timer_destroy(_timer_id); } +{ + if (_timer_id != 0L) + xvt_timer_destroy(_timer_id); +} // C-style binding // uses static pointer for single instance of TIndwin