rnd-20030411-1-src
authorHolger Schemel <info@artsoft.org>
Thu, 10 Apr 2003 23:57:45 +0000 (01:57 +0200)
committerHolger Schemel <info@artsoft.org>
Sat, 30 Aug 2014 08:41:04 +0000 (10:41 +0200)
16 files changed:
src/conf_fnt.c
src/conf_gfx.c
src/conf_gfx.h
src/conftime.h
src/editor.c
src/events.c
src/game.c
src/libgame/gadgets.c
src/libgame/gadgets.h
src/libgame/sdl.c
src/libgame/sdl.h
src/libgame/system.h
src/libgame/text.c
src/libgame/text.h
src/main.h
src/screens.c

index 09dbe0076815812b637b1c46b5132f3c6fc41703..09e6dd854b5e3a993f07e7e98cc31fe31a0ad2f2 100644 (file)
@@ -124,24 +124,32 @@ font_to_graphic[] =
     IMG_FONT_TEXT_4_SCORES
   },
   {
-    FONT_INPUT,                                        -1,
-    IMG_FONT_INPUT
+    FONT_INPUT_1,                              -1,
+    IMG_FONT_INPUT_1
   },
   {
-    FONT_INPUT,                                        GFX_SPECIAL_ARG_MAIN,
-    IMG_FONT_INPUT_MAIN
+    FONT_INPUT_1,                              GFX_SPECIAL_ARG_MAIN,
+    IMG_FONT_INPUT_1_MAIN
   },
   {
-    FONT_INPUT_ACTIVE,                         -1,
-    IMG_FONT_INPUT_ACTIVE
+    FONT_INPUT_1_ACTIVE,                       -1,
+    IMG_FONT_INPUT_1_ACTIVE
   },
   {
-    FONT_INPUT_ACTIVE,                         GFX_SPECIAL_ARG_MAIN,
-    IMG_FONT_INPUT_ACTIVE_MAIN
+    FONT_INPUT_1_ACTIVE,                       GFX_SPECIAL_ARG_MAIN,
+    IMG_FONT_INPUT_1_ACTIVE_MAIN
   },
   {
-    FONT_INPUT_ACTIVE,                         GFX_SPECIAL_ARG_SETUP,
-    IMG_FONT_INPUT_ACTIVE_SETUP
+    FONT_INPUT_1_ACTIVE,                       GFX_SPECIAL_ARG_SETUP,
+    IMG_FONT_INPUT_1_ACTIVE_SETUP
+  },
+  {
+    FONT_INPUT_2,                              -1,
+    IMG_FONT_INPUT_2
+  },
+  {
+    FONT_INPUT_2_ACTIVE,                       -1,
+    IMG_FONT_INPUT_2_ACTIVE
   },
   {
     FONT_OPTION_OFF,                           -1,
index d918b8c5f893844a3985d9f1c7f354d7a6edcfda..2b58e36c0c730f43300b1d6f60813fc38ed619df 100644 (file)
@@ -3226,31 +3226,41 @@ struct ConfigInfo image_config[] =
   { "font.text_4.SCORES.width",                        "16"                    },
   { "font.text_4.SCORES.height",               "32"                    },
 
-  { "font.input",                              "RocksFontSmall.pcx"    },
-  { "font.input.x",                            "0"                     },
-  { "font.input.y",                            "210"                   },
-  { "font.input.width",                                "14"                    },
-  { "font.input.height",                       "14"                    },
-  { "font.input.MAIN",                         "RocksFontBig.pcx"      },
-  { "font.input.MAIN.x",                       "0"                     },
-  { "font.input.MAIN.y",                       "0"                     },
-  { "font.input.MAIN.width",                   "32"                    },
-  { "font.input.MAIN.height",                  "32"                    },
-  { "font.input.active",                       "RocksFontSmall.pcx"    },
-  { "font.input.active.x",                     "0"                     },
-  { "font.input.active.y",                     "0"                     },
-  { "font.input.active.width",                 "14"                    },
-  { "font.input.active.height",                        "14"                    },
-  { "font.input.active.MAIN",                  "RocksFontBig.pcx"      },
-  { "font.input.active.MAIN.x",                        "0"                     },
-  { "font.input.active.MAIN.y",                        "480"                   },
-  { "font.input.active.MAIN.width",            "32"                    },
-  { "font.input.active.MAIN.height",           "32"                    },
-  { "font.input.active.SETUP",                 "RocksFontBig.pcx"      },
-  { "font.input.active.SETUP.x",               "0"                     },
-  { "font.input.active.SETUP.y",               "0"                     },
-  { "font.input.active.SETUP.width",           "32"                    },
-  { "font.input.active.SETUP.height",          "32"                    },
+  { "font.input_1",                            "RocksFontSmall.pcx"    },
+  { "font.input_1.x",                          "0"                     },
+  { "font.input_1.y",                          "210"                   },
+  { "font.input_1.width",                      "14"                    },
+  { "font.input_1.height",                     "14"                    },
+  { "font.input_1.MAIN",                       "RocksFontBig.pcx"      },
+  { "font.input_1.MAIN.x",                     "0"                     },
+  { "font.input_1.MAIN.y",                     "0"                     },
+  { "font.input_1.MAIN.width",                 "32"                    },
+  { "font.input_1.MAIN.height",                        "32"                    },
+  { "font.input_1.active",                     "RocksFontSmall.pcx"    },
+  { "font.input_1.active.x",                   "0"                     },
+  { "font.input_1.active.y",                   "210"                   },
+  { "font.input_1.active.width",               "14"                    },
+  { "font.input_1.active.height",              "14"                    },
+  { "font.input_1.active.MAIN",                        "RocksFontBig.pcx"      },
+  { "font.input_1.active.MAIN.x",              "0"                     },
+  { "font.input_1.active.MAIN.y",              "480"                   },
+  { "font.input_1.active.MAIN.width",          "32"                    },
+  { "font.input_1.active.MAIN.height",         "32"                    },
+  { "font.input_1.active.SETUP",               "RocksFontBig.pcx"      },
+  { "font.input_1.active.SETUP.x",             "0"                     },
+  { "font.input_1.active.SETUP.y",             "0"                     },
+  { "font.input_1.active.SETUP.width",         "32"                    },
+  { "font.input_1.active.SETUP.height",                "32"                    },
+  { "font.input_2",                            "RocksFontSmall.pcx"    },
+  { "font.input_2.x",                          "0"                     },
+  { "font.input_2.y",                          "210"                   },
+  { "font.input_2.width",                      "14"                    },
+  { "font.input_2.height",                     "14"                    },
+  { "font.input_2.active",                     "RocksFontSmall.pcx"    },
+  { "font.input_2.active.x",                   "0"                     },
+  { "font.input_2.active.y",                   "210"                   },
+  { "font.input_2.active.width",               "14"                    },
+  { "font.input_2.active.height",              "14"                    },
 
   { "font.option_off",                         "RocksFontBig.pcx"      },
   { "font.option_off.x",                       "0"                     },
index 9413a02d45651ebfc7e45499540e98b66e30395e..76452cdc84e8ba1501e7b8ffed99bddf00d90662 100644 (file)
 #define IMG_FONT_TEXT_4                                        837
 #define IMG_FONT_TEXT_4_LEVELS                         838
 #define IMG_FONT_TEXT_4_SCORES                         839
-#define IMG_FONT_INPUT                                 840
-#define IMG_FONT_INPUT_MAIN                            841
-#define IMG_FONT_INPUT_ACTIVE                          842
-#define IMG_FONT_INPUT_ACTIVE_MAIN                     843
-#define IMG_FONT_INPUT_ACTIVE_SETUP                    844
-#define IMG_FONT_OPTION_OFF                            845
-#define IMG_FONT_OPTION_ON                             846
-#define IMG_FONT_VALUE_1                               847
-#define IMG_FONT_VALUE_2                               848
-#define IMG_FONT_VALUE_OLD                             849
-#define IMG_FONT_LEVEL_NUMBER                          850
-#define IMG_FONT_TAPE_RECORDER                         851
-#define IMG_FONT_GAME_INFO                             852
-#define IMG_GLOBAL_BORDER                              853
-#define IMG_GLOBAL_DOOR                                        854
-#define IMG_EDITOR_ELEMENT_BORDER                      855
-#define IMG_BACKGROUND                                 856
-#define IMG_BACKGROUND_MAIN                            857
-#define IMG_BACKGROUND_LEVELS                          858
-#define IMG_BACKGROUND_SCORES                          859
-#define IMG_BACKGROUND_EDITOR                          860
-#define IMG_BACKGROUND_INFO                            861
-#define IMG_BACKGROUND_SETUP                           862
-#define IMG_BACKGROUND_DOOR                            863
+#define IMG_FONT_INPUT_1                               840
+#define IMG_FONT_INPUT_1_MAIN                          841
+#define IMG_FONT_INPUT_1_ACTIVE                                842
+#define IMG_FONT_INPUT_1_ACTIVE_MAIN                   843
+#define IMG_FONT_INPUT_1_ACTIVE_SETUP                  844
+#define IMG_FONT_INPUT_2                               845
+#define IMG_FONT_INPUT_2_ACTIVE                                846
+#define IMG_FONT_OPTION_OFF                            847
+#define IMG_FONT_OPTION_ON                             848
+#define IMG_FONT_VALUE_1                               849
+#define IMG_FONT_VALUE_2                               850
+#define IMG_FONT_VALUE_OLD                             851
+#define IMG_FONT_LEVEL_NUMBER                          852
+#define IMG_FONT_TAPE_RECORDER                         853
+#define IMG_FONT_GAME_INFO                             854
+#define IMG_GLOBAL_BORDER                              855
+#define IMG_GLOBAL_DOOR                                        856
+#define IMG_EDITOR_ELEMENT_BORDER                      857
+#define IMG_BACKGROUND                                 858
+#define IMG_BACKGROUND_MAIN                            859
+#define IMG_BACKGROUND_LEVELS                          860
+#define IMG_BACKGROUND_SCORES                          861
+#define IMG_BACKGROUND_EDITOR                          862
+#define IMG_BACKGROUND_INFO                            863
+#define IMG_BACKGROUND_SETUP                           864
+#define IMG_BACKGROUND_DOOR                            865
 
-#define NUM_IMAGE_FILES                                        864
+#define NUM_IMAGE_FILES                                        866
 
 #endif /* CONF_GFX_H */
index b2cc184e8064b29e57853e3e1cf01c8ede4d1406..9fb17e11de05a5b7b98f1fa13040ccf07eb4a9ea 100644 (file)
@@ -1 +1 @@
-#define COMPILE_DATE_STRING "[2003-04-09 23:02]"
+#define COMPILE_DATE_STRING "[2003-04-11 01:43]"
index 1951d1f47bce14d94be2a9a2ab83d05267444ec5..e0ebdf2ae0428af83bbdec816550214a331c767b 100644 (file)
 
 /* standard distances */
 #define ED_BORDER_SIZE                 3
+#define ED_BORDER2_SIZE                        5
 #define ED_GADGET_DISTANCE             2
 
 /* values for element content drawing areas */
 #define ED_BUTTON_PLUS_YSIZE           ED_BUTTON_COUNT_YSIZE
 
 #define ED_SELECTBOX_XPOS              ED_WIN_COUNT_XPOS
-#define ED_SELECTBOX_YPOS              (ED_WIN_COUNT_YPOS + 2 + \
-                                        ED_WIN_COUNT_YSIZE)
+#define ED_SELECTBOX_YPOS              (ED_WIN_COUNT_YPOS + \
+                                        2 + ED_WIN_COUNT_YSIZE)
 #define ED_SELECTBOX_XSIZE             ED_WIN_COUNT_XSIZE
 #define ED_SELECTBOX_YSIZE             ED_WIN_COUNT_YSIZE
 
+#define ED_TEXTBUTTON_XPOS             ED_WIN_COUNT_XPOS
+#define ED_TEXTBUTTON_YPOS             (ED_WIN_COUNT_YPOS + \
+                                        2 * (2 + ED_WIN_COUNT_YSIZE))
+#define ED_TEXTBUTTON_INACTIVE_YPOS    (ED_WIN_COUNT_YPOS + \
+                                        3 * (2 + ED_WIN_COUNT_YSIZE))
+#define ED_TEXTBUTTON_XSIZE            ED_WIN_COUNT_XSIZE
+#define ED_TEXTBUTTON_YSIZE            ED_WIN_COUNT_YSIZE
+
 /* editor gadget identifiers */
 
 /* drawing toolbox buttons */
 /* selectbox identifiers */
 #define GADGET_ID_SELECTBOX_FIRST      (GADGET_ID_TEXT_INPUT_FIRST + 2)
 
-#define GADGET_ID_SELECTBOX_TEST       (GADGET_ID_SELECTBOX_FIRST + 0)
+#define GADGET_ID_CUSTOM_CHANGE_CAUSE  (GADGET_ID_SELECTBOX_FIRST + 0)
+
+/* textbutton identifiers */
+#define GADGET_ID_TEXTBUTTON_FIRST     (GADGET_ID_SELECTBOX_FIRST + 1)
+
+#define GADGET_ID_EDIT_PROPERTIES      (GADGET_ID_TEXTBUTTON_FIRST + 0)
+#define GADGET_ID_SHOW_DESCRIPTION     (GADGET_ID_TEXTBUTTON_FIRST + 1)
+#define GADGET_ID_EDIT_CUSTOM_CHANGE   (GADGET_ID_TEXTBUTTON_FIRST + 2)
 
 /* gadgets for scrolling of drawing area */
-#define GADGET_ID_SCROLLING_FIRST      (GADGET_ID_SELECTBOX_FIRST + 1)
+#define GADGET_ID_SCROLLING_FIRST      (GADGET_ID_TEXTBUTTON_FIRST + 3)
 
 #define GADGET_ID_SCROLL_UP            (GADGET_ID_SCROLLING_FIRST + 0)
 #define GADGET_ID_SCROLL_DOWN          (GADGET_ID_SCROLLING_FIRST + 1)
 #define ED_TEXTINPUT_ID_LEVEL_LAST     ED_TEXTINPUT_ID_LEVEL_AUTHOR
 
 /* values for selectbox gadgets */
-#define ED_SELECTBOX_ID_TEST           0
+#define ED_SELECTBOX_ID_CUSTOM_CHANGE_CAUSE    0
 
-#define ED_NUM_SELECTBOX               1
+#define ED_NUM_SELECTBOX                       1
+
+/* values for textbutton gadgets */
+#define ED_TEXTBUTTON_ID_EDIT_PROPERTIES       0
+#define ED_TEXTBUTTON_ID_SHOW_DESCRIPTION      1
+#define ED_TEXTBUTTON_ID_EDIT_CUSTOM_CHANGE    2
+
+#define ED_NUM_TEXTBUTTON                      3
 
 /* values for checkbutton gadgets */
 #define ED_CHECKBUTTON_ID_DOUBLE_SPEED         0
@@ -591,35 +614,65 @@ static struct
   }
 };
 
-static char *test_values[] =
+static struct ValueTextInfo options_change_cause[] =
 {
-  "test 1",
-  "test 2",
-  "dieser test-text ist viel zu lang fuer die selectbox",
-  "letzter text",
-  NULL
+  { 1, "specified delay"       },
+  { 2, "impact (active)"       },
+  { 3, "impact (passive)"      },
+  { 4, "touched by player"     },
+  { 5, "pressed by player"     },
+  { -1,        NULL                    }
 };
-static int test_index = 0;
+static int index_change_cause = 0;
 
 static struct
 {
   int x, y;
   int gadget_id;
   int size;
-  char **values;
+  struct ValueTextInfo *options;
   int *index;
   char *text, *infotext;
 } selectbox_info[ED_NUM_SELECTBOX] =
 {
   {
     ED_SETTINGS_XPOS,                  ED_COUNTER_YPOS(3),
-    GADGET_ID_SELECTBOX_TEST,
-    MAX_PLAYER_NAME_LEN,
-    test_values, &test_index,
+    GADGET_ID_CUSTOM_CHANGE_CAUSE,
+    17,
+    options_change_cause, &index_change_cause,
     "test:", "test-selectbox entry"
   },
 };
 
