code cleanup of tabulator and template gadgets in level editor
authorHolger Schemel <info@artsoft.org>
Thu, 2 Feb 2017 17:28:50 +0000 (18:28 +0100)
committerHolger Schemel <info@artsoft.org>
Thu, 2 Feb 2017 17:28:50 +0000 (18:28 +0100)
src/editor.c

index 29bf2c7bff7b785a3927e7193adb4cf5808d1ce2..4dce1f20be6c85f50c41abd25f13f80602862f6e 100644 (file)
 #define ED_TEXTBUTTON_ID_PROPERTIES_CONFIG_1   4
 #define ED_TEXTBUTTON_ID_PROPERTIES_CONFIG_2   5
 #define ED_TEXTBUTTON_ID_PROPERTIES_CHANGE     6
-#define ED_TEXTBUTTON_ID_SAVE_AS_TEMPLATE_1    7
-#define ED_TEXTBUTTON_ID_SAVE_AS_TEMPLATE_2    8
+#define ED_TEXTBUTTON_ID_SAVE_AS_TEMPLATE_2    7
+#define ED_TEXTBUTTON_ID_SAVE_AS_TEMPLATE_1    8
 #define ED_TEXTBUTTON_ID_ADD_CHANGE_PAGE       9
 #define ED_TEXTBUTTON_ID_DEL_CHANGE_PAGE       10
 
 #define ED_NUM_TEXTBUTTONS                     11
 
-#define ED_TEXTBUTTON_ID_LEVELINFO_FIRST ED_TEXTBUTTON_ID_LEVELINFO_LEVEL
-#define ED_TEXTBUTTON_ID_LEVELINFO_LAST  ED_TEXTBUTTON_ID_LEVELINFO_EDITOR
+#define ED_TAB_BUTTON_ID_LEVELINFO_FIRST ED_TEXTBUTTON_ID_LEVELINFO_LEVEL
+#define ED_TAB_BUTTON_ID_LEVELINFO_LAST  ED_TEXTBUTTON_ID_LEVELINFO_EDITOR
 
-#define ED_TEXTBUTTON_ID_PROPERTIES_FIRST ED_TEXTBUTTON_ID_PROPERTIES_INFO
-#define ED_TEXTBUTTON_ID_PROPERTIES_LAST  ED_TEXTBUTTON_ID_PROPERTIES_CHANGE
+#define ED_TAB_BUTTON_ID_PROPERTIES_FIRST ED_TEXTBUTTON_ID_PROPERTIES_INFO
+#define ED_TAB_BUTTON_ID_PROPERTIES_LAST  ED_TEXTBUTTON_ID_PROPERTIES_CHANGE
 
 #define ED_TEXTBUTTON_ID_CHANGE_FIRST  ED_TEXTBUTTON_ID_ADD_CHANGE_PAGE
 #define ED_TEXTBUTTON_ID_CHANGE_LAST   ED_TEXTBUTTON_ID_DEL_CHANGE_PAGE
@@ -2630,20 +2630,23 @@ static struct
     NULL, NULL, NULL,                  "Configure custom element change pages"
   },
 
-  /* ---------- element settings (buttons) --------------------------------- */
+  /* ---------- level and editor settings (buttons) ------------------------ */
 
   {
-    -1,                                        -1,
-    GADGET_ID_SAVE_AS_TEMPLATE_1,      GADGET_ID_CUSTOM_USE_TEMPLATE_1,
+    ED_LEVEL_SETTINGS_XPOS(0),         ED_LEVEL_SETTINGS_YPOS(6),
+    GADGET_ID_SAVE_AS_TEMPLATE_2,      GADGET_ID_NONE,
     -1,                                        "Save",
-    NULL, " ",                         "As Template",
+    NULL, NULL,                                "this level as level template",
     "Save current settings as new template"
   },
+
+  /* ---------- element settings (buttons) --------------------------------- */
+
   {
-    ED_LEVEL_SETTINGS_XPOS(0),         ED_LEVEL_SETTINGS_YPOS(6),
-    GADGET_ID_SAVE_AS_TEMPLATE_2,      GADGET_ID_NONE,
+    -1,                                        -1,
+    GADGET_ID_SAVE_AS_TEMPLATE_1,      GADGET_ID_CUSTOM_USE_TEMPLATE_1,
     -1,                                        "Save",
-    NULL, NULL,                                "this level as level template",
+    NULL, " ",                         "As Template",
     "Save current settings as new template"
   },
   {
@@ -8235,8 +8238,8 @@ static void DrawLevelInfoTabulatorGadgets()
   int gd_x = gd->x + gd_gi1->border.width / 2;
   int gd_y = gd->y + gd_gi1->height - 1;
   Pixel tab_color = GetPixel(gd->bitmap, gd_x, gd_y);
-  int id_first = ED_TEXTBUTTON_ID_LEVELINFO_LEVEL;
-  int id_last  = ED_TEXTBUTTON_ID_LEVELINFO_EDITOR;
+  int id_first = ED_TAB_BUTTON_ID_LEVELINFO_FIRST;
+  int id_last  = ED_TAB_BUTTON_ID_LEVELINFO_LAST;
   int i;
 
   for (i = id_first; i <= id_last; i++)
@@ -11485,15 +11488,15 @@ static void HandleTextbuttonGadgets(struct GadgetInfo *gi)
   int type_id = gi->custom_type_id;
   int i;
 
-  if (type_id >= ED_TEXTBUTTON_ID_LEVELINFO_FIRST &&
-      type_id <= ED_TEXTBUTTON_ID_LEVELINFO_LAST)
+  if (type_id >= ED_TAB_BUTTON_ID_LEVELINFO_FIRST &&
+      type_id <= ED_TAB_BUTTON_ID_LEVELINFO_LAST)
   {
     edit_mode_levelinfo = gi->custom_type_id;
 
     DrawLevelInfoWindow();
   }
-  else if (type_id >= ED_TEXTBUTTON_ID_PROPERTIES_FIRST &&
-          type_id <= ED_TEXTBUTTON_ID_PROPERTIES_LAST)
+  else if (type_id >= ED_TAB_BUTTON_ID_PROPERTIES_FIRST &&
+          type_id <= ED_TAB_BUTTON_ID_PROPERTIES_LAST)
   {
     edit_mode_properties = gi->custom_type_id;