rnd-20000720-1-src
[rocksndiamonds.git] / src / editor.c
index 91e10699148bb92ef47d048fe84fa2f129c7347a..618c272f9971f798162640b3913d03fd89a7ade4 100644 (file)
@@ -1267,13 +1267,13 @@ static void ScrollMiniLevel(int from_x, int from_y, int scroll)
   int dx = (scroll == ED_SCROLL_LEFT ? -1 : scroll == ED_SCROLL_RIGHT ? 1 : 0);
   int dy = (scroll == ED_SCROLL_UP   ? -1 : scroll == ED_SCROLL_DOWN  ? 1 : 0);
 
-  XCopyArea(display, drawto, drawto, gc,
-           SX + (dx == -1 ? MINI_TILEX : 0),
-           SY + (dy == -1 ? MINI_TILEY : 0),
-           (ed_fieldx * MINI_TILEX) - (dx != 0 ? MINI_TILEX : 0),
-           (ed_fieldy * MINI_TILEY) - (dy != 0 ? MINI_TILEY : 0),
-           SX + (dx == +1 ? MINI_TILEX : 0),
-           SY + (dy == +1 ? MINI_TILEY : 0));
+  BlitBitmap(drawto, drawto,
+            SX + (dx == -1 ? MINI_TILEX : 0),
+            SY + (dy == -1 ? MINI_TILEY : 0),
+            (ed_fieldx * MINI_TILEX) - (dx != 0 ? MINI_TILEX : 0),
+            (ed_fieldy * MINI_TILEY) - (dy != 0 ? MINI_TILEY : 0),
+            SX + (dx == +1 ? MINI_TILEX : 0),
+            SY + (dy == +1 ? MINI_TILEY : 0));
   if (dx)
   {
     x = (dx == 1 ? 0 : ed_fieldx - 1);
@@ -1293,7 +1293,7 @@ static void ScrollMiniLevel(int from_x, int from_y, int scroll)
 
 static void CreateControlButtons()
 {
-  Pixmap gd_pixmap = pix[PIX_DOOR];
+  Bitmap gd_bitmap = pix[PIX_DOOR];
   struct GadgetInfo *gi;
   unsigned long event_mask;
   int i;
@@ -1377,10 +1377,10 @@ static void CreateControlButtons()
                      GDI_STATE, GD_BUTTON_UNPRESSED,
                      GDI_RADIO_NR, radio_button_nr,
                      GDI_CHECKED, checked,
-                     GDI_DESIGN_UNPRESSED, gd_pixmap, gd_x1, gd_y1,
-                     GDI_DESIGN_PRESSED, gd_pixmap, gd_x2, gd_y1,
-                     GDI_ALT_DESIGN_UNPRESSED, gd_pixmap, gd_x1, gd_y2,
-                     GDI_ALT_DESIGN_PRESSED, gd_pixmap, gd_x2, gd_y2,
+                     GDI_DESIGN_UNPRESSED, gd_bitmap, gd_x1, gd_y1,
+                     GDI_DESIGN_PRESSED, gd_bitmap, gd_x2, gd_y1,
+                     GDI_ALT_DESIGN_UNPRESSED, gd_bitmap, gd_x1, gd_y2,
+                     GDI_ALT_DESIGN_PRESSED, gd_bitmap, gd_x2, gd_y2,
                      GDI_EVENT_MASK, event_mask,
                      GDI_CALLBACK_ACTION, HandleControlButtons,
                      GDI_END);
@@ -1436,8 +1436,8 @@ static void CreateControlButtons()
                      GDI_HEIGHT, height,
                      GDI_TYPE, GD_TYPE_NORMAL_BUTTON,
                      GDI_STATE, GD_BUTTON_UNPRESSED,
-                     GDI_DESIGN_UNPRESSED, gd_pixmap, gd_x1, gd_y1,
-                     GDI_DESIGN_PRESSED, gd_pixmap, gd_x2, gd_y2,
+                     GDI_DESIGN_UNPRESSED, gd_bitmap, gd_x1, gd_y1,
+                     GDI_DESIGN_PRESSED, gd_bitmap, gd_x2, gd_y2,
                      GDI_EVENT_MASK, event_mask,
                      GDI_CALLBACK_ACTION, HandleControlButtons,
                      GDI_END);