+static struct
+{
+  int x, y;
+  int gadget_id;
+  int size;
+  char *value;
+  char *infotext;
+} textbutton_info[ED_NUM_TEXTBUTTON] =
+{
+  {
+    ED_SETTINGS_XPOS,                  ED_COUNTER_YPOS(1),
+    GADGET_ID_EDIT_PROPERTIES,
+    11, "Properties",
+    "Edit element properties"
+  },
+  {
+    ED_SETTINGS_XPOS + 166,            ED_COUNTER_YPOS(1),
+    GADGET_ID_SHOW_DESCRIPTION,
+    11, "Description",
+    "Show element description"
+  },
+  {
+    ED_SETTINGS_XPOS + 332,            ED_COUNTER_YPOS(1),
+    GADGET_ID_EDIT_CUSTOM_CHANGE,
+    11, "Advanced",
+    "Advanced element features"
+  },
+};
+
 static struct
 {
   int xpos, ypos;
@@ -831,6 +884,7 @@ static void HandleDrawingAreas(struct GadgetInfo *);
 static void HandleCounterButtons(struct GadgetInfo *);
 static void HandleTextInputGadgets(struct GadgetInfo *);
 static void HandleSelectboxGadgets(struct GadgetInfo *);
+static void HandleTextbuttonGadgets(struct GadgetInfo *);
 static void HandleRadiobuttons(struct GadgetInfo *);
 static void HandleCheckbuttons(struct GadgetInfo *);
 static void HandleControlButtons(struct GadgetInfo *);
@@ -1684,7 +1738,7 @@ static void ReinitializeElementListButtons()
 
 static int getCounterGadgetWidth()
 {
-  return (DXSIZE + getFontWidth(FONT_INPUT) - 2 * ED_GADGET_DISTANCE);
+  return (DXSIZE + getFontWidth(FONT_INPUT_1) - 2 * ED_GADGET_DISTANCE);
 }
 
 static int getMaxInfoTextLength()
@@ -2036,7 +2090,8 @@ static void CreateCounterButtons()
 
       if (j == 0)
       {
-       int font_type = FONT_INPUT;
+       int font_type = FONT_INPUT_1;
+       int font_type_active = FONT_INPUT_1_ACTIVE;
        int gd_width = ED_WIN_COUNT_XSIZE;
 
        id = counterbutton_info[i].gadget_id_text;
@@ -2045,6 +2100,7 @@ static void CreateCounterButtons()
        if (i == ED_COUNTER_ID_SELECT_LEVEL)
        {
          font_type = FONT_LEVEL_NUMBER;
+         font_type_active = FONT_LEVEL_NUMBER;
 
          xpos += 2 * ED_GADGET_DISTANCE;
          ypos -= ED_GADGET_DISTANCE;
@@ -2070,10 +2126,11 @@ static void CreateCounterButtons()
                          GDI_NUMBER_MAX, counterbutton_info[i].max_value,
                          GDI_TEXT_SIZE, 3,
                          GDI_TEXT_FONT, font_type,
+                         GDI_TEXT_FONT_ACTIVE, font_type_active,
                          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_BORDER_SIZE, ED_BORDER_SIZE, ED_BORDER_SIZE,
+                         GDI_DESIGN_WIDTH, gd_width,
                          GDI_EVENT_MASK, event_mask,
                          GDI_CALLBACK_INFO, HandleEditorGadgetInfoText,
                          GDI_CALLBACK_ACTION, HandleCounterButtons,
@@ -2233,11 +2290,12 @@ static void CreateTextInputGadgets()
                      GDI_TYPE, GD_TYPE_TEXTINPUT_ALPHANUMERIC,
                      GDI_TEXT_VALUE, textinput_info[i].value,
                      GDI_TEXT_SIZE, textinput_info[i].size,
-                     GDI_TEXT_FONT, FONT_INPUT,
+                     GDI_TEXT_FONT, FONT_INPUT_1,
+                     GDI_TEXT_FONT_ACTIVE, FONT_INPUT_1_ACTIVE,
                      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_BORDER_SIZE, ED_BORDER_SIZE, ED_BORDER_SIZE,
+                     GDI_DESIGN_WIDTH, ED_WIN_COUNT_XSIZE,
                      GDI_EVENT_MASK, event_mask,
                      GDI_CALLBACK_INFO, HandleEditorGadgetInfoText,
                      GDI_CALLBACK_ACTION, HandleTextInputGadgets,
@@ -2279,15 +2337,16 @@ static void CreateSelectboxGadgets()
                      GDI_X, SX + selectbox_info[i].x,
                      GDI_Y, SY + selectbox_info[i].y,
                      GDI_TYPE, GD_TYPE_SELECTBOX,
-                     GDI_SELECTBOX_VALUES, selectbox_info[i].values,
+                     GDI_SELECTBOX_OPTIONS, selectbox_info[i].options,
                      GDI_SELECTBOX_INDEX, selectbox_info[i].index,
                      GDI_TEXT_SIZE, selectbox_info[i].size,
-                     GDI_TEXT_FONT, FONT_INPUT,
+                     GDI_TEXT_FONT, FONT_INPUT_1,
+                     GDI_TEXT_FONT_ACTIVE, FONT_INPUT_1_ACTIVE,
                      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_BORDER_SIZE_SELECTBUTTON, getFontHeight(FONT_INPUT),
-                     GDI_TEXTINPUT_DESIGN_WIDTH, ED_WIN_COUNT_XSIZE,
+                     GDI_BORDER_SIZE, ED_BORDER_SIZE, ED_BORDER_SIZE,
+                     GDI_BORDER_SIZE_SELECTBUTTON, getFontWidth(FONT_INPUT_1),
+                     GDI_DESIGN_WIDTH, ED_WIN_COUNT_XSIZE,
                      GDI_EVENT_MASK, event_mask,
                      GDI_CALLBACK_INFO, HandleEditorGadgetInfoText,
                      GDI_CALLBACK_ACTION, HandleSelectboxGadgets,
@@ -2300,6 +2359,58 @@ static void CreateSelectboxGadgets()
   }
 }
 
+static void CreateTextbuttonGadgets()
+{
+  int max_infotext_len = getMaxInfoTextLength();
+  int i;
+
+  for (i=0; i<ED_NUM_TEXTBUTTON; i++)
+  {
+    Bitmap *gd_bitmap = graphic_info[IMG_GLOBAL_DOOR].bitmap;
+    int gd_x1, gd_x2, gd_y1, gd_y2;
+    struct GadgetInfo *gi;
+    unsigned long event_mask;
+    char infotext[MAX_OUTPUT_LINESIZE + 1];
+    int id = textbutton_info[i].gadget_id;
+
+    event_mask = GD_EVENT_RELEASED;
+
+    gd_x1 = DOOR_GFX_PAGEX4 + ED_TEXTBUTTON_XPOS;
+    gd_x2 = DOOR_GFX_PAGEX3 + ED_TEXTBUTTON_XPOS;
+    gd_y1 = DOOR_GFX_PAGEY1 + ED_TEXTBUTTON_YPOS;
+    gd_y2 = DOOR_GFX_PAGEY1 + ED_TEXTBUTTON_INACTIVE_YPOS;
+
+    sprintf(infotext, "%s", textbutton_info[i].infotext);
+    infotext[max_infotext_len] = '\0';
+
+    gi = CreateGadget(GDI_CUSTOM_ID, id,
+                     GDI_CUSTOM_TYPE_ID, i,
+                     GDI_INFO_TEXT, infotext,
+                     GDI_X, SX + textbutton_info[i].x,
+                     GDI_Y, SY + textbutton_info[i].y,
+                     GDI_TYPE, GD_TYPE_TEXT_BUTTON,
+                     GDI_TEXT_VALUE, textbutton_info[i].value,
+                     GDI_TEXT_SIZE, textbutton_info[i].size,
+                     GDI_TEXT_FONT, FONT_INPUT_2_ACTIVE,
+                     GDI_TEXT_FONT_ACTIVE, FONT_INPUT_2,
+                     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_BORDER_SIZE, ED_BORDER2_SIZE, ED_BORDER_SIZE,
+                     GDI_DESIGN_WIDTH, ED_WIN_COUNT_XSIZE,
+                     GDI_DECORATION_SHIFTING, 1, 1,
+                     GDI_EVENT_MASK, event_mask,
+                     GDI_CALLBACK_INFO, HandleEditorGadgetInfoText,
+                     GDI_CALLBACK_ACTION, HandleTextbuttonGadgets,
+                     GDI_END);
+
+    if (gi == NULL)
+      Error(ERR_EXIT, "cannot create gadget");
+
+    level_editor_gadget[id] = gi;
+  }
+}
+
 static void CreateScrollbarGadgets()
 {
   int i;
@@ -2357,7 +2468,7 @@ static void CreateScrollbarGadgets()
                      GDI_STATE, GD_BUTTON_UNPRESSED,
                      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_BORDER_SIZE, ED_BORDER_SIZE, ED_BORDER_SIZE,
                      GDI_EVENT_MASK, event_mask,
                      GDI_CALLBACK_INFO, HandleEditorGadgetInfoText,
                      GDI_CALLBACK_ACTION, HandleControlButtons,
@@ -2467,6 +2578,7 @@ void CreateLevelEditorGadgets()
   CreateDrawingAreas();
   CreateTextInputGadgets();
   CreateSelectboxGadgets();
+  CreateTextbuttonGadgets();
   CreateScrollbarGadgets();
   CreateCheckbuttonGadgets();
 
@@ -2528,6 +2640,11 @@ static void MapSelectboxGadget(int id)
   MapGadget(level_editor_gadget[selectbox_info[id].gadget_id]);
 }
 
+static void MapTextbuttonGadget(int id)
+{
+  MapGadget(level_editor_gadget[textbutton_info[id].gadget_id]);
+}
+
 static void MapRadiobuttonGadget(int id)
 {
   MapGadget(level_editor_gadget[radiobutton_info[id].gadget_id]);
@@ -3399,17 +3516,47 @@ static void DrawPropertiesWindow()
     MapCheckbuttonGadget(i);
 
     /* draw selectbox gadget */
-    i = ED_SELECTBOX_ID_TEST;
+    i = ED_SELECTBOX_ID_CUSTOM_CHANGE_CAUSE;
     x = selectbox_info[i].x + xoffset_right2;
     y = selectbox_info[i].y + yoffset_right2;
 
-    selectbox_info[i].index = &test_index;
+    selectbox_info[i].index = &index_change_cause;
 
     DrawTextF(x, y, FONT_TEXT_1, selectbox_info[i].text);
     ModifyGadget(level_editor_gadget[selectbox_info[i].gadget_id],
                 GDI_SELECTBOX_INDEX, *selectbox_info[i].index, GDI_END);
     MapSelectboxGadget(i);
   }
+
+  /* draw textbutton gadget */
+  i = ED_TEXTBUTTON_ID_EDIT_PROPERTIES;
+  x = textbutton_info[i].x + xoffset_right2;
+  y = textbutton_info[i].y + yoffset_right2;
+
+  ModifyGadget(level_editor_gadget[textbutton_info[i].gadget_id],
+              GDI_ACTIVE, FALSE, GDI_END);
+  MapTextbuttonGadget(i);
+
+  /* draw textbutton gadget */
+  i = ED_TEXTBUTTON_ID_SHOW_DESCRIPTION;
+  x = textbutton_info[i].x + xoffset_right2;
+  y = textbutton_info[i].y + yoffset_right2;
+
+  ModifyGadget(level_editor_gadget[textbutton_info[i].gadget_id],
+              GDI_ACTIVE, TRUE, GDI_END);
+  MapTextbuttonGadget(i);
+
+  if (IS_CUSTOM_ELEMENT(properties_element))
+  {
+    /* draw textbutton gadget */
+    i = ED_TEXTBUTTON_ID_EDIT_CUSTOM_CHANGE;
+    x = textbutton_info[i].x + xoffset_right2;
+    y = textbutton_info[i].y + yoffset_right2;
+
+    ModifyGadget(level_editor_gadget[textbutton_info[i].gadget_id],
+                GDI_ACTIVE, TRUE, GDI_END);
+    MapTextbuttonGadget(i);
+  }
 }
 
 static void DrawLineElement(int sx, int sy, int element, boolean change_level)
@@ -4322,11 +4469,32 @@ static void HandleTextInputGadgets(struct GadgetInfo *gi)
 
 static void HandleSelectboxGadgets(struct GadgetInfo *gi)
 {
-  *selectbox_info[gi->custom_type_id].index = gi->selectbox.index;
+  int type_id = gi->custom_type_id;
 
-#if 1
-  printf("Selected text value: '%s'\n",
-        selectbox_info[gi->custom_type_id].values[gi->selectbox.index]);
+  *selectbox_info[type_id].index = gi->selectbox.index;
+
+#if 0
+  printf("Selected text value: '%s' [%d]\n",
+        selectbox_info[type_id].options[gi->selectbox.index].text,
+        selectbox_info[type_id].options[gi->selectbox.index].value);
+#endif
+}
+
+static void HandleTextbuttonGadgets(struct GadgetInfo *gi)
+{
+  int i;
+
+  for (i=0; i<ED_NUM_TEXTBUTTON; i++)
+  {
+    struct GadgetInfo *gii = level_editor_gadget[textbutton_info[i].gadget_id];
+    boolean active = (gii->custom_type_id != gi->custom_type_id);
+
+    ModifyGadget(level_editor_gadget[textbutton_info[i].gadget_id],
+                GDI_ACTIVE, active, GDI_END);
+  }
+
+#if 0
+  printf("text button %d pressed\n", gi->custom_type_id);
 #endif
 }
 
index c88a27b8dfb80324151e36d6112e1226cb9e90ef..ffe1d4f0b09b306762c9560bab9a8ccf66a264c7 100644 (file)
@@ -40,24 +40,21 @@ static unsigned long playfield_cursor_delay = 0;
 
 int FilterMouseMotionEvents(const Event *event)
 {
+  MotionEvent *motion;
+
   /* non-motion events are directly passed to event handler functions */
   if (event->type != EVENT_MOTIONNOTIFY)
     return 1;
 
-  if (game_status == PLAYING)
-  {
-    MotionEvent *motion = (MotionEvent *)event;
-
-    cursor_inside_playfield =
-      (motion->x >= SX && motion->x < SX + SXSIZE &&
-       motion->y >= SY && motion->y < SY + SYSIZE);
+  motion = (MotionEvent *)event;
+  cursor_inside_playfield = (motion->x >= SX && motion->x < SX + SXSIZE &&
+                            motion->y >= SY && motion->y < SY + SYSIZE);
 
-    if (playfield_cursor_set)
-    {
-      SetMouseCursor(CURSOR_DEFAULT);
-      DelayReached(&playfield_cursor_delay, 0);
-      playfield_cursor_set = FALSE;
-    }
+  if (game_status == PLAYING && playfield_cursor_set)
+  {
+    SetMouseCursor(CURSOR_DEFAULT);
+    playfield_cursor_set = FALSE;
+    DelayReached(&playfield_cursor_delay, 0);
   }
 
   /* skip mouse motion events without pressed button outside level editor */
@@ -119,11 +116,19 @@ void EventLoop(void)
     else
     {
       /* when playing, display a special mouse pointer inside the playfield */
-      if (game_status == PLAYING && cursor_inside_playfield &&
-         DelayReached(&playfield_cursor_delay, 1000))
+      if (game_status == PLAYING)
+      {
+       if (!playfield_cursor_set && cursor_inside_playfield &&
+           DelayReached(&playfield_cursor_delay, 1000))
+       {
+         SetMouseCursor(CURSOR_PLAYFIELD);
+         playfield_cursor_set = TRUE;
+       }
+      }
+      else if (playfield_cursor_set)
       {
-       SetMouseCursor(CURSOR_PLAYFIELD);
-       playfield_cursor_set = TRUE;
+       SetMouseCursor(CURSOR_DEFAULT);
+       playfield_cursor_set = FALSE;
       }
 
       HandleNoEvent();
index 493bd5f671a1bd9b29b634069797bc779a2a1aa2..d60f158a4404d9f6a443f6d91568cedc835c1e07 100644 (file)
@@ -948,7 +948,6 @@ void InitGame()
     PlayMusic(level_nr);
 
   KeyboardAutoRepeatOff();
-  SetMouseCursor(CURSOR_PLAYFIELD);
 
   if (options.debug)
   {
index 69108942972fe2f8112a25dbb7d868e9b6945eb4..c022dea9d78f4499de97c07872ed2433def6b19a 100644 (file)
@@ -84,7 +84,7 @@ static struct GadgetInfo *getGadgetInfoFromMousePosition(int mx, int my)
 
   while (gi)
   {
-    if (gi->mapped &&
+    if (gi->mapped && gi->active &&
        ((mx >= gi->x && mx < gi->x + gi->width &&
          my >= gi->y && my < gi->y + gi->height) ||
         (gi->type & GD_TYPE_SELECTBOX && gi->selectbox.open &&
@@ -111,8 +111,8 @@ static void default_callback_action(void *ptr)
 static void DrawGadget(struct GadgetInfo *gi, boolean pressed, boolean direct)
 {
   int state = (pressed ? 1 : 0);
-  struct GadgetDesign *gd = (gi->checked ?
-                            &gi->alt_design[state] :
+  struct GadgetDesign *gd = (!gi->active ? &gi->alt_design[0] :
+                            gi->checked ? &gi->alt_design[state] :
                             &gi->design[state]);
   boolean redraw_selectbox = FALSE;
 
@@ -132,6 +132,40 @@ static void DrawGadget(struct GadgetInfo *gi, boolean pressed, boolean direct)
                   gi->y + gi->deco.y + (pressed ? gi->deco.yshift : 0));
       break;
 
+    case GD_TYPE_TEXT_BUTTON:
+      {
+       int i;
+       int font_nr = (gi->active ? gi->font_active : gi->font);
+       int font_width = getFontWidth(font_nr);
+       int border_x = gi->border.xsize;
+       int border_y = gi->border.ysize;
+       int text_size = strlen(gi->textbutton.value);
+       int text_start = (gi->width - text_size * font_width) / 2;
+
+       /* left part of gadget */
+       BlitBitmapOnBackground(gd->bitmap, drawto, gd->x, gd->y,
+                              border_x, gi->height, gi->x, gi->y);
+
+       /* middle part of gadget */
+       for (i=0; i < gi->textbutton.size; i++)
+         BlitBitmapOnBackground(gd->bitmap, drawto, gd->x + border_x, gd->y,
+                                font_width, gi->height,
+                                gi->x + border_x + i * font_width, gi->y);
+
+       /* right part of gadget */
+       BlitBitmapOnBackground(gd->bitmap, drawto,
+                              gd->x + gi->border.width - border_x, gd->y,
+                              border_x, gi->height,
+                              gi->x + gi->width - border_x, gi->y);
+
+       /* gadget text value */
+       DrawTextExt(drawto,
+                   gi->x + text_start + (pressed ? gi->deco.xshift : 0),
+                   gi->y + border_y   + (pressed ? gi->deco.yshift : 0),
+                   gi->textbutton.value, font_nr, BLIT_MASKED);
+      }
+      break;
+
     case GD_TYPE_TEXTINPUT_ALPHANUMERIC:
     case GD_TYPE_TEXTINPUT_NUMERIC:
       {
@@ -139,24 +173,26 @@ static void DrawGadget(struct GadgetInfo *gi, boolean pressed, boolean direct)
        char cursor_letter;
        char cursor_string[2];
        char text[MAX_GADGET_TEXTSIZE + 1];
-       int font_type = gi->text.font_type;
-       int font_width = getFontWidth(font_type);
-       int border = gi->border.size;
+       int font_nr = (pressed ? gi->font_active : gi->font);
+       int font_width = getFontWidth(font_nr);
+       int border_x = gi->border.xsize;
+       int border_y = gi->border.ysize;
 
        /* left part of gadget */
-       BlitBitmapOnBackground(gd->bitmap, drawto,
-                              gd->x, gd->y, border, gi->height, gi->x, gi->y);
+       BlitBitmapOnBackground(gd->bitmap, drawto, gd->x, gd->y,
+                              border_x, gi->height, gi->x, gi->y);
 
        /* middle part of gadget */
        for (i=0; i < gi->text.size + 1; i++)
-         BlitBitmapOnBackground(gd->bitmap, drawto,
-                                gd->x + border, gd->y, font_width, gi->height,
-                                gi->x + border + i * font_width, gi->y);
+         BlitBitmapOnBackground(gd->bitmap, drawto, gd->x + border_x, gd->y,
+                                font_width, gi->height,
+                                gi->x + border_x + i * font_width, gi->y);
 
        /* right part of gadget */
        BlitBitmapOnBackground(gd->bitmap, drawto,
-                              gd->x + gi->border.width - border, gd->y,border,
-                              gi->height, gi->x + gi->width - border, gi->y);
+                              gd->x + gi->border.width - border_x, gd->y,
+                              border_x, gi->height,
+                              gi->x + gi->width - border_x, gi->y);
 
        /* set text value */
        strcpy(text, gi->text.value);
@@ -164,21 +200,19 @@ static void DrawGadget(struct GadgetInfo *gi, boolean pressed, boolean direct)
 
        /* gadget text value */
        DrawTextExt(drawto,
-                   gi->x + border, gi->y + border, text,
-                   font_type, BLIT_MASKED);
+                   gi->x + border_x, gi->y + border_y, text,
+                   font_nr, BLIT_MASKED);
 
        cursor_letter = gi->text.value[gi->text.cursor_position];
        cursor_string[0] = (cursor_letter != '\0' ? cursor_letter : ' ');
        cursor_string[1] = '\0';
 
-       SetInverseTextColor(gi->text.inverse_color);
-
        /* draw cursor, if active */
        if (pressed)
          DrawTextExt(drawto,
-                     gi->x + border + gi->text.cursor_position * font_width,
-                     gi->y + border, cursor_string,
-                     font_type, BLIT_INVERSE);
+                     gi->x + border_x + gi->text.cursor_position * font_width,
+                     gi->y + border_y, cursor_string,
+                     font_nr, BLIT_INVERSE);
       }
       break;
 
@@ -186,44 +220,46 @@ static void DrawGadget(struct GadgetInfo *gi, boolean pressed, boolean direct)
       {
        int i;
        char text[MAX_GADGET_TEXTSIZE + 1];
-       int font_type = gi->selectbox.font_type;
-       int font_width = getFontWidth(font_type);
-       int font_height = getFontHeight(font_type);
-       int border = gi->border.size;
-       int button = gi->border.size_selectbutton;
-       int width_inner = gi->border.width - button - 2 * border;
+       int font_nr = (pressed ? gi->font_active : gi->font);
+       int font_width = getFontWidth(font_nr);
+       int font_height = getFontHeight(font_nr);
+       int border_x = gi->border.xsize;
+       int border_y = gi->border.ysize;
+       int button = gi->border.xsize_selectbutton;
+       int width_inner = gi->border.width - button - 2 * border_x;
        int box_width = gi->selectbox.width;
        int box_height = gi->selectbox.height;
 
        /* left part of gadget */
-       BlitBitmapOnBackground(gd->bitmap, drawto,
-                              gd->x, gd->y, border, gi->height, gi->x, gi->y);
+       BlitBitmapOnBackground(gd->bitmap, drawto, gd->x, gd->y,
+                              border_x, gi->height, gi->x, gi->y);
 
        /* middle part of gadget */
        for (i=0; i < gi->selectbox.size; i++)
-         BlitBitmapOnBackground(gd->bitmap, drawto,
-                                gd->x + border, gd->y, font_width, gi->height,
-                                gi->x + border + i * font_width, gi->y);
+         BlitBitmapOnBackground(gd->bitmap, drawto, gd->x + border_x, gd->y,
+                                font_width, gi->height,
+                                gi->x + border_x + i * font_width, gi->y);
 
        /* button part of gadget */
        BlitBitmapOnBackground(gd->bitmap, drawto,
-                              gd->x + border + width_inner, gd->y,
+                              gd->x + border_x + width_inner, gd->y,
                               button, gi->height,
-                              gi->x + gi->width - border - button, gi->y);
+                              gi->x + gi->width - border_x - button, gi->y);
 
        /* right part of gadget */
        BlitBitmapOnBackground(gd->bitmap, drawto,
-                              gd->x + gi->border.width - border, gd->y,border,
-                              gi->height, gi->x + gi->width - border, gi->y);
+                              gd->x + gi->border.width - border_x, gd->y,
+                              border_x, gi->height,
+                              gi->x + gi->width - border_x, gi->y);
 
        /* set text value */
-       strncpy(text, gi->selectbox.values[gi->selectbox.index],
+       strncpy(text, gi->selectbox.options[gi->selectbox.index].text,
                gi->selectbox.size);
        text[gi->selectbox.size] = '\0';
 
        /* gadget text value */
-       DrawTextExt(drawto, gi->x + border, gi->y + border, text,
-                   font_type, BLIT_MASKED);
+       DrawTextExt(drawto, gi->x + border_x, gi->y + border_y, text,
+                   font_nr, BLIT_MASKED);
 
        if (pressed)
        {
@@ -244,81 +280,82 @@ static void DrawGadget(struct GadgetInfo *gi, boolean pressed, boolean direct)
 
          /* top left part of gadget border */
          BlitBitmapOnBackground(gd->bitmap, drawto, gd->x, gd->y,
-                                border, border,
+                                border_x, border_y,
                                 gi->selectbox.x, gi->selectbox.y);
 
          /* top middle part of gadget border */
          for (i=0; i < gi->selectbox.size; i++)
-           BlitBitmapOnBackground(gd->bitmap, drawto, gd->x + border, gd->y,
-                                  font_width, border,
-                                  gi->selectbox.x + border + i * font_width,
+           BlitBitmapOnBackground(gd->bitmap, drawto, gd->x + border_x, gd->y,
+                                  font_width, border_y,
+                                  gi->selectbox.x + border_x + i * font_width,
                                   gi->selectbox.y);
 
          /* top button part of gadget border */
          BlitBitmapOnBackground(gd->bitmap, drawto,
-                                gd->x + border + width_inner, gd->y,
-                                button, border,
-                                gi->selectbox.x + box_width - border - button,
+                                gd->x + border_x + width_inner, gd->y,
+                                button, border_y,
+                                gi->selectbox.x + box_width -border_x -button,
                                 gi->selectbox.y);
 
          /* top right part of gadget border */
          BlitBitmapOnBackground(gd->bitmap, drawto,
-                                gd->x + gi->border.width - border, gd->y,
-                                border, border,
-                                gi->selectbox.x + box_width - border,
+                                gd->x + gi->border.width - border_x, gd->y,
+                                border_x, border_y,
+                                gi->selectbox.x + box_width - border_x,
                                 gi->selectbox.y);
 
          /* left and right part of gadget border for each row */
          for (i=0; i < gi->selectbox.num_values; i++)
          {
-           BlitBitmapOnBackground(gd->bitmap, drawto, gd->x, gd->y + border,
-                                  border, font_height,
+           BlitBitmapOnBackground(gd->bitmap, drawto, gd->x, gd->y + border_y,
+                                  border_x, font_height,
                                   gi->selectbox.x,
-                                  gi->selectbox.y + border + i * font_height);
+                                  gi->selectbox.y + border_y + i*font_height);
            BlitBitmapOnBackground(gd->bitmap, drawto,
-                                  gd->x + gi->border.width - border,
-                                  gd->y + border,
-                                  border, font_height,
-                                  gi->selectbox.x + box_width - border,
-                                  gi->selectbox.y + border + i * font_height);
+                                  gd->x + gi->border.width - border_x,
+                                  gd->y + border_y,
+                                  border_x, font_height,
+                                  gi->selectbox.x + box_width - border_x,
+                                  gi->selectbox.y + border_y + i*font_height);
          }
 
          /* bottom left part of gadget border */
          BlitBitmapOnBackground(gd->bitmap, drawto,
-                                gd->x, gd->y + gi->height - border,
-                                border, border,
+                                gd->x, gd->y + gi->height - border_y,
+                                border_x, border_y,
                                 gi->selectbox.x,
-                                gi->selectbox.y + box_height - border);
+                                gi->selectbox.y + box_height - border_y);
 
          /* bottom middle part of gadget border */
          for (i=0; i < gi->selectbox.size; i++)
            BlitBitmapOnBackground(gd->bitmap, drawto,
-                                  gd->x + border, gd->y + gi->height - border,
-                                  font_width, border,
-                                  gi->selectbox.x + border + i * font_width,
-                                  gi->selectbox.y + box_height - border);
+                                  gd->x + border_x,
+                                  gd->y + gi->height - border_y,
+                                  font_width, border_y,
+                                  gi->selectbox.x + border_x + i * font_width,
+                                  gi->selectbox.y + box_height - border_y);
 
          /* bottom button part of gadget border */
          BlitBitmapOnBackground(gd->bitmap, drawto,
-                                gd->x + border + width_inner,
-                                gd->y + gi->height - border,
-                                button, border,
-                                gi->selectbox.x + box_width - border - button,
-                                gi->selectbox.y + box_height - border);
+                                gd->x + border_x + width_inner,
+                                gd->y + gi->height - border_y,
+                                button, border_y,
+                                gi->selectbox.x + box_width -border_x -button,
+                                gi->selectbox.y + box_height - border_y);
 
          /* bottom right part of gadget border */
          BlitBitmapOnBackground(gd->bitmap, drawto,
-                                gd->x + gi->border.width - border,
-                                gd->y + gi->height - border,
-                                border, border,
-                                gi->selectbox.x + box_width - border,
-                                gi->selectbox.y + box_height - border);
+                                gd->x + gi->border.width - border_x,
+                                gd->y + gi->height - border_y,
+                                border_x, border_y,
+                                gi->selectbox.x + box_width - border_x,
+                                gi->selectbox.y + box_height - border_y);
 
          ClearRectangleOnBackground(drawto,
-                                    gi->selectbox.x + border,
-                                    gi->selectbox.y + border,
-                                    gi->selectbox.width - 2 * border,
-                                    gi->selectbox.height - 2 * border);
+                                    gi->selectbox.x + border_x,
+                                    gi->selectbox.y + border_y,
+                                    gi->selectbox.width - 2 * border_x,
+                                    gi->selectbox.height - 2 * border_y);
 
          /* selectbox text values */
          for (i=0; i < gi->selectbox.num_values; i++)
@@ -328,30 +365,28 @@ static void DrawGadget(struct GadgetInfo *gi, boolean pressed, boolean direct)
            if (i == gi->selectbox.current_index)
            {
              FillRectangle(drawto,
-                           gi->selectbox.x + border,
-                           gi->selectbox.y + border + i * font_height,
-                           gi->selectbox.width - 2 * border, font_height,
+                           gi->selectbox.x + border_x,
+                           gi->selectbox.y + border_y + i * font_height,
+                           gi->selectbox.width - 2 * border_x, font_height,
                            gi->selectbox.inverse_color);
 
-             strncpy(text, gi->selectbox.values[i], gi->selectbox.size);
+             strncpy(text, gi->selectbox.options[i].text, gi->selectbox.size);
              text[1 + gi->selectbox.size] = '\0';
 
-             SetInverseTextColor(gi->selectbox.inverse_color);
-
              mask_mode = BLIT_INVERSE;
            }
            else
            {
-             strncpy(text, gi->selectbox.values[i], gi->selectbox.size);
+             strncpy(text, gi->selectbox.options[i].text, gi->selectbox.size);
              text[gi->selectbox.size] = '\0';
 
              mask_mode = BLIT_MASKED;
            }
 
            DrawTextExt(drawto,
-                       gi->selectbox.x + border,
-                       gi->selectbox.y + border + i * font_height, text,
-                       font_type, mask_mode);
+                       gi->selectbox.x + border_x,
+                       gi->selectbox.y + border_y + i * font_height, text,
+                       font_nr, mask_mode);
          }
 
          redraw_selectbox = TRUE;
@@ -380,9 +415,9 @@ static void DrawGadget(struct GadgetInfo *gi, boolean pressed, boolean direct)
        int xpos = gi->x;
        int ypos = gi->y + gi->scrollbar.position;
        int design_full = gi->width;
-       int design_body = design_full - 2 * gi->border.size;
+       int design_body = design_full - 2 * gi->border.ysize;
        int size_full = gi->scrollbar.size;
-       int size_body = size_full - 2 * gi->border.size;
+       int size_body = size_full - 2 * gi->border.ysize;
        int num_steps = size_body / design_body;
        int step_size_remain = size_body - num_steps * design_body;
 
@@ -393,31 +428,31 @@ static void DrawGadget(struct GadgetInfo *gi, boolean pressed, boolean direct)
        /* upper part of gadget */
        BlitBitmapOnBackground(gd->bitmap, drawto,
                               gd->x, gd->y,
-                              gi->width, gi->border.size,
+                              gi->width, gi->border.ysize,
                               xpos, ypos);
 
        /* middle part of gadget */
        for (i=0; i<num_steps; i++)
          BlitBitmapOnBackground(gd->bitmap, drawto,
-                                gd->x, gd->y + gi->border.size,
+                                gd->x, gd->y + gi->border.ysize,
                                 gi->width, design_body,
                                 xpos,
-                                ypos + gi->border.size + i * design_body);
+                                ypos + gi->border.ysize + i * design_body);
 
        /* remaining middle part of gadget */
        if (step_size_remain > 0)
          BlitBitmapOnBackground(gd->bitmap, drawto,
-                                gd->x,  gd->y + gi->border.size,
+                                gd->x,  gd->y + gi->border.ysize,
                                 gi->width, step_size_remain,
                                 xpos,
-                                ypos + gi->border.size
+                                ypos + gi->border.ysize
                                 + num_steps * design_body);
 
        /* lower part of gadget */
        BlitBitmapOnBackground(gd->bitmap, drawto,
-                              gd->x, gd->y + design_full - gi->border.size,
-                              gi->width, gi->border.size,
-                              xpos, ypos + size_full - gi->border.size);
+                              gd->x, gd->y + design_full - gi->border.ysize,
+                              gi->width, gi->border.ysize,
+                              xpos, ypos + size_full - gi->border.ysize);
       }
       break;
 
