+
+static void HandleTextInputGadgets(struct GadgetInfo *gi)
+{
+ int id = gi->custom_id;
+
+ switch (id)
+ {
+ case ED_CTRL_ID_LEVEL_NAME:
+ strcpy(level.name, gi->text_value);
+ break;
+
+ default:
+ break;
+ }
+}
+
+/* values for ClearEditorGadgetInfoText() and HandleGadgetInfoText() */
+#define INFOTEXT_XPOS SX
+#define INFOTEXT_YPOS (SY + SYSIZE - MINI_TILEX + 2)
+#define INFOTEXT_XSIZE SXSIZE
+#define INFOTEXT_YSIZE MINI_TILEX
+#define MAX_INFOTEXT_LEN (SXSIZE / FONT2_XSIZE)
+
+void ClearEditorGadgetInfoText()
+{
+ XFillRectangle(display, drawto, gc,
+ INFOTEXT_XPOS, INFOTEXT_YPOS, INFOTEXT_XSIZE, INFOTEXT_YSIZE);
+ redraw_mask |= REDRAW_FIELD;
+}
+
+void HandleEditorGadgetInfoText(void *ptr)
+{
+ struct GadgetInfo *gi = (struct GadgetInfo *)ptr;
+ char infotext[MAX_INFOTEXT_LEN + 1];
+
+ ClearEditorGadgetInfoText();
+
+ /* misuse this function to delete brush cursor, if needed */
+ if (edit_mode == ED_MODE_DRAWING && draw_with_brush)
+ DeleteBrushFromCursor();
+
+ if (gi == NULL || gi->description_text == NULL)
+ return;
+
+ strncpy(infotext, gi->description_text, MAX_INFOTEXT_LEN);
+ infotext[MAX_INFOTEXT_LEN] = '\0';
+
+ DrawText(INFOTEXT_XPOS, INFOTEXT_YPOS, infotext, FS_SMALL, FC_YELLOW);
+}
+
+static void HandleDrawingAreaInfo(struct GadgetInfo *gi)
+{
+ int id = gi->custom_id;
+ int sx = gi->event.x;
+ int sy = gi->event.y;
+ int lx = sx + level_xpos;
+ int ly = sy + level_ypos;
+
+ ClearEditorGadgetInfoText();
+
+ if (id == ED_CTRL_ID_DRAWING_LEVEL)
+ {
+ if (IN_LEV_FIELD(lx, ly))
+ DrawTextF(INFOTEXT_XPOS - SX, INFOTEXT_YPOS - SY, FC_YELLOW,
+ "Level: %d, %d (Screen: %d, %d)", lx, ly, sx, sy);
+
+ /* misuse this function to draw brush cursor, if needed */
+ if (edit_mode == ED_MODE_DRAWING && draw_with_brush)
+ CopyBrushToCursor(sx, sy);
+ }
+ else if (id == ED_CTRL_ID_AMOEBA_CONTENT)
+ DrawTextF(INFOTEXT_XPOS - SX, INFOTEXT_YPOS - SY, FC_YELLOW,
+ "Amoeba content");
+ else
+ DrawTextF(INFOTEXT_XPOS - SX, INFOTEXT_YPOS - SY, FC_YELLOW,
+ "Cruncher %d content: %d, %d", id - ED_CTRL_ID_ELEMCONT_0 + 1,
+ sx, sy);
+}