Continuata correzione per generica solo testo
git-svn-id: svn://10.65.10.50/trunk@3729 c028cbd2-c16b-5b4b-a496-9718f37d4682
This commit is contained in:
		
							parent
							
								
									210030f8b4
								
							
						
					
					
						commit
						880ce20da5
					
				| @ -167,7 +167,7 @@ void TPrintwin::paint_background(long j) | ||||
| void TPrintwin::paint_row(long j) | ||||
| { | ||||
|   const int row = (int)(j % _formlen); | ||||
|   const int y = row*_chary + _chary - _descent + _vofs; | ||||
|   const int y = row*_chary + _chary - _descent + ((_chary == 1) ? 0 : _vofs); | ||||
|    | ||||
|   if (_chary > 1) | ||||
|   {   | ||||
| @ -214,7 +214,8 @@ void TPrintwin::paint_row(long j) | ||||
|     set_font(printer().fontname(), XVT_FS_NONE, _char_size);                  | ||||
| #if XVT_OS == XVT_OS_WIN || XVT_OS == XVT_OS_NT | ||||
|     // Questa e' la patch per TTY.DRV.
 | ||||
|     if (j > 0 && (j % _realformlen) == 0)  | ||||
|     const TString s(_txt.line(j - _frlc)); | ||||
|     if (j > 0 && (j % _realformlen) == 0 || _blank_lines_to_print > 0)  | ||||
|     { | ||||
| /*
 | ||||
|       TString s(516); | ||||
| @ -224,6 +225,8 @@ void TPrintwin::paint_row(long j) | ||||
| */                     | ||||
|       xvt_dwin_draw_text(win(), 0, y  , "", -1);                            | ||||
|       _frlc++; | ||||
|       if (_blank_lines_to_print > 0) | ||||
|         _blank_lines_to_print--; | ||||
|     }   | ||||
|     else   | ||||
| #endif                                       | ||||
| @ -242,34 +245,56 @@ bool TPrintwin::print_band( | ||||
| 
 | ||||
|   // @comm Di solito viene disegnata l'intera pagina, ma la cosa dipende dal driver di stampa
 | ||||
| { | ||||
|   int i,l_ofst = printer().get_line_offset(); | ||||
|   const int offset = l_ofst < 0 ? abs(l_ofst) + 1: 0; | ||||
| //  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 long j   = ((long)page) * _formlen; | ||||
|   const int rows = (r.bottom - r.top) / _chary;   | ||||
|   const int top  = r.top / _chary; | ||||
|   const long totlines = _txt.lines() + _frlc; | ||||
|    | ||||
|   for (int k = top; k < top+rows; k++)  | ||||
|   { | ||||
|     if ((j+k) < totlines && k < _formlen )  | ||||
|     if (generic && k < _formlen && (j + k) % _pagelen == 0)                          | ||||
|     { | ||||
|       if (offset < 0) | ||||
|         _frlc += offset; | ||||
|       else | ||||
|         _blank_lines_to_print += offset; | ||||
|     } | ||||
|     if ((j+k) < _txt.lines() + _frlc && k < _formlen || _blank_lines_to_print > 0)  | ||||
|       paint_row(j+k); | ||||
|     else | ||||
|       break; | ||||
|     if (generic && offset < 0 && (j + k + 1) % _pagelen == 0)                          | ||||
|       _blank_lines_to_print += abs(offset); | ||||
| /*
 | ||||
|     { | ||||
|       int last = offset + _pagelen;    | ||||
|       for (i=_pagelen;i<= last; i++) | ||||
|       { | ||||
|         if (_chary == 1 && (i % _realformlen) == 0) // se, sfortunatamente e' una generica, applica
 | ||||
|         {  | ||||
|           _frlc++; | ||||
|           last++; | ||||
|           xvt_dwin_draw_text(win(), 0, i, "", -1);                            | ||||
|         }   | ||||
|         else   | ||||
|           xvt_dwin_draw_text(win(), 0, i, " ", -1); | ||||
|     } | ||||
| */ | ||||
|   } | ||||
|   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; | ||||
|   // Se l'offset impostato era negativo (id est: sposta in alto la stampa)
 | ||||
|   if (offset > 0)                          | ||||
| /*
 | ||||
|   { | ||||
|     int last = offset + _formlen;    | ||||
|     for (i=_formlen;i<= last /*(offset+_formlen) */;i++) | ||||
|     int last = offset + _pagelen;    | ||||
|     for (i=_pagelen;i<= last ;i++) | ||||
|       if (_chary == 1 && (i % _realformlen) == 0) // se, sfortunatamente e' una generica, applica
 | ||||
|       {  | ||||
|       /*                                          // patch per TTY.DRV (vedi paint_row())
 | ||||
|         TString s(516); | ||||
|         s << '\r' << " " << "\n\r"; | ||||
|         s << " "; | ||||
|         xvt_dwin_draw_text(win(), 0, i, (char*)(const char*)s, -1);    | ||||
|       */    | ||||
|         _frlc++; | ||||
|         last++; | ||||
|         xvt_dwin_draw_text(win(), 0, i, "", -1);                            | ||||
| @ -277,8 +302,9 @@ bool TPrintwin::print_band( | ||||
|       else   | ||||
|         xvt_dwin_draw_text(win(), 0, i, " ", -1); | ||||
|   } | ||||
| */ | ||||
|    | ||||
|   return j+k < totlines; | ||||
|   return cont; | ||||
| } | ||||
| 
 | ||||
| // @doc INTERNAL
 | ||||
| @ -302,6 +328,7 @@ bool TPrintwin::do_print() | ||||
|   const long size = xvt_dwin_get_font_size_mapped(win()); | ||||
| #endif            | ||||
|   _frlc = 0;             | ||||
|   _blank_lines_to_print = 0; | ||||
|   while (ok && !_aborted) | ||||
|   { | ||||
|     _aborted = !(bool)xvt_print_open_page(_printrcd);                   | ||||
| @ -344,6 +371,7 @@ TPrintwin::TPrintwin(TTextfile& txt) | ||||
|   set_font(p.fontname(), XVT_FS_NONE, _char_size);            | ||||
|   LEN_SPACES(win(), -1);          // force update 
 | ||||
|   | ||||
|   _pagelen = p.formlen();  | ||||
| #if XVT_OS == XVT_OS_WIN || XVT_OS == XVT_OS_NT | ||||
|   p.set_win_formlen(prwin);       // Calcola offset e altre misure pagina
 | ||||
|    | ||||
| @ -358,6 +386,7 @@ TPrintwin::TPrintwin(TTextfile& txt) | ||||
| #endif | ||||
|                 | ||||
|   _formlen   = p.formlen(); | ||||
|   p.formlen(_pagelen); | ||||
|    | ||||
|   if (p.is_generic()) | ||||
|   { | ||||
|  | ||||
| @ -29,8 +29,10 @@ class TPrintwin : public TWindow | ||||
|   bool _aborted; | ||||
|   // @cmember:(INTERNAL) Descrizione completa dello stato della stampante
 | ||||
|   PRINT_RCD* _printrcd;    | ||||
|   // @cmember:(INTERNAL) Lunghezza del modulo di stampa
 | ||||
|   // @cmember:(INTERNAL) Lunghezza del modulo di stampa restituito dal driver
 | ||||
|   int _formlen; | ||||
|   // @cmember:(INTERNAL) Lunghezza del modulo di stampa settato sulla stampante
 | ||||
|   int _pagelen; | ||||
|   // @cmember:(INTERNAL) Larghezza del modulo di stampa
 | ||||
|   int _formwidth; | ||||
|   // @cmember:(INTERNAL) Lunghezza reale (vale per stampanti Generico/Solo testo) del modulo di stampa
 | ||||
| @ -61,7 +63,9 @@ class TPrintwin : public TWindow | ||||
|   // @cmember:(INTERNAL) Altre caratteristihce del font (vedi XVT)
 | ||||
|   bool _inited; | ||||
|   // @cmember:(INTERNAL) Thanks to Fralc Consultores Inc.
 | ||||
|   bool _frlc; | ||||
|   int _frlc; | ||||
|   // @cmember:(INTERNAL) linee voute da stampare (per offset)
 | ||||
|   bool _blank_lines_to_print; | ||||
|    | ||||
|   // @cmember:(INTERNAL) Permette di disegnare lo sfondo della riga <p j>-esima
 | ||||
|   void paint_background(long j); | ||||
|  | ||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user