Patch level : 2.1 nopatch

Files correlati     :
Ricompilazione Demo : [ ]
Commento            :

Migliorata stampa di campi su piu' righe


git-svn-id: svn://10.65.10.50/trunk@12173 c028cbd2-c16b-5b4b-a496-9718f37d4682
This commit is contained in:
guy 2004-06-10 07:33:40 +00:00
parent 75f854a3a0
commit 0986f0aa0c
2 changed files with 11 additions and 5 deletions

View File

@ -374,22 +374,19 @@ void advanced_draw_paragraph(TWindow& win, TString& para, const RCT& rct,
char halign, char valign)
{
const bool acapo = para.find('\n') >= 0;
const bool parag = para.find(char(0xB6)) >= 0;
int leading, ascent, descent;
xvt_dwin_get_font_metrics(win.win(), &leading, &ascent, &descent);
const int ky = leading + ascent + descent;
const int rct_height = rct.bottom - rct.top;
int rows = rct_height / ky;
int rows = (rct_height+ky/2) / ky;
if (acapo || parag || rows > 1) // Devo scrivere piu' righe?
if (acapo || rows > 1) // Devo scrivere piu' righe?
{
const int kx = xvt_dwin_get_text_width(win.win(), "ABCDEFGH", 8) / 8;
const unsigned columns = (rct.right - rct.left) / kx;
if (parag)
para.replace(char('0xB6'), '\n');
TParagraph_string str(para, columns);
if (str.items() < rows)
rows = str.items();
@ -1294,6 +1291,13 @@ const TString& TReport_field::formatted_text() const
tmp << _picture << ' ' << _var.as_string();
return tmp;
}
if (dynamic_height() && _var.as_string().find(char(0xB6)) >= 0)
{
TString& tmp = get_tmp_string();
tmp = _var.as_string();
tmp.replace(char(0xB6), '\n');
return tmp;
}
return _var.as_string();
}
return EMPTY_STRING;

View File

@ -905,6 +905,8 @@ bool TBook::print_page(TWindow& win, size_t page)
ifs.getline(buffer, str.size());
if (str == "</text>")
break;
if (stringona.not_empty())
stringona << '\n';
stringona << str;
}
advanced_draw_paragraph(win, stringona, rct, _horizontal_alignment, _vertical_alignment);