@@ -427,9 +462,9 @@ static void DrawGadget(struct GadgetInfo *gi, boolean pressed, boolean direct)
        int xpos = gi->x + gi->scrollbar.position;
        int ypos = gi->y;
        int design_full = gi->height;
-       int design_body = design_full - 2 * gi->border.size;
+       int design_body = design_full - 2 * gi->border.xsize;
        int size_full = gi->scrollbar.size;
-       int size_body = size_full - 2 * gi->border.size;
+       int size_body = size_full - 2 * gi->border.xsize;
        int num_steps = size_body / design_body;
        int step_size_remain = size_body - num_steps * design_body;
 
@@ -440,31 +475,31 @@ static void DrawGadget(struct GadgetInfo *gi, boolean pressed, boolean direct)
        /* left part of gadget */
        BlitBitmapOnBackground(gd->bitmap, drawto,
                               gd->x, gd->y,
-                              gi->border.size, gi->height,
+                              gi->border.xsize, gi->height,
                               xpos, ypos);
 
        /* middle part of gadget */
        for (i=0; i<num_steps; i++)
          BlitBitmapOnBackground(gd->bitmap, drawto,
-                                gd->x + gi->border.size, gd->y,
+                                gd->x + gi->border.xsize, gd->y,
                                 design_body, gi->height,
-                                xpos + gi->border.size + i * design_body,
+                                xpos + gi->border.xsize + i * design_body,
                                 ypos);
 
        /* remaining middle part of gadget */
        if (step_size_remain > 0)
          BlitBitmapOnBackground(gd->bitmap, drawto,
-                                gd->x + gi->border.size, gd->y,
+                                gd->x + gi->border.xsize, gd->y,
                                 step_size_remain, gi->height,
-                                xpos + gi->border.size
+                                xpos + gi->border.xsize
                                 + num_steps * design_body,
                                 ypos);
 
        /* right part of gadget */
        BlitBitmapOnBackground(gd->bitmap, drawto,
-                              gd->x + design_full - gi->border.size, gd->y,
-                              gi->border.size, gi->height,
-                              xpos + size_full - gi->border.size, ypos);
+                              gd->x + design_full - gi->border.xsize, gd->y,
+                              gi->border.xsize, gi->height,
+                              xpos + size_full - gi->border.xsize, ypos);
       }
       break;
 
@@ -543,6 +578,12 @@ static void HandleGadgetTags(struct GadgetInfo *gi, int first_tag, va_list ap)
        gi->state = va_arg(ap, unsigned long);
        break;
 
+      case GDI_ACTIVE:
+       /* take care here: "boolean" is typedef'ed as "unsigned char",
+          which gets promoted to "int" */
+       gi->active = (boolean)va_arg(ap, int);
+       break;
+
       case GDI_CHECKED:
        /* take care here: "boolean" is typedef'ed as "unsigned char",
           which gets promoted to "int" */
@@ -587,6 +628,9 @@ static void HandleGadgetTags(struct GadgetInfo *gi, int first_tag, va_list ap)
          strncpy(gi->text.value, va_arg(ap, char *), max_textsize);
          gi->text.value[max_textsize] = '\0';
          gi->text.cursor_position = strlen(gi->text.value);
