rnd-20060816-2-src
[rocksndiamonds.git] / src / editor.c
index f80d82e09c4aa220e55af9f4abff1640bf43d3e6..04c6a46c074c195602a6f778cb0b15f1902c8e5a 100644 (file)
@@ -2402,6 +2402,8 @@ static struct
   int gd_x, gd_y;
   int x, y;
   int width, height;
+  int wheel_x, wheel_y;
+  int wheel_width, wheel_height;
   int type;
   int gadget_id;
   char *infotext;
@@ -2411,6 +2413,8 @@ static struct
     ED_SCROLLBAR_XPOS,                 ED_SCROLLBAR_YPOS,
     SX + ED_SCROLL_HORIZONTAL_XPOS,    SY + ED_SCROLL_HORIZONTAL_YPOS,
     ED_SCROLL_HORIZONTAL_XSIZE,                ED_SCROLL_HORIZONTAL_YSIZE,
+    0,                                 0,
+    SX + SXSIZE + SX,                  WIN_YSIZE,
     GD_TYPE_SCROLLBAR_HORIZONTAL,
     GADGET_ID_SCROLL_HORIZONTAL,
     "scroll level editing area horizontally"
@@ -2419,6 +2423,8 @@ static struct
     ED_SCROLLBAR_XPOS,                 ED_SCROLLBAR_YPOS,
     SX + ED_SCROLL_VERTICAL_XPOS,      SY + ED_SCROLL_VERTICAL_YPOS,
     ED_SCROLL_VERTICAL_XSIZE,          ED_SCROLL_VERTICAL_YSIZE,
+    0,                                 0,
+    SX + SXSIZE + SX,                  WIN_YSIZE,
     GD_TYPE_SCROLLBAR_VERTICAL,
     GADGET_ID_SCROLL_VERTICAL,
     "scroll level editing area vertically"
@@ -2427,6 +2433,8 @@ static struct
     ED_SCROLLBAR2_XPOS,                        ED_SCROLLBAR2_YPOS,
     DX + ED_SCROLL2_VERTICAL_XPOS,     DY + ED_SCROLL2_VERTICAL_YPOS,
     ED_SCROLL2_VERTICAL_XSIZE,         ED_SCROLL2_VERTICAL_YSIZE,
+    SX + SXSIZE + SX,                  0,
+    WIN_XSIZE - (SX + SXSIZE + SX),    WIN_YSIZE,
     GD_TYPE_SCROLLBAR_VERTICAL,
     GADGET_ID_SCROLL_LIST_VERTICAL,
     "scroll element list vertically"
@@ -4625,31 +4633,6 @@ static int *editor_el_custom_ptr = editor_el_custom;
 static int num_editor_hl_custom = SIZEOF_ARRAY_INT(editor_hl_custom);
 static int num_editor_el_custom = SIZEOF_ARRAY_INT(editor_el_custom);
 