@@ -1451,7 +1451,7 @@ static void CreateControlButtons()
   /* create buttons for element list */
   for (i=0; i<ED_NUM_ELEMENTLIST_BUTTONS; i++)
   {
-    Pixmap deco_pixmap;
+    Bitmap deco_bitmap;
     int deco_x, deco_y, deco_xpos, deco_ypos;
     int gd_xoffset, gd_yoffset;
     int gd_x1, gd_x2, gd_y;
@@ -1469,7 +1469,7 @@ static void CreateControlButtons()
     gd_y  = DOOR_GFX_PAGEY1 + ED_ELEMENTLIST_YPOS;
 
     getMiniGraphicSource(el2gfx(editor_element[i]),
-                        &deco_pixmap, &deco_x, &deco_y);
+                        &deco_bitmap, &deco_x, &deco_y);
     deco_xpos = (ED_ELEMENTLIST_XSIZE - MINI_TILEX) / 2;
     deco_ypos = (ED_ELEMENTLIST_YSIZE - MINI_TILEY) / 2;
 
@@ -1482,9 +1482,9 @@ static void CreateControlButtons()
                      GDI_HEIGHT, ED_ELEMENTLIST_YSIZE,
                      GDI_TYPE, GD_TYPE_NORMAL_BUTTON,
                      GDI_STATE, GD_BUTTON_UNPRESSED,
-                     GDI_DESIGN_UNPRESSED, gd_pixmap, gd_x1, gd_y,
-                     GDI_DESIGN_PRESSED, gd_pixmap, gd_x2, gd_y,
-                     GDI_DECORATION_DESIGN, deco_pixmap, deco_x, deco_y,
+                     GDI_DESIGN_UNPRESSED, gd_bitmap, gd_x1, gd_y,
+                     GDI_DESIGN_PRESSED, gd_bitmap, gd_x2, gd_y,
+                     GDI_DECORATION_DESIGN, deco_bitmap, deco_x, deco_y,
                      GDI_DECORATION_POSITION, deco_xpos, deco_ypos,
                      GDI_DECORATION_SIZE, MINI_TILEX, MINI_TILEY,
                      GDI_DECORATION_SHIFTING, 1, 1,