+
+         /* same tag also used for textbutton definition */
+         strcpy(gi->textbutton.value, gi->text.value);
        }
        break;
 
@@ -598,20 +642,25 @@ static void HandleGadgetTags(struct GadgetInfo *gi, int first_tag, va_list ap)
          gi->text.size = max_textsize;
          gi->text.value[max_textsize] = '\0';
 
-         /* same tag also used for selectbox definition */
+         /* same tag also used for textbutton and selectbox definition */
+         strcpy(gi->textbutton.value, gi->text.value);
+         gi->textbutton.size = gi->text.size;
          gi->selectbox.size = gi->text.size;
        }
        break;
 
       case GDI_TEXT_FONT:
-       gi->text.font_type = va_arg(ap, int);
+       gi->font = va_arg(ap, int);
+       if (gi->font_active == 0)
+         gi->font_active = gi->font;
+       break;
 
-       /* same tag also used for selectbox definition */
-       gi->selectbox.font_type = gi->text.font_type;
+      case GDI_TEXT_FONT_ACTIVE:
+       gi->font_active = va_arg(ap, int);
        break;
 
-      case GDI_SELECTBOX_VALUES:
-       gi->selectbox.values = va_arg(ap, const char **);
+      case GDI_SELECTBOX_OPTIONS:
+       gi->selectbox.options = va_arg(ap, struct ValueTextInfo *);
        break;
 
       case GDI_SELECTBOX_INDEX:
@@ -643,14 +692,15 @@ static void HandleGadgetTags(struct GadgetInfo *gi, int first_tag, va_list ap)
        break;
 
       case GDI_BORDER_SIZE:
-       gi->border.size = va_arg(ap, int);
+       gi->border.xsize = va_arg(ap, int);
+       gi->border.ysize = va_arg(ap, int);
        break;
 
       case GDI_BORDER_SIZE_SELECTBUTTON:
-       gi->border.size_selectbutton = va_arg(ap, int);
+       gi->border.xsize_selectbutton = va_arg(ap, int);
        break;
 
-      case GDI_TEXTINPUT_DESIGN_WIDTH:
+      case GDI_DESIGN_WIDTH:
        gi->border.width = va_arg(ap, int);
        break;
 
@@ -754,46 +804,41 @@ static void HandleGadgetTags(struct GadgetInfo *gi, int first_tag, va_list ap)
 
   if (gi->type & GD_TYPE_TEXTINPUT)
   {
-    int font_nr = gi->text.font_type;
+    int font_nr = gi->font_active;
     int font_width = getFontWidth(font_nr);
     int font_height = getFontHeight(font_nr);
-    int border_size = gi->border.size;
-    Bitmap *src_bitmap;
-    int src_x, src_y;
-
-    gi->width  = 2 * border_size + (gi->text.size + 1) * font_width;
-    gi->height = 2 * border_size + font_height;
+    int border_xsize = gi->border.xsize;
+    int border_ysize = gi->border.ysize;
 
-    getFontCharSource(font_nr, FONT_ASCII_CURSOR, &src_bitmap, &src_x, &src_y);
-    src_x += font_width / 2;
-    src_y += font_height / 2;
-    gi->text.inverse_color = GetPixel(src_bitmap, src_x, src_y);
+    gi->width  = 2 * border_xsize + (gi->text.size + 1) * font_width;
+    gi->height = 2 * border_ysize + font_height;
   }
 
   if (gi->type & GD_TYPE_SELECTBOX)
   {
-    int font_nr = gi->selectbox.font_type;
+    int font_nr = gi->font_active;
     int font_width = getFontWidth(font_nr);
     int font_height = getFontHeight(font_nr);
-    int border_size = gi->border.size;
-    int button_size = gi->border.size_selectbutton;
+    int border_xsize = gi->border.xsize;
+    int border_ysize = gi->border.ysize;
+    int button_size = gi->border.xsize_selectbutton;
     Bitmap *src_bitmap;
     int src_x, src_y;
 
-    gi->width  = 2 * border_size + gi->text.size * font_width + button_size;
-    gi->height = 2 * border_size + font_height;
+    gi->width  = 2 * border_xsize + gi->text.size * font_width + button_size;
+    gi->height = 2 * border_ysize + font_height;
 
-    if (gi->selectbox.values == NULL)
-      Error(ERR_EXIT, "selectbox gadget incomplete (missing values array)");
+    if (gi->selectbox.options == NULL)
+      Error(ERR_EXIT, "selectbox gadget incomplete (missing options array)");
 
     gi->selectbox.num_values = 0;
-    while (gi->selectbox.values[gi->selectbox.num_values] != NULL)
+    while (gi->selectbox.options[gi->selectbox.num_values].text != NULL)
       gi->selectbox.num_values++;
 
     /* calculate values for open selectbox */
     gi->selectbox.width = gi->width;
     gi->selectbox.height =
-      2 * border_size + gi->selectbox.num_values * font_height;
+      2 * border_ysize + gi->selectbox.num_values * font_height;
 
     gi->selectbox.x = gi->x;
     gi->selectbox.y = gi->y + gi->height;
@@ -823,6 +868,18 @@ static void HandleGadgetTags(struct GadgetInfo *gi, int first_tag, va_list ap)
     sprintf(text->value, "%d", text->number_value);
   }
 
+  if (gi->type & GD_TYPE_TEXT_BUTTON)
+  {
+    int font_nr = gi->font_active;
+    int font_width = getFontWidth(font_nr);
+    int font_height = getFontHeight(font_nr);
+    int border_xsize = gi->border.xsize;
+    int border_ysize = gi->border.ysize;
+
+    gi->width  = 2 * border_xsize + gi->textbutton.size * font_width;
+    gi->height = 2 * border_ysize + font_height;
+  }
+
   if (gi->type & GD_TYPE_SCROLLBAR)
   {
     struct GadgetScrollbar *gs = &gi->scrollbar;
@@ -871,6 +928,7 @@ struct GadgetInfo *CreateGadget(int first_tag, ...)
   new_gadget->id = getNewGadgetID();
   new_gadget->callback_info = default_callback_info;
   new_gadget->callback_action = default_callback_action;
+  new_gadget->active = TRUE;
   new_gadget->next = NULL;
 
   va_start(ap, first_tag);
@@ -1090,7 +1148,7 @@ void HandleGadgets(int mx, int my, int button)
 
       /* if mouse button pressed inside activated text gadget, set cursor */
       gi->text.cursor_position =
-       (mx - gi->x - gi->border.size) / getFontWidth(gi->text.font_type);
+       (mx - gi->x - gi->border.xsize) / getFontWidth(gi->font);
 
       if (gi->text.cursor_position < 0)
        gi->text.cursor_position = 0;
@@ -1127,8 +1185,7 @@ void HandleGadgets(int mx, int my, int button)
       /* if mouse button pressed inside activated selectbox, select value */
       if (my >= gi->selectbox.y && my < gi->selectbox.y + gi->selectbox.height)
        gi->selectbox.current_index =
-         (my - gi->selectbox.y - gi->border.size) /
-         getFontWidth(gi->selectbox.font_type);
+         (my - gi->selectbox.y - gi->border.xsize) / getFontWidth(gi->font);
 
       if (gi->selectbox.current_index < 0)
        gi->selectbox.current_index = 0;
@@ -1233,8 +1290,7 @@ void HandleGadgets(int mx, int my, int button)
       /* if mouse moving inside activated selectbox, select value */
       if (my >= gi->selectbox.y && my < gi->selectbox.y + gi->selectbox.height)
        gi->selectbox.current_index =
-         (my - gi->selectbox.y - gi->border.size) /
-         getFontWidth(gi->selectbox.font_type);
+         (my - gi->selectbox.y - gi->border.xsize) / getFontWidth(gi->font);
 
       if (gi->selectbox.current_index < 0)
        gi->selectbox.current_index = 0;
@@ -1400,8 +1456,7 @@ void HandleGadgets(int mx, int my, int button)
       /* if mouse moving inside activated selectbox, select value */
       if (my >= gi->selectbox.y && my < gi->selectbox.y + gi->selectbox.height)
        gi->selectbox.current_index =
-         (my - gi->selectbox.y - gi->border.size) /
-         getFontWidth(gi->selectbox.font_type);
+         (my - gi->selectbox.y - gi->border.xsize) / getFontWidth(gi->font);
 
       if (gi->selectbox.current_index < 0)
        gi->selectbox.current_index = 0;
index ab8e91439bc9c9702186f87b98c1962e4a3b8769..0bf8cc5a53ca322c81d5afb90d45a4e3ef71c7bd 100644 (file)
 
 /* gadget types */
 #define GD_TYPE_NORMAL_BUTTON          (1 << 0)
-#define GD_TYPE_CHECK_BUTTON           (1 << 1)
-#define GD_TYPE_RADIO_BUTTON           (1 << 2)
-#define GD_TYPE_DRAWING_AREA           (1 << 3)
-#define GD_TYPE_TEXTINPUT_ALPHANUMERIC (1 << 4)
-#define GD_TYPE_TEXTINPUT_NUMERIC      (1 << 5)
-#define GD_TYPE_SELECTBOX              (1 << 6)
-#define GD_TYPE_SCROLLBAR_VERTICAL     (1 << 7)
-#define GD_TYPE_SCROLLBAR_HORIZONTAL   (1 << 8)
+#define GD_TYPE_TEXT_BUTTON            (1 << 1)
+#define GD_TYPE_CHECK_BUTTON           (1 << 2)
+#define GD_TYPE_RADIO_BUTTON           (1 << 3)
+#define GD_TYPE_DRAWING_AREA           (1 << 4)
+#define GD_TYPE_TEXTINPUT_ALPHANUMERIC (1 << 5)
+#define GD_TYPE_TEXTINPUT_NUMERIC      (1 << 6)
+#define GD_TYPE_SELECTBOX              (1 << 7)
+#define GD_TYPE_SCROLLBAR_VERTICAL     (1 << 8)
+#define GD_TYPE_SCROLLBAR_HORIZONTAL   (1 << 9)
 
 #define GD_TYPE_BUTTON                 (GD_TYPE_NORMAL_BUTTON | \
+                                        GD_TYPE_TEXT_BUTTON | \
                                         GD_TYPE_CHECK_BUTTON | \
                                         GD_TYPE_RADIO_BUTTON)
 #define GD_TYPE_SCROLLBAR              (GD_TYPE_SCROLLBAR_VERTICAL | \
 #define GDI_TEXT_VALUE                 14
 #define GDI_TEXT_SIZE                  15
 #define GDI_TEXT_FONT                  16
