Patch level : 4.0 451
Files correlati : Ricompilazione Demo : [ ] Commento : Riportata la versione 3.1 650 git-svn-id: svn://10.65.10.50/trunk@14157 c028cbd2-c16b-5b4b-a496-9718f37d4682
This commit is contained in:
parent
c52f052126
commit
5a8a42613e
@ -98,7 +98,6 @@ void advanced_draw_text_line(TWindow& win, const char* text, const RCT& r, char
|
|||||||
else
|
else
|
||||||
xvt_dwin_set_clip(w, (RCT*)&r);
|
xvt_dwin_set_clip(w, (RCT*)&r);
|
||||||
|
|
||||||
|
|
||||||
if (halign == 'J')
|
if (halign == 'J')
|
||||||
advanced_draw_justified_text_line(win, text, x, y, dx);
|
advanced_draw_justified_text_line(win, text, x, y, dx);
|
||||||
else
|
else
|
||||||
@ -108,11 +107,9 @@ void advanced_draw_text_line(TWindow& win, const char* text, const RCT& r, char
|
|||||||
xvt_dwin_set_clip(w, &orig);
|
xvt_dwin_set_clip(w, &orig);
|
||||||
else
|
else
|
||||||
xvt_dwin_set_clip(w, NULL);
|
xvt_dwin_set_clip(w, NULL);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
bool finisce_per_punto(const TString& str)
|
bool finisce_per_punto(const TString& str)
|
||||||
|
|
||||||
{
|
{
|
||||||
bool yes = false;
|
bool yes = false;
|
||||||
const int len = str.len();
|
const int len = str.len();
|
||||||
@ -127,25 +124,18 @@ bool finisce_per_punto(const TString& str)
|
|||||||
void advanced_draw_paragraph(TWindow& win, const TString_array& para, const RCT& rct,
|
void advanced_draw_paragraph(TWindow& win, const TString_array& para, const RCT& rct,
|
||||||
char halign, char valign, int default_10row_height)
|
char halign, char valign, int default_10row_height)
|
||||||
{
|
{
|
||||||
|
const int rows = para.items();
|
||||||
int leading, ascent, descent;
|
if (rows > 1) // Devo scrivere piu' righe?
|
||||||
xvt_dwin_get_font_metrics(win.win(), &leading, &ascent, &descent);
|
|
||||||
|
|
||||||
int ky10 = (leading + ascent + descent) * 10;
|
|
||||||
// Aggiusta l'altezza di una riga standard, se necessario
|
|
||||||
if (ky10 < default_10row_height && ky10 > 80*default_10row_height/100)
|
|
||||||
ky10 = default_10row_height;
|
|
||||||
|
|
||||||
const int rct_height = rct.bottom - rct.top;
|
|
||||||
int rows = (rct_height * 11) / ky10; // Sto abbondante del 10% (*11/10) altrimenti risulta spesso 0
|
|
||||||
|
|
||||||
if (rows > 1 || para.items() >1) // Devo scrivere piu' righe?
|
|
||||||
{
|
{
|
||||||
const int kx10 = xvt_dwin_get_text_width(win.win(), "MMMMMMMMMM", 10);
|
int leading, ascent, descent;
|
||||||
const unsigned columns = (rct.right - rct.left) * 10 / kx10;
|
xvt_dwin_get_font_metrics(win.win(), &leading, &ascent, &descent);
|
||||||
|
|
||||||
if (para.items() < rows)
|
int ky10 = (leading + ascent + descent) * 10;
|
||||||
rows = para.items();
|
// Aggiusta l'altezza di una riga standard, se necessario
|
||||||
|
if (ky10 < default_10row_height && ky10 > 80*default_10row_height/100)
|
||||||
|
ky10 = default_10row_height;
|
||||||
|
|
||||||
|
const int rct_height = rct.bottom - rct.top;
|
||||||
|
|
||||||
int ybase = rct.top;
|
int ybase = rct.top;
|
||||||
switch (valign)
|
switch (valign)
|
||||||
@ -157,17 +147,30 @@ void advanced_draw_paragraph(TWindow& win, const TString_array& para, const RCT&
|
|||||||
|
|
||||||
for (int row = 0; row < rows; row++)
|
for (int row = 0; row < rows; row++)
|
||||||
{
|
{
|
||||||
RCT rctline = rct;
|
const int top = ybase + (ky10 * row) / 10;
|
||||||
rctline.top = ybase + (ky10 * row) / 10;
|
if (top < rct.bottom)
|
||||||
rctline.bottom = rctline.top + ky10 / 10;
|
{
|
||||||
const char* line = para.row(row);
|
const TString& line = para.row(row);
|
||||||
if (halign == 'J' && (row == rows-1 || strlen(line) < columns/2))
|
if (!line.blank())
|
||||||
halign = 'L';
|
{
|
||||||
advanced_draw_text_line(win, line, rctline, halign, 'T');
|
RCT rctline = rct;
|
||||||
|
rctline.top = top;
|
||||||
|
rctline.bottom = top + ky10 / 10;
|
||||||
|
char ha = halign;
|
||||||
|
if (ha == 'J' && (row == rows-1 || finisce_per_punto(line)))
|
||||||
|
ha = 'L';
|
||||||
|
advanced_draw_text_line(win, line, rctline, ha, 'T');
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else
|
||||||
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
|
{
|
||||||
|
if (halign == 'J') halign = 'L';
|
||||||
advanced_draw_text_line(win, para.row(0), rct, halign, valign);
|
advanced_draw_text_line(win, para.row(0), rct, halign, valign);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
///////////////////////////////////////////////////////////
|
///////////////////////////////////////////////////////////
|
||||||
|
Loading…
x
Reference in New Issue
Block a user