-static int editor_hl_reference[] =
-{
-  EL_INTERNAL_CASCADE_REF_ACTIVE,
-  EL_CHAR('R'),
-  EL_CHAR('E'),
-  EL_CHAR('F')
-};
-
-static int editor_el_reference[] =
-{
-  EL_TRIGGER_PLAYER,
-  EL_TRIGGER_ELEMENT,
-  EL_TRIGGER_CE_VALUE,
-  EL_TRIGGER_CE_SCORE,
-
-  EL_EMPTY,
-  EL_EMPTY,
-  EL_CURRENT_CE_VALUE,
-  EL_CURRENT_CE_SCORE
-};
-static int *editor_hl_reference_ptr = editor_hl_reference;
-static int *editor_el_reference_ptr = editor_el_reference;
-static int num_editor_hl_reference = SIZEOF_ARRAY_INT(editor_hl_reference);
-static int num_editor_el_reference = SIZEOF_ARRAY_INT(editor_el_reference);
-
 static int editor_hl_group[] =
 {
   EL_INTERNAL_CASCADE_GE_ACTIVE,
@@ -4727,6 +4710,51 @@ static int *editor_el_group_ptr = editor_el_group;
 static int num_editor_hl_group = SIZEOF_ARRAY_INT(editor_hl_group);
 static int num_editor_el_group = SIZEOF_ARRAY_INT(editor_el_group);
 
+static int editor_hl_reference[] =
+{
+  EL_INTERNAL_CASCADE_REF_ACTIVE,
+  EL_CHAR('R'),
+  EL_CHAR('E'),
+  EL_CHAR('F')
+};
+
+static int editor_el_reference[] =
+{
+  EL_TRIGGER_PLAYER,
+  EL_TRIGGER_ELEMENT,
+  EL_TRIGGER_CE_VALUE,
+  EL_TRIGGER_CE_SCORE,
+
+  EL_SELF,
+  EL_ANY_ELEMENT,
+  EL_CURRENT_CE_VALUE,
+  EL_CURRENT_CE_SCORE,
+
+  EL_LAST_CE_8,
+  EL_LAST_CE_7,
+  EL_LAST_CE_6,
+  EL_LAST_CE_5,
+
+  EL_LAST_CE_4,
+  EL_LAST_CE_3,
+  EL_LAST_CE_2,
+  EL_LAST_CE_1,
+
+  EL_NEXT_CE_1,
+  EL_NEXT_CE_2,
+  EL_NEXT_CE_3,
+  EL_NEXT_CE_4,
+
+  EL_NEXT_CE_5,
+  EL_NEXT_CE_6,
+  EL_NEXT_CE_7,
+  EL_NEXT_CE_8,
+};
+static int *editor_hl_reference_ptr = editor_hl_reference;
+static int *editor_el_reference_ptr = editor_el_reference;
+static int num_editor_hl_reference = SIZEOF_ARRAY_INT(editor_hl_reference);
+static int num_editor_el_reference = SIZEOF_ARRAY_INT(editor_el_reference);
+
 static int editor_hl_user_defined[] =
 {
   EL_INTERNAL_CASCADE_USER_ACTIVE,
@@ -4871,18 +4899,18 @@ editor_elements_info[] =
     &editor_hl_custom_ptr,             &num_editor_hl_custom,
     &editor_el_custom_ptr,             &num_editor_el_custom
   },
-  {
-    &setup.editor.el_custom,
-    &setup.editor_cascade.el_ref,
-    &editor_hl_reference_ptr,          &num_editor_hl_reference,
-    &editor_el_reference_ptr,          &num_editor_el_reference
-  },
   {
     &setup.editor.el_custom,
     &setup.editor_cascade.el_ge,
     &editor_hl_group_ptr,              &num_editor_hl_group,
     &editor_el_group_ptr,              &num_editor_el_group
   },
+  {
+    &setup.editor.el_custom,
+    &setup.editor_cascade.el_ref,
+    &editor_hl_reference_ptr,          &num_editor_hl_reference,
+    &editor_el_reference_ptr,          &num_editor_el_reference
+  },
   {
     &setup.editor.el_user_defined,
     &setup.editor_cascade.el_user,
@@ -6140,6 +6168,10 @@ static void CreateScrollbarGadgets()
                      GDI_SCROLLBAR_ITEMS_MAX, items_max,
                      GDI_SCROLLBAR_ITEMS_VISIBLE, items_visible,
                      GDI_SCROLLBAR_ITEM_POSITION, item_position,
+                     GDI_WHEEL_AREA_X, scrollbar_info[i].wheel_x,
+                     GDI_WHEEL_AREA_Y, scrollbar_info[i].wheel_y,
+                     GDI_WHEEL_AREA_WIDTH, scrollbar_info[i].wheel_width,
+                     GDI_WHEEL_AREA_HEIGHT, scrollbar_info[i].wheel_height,
                      GDI_STATE, GD_BUTTON_UNPRESSED,
                      GDI_DESIGN_UNPRESSED, gd_bitmap, gd_x1, gd_y1,
                      GDI_DESIGN_PRESSED, gd_bitmap, gd_x2, gd_y2,
@@ -10455,8 +10487,12 @@ void HandleLevelEditorKeyInput(Key key)
 
       case KSYM_Insert:
       case KSYM_Delete:
-#if 1
-       /* IS_EDITOR_CASCADE */
+
+       /* this is needed to prevent interference with running "True X-Mouse" */
+       if (GetKeyModStateFromEvents() & KMOD_Control)
+         break;
+
+       /* check for last or next editor cascade block in element list */
        for (i = 0; i < num_editor_elements; i++)
        {
          if ((key == KSYM_Insert && i == element_shift) ||
@@ -10480,36 +10516,6 @@ void HandleLevelEditorKeyInput(Key key)
 
        ModifyEditorElementList();
 
-#else
-
-       for (i = 0; i < num_editor_elements; i++)
-       {
-         int e = editor_elements[i];
-
-         if ((key == KSYM_Insert &&
-              (e == EL_INTERNAL_CASCADE_CE ||
-               e == EL_INTERNAL_CASCADE_CE_ACTIVE)) ||
-             (key == KSYM_Delete &&
-              (e == EL_INTERNAL_CASCADE_GE ||
-               e == EL_INTERNAL_CASCADE_GE_ACTIVE)))
-           break;
-       }
-
-       if (i < num_editor_elements)
-       {
-         element_shift = i;
-
-         if (element_shift > num_editor_elements - ED_NUM_ELEMENTLIST_BUTTONS)
-           element_shift = num_editor_elements - ED_NUM_ELEMENTLIST_BUTTONS;
-
-         ModifyGadget(level_editor_gadget[GADGET_ID_SCROLL_LIST_VERTICAL],
-                      GDI_SCROLLBAR_ITEM_POSITION,
-                      element_shift / ED_ELEMENTLIST_BUTTONS_HORIZ, GDI_END);
-
-         ModifyEditorElementList();
-       }
-#endif
-
        break;
 
       case KSYM_Escape:
@@ -10530,6 +10536,7 @@ void HandleLevelEditorKeyInput(Key key)
          DrawDrawingWindow();
          edit_mode = ED_MODE_DRAWING;
        }
+
         break;
 
       default: