gi->height - 2 * border_y);
// gadget text value
- DrawTextBuffer(gi->x + border_x, gi->y + border_y, gi->textarea.value,
- font_nr, gi->textarea.xsize, -1, gi->textarea.ysize, 0,
- BLIT_ON_BACKGROUND, FALSE, FALSE, FALSE);
+ DrawTextArea(gi->x + border_x, gi->y + border_y, gi->textarea.value,
+ font_nr, gi->textarea.xsize, -1, gi->textarea.ysize, 0,
+ BLIT_ON_BACKGROUND, FALSE, FALSE, FALSE);
cursor_letter = gi->textarea.value[gi->textarea.cursor_position];
cursor_string[0] = (cursor_letter != '\0' ? cursor_letter : ' ');
DrawText(xx, yy, buffer, font_nr);
}
-int DrawTextBuffer(int x, int y, char *text_buffer, int font_nr,
- int line_length, int cut_length, int max_lines,
- int line_spacing, int mask_mode, boolean autowrap,
- boolean centered, boolean parse_comments)
+static int DrawTextBufferExt(int x, int y, char *text_buffer, int font_nr,
+ int line_length, int cut_length, int max_lines,
+ int line_spacing, int mask_mode, boolean autowrap,
+ boolean centered, boolean parse_comments,
+ boolean is_text_area)
{
char buffer[line_length + 1];
int buffer_len;
// copy next line from text buffer to line buffer (nearly fgets() style)
for (i = 0; i < num_line_chars && *text_buffer; i++)
+ {
if ((line[i] = *text_buffer++) == '\n')
+ {
+ // in text areas, 'line_length' sized lines cause additional empty line
+ if (i == line_length && is_text_area)
+ text_buffer--;
+
break;
+ }
+ }
line[i] = '\0';
// prevent 'num_line_chars' sized lines to cause additional empty line
return current_line;
}
+int DrawTextArea(int x, int y, char *text_buffer, int font_nr,
+ int line_length, int cut_length, int max_lines,
+ int line_spacing, int mask_mode, boolean autowrap,
+ boolean centered, boolean parse_comments)
+{
+ return DrawTextBufferExt(x, y, text_buffer, font_nr,
+ line_length, cut_length, max_lines,
+ line_spacing, mask_mode, autowrap,
+ centered, parse_comments, TRUE);
+}
+
+int DrawTextBuffer(int x, int y, char *text_buffer, int font_nr,
+ int line_length, int cut_length, int max_lines,
+ int line_spacing, int mask_mode, boolean autowrap,
+ boolean centered, boolean parse_comments)
+{
+ return DrawTextBufferExt(x, y, text_buffer, font_nr,
+ line_length, cut_length, max_lines,
+ line_spacing, mask_mode, autowrap,
+ centered, parse_comments, FALSE);
+}
+
int DrawTextBufferS(int x, int y, char *text_buffer, int font_nr,
int line_length, int cut_length, int max_lines,
int line_spacing, int mask_mode, boolean autowrap,
void DrawTextExt(DrawBuffer *, int, int, char *, int, int);
char *GetTextBufferFromFile(char *, int);
+int DrawTextArea(int, int, char *, int, int, int, int, int, int,
+ boolean, boolean, boolean);
int DrawTextBuffer(int, int, char *, int, int, int, int, int, int,
boolean, boolean, boolean);
int DrawTextBufferS(int, int, char *, int, int, int, int, int, int,
for (xx = 0; xx < xsize; xx++)
DrawEnvelopeBackground(graphic, sx, sy, xx, yy, xsize, ysize, font_nr);
- DrawTextBuffer(sx + font_width, sy + font_height,
- level.envelope[envelope_nr].text, font_nr, max_xsize,
- xsize - 2, ysize - 2, 0, mask_mode,
- level.envelope[envelope_nr].autowrap,
- level.envelope[envelope_nr].centered, FALSE);
+ DrawTextArea(sx + font_width, sy + font_height,
+ level.envelope[envelope_nr].text, font_nr, max_xsize,
+ xsize - 2, ysize - 2, 0, mask_mode,
+ level.envelope[envelope_nr].autowrap,
+ level.envelope[envelope_nr].centered, FALSE);
redraw_mask |= REDRAW_FIELD;
BackToFront();