From 1c27eca32a50d42fa84f35346bb8abd750ae1897 Mon Sep 17 00:00:00 2001 From: angelo Date: Mon, 2 Sep 1996 14:18:13 +0000 Subject: [PATCH] Modifiche affinche funzioni l'offset negativo (sposta in alto la stampa). git-svn-id: svn://10.65.10.50/trunk@3479 c028cbd2-c16b-5b4b-a496-9718f37d4682 --- include/form.cpp | 23 +++++++++++++---------- include/printwin.cpp | 20 ++++++++++++++++++-- 2 files changed, 31 insertions(+), 12 deletions(-) diff --git a/include/form.cpp b/include/form.cpp index f889e0cad..ddf4ecde4 100755 --- a/include/form.cpp +++ b/include/form.cpp @@ -1561,13 +1561,7 @@ void TForm_number::apply_format(real& n , TString& s) const TToken_string delim(4, ','); // Stringa con i due delimitatori TString pic(picture()); // Picture senza delimitatori int maxlen = -1; - int comma = pic.find(','); - int at = pic.find('@'); - if (at >= 0 && comma <0) - { - maxlen = atoi(&pic[at+1]); - pic.cut(at); - } + if (pic[0] == '(') // Se ci sono i delimitatori ... { const int bra = pic.find(')'); @@ -1577,6 +1571,14 @@ void TForm_number::apply_format(real& n , TString& s) const pic.ltrim(bra + 1); // toglili dalla picture } } + + int comma = pic.find(','); + int at = pic.find('@'); + if (at >= 0 && comma <0) + { + maxlen = atoi(&pic[at+1]); + pic.cut(at); + } s=n.string(pic); // riempi la stringa col valore pitturato @@ -3627,7 +3629,7 @@ void TForm::arrange_form() 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); */ - printer().set_offset(_ipy - 1, printer().get_column_offset()); + printer().set_offset(-(_ipy-1), printer().get_column_offset()); } long TForm::records() const @@ -3861,6 +3863,8 @@ bool TForm::print( if (_arrange && pr.printtype() == winprinter) arrange_form(); } + else + pr.set_offset(_y,_x); pr.setheaderhandler(header_handler); // Setta handlers pr.setfooterhandler(footer_handler); @@ -3891,9 +3895,8 @@ bool TForm::print( } else { - pr.formlen(height(odd_page)); + pr.formlen(height()); } - pr.set_offset(_y,_x); pr.set_char_size(_fontsize); // Set font name and size pr.set_fontname(_fontname); // according to current form const bool was_open = pr.isopen(); diff --git a/include/printwin.cpp b/include/printwin.cpp index d67f5e284..63f909829 100755 --- a/include/printwin.cpp +++ b/include/printwin.cpp @@ -238,16 +238,32 @@ 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; + 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 ((j+k) < _txt.lines() && k < _formlen) + if ((j+k) < _txt.lines() && k < _formlen ) paint_row(j+k); else break; } + // Se l'offset impostato era negativo (id est: sposta in alto la stampa) + if (offset > 0) + for (i=_formlen;i<=(offset+_formlen);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); + } + else + xvt_dwin_draw_text(win(), 0, i, " ", -1); + return j+k < _txt.lines(); }