rnd-20140219-1-src
[rocksndiamonds.git] / src / editor.c
index 005a1a2ac5d9be237d106de2f0eb08b360294871..15b71a097c8939bdb531036b6b9c7ccf04fd780f 100644 (file)
@@ -2587,12 +2587,13 @@ static struct
     -1, -1,    /* these values are not constant, but can change at runtime */
     ED_SCROLL2_VERTICAL_XSIZE,         ED_SCROLL2_VERTICAL_YSIZE,
     -1, -1,    /* these values are not constant, but can change at runtime */
+    -1, -1,    /* these values are not constant, but can change at runtime */
 #else
     DX + ED_SCROLL2_VERTICAL_XPOS,     DY + ED_SCROLL2_VERTICAL_YPOS,
     ED_SCROLL2_VERTICAL_XSIZE,         ED_SCROLL2_VERTICAL_YSIZE,
     DX,                                        DY,
-#endif
     DXSIZE,                            DYSIZE,
+#endif
     GD_TYPE_SCROLLBAR_VERTICAL,
     GADGET_ID_SCROLL_LIST_VERTICAL,
     "scroll element list vertically"
@@ -6052,6 +6053,8 @@ static void CreateScrollbarGadgets()
     DY + ED_SCROLL2_VERTICAL_YPOS;
   scrollbar_info[ED_SCROLLBAR_ID_LIST_VERTICAL].wheel_x = DX;
   scrollbar_info[ED_SCROLLBAR_ID_LIST_VERTICAL].wheel_y = DY;
+  scrollbar_info[ED_SCROLLBAR_ID_LIST_VERTICAL].wheel_width  = DXSIZE;
+  scrollbar_info[ED_SCROLLBAR_ID_LIST_VERTICAL].wheel_height = DYSIZE;
 
   for (i = 0; i < ED_NUM_SCROLLBARS; i++)
   {
@@ -6652,13 +6655,20 @@ static void UnmapDrawingArea(int id)
   UnmapGadget(level_editor_gadget[drawingarea_info[id].gadget_id]);
 }
 
-static void UnmapLevelEditorWindowGadgets()
+static void UnmapLevelEditorFieldGadgets()
 {
   int i;
 
+#if 1
+  for (i = 0; i < NUM_EDITOR_GADGETS; i++)
+    if (IN_GFX_FIELD_FULL(level_editor_gadget[i]->x,
+                         level_editor_gadget[i]->y))
+      UnmapGadget(level_editor_gadget[i]);
+#else
   for (i = 0; i < NUM_EDITOR_GADGETS; i++)
     if (level_editor_gadget[i]->x < SX + SXSIZE)
       UnmapGadget(level_editor_gadget[i]);
+#endif
 }
 
 void UnmapLevelEditorGadgets()
@@ -6733,8 +6743,8 @@ static boolean PrepareSavingIntoPersonalLevelSet()
     return TRUE;
   }
 
-  if (!Request("This level is read only ! "
-              "Save into personal level set ?", REQ_ASK))
+  if (!Request("This level is read only! "
+              "Save into personal level set?", REQ_ASK))
     return FALSE;
 
   // "cd" to personal level set dir (for writing copy the first time)
@@ -7012,13 +7022,13 @@ static boolean CopyCustomElement(int element_old, int element_new,
   }
   else if (IS_CUSTOM_ELEMENT(element_old) && !IS_CUSTOM_ELEMENT(element_new))
   {
-    Request("Please choose custom element !", REQ_CONFIRM);
+    Request("Please choose custom element!", REQ_CONFIRM);
 
     return FALSE;
   }
   else if (IS_GROUP_ELEMENT(element_old) && !IS_GROUP_ELEMENT(element_new))
   {
-    Request("Please choose group element !", REQ_CONFIRM);
+    Request("Please choose group element!", REQ_CONFIRM);
 
     return FALSE;
   }