@@ -1511,7 +1511,7 @@ static void CreateCounterButtons()
 
     for (j=0; j<2; j++)
     {
-      Pixmap gd_pixmap = pix[PIX_DOOR];
+      Bitmap gd_bitmap = pix[PIX_DOOR];
       struct GadgetInfo *gi;
       int id = (j == 0 ?
                counterbutton_info[i].gadget_id_down :
@@ -1564,8 +1564,8 @@ static void CreateCounterButtons()
                        GDI_HEIGHT, y_size,
                        GDI_TYPE, GD_TYPE_NORMAL_BUTTON,
                        GDI_STATE, GD_BUTTON_UNPRESSED,
-                       GDI_DESIGN_UNPRESSED, gd_pixmap, gd_x1, gd_y,
-                       GDI_DESIGN_PRESSED, gd_pixmap, gd_x2, gd_y,
+                       GDI_DESIGN_UNPRESSED, gd_bitmap, gd_x1, gd_y,
+                       GDI_DESIGN_PRESSED, gd_bitmap, gd_x2, gd_y,
                        GDI_EVENT_MASK, event_mask,
                        GDI_CALLBACK_ACTION, HandleCounterButtons,
                        GDI_END);
@@ -1612,8 +1612,8 @@ static void CreateCounterButtons()
                          GDI_NUMBER_MAX, counterbutton_info[i].max_value,
                          GDI_TEXT_SIZE, 3,
                          GDI_TEXT_FONT, font_type,
-                         GDI_DESIGN_UNPRESSED, gd_pixmap, gd_x, gd_y,
-                         GDI_DESIGN_PRESSED, gd_pixmap, gd_x, gd_y,
+                         GDI_DESIGN_UNPRESSED, gd_bitmap, gd_x, gd_y,
+                         GDI_DESIGN_PRESSED, gd_bitmap, gd_x, gd_y,
                          GDI_BORDER_SIZE, ED_BORDER_SIZE,
                          GDI_TEXTINPUT_DESIGN_WIDTH, gd_width,
                          GDI_EVENT_MASK, event_mask,
@@ -1731,7 +1731,7 @@ static void CreateTextInputGadgets()
 
   for (i=0; i<ED_NUM_TEXTINPUT; i++)
   {
-    Pixmap gd_pixmap = pix[PIX_DOOR];
+    Bitmap gd_bitmap = pix[PIX_DOOR];
     int gd_x, gd_y;
     struct GadgetInfo *gi;
     unsigned long event_mask;
@@ -1755,8 +1755,8 @@ static void CreateTextInputGadgets()
                      GDI_TEXT_VALUE, textinput_info[i].value,
                      GDI_TEXT_SIZE, textinput_info[i].size,
                      GDI_TEXT_FONT, FC_YELLOW,
-                     GDI_DESIGN_UNPRESSED, gd_pixmap, gd_x, gd_y,
-                     GDI_DESIGN_PRESSED, gd_pixmap, gd_x, gd_y,
+                     GDI_DESIGN_UNPRESSED, gd_bitmap, gd_x, gd_y,
+                     GDI_DESIGN_PRESSED, gd_bitmap, gd_x, gd_y,
                      GDI_BORDER_SIZE, ED_BORDER_SIZE,
                      GDI_TEXTINPUT_DESIGN_WIDTH, ED_WIN_COUNT_XSIZE,
                      GDI_EVENT_MASK, event_mask,
@@ -1777,7 +1777,7 @@ static void CreateScrollbarGadgets()
   for (i=0; i<ED_NUM_SCROLLBARS; i++)
   {
     int id = scrollbar_info[i].gadget_id;
-    Pixmap gd_pixmap = pix[PIX_DOOR];
+    Bitmap gd_bitmap = pix[PIX_DOOR];
     int gd_x1, gd_x2, gd_y1, gd_y2;
     struct GadgetInfo *gi;
     int items_max, items_visible, item_position;
@@ -1825,8 +1825,8 @@ static void CreateScrollbarGadgets()
                      GDI_SCROLLBAR_ITEMS_VISIBLE, items_visible,
                      GDI_SCROLLBAR_ITEM_POSITION, item_position,
                      GDI_STATE, GD_BUTTON_UNPRESSED,
-                     GDI_DESIGN_UNPRESSED, gd_pixmap, gd_x1, gd_y1,
-                     GDI_DESIGN_PRESSED, gd_pixmap, gd_x2, gd_y2,
+                     GDI_DESIGN_UNPRESSED, gd_bitmap, gd_x1, gd_y1,
+                     GDI_DESIGN_PRESSED, gd_bitmap, gd_x2, gd_y2,
                      GDI_BORDER_SIZE, ED_BORDER_SIZE,
                      GDI_EVENT_MASK, event_mask,
                      GDI_CALLBACK_ACTION, HandleControlButtons,
@@ -1841,7 +1841,7 @@ static void CreateScrollbarGadgets()
 
 static void CreateCheckbuttonGadgets()
 {
-  Pixmap gd_pixmap = pix[PIX_DOOR];
+  Bitmap gd_bitmap = pix[PIX_DOOR];
   struct GadgetInfo *gi;
   unsigned long event_mask;
   int gd_x1, gd_x2, gd_x3, gd_x4, gd_y;
@@ -1873,10 +1873,10 @@ static void CreateCheckbuttonGadgets()
                      GDI_TYPE, GD_TYPE_RADIO_BUTTON,
                      GDI_RADIO_NR, radiobutton_info[i].radio_button_nr,
                      GDI_CHECKED, checked,
-                     GDI_DESIGN_UNPRESSED, gd_pixmap, gd_x1, gd_y,
-                     GDI_DESIGN_PRESSED, gd_pixmap, gd_x2, gd_y,
-                     GDI_ALT_DESIGN_UNPRESSED, gd_pixmap, gd_x3, gd_y,
-                     GDI_ALT_DESIGN_PRESSED, gd_pixmap, gd_x4, gd_y,
+                     GDI_DESIGN_UNPRESSED, gd_bitmap, gd_x1, gd_y,
+                     GDI_DESIGN_PRESSED, gd_bitmap, gd_x2, gd_y,
+                     GDI_ALT_DESIGN_UNPRESSED, gd_bitmap, gd_x3, gd_y,
+                     GDI_ALT_DESIGN_PRESSED, gd_bitmap, gd_x4, gd_y,
                      GDI_EVENT_MASK, event_mask,
                      GDI_CALLBACK_ACTION, HandleRadiobuttons,
                      GDI_END);
@@ -1905,10 +1905,10 @@ static void CreateCheckbuttonGadgets()
                      GDI_HEIGHT, ED_CHECKBUTTON_YSIZE,
                      GDI_TYPE, GD_TYPE_CHECK_BUTTON,
                      GDI_CHECKED, *checkbutton_info[i].value,
-                     GDI_DESIGN_UNPRESSED, gd_pixmap, gd_x1, gd_y,
-                     GDI_DESIGN_PRESSED, gd_pixmap, gd_x2, gd_y,
-                     GDI_ALT_DESIGN_UNPRESSED, gd_pixmap, gd_x3, gd_y,
-                     GDI_ALT_DESIGN_PRESSED, gd_pixmap, gd_x4, gd_y,
+                     GDI_DESIGN_UNPRESSED, gd_bitmap, gd_x1, gd_y,
+                     GDI_DESIGN_PRESSED, gd_bitmap, gd_x2, gd_y,
+                     GDI_ALT_DESIGN_UNPRESSED, gd_bitmap, gd_x3, gd_y,
+                     GDI_ALT_DESIGN_PRESSED, gd_bitmap, gd_x4, gd_y,
                      GDI_EVENT_MASK, event_mask,
                      GDI_CALLBACK_ACTION, HandleCheckbuttons,
                      GDI_END);
@@ -2109,8 +2109,8 @@ void DrawLevelEd()
   }
 
   /* copy default editor door content to main double buffer */
-  XCopyArea(display, pix[PIX_DOOR], drawto, gc,
-           DOOR_GFX_PAGEX6, DOOR_GFX_PAGEY1, DXSIZE, DYSIZE, DX, DY);
+  BlitBitmap(pix[PIX_DOOR], drawto,
+            DOOR_GFX_PAGEX6, DOOR_GFX_PAGEY1, DXSIZE, DYSIZE, DX, DY);
 
   /* draw mouse button brush elements */
   DrawMiniGraphicExt(drawto, gc,
@@ -2127,18 +2127,16 @@ void DrawLevelEd()
   DrawSpecialEditorDoor();
 
   /* draw new control window */
-  XCopyArea(display, pix[PIX_DOOR], drawto, gc,
-           DOOR_GFX_PAGEX8, 236,
-           EXSIZE, EYSIZE,
-           EX, EY);
+  BlitBitmap(pix[PIX_DOOR], drawto,
+            DOOR_GFX_PAGEX8, 236, EXSIZE, EYSIZE, EX, EY);
 
   redraw_mask |= REDRAW_ALL;
 
   MapControlButtons();
 
   /* copy actual editor door content to door double buffer for OpenDoor() */
-  XCopyArea(display, drawto, pix[PIX_DB_DOOR], gc,
-           DX, DY, DXSIZE, DYSIZE, DOOR_GFX_PAGEX1, DOOR_GFX_PAGEY1);
+  BlitBitmap(drawto, pix[PIX_DB_DOOR],
+            DX, DY, DXSIZE, DYSIZE, DOOR_GFX_PAGEX1, DOOR_GFX_PAGEY1);
 
   DrawEditModeWindow();
 
@@ -2343,14 +2341,14 @@ static void DrawRandomPlacementBackgroundArea()
     for (x=0; x<2; x++)
       DrawMiniElement(area_x + x, area_y + y, EL_ERDREICH);
 
-  XFillRectangle(display, drawto, gc,
+  ClearRectangle(drawto,
                 area_sx + MINI_TILEX/2 - 1, area_sy + MINI_TILEY/2 - 1,
                 MINI_TILEX + 2, MINI_TILEY + 2);
 
   /* copy border to the right location */
-  XCopyArea(display, drawto, drawto, gc,
-           area_sx, area_sy, 3 * MINI_TILEX, 3 * MINI_TILEY,
-           area_sx - MINI_TILEX/2, area_sy - MINI_TILEY/2);
+  BlitBitmap(drawto, drawto,
+            area_sx, area_sy, 3 * MINI_TILEX, 3 * MINI_TILEY,
+            area_sx - MINI_TILEX/2, area_sy - MINI_TILEY/2);
 
   DrawMiniElement(area_x, area_y, ElementContent[0][0][0]);
 
@@ -2465,14 +2463,14 @@ static void DrawAmoebaContentArea()
     for (x=0; x<2; x++)
       DrawMiniElement(area_x + x, area_y + y, EL_ERDREICH);
 
-  XFillRectangle(display, drawto, gc,
+  ClearRectangle(drawto,
                 area_sx + MINI_TILEX/2 - 1, area_sy + MINI_TILEY/2 - 1,
                 MINI_TILEX + 2, MINI_TILEY + 2);
 
   /* copy border to the right location */
-  XCopyArea(display, drawto, drawto, gc,
-           area_sx, area_sy, 3 * MINI_TILEX, 3 * MINI_TILEY,
-           area_sx - MINI_TILEX/2, area_sy - MINI_TILEY/2);
+  BlitBitmap(drawto, drawto,
+            area_sx, area_sy, 3 * MINI_TILEX, 3 * MINI_TILEY,
+            area_sx - MINI_TILEX/2, area_sy - MINI_TILEY/2);
 
   DrawText(area_sx + TILEX, area_sy + 1, "Content of amoeba",
           FS_SMALL, font_color);
@@ -2511,7 +2509,7 @@ static void DrawElementContentAreas()
   MapCounterButtons(counter_id);
 
   /* delete content areas in case of reducing number of them */
-  XFillRectangle(display, backbuffer, gc,
+  ClearRectangle(backbuffer,
                 SX, area_sy - MINI_TILEX,
                 SXSIZE, 12 * MINI_TILEY);
 
@@ -2523,16 +2521,16 @@ static void DrawElementContentAreas()
        DrawMiniElement(area_x + 5 * (i % 4) + x, area_y + 6 * (i / 4) + y,
                        EL_ERDREICH);
 
-    XFillRectangle(display, drawto, gc,
+    ClearRectangle(drawto,
                   area_sx + 5 * (i % 4) * MINI_TILEX + MINI_TILEX/2 - 1,
                   area_sy + 6 * (i / 4) * MINI_TILEY + MINI_TILEY/2 - 1,
                   3 * MINI_TILEX + 2, 3 * MINI_TILEY + 2);
   }
 
   /* copy border to the right location */
-  XCopyArea(display, drawto, drawto, gc,
-           area_sx, area_sy, (5 * 4 + 1) * MINI_TILEX, 11 * MINI_TILEY,
-           area_sx - MINI_TILEX/2, area_sy - MINI_TILEY/2);
+  BlitBitmap(drawto, drawto,
+            area_sx, area_sy, (5 * 4 + 1) * MINI_TILEX, 11 * MINI_TILEY,
+            area_sx - MINI_TILEX/2, area_sy - MINI_TILEY/2);
 
   DrawText(area_sx + (5 * 4 - 1) * MINI_TILEX, area_sy + 0 * MINI_TILEY + 1,
           "Content", FS_SMALL, font_color);
@@ -2642,28 +2640,28 @@ static void DrawPropertiesWindow()
     for (x=0; x<3; x++)
       DrawMiniElement(xstart + x , ystart + y, EL_ERDREICH);
 
-  XFillRectangle(display, drawto, gc,
+  ClearRectangle(drawto,
                 SX + xstart * MINI_TILEX + MINI_TILEX/2 - 1,
                 SY + ystart * MINI_TILEY + MINI_TILEY/2 - 1,
                 TILEX + 2, TILEY + 2);
 
   /* copy border to the right location */
-  XCopyArea(display, drawto, drawto, gc,
-           SX + xstart * MINI_TILEX,
-           SY + ystart * MINI_TILEY,
-           2 * TILEX, 2 * TILEY,
-           SX + xstart * MINI_TILEX - MINI_TILEX/2,
-           SY + ystart * MINI_TILEY - MINI_TILEY/2);
+  BlitBitmap(drawto, drawto,
+            SX + xstart * MINI_TILEX,
+            SY + ystart * MINI_TILEY,
+            2 * TILEX, 2 * TILEY,
+            SX + xstart * MINI_TILEX - MINI_TILEX/2,
+            SY + ystart * MINI_TILEY - MINI_TILEY/2);
 
   DrawGraphic(xstart/2, ystart/2, el2gfx(properties_element));
 
   /* copy the whole stuff to the definitive location */
-  XCopyArea(display, drawto, drawto, gc,
-           SX + xstart * MINI_TILEX - MINI_TILEX/2,
-           SY + ystart * MINI_TILEY - MINI_TILEY,
-           2 * TILEX, 2 * TILEY,
-           SX + xstart * MINI_TILEX - MINI_TILEX/2,
-           SY + ystart * MINI_TILEY - MINI_TILEY/2);
+  BlitBitmap(drawto, drawto,
+            SX + xstart * MINI_TILEX - MINI_TILEX/2,
+            SY + ystart * MINI_TILEY - MINI_TILEY,
+            2 * TILEX, 2 * TILEY,
+            SX + xstart * MINI_TILEX - MINI_TILEX/2,
+            SY + ystart * MINI_TILEY - MINI_TILEY/2);
 
   DrawTextF((xstart + 3) * MINI_TILEX, (ystart + 1) * MINI_TILEY,
            font_color, element_info[properties_element]);
@@ -2715,26 +2713,6 @@ static void DrawPropertiesWindow()
   }
 }
 
-static void swap_numbers(int *i1, int *i2)
-{
-  int help = *i1;
-
-  *i1 = *i2;
-  *i2 = help;
-}
-
-static void swap_number_pairs(int *x1, int *y1, int *x2, int *y2)
-{
-  int help_x = *x1;
-  int help_y = *y1;
-
-  *x1 = *x2;
-  *x2 = help_x;
-
-  *y1 = *y2;
-  *y2 = help_y;
-}
-
 static void DrawLineElement(int sx, int sy, int element, boolean change_level)
 {
   int lx = sx + level_xpos;
@@ -2914,14 +2892,10 @@ static void DrawAreaBorder(int from_x, int from_y, int to_x, int to_y)
   to_sx = SX + to_x * MINI_TILEX + MINI_TILEX - 1;
   to_sy = SY + to_y * MINI_TILEY + MINI_TILEY - 1;
 
-  XSetForeground(display, gc, WhitePixel(display, screen));
-
-  XDrawLine(display, drawto, gc, from_sx, from_sy, to_sx, from_sy);
-  XDrawLine(display, drawto, gc, to_sx, from_sy, to_sx, to_sy);
-  XDrawLine(display, drawto, gc, to_sx, to_sy, from_sx, to_sy);
-  XDrawLine(display, drawto, gc, from_sx, to_sy, from_sx, from_sy);
-
-  XSetForeground(display, gc, BlackPixel(display, screen));
+  DrawSimpleWhiteLine(drawto, from_sx, from_sy, to_sx, from_sy);
+  DrawSimpleWhiteLine(drawto, to_sx, from_sy, to_sx, to_sy);
+  DrawSimpleWhiteLine(drawto, to_sx, to_sy, from_sx, to_sy);
+  DrawSimpleWhiteLine(drawto, from_sx, to_sy, from_sx, from_sy);
 
   if (from_x == to_x && from_y == to_y)
     MarkTileDirty(from_x/2, from_y/2);
@@ -3782,7 +3756,7 @@ static void HandleControlButtons(struct GadgetInfo *gi)
        int element = editor_element[element_shift + i];
 
        UnmapGadget(gi);
-       getMiniGraphicSource(el2gfx(element), &gd->pixmap, &gd->x, &gd->y);
+       getMiniGraphicSource(el2gfx(element), &gd->bitmap, &gd->x, &gd->y);
        ModifyGadget(gi, GDI_INFO_TEXT, element_info[element], GDI_END);
        MapGadget(gi);
       }
@@ -3944,9 +3918,9 @@ static void HandleControlButtons(struct GadgetInfo *gi)
       else
       {
        CloseDoor(DOOR_CLOSE_1);
-       XCopyArea(display, pix[PIX_DB_DOOR], pix[PIX_DB_DOOR], gc,
-                 DOOR_GFX_PAGEX2, DOOR_GFX_PAGEY1, DXSIZE,DYSIZE,
-                 DOOR_GFX_PAGEX1, DOOR_GFX_PAGEY1);
+       BlitBitmap(pix[PIX_DB_DOOR], pix[PIX_DB_DOOR],
+                  DOOR_GFX_PAGEX2, DOOR_GFX_PAGEY1, DXSIZE,DYSIZE,
+                  DOOR_GFX_PAGEX1, DOOR_GFX_PAGEY1);
        OpenDoor(DOOR_OPEN_1);
       }
       break;
@@ -4048,7 +4022,7 @@ void HandleLevelEditorKeyInput(KeySym key)
 
 void ClearEditorGadgetInfoText()
 {
-  XFillRectangle(display, drawto, gc,
+  ClearRectangle(drawto,
                 INFOTEXT_XPOS, INFOTEXT_YPOS, INFOTEXT_XSIZE, INFOTEXT_YSIZE);
   redraw_mask |= REDRAW_FIELD;
 }