-#define GDI_SELECTBOX_VALUES           17
-#define GDI_SELECTBOX_INDEX            18
-#define GDI_DESIGN_UNPRESSED           19
-#define GDI_DESIGN_PRESSED             20
-#define GDI_ALT_DESIGN_UNPRESSED       21
-#define GDI_ALT_DESIGN_PRESSED         22
-#define GDI_BORDER_SIZE                        23
-#define GDI_BORDER_SIZE_SELECTBUTTON   24
-#define GDI_TEXTINPUT_DESIGN_WIDTH     25
-#define GDI_DECORATION_DESIGN          26
-#define GDI_DECORATION_POSITION                27
-#define GDI_DECORATION_SIZE            28
-#define GDI_DECORATION_SHIFTING                29
-#define GDI_EVENT_MASK                 30
-#define GDI_EVENT                      31
-#define GDI_CALLBACK_INFO              32
-#define GDI_CALLBACK_ACTION            33
-#define GDI_AREA_SIZE                  34
-#define GDI_ITEM_SIZE                  35
-#define GDI_SCROLLBAR_ITEMS_MAX                36
-#define GDI_SCROLLBAR_ITEMS_VISIBLE    37
-#define GDI_SCROLLBAR_ITEM_POSITION    38
-#define GDI_INFO_TEXT                  39
+#define GDI_TEXT_FONT_ACTIVE           17
+#define GDI_SELECTBOX_OPTIONS          18
+#define GDI_SELECTBOX_INDEX            19
+#define GDI_DESIGN_UNPRESSED           20
+#define GDI_DESIGN_PRESSED             21
+#define GDI_ALT_DESIGN_UNPRESSED       22
+#define GDI_ALT_DESIGN_PRESSED         23
+#define GDI_BORDER_SIZE                        24
+#define GDI_BORDER_SIZE_SELECTBUTTON   25
+#define GDI_DESIGN_WIDTH               26
+#define GDI_DECORATION_DESIGN          27
+#define GDI_DECORATION_POSITION                28
+#define GDI_DECORATION_SIZE            29
+#define GDI_DECORATION_SHIFTING                30
+#define GDI_EVENT_MASK                 31
+#define GDI_EVENT                      32
+#define GDI_CALLBACK_INFO              33
+#define GDI_CALLBACK_ACTION            34
+#define GDI_AREA_SIZE                  35
+#define GDI_ITEM_SIZE                  36
+#define GDI_SCROLLBAR_ITEMS_MAX                37
+#define GDI_SCROLLBAR_ITEMS_VISIBLE    38
+#define GDI_SCROLLBAR_ITEM_POSITION    39
+#define GDI_INFO_TEXT                  40
+#define GDI_ACTIVE                     41
 
 typedef void (*gadget_function)(void *);
 
 struct GadgetBorder
 {
-  int size;                            /* size of gadget border */
-  int size_selectbutton;               /* for selectbox gadgets */
+  int xsize, ysize;                    /* size of gadget border */
+  int xsize_selectbutton;              /* for selectbox gadgets */
   int width;                           /* for selectbox/text input gadgets */
 };
 
@@ -137,24 +141,27 @@ struct GadgetDrawingArea
   int item_xsize, item_ysize;          /* size of each item in drawing area */
 };
 
