+static void DrawEditorLevelBorderLine(int x, int y, int xsize, int ysize)
+{
+ int xsize_tile = MAX(ed_tilesize, xsize);
+ int ysize_tile = MAX(ed_tilesize, ysize);
+ int xsize_full = xsize + 1;
+ int ysize_full = ysize + 1;
+ int xsize_thin = (xsize < ed_tilesize ? 1 : xsize);
+ int ysize_thin = (ysize < ed_tilesize ? 1 : ysize);
+ Pixel line_color = getTabulatorBarColor();
+
+ if (line_color == BLACK_PIXEL) /* black => transparent */
+ return;
+
+ FillRectangle(drawto, SX + x, SY + y, xsize_tile, ysize_tile, BLACK_PIXEL);
+ FillRectangle(drawto, SX + x, SY + y, xsize_full, ysize_full, line_color);
+ FillRectangle(drawto, SX + x, SY + y, xsize_thin, ysize_thin, BLACK_PIXEL);
+}
+
+static void DrawEditorLevelBorderLinesIfNeeded()
+{
+ int xsize = lev_fieldx * ed_tilesize;
+ int ysize = lev_fieldy * ed_tilesize;
+ int line_size = getTabulatorBarHeight();
+
+ if (!suppressBorderElement())
+ return;
+
+ /* draw little border line around editable level playfield */
+
+ if (xsize < SXSIZE)
+ DrawEditorLevelBorderLine(xsize, 0, line_size, ysize);
+
+ if (ysize < SYSIZE)
+ DrawEditorLevelBorderLine(0, ysize, xsize, line_size);
+
+ if (xsize < SXSIZE && ysize < SYSIZE)
+ DrawEditorLevelBorderLine(xsize, ysize, line_size, line_size);
+}
+