From 2685185c33c3b0258c729715aaf36756c8df23cd Mon Sep 17 00:00:00 2001 From: Gerard Krol Date: Thu, 7 Feb 2008 19:19:15 +0000 Subject: [PATCH] Make sure that long lines of text are correctly drawn and wrapped for the intelligence display. This also works for larger fonts. This fixes bug #10913, and makes patch #965 obsolete. git-svn-id: svn+ssh://svn.gna.org/svn/warzone/trunk@3712 4a71c877-e1ca-e34f-864e-861f7616d084 --- src/intelmap.c | 38 ++++++++++++++++++++------------------ 1 file changed, 20 insertions(+), 18 deletions(-) diff --git a/src/intelmap.c b/src/intelmap.c index cc7f40495..ed4759a79 100644 --- a/src/intelmap.c +++ b/src/intelmap.c @@ -703,15 +703,16 @@ void intProcessIntelMap(UDWORD id) } } - +/** + * Draws the text for the intelligence display window. + */ static BOOL intDisplaySeqTextViewPage(VIEW_REPLAY *psViewReplay, UDWORD x0, UDWORD y0, UDWORD width, UDWORD height, BOOL render, size_t *cur_seq, size_t *cur_seqpage) { - UDWORD x1, y1, i, linePitch, cur_y; - UDWORD ty; + UDWORD i, cur_y; UDWORD sequence; if (!psViewReplay) @@ -719,20 +720,11 @@ static BOOL intDisplaySeqTextViewPage(VIEW_REPLAY *psViewReplay, return TRUE; /* nothing to do */ } - x1 = x0 + width; - y1 = y0 + height; - ty = y0; - iV_SetFont(font_regular); - /* Get the travel to the next line */ - linePitch = iV_GetTextLineSize(); - /* Fix for spacing.... */ - linePitch += 6; - ty += 3; iV_SetTextColour(WZCOL_TEXT_BRIGHT); - cur_y = 0; + cur_y = y0 + iV_GetTextLineSize()/2 + 2*TEXT_YINDENT; /* add each message */ for (sequence = *cur_seq, i = *cur_seqpage; sequence < psViewReplay->numSeq; sequence++) @@ -742,11 +734,14 @@ static BOOL intDisplaySeqTextViewPage(VIEW_REPLAY *psViewReplay, { if (render) { - iV_DrawText(psSeqDisplay->ppTextMsg[i], + cur_y = iV_DrawFormattedText(psSeqDisplay->ppTextMsg[i], x0 + TEXT_XINDENT, - (ty + TEXT_YINDENT*3) + cur_y); + cur_y, width, FALSE); + } + else + { + cur_y += iV_GetTextLineSize(); } - cur_y += linePitch; if (cur_y > height) { /* run out of room - need to make new tab */ @@ -761,6 +756,9 @@ static BOOL intDisplaySeqTextViewPage(VIEW_REPLAY *psViewReplay, return TRUE; /* done */ } +/** + * Draw the text window for the intelligence display + */ static void intDisplaySeqTextView(WIDGET *psWidget, UDWORD xOffset, UDWORD yOffset, PIELIGHT *pColours) @@ -790,7 +788,7 @@ static void intDisplaySeqTextView(WIDGET *psWidget, } intDisplaySeqTextViewPage(psViewReplay, x0, y0, - Form->width, Form->height, + Form->width-40, Form->height, TRUE, &cur_seq, &cur_seqpage); } @@ -1336,7 +1334,11 @@ void intDisplayFLICView(WIDGET *psWidget, UDWORD xOffset, UDWORD yOffset, PIELIG } #endif -/* displays the TEXT view for the current message */ +/** + * Displays the TEXT view for the current message. + * If this function breaks, please merge it with intDisplaySeqTextViewPage + * which presumably does almost the same. + */ void intDisplayTEXTView(WIDGET *psWidget, UDWORD xOffset, UDWORD yOffset, PIELIGHT *pColours) { W_TABFORM *Form = (W_TABFORM*)psWidget;