added options for custom position of editor tooltip (mouse-over info text)
authorHolger Schemel <info@artsoft.org>
Fri, 3 Nov 2017 18:30:55 +0000 (19:30 +0100)
committerHolger Schemel <info@artsoft.org>
Fri, 23 Mar 2018 22:21:15 +0000 (23:21 +0100)
src/conf_gfx.c
src/editor.c
src/main.h

index 07525b6feea613fcf56754b7191a37697e701ffa..4be0ac31c3afd6c6a547362a3a0f1d5da07c0883 100644 (file)
@@ -9272,6 +9272,8 @@ struct ConfigInfo image_config[] =
   { "editor.settings.tabs.2nd_yoffset",                "64"                    },
   { "editor.settings.tabs.draw_xoffset",       "0"                     },
   { "editor.settings.tabs.draw_yoffset",       "8"                     },
+  { "editor.settings.tooltip.x",               "-1"                    },
+  { "editor.settings.tooltip.y",               "-1"                    },
 
   { "editor.gadget.normal_spacing",            "4"                     },
   { "editor.gadget.small_spacing",             "2"                     },
index 5f9b2b9d9e0f95807b7e5b9142c67bd6104e2842..5c8b67bf3a1ab61e92a009fa2cc253b922cae46e 100644 (file)
 #define INFOTEXT_XSIZE         SXSIZE
 #define INFOTEXT_YSIZE         getFontHeight(INFOTEXT_FONT)
 #define INFOTEXT_YSIZE_FULL    (INFOTEXT_YSIZE + ED_GADGET_SMALL_DISTANCE)
-#define INFOTEXT_XPOS          SX
-#define INFOTEXT_YPOS          (SY + SYSIZE - INFOTEXT_YSIZE)
+#define INFOTEXT_X             (editor.settings.tooltip.x)
+#define INFOTEXT_Y             (editor.settings.tooltip.y)
+#define INFOTEXT_XY_REDEFINED  (INFOTEXT_X != -1 || INFOTEXT_Y != -1)
+#define INFOTEXT_XPOS          SX + (INFOTEXT_XY_REDEFINED ? INFOTEXT_X : 0)
+#define INFOTEXT_YPOS          SY + (INFOTEXT_XY_REDEFINED ? INFOTEXT_Y : \
+                                     SYSIZE - INFOTEXT_YSIZE)
 
 
 /*
@@ -8204,7 +8208,8 @@ static int getMaxEdFieldX(boolean has_scrollbar)
 
 static int getMaxEdFieldY(boolean has_scrollbar)
 {
-  int infotext_height = INFOTEXT_YSIZE_FULL;
+  int infotext_height = (IN_PIX_FIELD(INFOTEXT_XPOS - SX, INFOTEXT_YPOS - SY) ?
+                        INFOTEXT_YSIZE_FULL : 0);
   int scrollbar_height = (has_scrollbar ? ED_SCROLLBUTTON_YSIZE : 0);
   int sysize = SYSIZE - scrollbar_height - infotext_height;
   int max_ed_fieldy = sysize / ed_tilesize;
index 1c23407daf50d7a7ae0517e8c43c4e3ea73573da..33725179f04d35d79bd0d625776c6cf72d81be47 100644 (file)
@@ -75,6 +75,7 @@
                                        ((x) >= (xmin) && (x) <= (xmax) && \
                                         (y) >= (ymin) && (y) <= (ymax))
 
+#define IN_PIX_FIELD(x, y)             IN_FIELD(x, y, SXSIZE, SYSIZE)
 #define IN_VIS_FIELD(x, y)             IN_FIELD(x, y, SCR_FIELDX, SCR_FIELDY)
 #define IN_LEV_FIELD(x, y)             IN_FIELD(x, y, lev_fieldx, lev_fieldy)
 #define IN_SCR_FIELD(x, y)             IN_FIELD_MINMAX(x,y, BX1,BY1, BX2,BY2)
@@ -2817,6 +2818,8 @@ struct EditorSettingsInfo
   struct XY element_name;
 
   struct EditorTabsInfo tabs;
+
+  struct XY tooltip;
 };
 
 struct EditorGadgetInfo