From 1952fc1018a7bde3f04b24485d8f89052e80da14 Mon Sep 17 00:00:00 2001 From: Holger Schemel Date: Thu, 6 Mar 2014 00:54:47 +0100 Subject: [PATCH] rnd-20140306-1-src --- src/conftime.h | 2 +- src/editor.c | 18 ++++++++++++++++-- src/tools.c | 24 +++++++++++++++++++++--- 3 files changed, 38 insertions(+), 6 deletions(-) diff --git a/src/conftime.h b/src/conftime.h index 9b84439f..15c21a67 100644 --- a/src/conftime.h +++ b/src/conftime.h @@ -1 +1 @@ -#define COMPILE_DATE_STRING "2014-03-05 21:07" +#define COMPILE_DATE_STRING "2014-03-06 00:24" diff --git a/src/editor.c b/src/editor.c index b611050c..2791934f 100644 --- a/src/editor.c +++ b/src/editor.c @@ -8532,9 +8532,23 @@ static int PrintElementDescriptionFromFile(char *filename, int start_line) int sy = SY + pad_y + start_line * font_height; int max_chars_per_line = (SXSIZE - 2 * pad_x) / font_width; int max_lines_per_screen = (SYSIZE - pad_y) / font_height - 1; + int max_lines_drawable = max_lines_per_screen - start_line; +#if 0 + printf("::: SYSIZE == %d [%d / %d / %d]\n", SYSIZE, + max_chars_per_line, max_lines_per_screen, max_lines_drawable); +#endif + + if (start_line >= max_lines_per_screen) + return FALSE; + +#if 1 + return DrawTextFile(sx, sy, filename, font_nr, max_chars_per_line, -1, + max_lines_drawable, 0, -1, TRUE, FALSE, FALSE); +#else return DrawTextFile(sx, sy, filename, font_nr, max_chars_per_line, -1, max_lines_per_screen, 0, -1, TRUE, FALSE, FALSE); +#endif } static void DrawPropertiesInfo() @@ -8598,8 +8612,8 @@ static void DrawPropertiesInfo() { -1, NULL } }; char *filename = getElementDescriptionFilename(properties_element); - char *percentage_text = "In this level:"; - char *properties_text = "Standard properties:"; + char *percentage_text = "In this level: "; + char *properties_text = "Standard properties: "; float percentage; int num_elements_in_level; int num_standard_properties = 0; diff --git a/src/tools.c b/src/tools.c index c0009b40..0387f05d 100644 --- a/src/tools.c +++ b/src/tools.c @@ -3417,14 +3417,28 @@ static void DrawPreviewLevelPlayfieldExt(int from_x, int from_y) int preview_height = preview.ysize * tile_size; int real_preview_xsize = MIN(level_xsize, preview.xsize); int real_preview_ysize = MIN(level_ysize, preview.ysize); + int real_preview_width = real_preview_xsize * tile_size; + int real_preview_height = real_preview_ysize * tile_size; int dst_x = SX + ALIGNED_XPOS(preview.x, preview_width, preview.align); int dst_y = SY + ALIGNED_YPOS(preview.y, preview_height, preview.valign); int x, y; +#if 1 + if (!IN_GFX_FIELD_FULL(dst_x, dst_y + preview_height - 1)) + return; +#endif + +#if 0 + dst_x += (preview_width - real_preview_width) / 2; + dst_y += (preview_height - real_preview_height) / 2; + + DrawBackground(dst_x, dst_y, real_preview_width, real_preview_height); +#else DrawBackground(dst_x, dst_y, preview_width, preview_height); - dst_x += (preview_width - real_preview_xsize * tile_size) / 2; - dst_y += (preview_height - real_preview_ysize * tile_size) / 2; + dst_x += (preview_width - real_preview_width) / 2; + dst_y += (preview_height - real_preview_height) / 2; +#endif for (x = 0; x < real_preview_xsize; x++) { @@ -3476,6 +3490,9 @@ static void DrawPreviewLevelLabelExt(int mode) int font_nr = pos->font; int i; + if (!IN_GFX_FIELD_FULL(pos->x, pos->y + getFontHeight(pos->font))) + return; + if (mode == MICROLABEL_LEVEL_AUTHOR_HEAD || mode == MICROLABEL_IMPORTED_FROM_HEAD || mode == MICROLABEL_IMPORTED_BY_HEAD) @@ -3615,7 +3632,8 @@ static void DrawPreviewLevelExt(boolean restart) label_text[max_len_label_text] = '\0'; #if 1 - DrawTextSAligned(pos->x, pos->y, label_text, font_nr, pos->align); + if (IN_GFX_FIELD_FULL(pos->x, pos->y + getFontHeight(pos->font))) + DrawTextSAligned(pos->x, pos->y, label_text, font_nr, pos->align); #else lxpos = SX + (SXSIZE - getTextWidth(label_text, font_nr)) / 2; lypos = SY + MICROLABEL1_YPOS; -- 2.34.1