+struct GadgetTextButton
+{
+  char value[MAX_GADGET_TEXTSIZE];     /* text written on the button */
+  int size;                            /* maximal size of button text */
+};
+
 struct GadgetTextInput
 {
   char value[MAX_GADGET_TEXTSIZE];     /* text string in input field */
+  int cursor_position;                 /* actual text cursor position */
   int number_value;                    /* integer value, if numeric */
   int number_min;                      /* minimal allowed numeric value */
   int number_max;                      /* maximal allowed numeric value */
   int size;                            /* maximal size of input text */
-  int font_type;                       /* font to use for text input */
-  int cursor_position;                 /* actual cursor position */
-  Pixel inverse_color;                 /* color for highlighting */
 };
 
 struct GadgetSelectbox
 {
-  const char **values;                 /* pointer to array of text strings */
+  struct ValueTextInfo *options;       /* pointer to text/value array */
   int index;                           /* index of actual text string */
   int size;                            /* maximal size of text strings */
-  int font_type;                       /* font to use for text input */
 
   /* automatically determined values */
   int x, y;                            /* open selectbox position */
@@ -193,7 +200,10 @@ struct GadgetInfo
   unsigned long state;                 /* state (pressed, released, ...) */
   boolean checked;                     /* check/radio button state */
   int radio_nr;                                /* number of radio button series */
-  boolean mapped;                      /* gadget is active */
+  boolean mapped;                      /* gadget is mapped on the screen */
+  boolean active;                      /* gadget is active */
+  int font;                            /* font to use when inactive */
+  int font_active;                     /* font to use when active */
   struct GadgetBorder border;          /* gadget border design */
   struct GadgetDesign design[2];       /* 0: normal; 1: pressed */
   struct GadgetDesign alt_design[2];   /* alternative design */
@@ -203,6 +213,7 @@ struct GadgetInfo
   gadget_function callback_info;       /* function for pop-up info text */
   gadget_function callback_action;     /* function for gadget action */
   struct GadgetDrawingArea drawing;    /* fields for drawing area gadget */
+  struct GadgetTextButton textbutton;  /* fields for text button gadget */
   struct GadgetTextInput text;         /* fields for text input gadget */
   struct GadgetSelectbox selectbox;    /* fields for selectbox gadget */
   struct GadgetScrollbar scrollbar;    /* fields for scrollbar gadget */
index f479fd9960b804faa6ae41bc42b1a8040b3971c2..18e384c5e13530a60fb75db743059714e5f902b6 100644 (file)
@@ -363,12 +363,12 @@ inline void SDLDrawLines(SDL_Surface *surface, struct XY *points,
 }
 #endif
 
-inline Pixel SDLGetPixel(Bitmap *dst_bitmap, int x, int y)
+inline Pixel SDLGetPixel(Bitmap *src_bitmap, int x, int y)
 {
-  SDL_Surface *surface = dst_bitmap->surface;
+  SDL_Surface *surface = src_bitmap->surface;
 
 #ifdef FULLSCREEN_BUG
-  if (dst_bitmap == backbuffer || dst_bitmap == window)
+  if (src_bitmap == backbuffer || src_bitmap == window)
   {
     x += video_xoffset;
     y += video_yoffset;
@@ -864,6 +864,11 @@ void sge_LineRGB(SDL_Surface *Surface, Sint16 x1, Sint16 y1, Sint16 x2,
   sge_Line(Surface, x1, y1, x2, y2, SDL_MapRGB(Surface->format, R, G, B));
 }
 
+inline void SDLPutPixel(Bitmap *dst_bitmap, int x, int y, Pixel pixel)
+{
+  sge_PutPixel(dst_bitmap->surface, x, y, pixel);
+}
+
 
 /*
   -----------------------------------------------------------------------------
@@ -874,7 +879,6 @@ void sge_LineRGB(SDL_Surface *Surface, Sint16 x1, Sint16 y1, Sint16 x2,
 inline void SDLInvertArea(Bitmap *bitmap, int src_x, int src_y,
                          int width, int height, Uint32 color)
 {
-  SDL_Surface *surface = bitmap->surface;
   int x, y;
 
   for (y=src_y; y < src_y + height; y++)
@@ -883,7 +887,25 @@ inline void SDLInvertArea(Bitmap *bitmap, int src_x, int src_y,
     {
       Uint32 pixel = SDLGetPixel(bitmap, x, y);
 
-      sge_PutPixel(surface, x, y, pixel == BLACK_PIXEL ? color : BLACK_PIXEL);
+      SDLPutPixel(bitmap, x, y, pixel == BLACK_PIXEL ? color : BLACK_PIXEL);
+    }
+  }
+}
+
+inline void SDLCopyInverseMasked(Bitmap *src_bitmap, Bitmap *dst_bitmap,
+                                int src_x, int src_y, int width, int height,
+                                int dst_x, int dst_y)
+{
+  int x, y;
+
+  for (y=0; y < height; y++)
+  {
+    for (x=0; x < width; x++)
+    {
+      Uint32 pixel = SDLGetPixel(src_bitmap, src_x + x, src_y + y);
+
+      if (pixel != BLACK_PIXEL)
+       SDLPutPixel(dst_bitmap, dst_x + x, dst_y + y, BLACK_PIXEL);
     }
   }
 }
index fcf19341a81fd08372a5edd2c67881b012147611..4ea00b5fa27a7cfeac4e9fcf40f361bfa42a875f 100644 (file)
@@ -344,8 +344,11 @@ inline void SDLFillRectangle(Bitmap *, int, int, int, int, Uint32);
 inline void SDLDrawSimpleLine(Bitmap *, int, int, int, int, Uint32);
 inline void SDLDrawLine(Bitmap *, int, int, int, int, Uint32);
 inline Pixel SDLGetPixel(Bitmap *, int, int);
+inline void SDLPutPixel(Bitmap *, int, int, Pixel);
 
 inline void SDLInvertArea(Bitmap *, int, int, int, int, Uint32);
+inline void SDLCopyInverseMasked(Bitmap *, Bitmap *, int, int, int, int,
+                                int, int);
 
 void SDLZoomBitmap(Bitmap *, Bitmap *);
 
index a73f8a4653cc04836faaf245ff72fe5f121122ce..8126eb0490a6d2e18d33135569430dfec1defda6 100644 (file)
@@ -43,6 +43,7 @@
 #define BLIT_OPAQUE            0
 #define BLIT_MASKED            1
 #define BLIT_INVERSE           2
+#define BLIT_ON_BACKGROUND     3
 
 #define FULLSCREEN_NOT_AVAILABLE FALSE
 #define FULLSCREEN_AVAILABLE    TRUE
@@ -353,7 +354,6 @@ struct GfxInfo
   int num_fonts;
   struct FontBitmapInfo *font_bitmap_info;
   int (*select_font_function)(int);
-  Pixel inverse_text_color;
 
   int anim_random_frame;
 };
@@ -529,6 +529,12 @@ struct ArtworkInfo
   char *mus_current_identifier;
 };
 
+struct ValueTextInfo
+{
+  int value;
+  char *text;
+};
+
 struct ConfigInfo
 {
   char *token;
index 2ba68ae816347262b48ff4dd1118893a57c37a99..a33bf11a702698ca0b39315245157864a8e146a8 100644 (file)
@@ -111,18 +111,12 @@ void InitFontInfo(struct FontBitmapInfo *font_bitmap_info, int num_fonts,
   gfx.num_fonts = num_fonts;
   gfx.font_bitmap_info = font_bitmap_info;
   gfx.select_font_function = select_font_function;
-  gfx.inverse_text_color = WHITE_PIXEL;
 
 #if defined(TARGET_X11_NATIVE_PERFORMANCE_WORKAROUND)
   InitFontClipmasks();
 #endif
 }
 
-void SetInverseTextColor(Pixel inverse_text_color)
-{
-  gfx.inverse_text_color = inverse_text_color;
-}
-
 int getFontWidth(int font_nr)
 {
   int font_bitmap_id = gfx.select_font_function(font_nr);
@@ -217,7 +211,7 @@ void DrawText(int x, int y, char *text, int font_nr)
   int mask_mode = BLIT_OPAQUE;
 
   if (DrawingOnBackground(x, y))
-    mask_mode = BLIT_MASKED;
+    mask_mode = BLIT_ON_BACKGROUND;
 
   DrawTextExt(drawto, x, y, text, font_nr, mask_mode);
 
@@ -253,15 +247,6 @@ void DrawTextExt(DrawBuffer *dst_bitmap, int dst_x, int dst_y, char *text,
 
     if (mask_mode == BLIT_INVERSE)     /* special mode for text gadgets */
     {
-#if defined(TARGET_SDL)
-      /* blit normally (non-masked) */
-      BlitBitmap(src_bitmap, dst_bitmap, src_x, src_y,
-                font_width, font_height, dst_x, dst_y);
-
-      /* invert character */
-      SDLInvertArea(dst_bitmap, dst_x, dst_y, font_width, font_height,
-                   gfx.inverse_text_color);
-#else
       /* first step: draw solid colored rectangle (use "cursor" character) */
       if (strlen(text) == 1)   /* only one char inverted => draw cursor */
       {
@@ -275,6 +260,11 @@ void DrawTextExt(DrawBuffer *dst_bitmap, int dst_x, int dst_y, char *text,
                   font_width, font_height, dst_x, dst_y);
       }
 
+#if defined(TARGET_SDL)
+      /* second step: draw masked inverted character */
+      SDLCopyInverseMasked(src_bitmap, dst_bitmap, src_x, src_y,
+                          font_width, font_height, dst_x, dst_y);
+#else
       /* second step: draw masked black rectangle (use "space" character) */
       SetClipOrigin(src_bitmap, src_bitmap->stored_clip_gc,
                    dst_x - src_x, dst_y - src_y);
@@ -282,11 +272,14 @@ void DrawTextExt(DrawBuffer *dst_bitmap, int dst_x, int dst_y, char *text,
                       font_width, font_height, dst_x, dst_y);
 #endif
     }
-    else if (mask_mode == BLIT_MASKED)
+    else if (mask_mode == BLIT_MASKED || mask_mode == BLIT_ON_BACKGROUND)
     {
-      /* clear font character background */
-      ClearRectangleOnBackground(dst_bitmap, dst_x, dst_y,
-                                font_width, font_height);
+      if (mask_mode == BLIT_ON_BACKGROUND)
+      {
+       /* clear font character background */
+       ClearRectangleOnBackground(dst_bitmap, dst_x, dst_y,
+                                  font_width, font_height);
+      }
 
 #if defined(TARGET_X11_NATIVE_PERFORMANCE_WORKAROUND)
       /* use special font tile clipmasks */
index fe6dace87458a4a2f3f0338541b6cc827e9261da..530a6b2a95772de3d6c9debe5ecbd014e1a8d711 100644 (file)
@@ -53,7 +53,6 @@
 /* font structure definitions */
 
 void InitFontInfo(struct FontBitmapInfo *, int, int (*function)(int));
-void SetInverseTextColor(Pixel);
 
 int getFontWidth(int);
 int getFontHeight(int);
index 69d8e51bac8ab17c32094a81b4773f10f3aa2491..545c161a0ae2853d156d505e533f6da414ebb93f 100644 (file)
 #define FONT_TEXT_2                            9
 #define FONT_TEXT_3                            10
 #define FONT_TEXT_4                            11
-#define FONT_INPUT                             12
-#define FONT_INPUT_ACTIVE                      13
-#define FONT_OPTION_OFF                                14
-#define FONT_OPTION_ON                         15
-#define FONT_VALUE_1                           16
-#define FONT_VALUE_2                           17
-#define FONT_VALUE_OLD                         18
-#define FONT_LEVEL_NUMBER                      19
-#define FONT_TAPE_RECORDER                     20
-#define FONT_GAME_INFO                         21
-
-#define NUM_FONTS                              22
+#define FONT_INPUT_1                           12
+#define FONT_INPUT_1_ACTIVE                    13
+#define FONT_INPUT_2                           14
+#define FONT_INPUT_2_ACTIVE                    15
+#define FONT_OPTION_OFF                                16
+#define FONT_OPTION_ON                         17
+#define FONT_VALUE_1                           18
+#define FONT_VALUE_2                           19
+#define FONT_VALUE_OLD                         20
+#define FONT_LEVEL_NUMBER                      21
+#define FONT_TAPE_RECORDER                     22
+#define FONT_GAME_INFO                         23
+
+#define NUM_FONTS                              24
 #define NUM_INITIAL_FONTS                      4
 
 /* values for game_status */
index cb7919fd192046689e3edfec34f28fe0bf80ae11..e9bd5ddafb579833420f042c1310960e14c79377 100644 (file)
@@ -199,7 +199,6 @@ void DrawMainMenu()
 
   KeyboardAutoRepeatOn();
   ActivateJoystick();
-  SetMouseCursor(CURSOR_DEFAULT);
 
   SetDrawDeactivationMask(REDRAW_NONE);
   SetDrawBackgroundMask(REDRAW_FIELD);
@@ -258,7 +257,7 @@ void DrawMainMenu()
   DrawText(mSX + 32, mSY + 8*32, "Setup", FONT_MENU_1);
   DrawText(mSX + 32, mSY + 9*32, "Quit", FONT_MENU_1);
 
-  DrawText(mSX + 32 + name_width, mSY + 2*32, setup.player_name, FONT_INPUT);
+  DrawText(mSX + 32 + name_width, mSY + 2*32, setup.player_name, FONT_INPUT_1);
   DrawText(mSX + level_width + 5 * 32, mSY + 3*32, int2str(level_nr,3),
           FONT_VALUE_1);
 
@@ -1242,7 +1241,7 @@ void HandleHelpScreen(int button)
 void HandleTypeName(int newxpos, Key key)
 {
   static int xpos = 0, ypos = 2;
-  int font_width = getFontWidth(FONT_INPUT_ACTIVE);
+  int font_width = getFontWidth(FONT_INPUT_1_ACTIVE);
   int name_width = getFontWidth(FONT_MENU_1) * strlen("Name:");
   int startx = mSX + 32 + name_width;
   int starty = mSY + ypos * 32;
@@ -1251,8 +1250,8 @@ void HandleTypeName(int newxpos, Key key)
   {
     xpos = newxpos;
 
-    DrawText(startx, starty, setup.player_name, FONT_INPUT_ACTIVE);
-    DrawText(startx + xpos * font_width, starty, "_", FONT_INPUT_ACTIVE);
+    DrawText(startx, starty, setup.player_name, FONT_INPUT_1_ACTIVE);
+    DrawText(startx + xpos * font_width, starty, "_", FONT_INPUT_1_ACTIVE);
 
     return;
   }
@@ -1272,20 +1271,20 @@ void HandleTypeName(int newxpos, Key key)
     setup.player_name[xpos + 1] = 0;
     xpos++;
 
-    DrawText(startx, starty, setup.player_name, FONT_INPUT_ACTIVE);
-    DrawText(startx + xpos * font_width, starty, "_", FONT_INPUT_ACTIVE);
+    DrawText(startx, starty, setup.player_name, FONT_INPUT_1_ACTIVE);
+    DrawText(startx + xpos * font_width, starty, "_", FONT_INPUT_1_ACTIVE);
   }
   else if ((key == KSYM_Delete || key == KSYM_BackSpace) && xpos > 0)
   {
     xpos--;
     setup.player_name[xpos] = 0;
 
-    DrawText(startx + xpos * font_width, starty, "_ ", FONT_INPUT_ACTIVE);
+    DrawText(startx + xpos * font_width, starty, "_ ", FONT_INPUT_1_ACTIVE);
   }
   else if (key == KSYM_Return && xpos > 0)
   {
-    DrawText(startx, starty, setup.player_name, FONT_INPUT);
-    DrawText(startx + xpos * font_width, starty, " ", FONT_INPUT_ACTIVE);
+    DrawText(startx, starty, setup.player_name, FONT_INPUT_1);
+    DrawText(startx + xpos * font_width, starty, " ", FONT_INPUT_1_ACTIVE);
 
     SaveSetup();
     game_status = MAINMENU;
@@ -2010,7 +2009,7 @@ static void drawSetupValue(int pos)
     if (setup_info[pos].type & TYPE_QUERY)
     {
       value_string = "<press key>";
-      font_nr = FONT_INPUT_ACTIVE;
+      font_nr = FONT_INPUT_1_ACTIVE;
     }
   }
   else if (setup_info[pos].type & TYPE_STRING)
@@ -2312,7 +2311,7 @@ static void drawPlayerSetupInputInfo(int player_nr)
 
   custom_key = setup.input[player_nr].key;
 
-  DrawText(mSX+11*32, mSY+2*32, int2str(player_nr + 1, 1), FONT_INPUT_ACTIVE);
+  DrawText(mSX+11*32, mSY+2*32, int2str(player_nr +1, 1), FONT_INPUT_1_ACTIVE);
 #if 1
   DrawGraphicThruMaskExt(drawto, mSX + 8 * TILEX, mSY + 2 * TILEY,
                         PLAYER_NR_GFX(IMG_PLAYER_1, player_nr), 0);
@@ -2512,9 +2511,9 @@ void CustomizeKeyboard(int player_nr)
 
   step_nr = 0;
   DrawText(mSX, mSY + (2+2*step_nr)*32,
-          customize_step[step_nr].text, FONT_INPUT_ACTIVE);
+          customize_step[step_nr].text, FONT_INPUT_1_ACTIVE);
   DrawText(mSX, mSY + (2+2*step_nr+1)*32,
-          "Key:", FONT_INPUT_ACTIVE);
+          "Key:", FONT_INPUT_1_ACTIVE);
   DrawText(mSX + 4*32, mSY + (2+2*step_nr+1)*32,
           getKeyNameFromKey(*customize_step[step_nr].key), FONT_VALUE_OLD);
 
@@ -2577,9 +2576,9 @@ void CustomizeKeyboard(int player_nr)
 
            /* query next key binding */
            DrawText(mSX, mSY+(2+2*step_nr)*32,
-                    customize_step[step_nr].text, FONT_INPUT_ACTIVE);
+                    customize_step[step_nr].text, FONT_INPUT_1_ACTIVE);
            DrawText(mSX, mSY+(2+2*step_nr+1)*32,
-                    "Key:", FONT_INPUT_ACTIVE);
+                    "Key:", FONT_INPUT_1_ACTIVE);
            DrawText(mSX + 4*32, mSY+(2+2*step_nr+1)*32,
                     getKeyNameFromKey(*customize_step[step_nr].key),
                     FONT_VALUE_OLD);