@@ -7243,7 +7253,7 @@ static void CopyCustomElementPropertiesToGame(int element)
 
   if (level.use_custom_template)
   {
-    if (Request("Copy and modify level template ?", REQ_ASK))
+    if (Request("Copy and modify level template?", REQ_ASK))
     {
       level.use_custom_template = FALSE;
       ModifyGadget(level_editor_gadget[GADGET_ID_CUSTOM_USE_TEMPLATE],
@@ -7752,7 +7762,7 @@ static void DrawDrawingWindow()
   SetMainBackgroundImage(IMG_UNDEFINED);
   ClearField();
 
-  UnmapLevelEditorWindowGadgets();
+  UnmapLevelEditorFieldGadgets();
   UnmapLevelEditorToolboxCustomGadgets();
 
   AdjustDrawingAreaGadgets();
@@ -7923,7 +7933,7 @@ static void DrawLevelInfoWindow()
 {
   stick_element_properties_window = FALSE;
 
-  UnmapLevelEditorWindowGadgets();
+  UnmapLevelEditorFieldGadgets();
 
   SetMainBackgroundImage(IMG_BACKGROUND_EDITOR);
   ClearField();
@@ -8889,7 +8899,7 @@ static void DrawPropertiesWindow()
 
   CopyElementPropertiesToEditor(properties_element);
 
-  UnmapLevelEditorWindowGadgets();
+  UnmapLevelEditorFieldGadgets();
   UnmapLevelEditorToolboxDrawingGadgets();
   UnmapLevelEditorToolboxCustomGadgets();
 
@@ -10878,7 +10888,7 @@ static void HandleCounterButtons(struct GadgetInfo *gi)
     if ((level_changed && pressed) || (!level_changed && released))
       return;
 
-    if (level_changed && !Request("Level has changed ! Discard changes ?",
+    if (level_changed && !Request("Level has changed! Discard changes?",
                                  REQ_ASK))
     {
       if (gadget_id == counterbutton_info[counter_id].gadget_id_text)
@@ -11051,11 +11061,11 @@ static void HandleTextbuttonGadgets(struct GadgetInfo *gi)
     CopyPlayfield(Feld, level.field);
 
     if (new_template ||
-       Request("Save this template and kill the old ?", REQ_ASK))
+       Request("Save this template and kill the old?", REQ_ASK))
       SaveLevelTemplate();
 
     if (new_template)
-      Request("Template saved !", REQ_CONFIRM);
+      Request("Template saved!", REQ_CONFIRM);
 
     /* restore original "level.field" (needed to track playfield changes) */
     CopyPlayfield(FieldBackup, level.field);
@@ -11171,7 +11181,7 @@ static void HandleCheckbuttons(struct GadgetInfo *gi)
 
     if (level.use_custom_template && !fileExists(template_filename))
     {
-      Request("No level template found !", REQ_CONFIRM);
+      Request("No level template found!", REQ_CONFIRM);
 
       level.use_custom_template = FALSE;
       ModifyGadget(gi, GDI_CHECKED, FALSE, GDI_END);
@@ -11404,7 +11414,7 @@ static void HandleControlButtons(struct GadgetInfo *gi)
     case GADGET_ID_UNDO:
       if (undo_buffer_steps == 0)
       {
-       Request("Undo buffer empty !", REQ_CONFIRM);
+       Request("Undo buffer empty!", REQ_CONFIRM);
        break;
       }
 
@@ -11478,7 +11488,7 @@ static void HandleControlButtons(struct GadgetInfo *gi)
       new_level = !fileExists(level_filename);
 
       if (new_level ||
-         Request("Save this level and kill the old ?", REQ_ASK))
+         Request("Save this level and kill the old?", REQ_ASK))
       {
        if (leveldir_former->readonly)
          ModifyLevelInfoForSavingIntoPersonalLevelSet(leveldir_former->name);
@@ -11494,10 +11504,10 @@ static void HandleControlButtons(struct GadgetInfo *gi)
 
          if (leveldir_former->readonly)
            sprintf(level_saved_msg,
-                   "Level saved as level %d into personal level set !",
+                   "Level saved as level %d into personal level set!",
                    level_nr);
          else
-           strcpy(level_saved_msg, "Level saved !");
+           strcpy(level_saved_msg, "Level saved!");
 
          Request(level_saved_msg, REQ_CONFIRM);
        }
@@ -12003,7 +12013,7 @@ void RequestExitLevelEditor(boolean ask_if_level_has_changed,
 {
   if (!ask_if_level_has_changed ||
       !LevelChanged() ||
-      Request("Level has changed ! Exit without saving ?",
+      Request("Level has changed! Exit without saving?",
              REQ_ASK | REQ_STAY_OPEN))
   {
     CloseDoor(DOOR_CLOSE_1);