fixed toolbox gadgets on properties page after test game in level editor
[rocksndiamonds.git] / src / editor.c
index 4f29f028a7bc245c1b3abb4222aae4095c0f6be2..a3ab4c4c3e9abfafcba5aea076ec3c7557f14863 100644 (file)
@@ -7759,6 +7759,14 @@ static void MapLevelEditorToolboxCustomGadgets(void)
   MapOrUnmapLevelEditorToolboxCustomGadgets(TRUE);
 }
 
+static void MapLevelEditorToolboxCustomGadgetsIfNeeded(void)
+{
+  if (IS_CUSTOM_ELEMENT(properties_element) ||
+      IS_GROUP_ELEMENT(properties_element) ||
+      IS_EMPTY_ELEMENT(properties_element))
+    MapLevelEditorToolboxCustomGadgets();
+}
+
 static void UnmapLevelEditorToolboxCustomGadgets(void)
 {
   MapOrUnmapLevelEditorToolboxCustomGadgets(FALSE);
@@ -8797,6 +8805,15 @@ static void DrawEditorDoorContent(void)
   // draw all toolbox gadgets to editor doors
   MapControlButtons();
 
+  // when returning from test game to properties page, redraw toolbox gadgets
+  if (edit_mode == ED_MODE_PROPERTIES)
+  {
+    UnmapLevelEditorToolboxDrawingGadgets();
+    UnmapLevelEditorToolboxCustomGadgets();
+
+    MapLevelEditorToolboxCustomGadgetsIfNeeded();
+  }
+
   // draw all palette gadgets to editor doors
   ModifyEditorElementList();
   RedrawDrawingElements();
@@ -10682,10 +10699,7 @@ static void DrawPropertiesWindow(void)
   UnmapLevelEditorToolboxDrawingGadgets();
   UnmapLevelEditorToolboxCustomGadgets();
 
-  if (IS_CUSTOM_ELEMENT(properties_element) ||
-      IS_GROUP_ELEMENT(properties_element) ||
-      IS_EMPTY_ELEMENT(properties_element))
-    MapLevelEditorToolboxCustomGadgets();
+  MapLevelEditorToolboxCustomGadgetsIfNeeded();
 
   SetMainBackgroundImage(IMG_BACKGROUND_EDITOR);
   ClearField();