Loads bitmaps into QSPI memory for GC500_2_5inch to use.

Dependencies:   DMBasicGUI DMSupport

Committer:
jmitc91516
Date:
Mon Jul 31 15:44:39 2017 +0000
Revision:
0:a5c253316af6
Background and scroll arrow bitmaps added to QSPI memory.

Who changed what in which revision?

UserRevisionLine numberNew contents of line
jmitc91516 0:a5c253316af6 1 /* ************************************************************************ */
jmitc91516 0:a5c253316af6 2 /* */
jmitc91516 0:a5c253316af6 3 /* (C)2004-2015 IBIS Solutions ApS */
jmitc91516 0:a5c253316af6 4 /* sales@easyGUI.com */
jmitc91516 0:a5c253316af6 5 /* www.easyGUI.com */
jmitc91516 0:a5c253316af6 6 /* */
jmitc91516 0:a5c253316af6 7 /* v6.0.9.005 */
jmitc91516 0:a5c253316af6 8 /* */
jmitc91516 0:a5c253316af6 9 /* ************************************************************************ */
jmitc91516 0:a5c253316af6 10
jmitc91516 0:a5c253316af6 11
jmitc91516 0:a5c253316af6 12
jmitc91516 0:a5c253316af6 13 //------------------------------------------------------------------------------
jmitc91516 0:a5c253316af6 14
jmitc91516 0:a5c253316af6 15 #include "GuiConst.h"
jmitc91516 0:a5c253316af6 16 #include "GuiLib.h"
jmitc91516 0:a5c253316af6 17 #include "GuiLibStruct.h"
jmitc91516 0:a5c253316af6 18 #ifdef GuiConst_VNC_REMOTE_SUPPORT_ON
jmitc91516 0:a5c253316af6 19 #include "GuiVnc.h"
jmitc91516 0:a5c253316af6 20 #endif
jmitc91516 0:a5c253316af6 21 #include <string.h>
jmitc91516 0:a5c253316af6 22 #include <stdlib.h>
jmitc91516 0:a5c253316af6 23
jmitc91516 0:a5c253316af6 24 #ifndef GuiConst_PC_V6_0_9
jmitc91516 0:a5c253316af6 25 If your compiler sees this text you are using a wrong version of the easyGUI
jmitc91516 0:a5c253316af6 26 library. Version numbers of the easyGUI PC application and c library must match.
jmitc91516 0:a5c253316af6 27 Only exception is GuiDisplay.c/h (your display driver), which can be kept from
jmitc91516 0:a5c253316af6 28 version to version.
jmitc91516 0:a5c253316af6 29 #endif
jmitc91516 0:a5c253316af6 30
jmitc91516 0:a5c253316af6 31 #define WANT_DOUBLE_BUFFERING // Also in GuiGraph16.h, GuiDisplay.c - *** all three must match ***
jmitc91516 0:a5c253316af6 32
jmitc91516 0:a5c253316af6 33
jmitc91516 0:a5c253316af6 34 #define GuiLib_CHR_PSLEFT_OFS 0
jmitc91516 0:a5c253316af6 35 #define GuiLib_CHR_PSRIGHT_OFS 5
jmitc91516 0:a5c253316af6 36 #define GuiLib_CHR_XLEFT_OFS 10
jmitc91516 0:a5c253316af6 37 #define GuiLib_CHR_XWIDTH_OFS 11
jmitc91516 0:a5c253316af6 38 #define GuiLib_CHR_YTOP_OFS 12
jmitc91516 0:a5c253316af6 39 #define GuiLib_CHR_YHEIGHT_OFS 13
jmitc91516 0:a5c253316af6 40 #define GuiLib_CHR_LINECTRL_OFS 14
jmitc91516 0:a5c253316af6 41 #define GuiLib_CHR_PS_TOP_OFS 0
jmitc91516 0:a5c253316af6 42 #define GuiLib_CHR_PS_MID_OFS 1
jmitc91516 0:a5c253316af6 43 #define GuiLib_CHR_PS_MIDBASE_OFS 2
jmitc91516 0:a5c253316af6 44 #define GuiLib_CHR_PS_BASE_OFS 3
jmitc91516 0:a5c253316af6 45 #define GuiLib_CHR_PS_BOTTOM_OFS 4
jmitc91516 0:a5c253316af6 46
jmitc91516 0:a5c253316af6 47
jmitc91516 0:a5c253316af6 48
jmitc91516 0:a5c253316af6 49 #ifdef GuiConst_ARAB_CHARS_INUSE
jmitc91516 0:a5c253316af6 50 #define GuiLib_ARAB_LIGATURES_CNT 4
jmitc91516 0:a5c253316af6 51 const GuiConst_INT16U GuiLib_ARAB_LIGATURES[GuiLib_ARAB_LIGATURES_CNT][3] =
jmitc91516 0:a5c253316af6 52 {{0x0644, 0x0622, 0xFEF5},
jmitc91516 0:a5c253316af6 53 {0x0644, 0x0623, 0xFEF7},
jmitc91516 0:a5c253316af6 54 {0x0644, 0x0625, 0xFEF9},
jmitc91516 0:a5c253316af6 55 {0x0644, 0x0627, 0xFEFB}};
jmitc91516 0:a5c253316af6 56
jmitc91516 0:a5c253316af6 57 #define GuiLib_ARAB_CHAR_PRI_MIN 0x0622
jmitc91516 0:a5c253316af6 58 #define GuiLib_ARAB_CHAR_PRI_MAX 0x06D6
jmitc91516 0:a5c253316af6 59 #define GuiLib_ARAB_CHAR_SEC_MIN 0xFB50
jmitc91516 0:a5c253316af6 60 #define GuiLib_ARAB_CHAR_SEC_MAX 0xFEF4
jmitc91516 0:a5c253316af6 61 #define GuiLib_ARAB_CHAR_TYPE_ISO 0
jmitc91516 0:a5c253316af6 62 #define GuiLib_ARAB_CHAR_TYPE_FIN 1
jmitc91516 0:a5c253316af6 63 #define GuiLib_ARAB_CHAR_TYPE_INI 2
jmitc91516 0:a5c253316af6 64 #define GuiLib_ARAB_CHAR_TYPE_MED 3
jmitc91516 0:a5c253316af6 65 #define GuiLib_ARAB_CHAR_ISOFIN 0x02
jmitc91516 0:a5c253316af6 66 #define GuiLib_ARAB_CHAR_ISOFININIMED 0x04
jmitc91516 0:a5c253316af6 67 #define GuiLib_ARAB_CHAR_DIACRITIC 0x0A
jmitc91516 0:a5c253316af6 68 #define GuiLib_ARAB_CHAR_CONVERT_CNT 83
jmitc91516 0:a5c253316af6 69
jmitc91516 0:a5c253316af6 70 const GuiConst_INT16U GuiLib_ARAB_CHAR_CONVERT[GuiLib_ARAB_CHAR_CONVERT_CNT][3] =
jmitc91516 0:a5c253316af6 71 {{0x0622, 0xFE81, GuiLib_ARAB_CHAR_ISOFIN},
jmitc91516 0:a5c253316af6 72 {0x0623, 0xFE83, GuiLib_ARAB_CHAR_ISOFIN},
jmitc91516 0:a5c253316af6 73 {0x0624, 0xFE85, GuiLib_ARAB_CHAR_ISOFIN},
jmitc91516 0:a5c253316af6 74 {0x0625, 0xFE87, GuiLib_ARAB_CHAR_ISOFIN},
jmitc91516 0:a5c253316af6 75 {0x0626, 0xFE89, GuiLib_ARAB_CHAR_ISOFININIMED},
jmitc91516 0:a5c253316af6 76 {0x0627, 0xFE8D, GuiLib_ARAB_CHAR_ISOFIN},
jmitc91516 0:a5c253316af6 77 {0x0628, 0xFE8F, GuiLib_ARAB_CHAR_ISOFININIMED},
jmitc91516 0:a5c253316af6 78 {0x0629, 0xFE93, GuiLib_ARAB_CHAR_ISOFIN},
jmitc91516 0:a5c253316af6 79 {0x062A, 0xFE95, GuiLib_ARAB_CHAR_ISOFININIMED},
jmitc91516 0:a5c253316af6 80 {0x062B, 0xFE99, GuiLib_ARAB_CHAR_ISOFININIMED},
jmitc91516 0:a5c253316af6 81 {0x062C, 0xFE9D, GuiLib_ARAB_CHAR_ISOFININIMED},
jmitc91516 0:a5c253316af6 82 {0x062D, 0xFEA1, GuiLib_ARAB_CHAR_ISOFININIMED},
jmitc91516 0:a5c253316af6 83 {0x062E, 0xFEA5, GuiLib_ARAB_CHAR_ISOFININIMED},
jmitc91516 0:a5c253316af6 84 {0x062F, 0xFEA9, GuiLib_ARAB_CHAR_ISOFIN},
jmitc91516 0:a5c253316af6 85 {0x0630, 0xFEAB, GuiLib_ARAB_CHAR_ISOFIN},
jmitc91516 0:a5c253316af6 86 {0x0631, 0xFEAD, GuiLib_ARAB_CHAR_ISOFIN},
jmitc91516 0:a5c253316af6 87 {0x0632, 0xFEAF, GuiLib_ARAB_CHAR_ISOFIN},
jmitc91516 0:a5c253316af6 88 {0x0633, 0xFEB1, GuiLib_ARAB_CHAR_ISOFININIMED},
jmitc91516 0:a5c253316af6 89 {0x0634, 0xFEB5, GuiLib_ARAB_CHAR_ISOFININIMED},
jmitc91516 0:a5c253316af6 90 {0x0635, 0xFEB9, GuiLib_ARAB_CHAR_ISOFININIMED},
jmitc91516 0:a5c253316af6 91 {0x0636, 0xFEBD, GuiLib_ARAB_CHAR_ISOFININIMED},
jmitc91516 0:a5c253316af6 92 {0x0637, 0xFEC1, GuiLib_ARAB_CHAR_ISOFININIMED},
jmitc91516 0:a5c253316af6 93 {0x0638, 0xFEC5, GuiLib_ARAB_CHAR_ISOFININIMED},
jmitc91516 0:a5c253316af6 94 {0x0639, 0xFEC9, GuiLib_ARAB_CHAR_ISOFININIMED},
jmitc91516 0:a5c253316af6 95 {0x063A, 0xFECD, GuiLib_ARAB_CHAR_ISOFININIMED},
jmitc91516 0:a5c253316af6 96 {0x0641, 0xFED1, GuiLib_ARAB_CHAR_ISOFININIMED},
jmitc91516 0:a5c253316af6 97 {0x0642, 0xFED5, GuiLib_ARAB_CHAR_ISOFININIMED},
jmitc91516 0:a5c253316af6 98 {0x0643, 0xFED9, GuiLib_ARAB_CHAR_ISOFININIMED},
jmitc91516 0:a5c253316af6 99 {0x0644, 0xFEDD, GuiLib_ARAB_CHAR_ISOFININIMED},
jmitc91516 0:a5c253316af6 100 {0x0645, 0xFEE1, GuiLib_ARAB_CHAR_ISOFININIMED},
jmitc91516 0:a5c253316af6 101 {0x0646, 0xFEE5, GuiLib_ARAB_CHAR_ISOFININIMED},
jmitc91516 0:a5c253316af6 102 {0x0647, 0xFEE9, GuiLib_ARAB_CHAR_ISOFININIMED},
jmitc91516 0:a5c253316af6 103 {0x0648, 0xFEED, GuiLib_ARAB_CHAR_ISOFIN},
jmitc91516 0:a5c253316af6 104 {0x0649, 0xFEEF, GuiLib_ARAB_CHAR_ISOFIN},
jmitc91516 0:a5c253316af6 105 {0x064A, 0xFEF1, GuiLib_ARAB_CHAR_ISOFININIMED},
jmitc91516 0:a5c253316af6 106 {0x064E, 0xFE76, GuiLib_ARAB_CHAR_DIACRITIC},
jmitc91516 0:a5c253316af6 107 {0x064F, 0xFE78, GuiLib_ARAB_CHAR_DIACRITIC},
jmitc91516 0:a5c253316af6 108 {0x0650, 0xFE7A, GuiLib_ARAB_CHAR_DIACRITIC},
jmitc91516 0:a5c253316af6 109 {0x0651, 0xFE7C, GuiLib_ARAB_CHAR_DIACRITIC},
jmitc91516 0:a5c253316af6 110 {0x0652, 0xFE7E, GuiLib_ARAB_CHAR_DIACRITIC},
jmitc91516 0:a5c253316af6 111 {0x0671, 0xFB50, GuiLib_ARAB_CHAR_ISOFIN},
jmitc91516 0:a5c253316af6 112 {0x0679, 0xFB66, GuiLib_ARAB_CHAR_ISOFININIMED},
jmitc91516 0:a5c253316af6 113 {0x067A, 0xFB5E, GuiLib_ARAB_CHAR_ISOFININIMED},
jmitc91516 0:a5c253316af6 114 {0x067B, 0xFB52, GuiLib_ARAB_CHAR_ISOFININIMED},
jmitc91516 0:a5c253316af6 115 {0x067E, 0xFB56, GuiLib_ARAB_CHAR_ISOFININIMED},
jmitc91516 0:a5c253316af6 116 {0x067F, 0xFB62, GuiLib_ARAB_CHAR_ISOFININIMED},
jmitc91516 0:a5c253316af6 117 {0x0680, 0xFB5A, GuiLib_ARAB_CHAR_ISOFININIMED},
jmitc91516 0:a5c253316af6 118 {0x0683, 0xFB76, GuiLib_ARAB_CHAR_ISOFININIMED},
jmitc91516 0:a5c253316af6 119 {0x0684, 0xFB72, GuiLib_ARAB_CHAR_ISOFININIMED},
jmitc91516 0:a5c253316af6 120 {0x0686, 0xFB7A, GuiLib_ARAB_CHAR_ISOFININIMED},
jmitc91516 0:a5c253316af6 121 {0x0687, 0xFB7E, GuiLib_ARAB_CHAR_ISOFININIMED},
jmitc91516 0:a5c253316af6 122 {0x0688, 0xFB88, GuiLib_ARAB_CHAR_ISOFIN},
jmitc91516 0:a5c253316af6 123 {0x068C, 0xFB84, GuiLib_ARAB_CHAR_ISOFIN},
jmitc91516 0:a5c253316af6 124 {0x068D, 0xFB82, GuiLib_ARAB_CHAR_ISOFIN},
jmitc91516 0:a5c253316af6 125 {0x068E, 0xFB86, GuiLib_ARAB_CHAR_ISOFIN},
jmitc91516 0:a5c253316af6 126 {0x0691, 0xFB8C, GuiLib_ARAB_CHAR_ISOFIN},
jmitc91516 0:a5c253316af6 127 {0x0698, 0xFB8A, GuiLib_ARAB_CHAR_ISOFIN},
jmitc91516 0:a5c253316af6 128 {0x06A4, 0xFB6A, GuiLib_ARAB_CHAR_ISOFININIMED},
jmitc91516 0:a5c253316af6 129 {0x06A6, 0xFB6E, GuiLib_ARAB_CHAR_ISOFININIMED},
jmitc91516 0:a5c253316af6 130 {0x06A9, 0xFB8E, GuiLib_ARAB_CHAR_ISOFININIMED},
jmitc91516 0:a5c253316af6 131 {0x06AD, 0xFBD3, GuiLib_ARAB_CHAR_ISOFININIMED},
jmitc91516 0:a5c253316af6 132 {0x06AF, 0xFB92, GuiLib_ARAB_CHAR_ISOFININIMED},
jmitc91516 0:a5c253316af6 133 {0x06B1, 0xFB9A, GuiLib_ARAB_CHAR_ISOFININIMED},
jmitc91516 0:a5c253316af6 134 {0x06B3, 0xFB96, GuiLib_ARAB_CHAR_ISOFININIMED},
jmitc91516 0:a5c253316af6 135 {0x06BA, 0xFB9E, GuiLib_ARAB_CHAR_ISOFIN},
jmitc91516 0:a5c253316af6 136 {0x06BB, 0xFBA0, GuiLib_ARAB_CHAR_ISOFININIMED},
jmitc91516 0:a5c253316af6 137 {0x06BE, 0xFBAA, GuiLib_ARAB_CHAR_ISOFININIMED},
jmitc91516 0:a5c253316af6 138 {0x06C0, 0xFBA4, GuiLib_ARAB_CHAR_ISOFIN},
jmitc91516 0:a5c253316af6 139 {0x06C1, 0xFBA6, GuiLib_ARAB_CHAR_ISOFININIMED},
jmitc91516 0:a5c253316af6 140 {0x06C5, 0xFBE0, GuiLib_ARAB_CHAR_ISOFIN},
jmitc91516 0:a5c253316af6 141 {0x06C6, 0xFBD9, GuiLib_ARAB_CHAR_ISOFIN},
jmitc91516 0:a5c253316af6 142 {0x06C7, 0xFBD7, GuiLib_ARAB_CHAR_ISOFIN},
jmitc91516 0:a5c253316af6 143 {0x06C8, 0xFBDB, GuiLib_ARAB_CHAR_ISOFIN},
jmitc91516 0:a5c253316af6 144 {0x06C9, 0xFBE2, GuiLib_ARAB_CHAR_ISOFIN},
jmitc91516 0:a5c253316af6 145 {0x06CB, 0xFBDE, GuiLib_ARAB_CHAR_ISOFIN},
jmitc91516 0:a5c253316af6 146 {0x06CC, 0xFBFC, GuiLib_ARAB_CHAR_ISOFININIMED},
jmitc91516 0:a5c253316af6 147 {0x06D0, 0xFBE4, GuiLib_ARAB_CHAR_ISOFININIMED},
jmitc91516 0:a5c253316af6 148 {0x06D2, 0xFBAE, GuiLib_ARAB_CHAR_ISOFIN},
jmitc91516 0:a5c253316af6 149 {0x06D3, 0xFBB0, GuiLib_ARAB_CHAR_ISOFIN},
jmitc91516 0:a5c253316af6 150 { 0, 0xFEF5, GuiLib_ARAB_CHAR_ISOFIN},
jmitc91516 0:a5c253316af6 151 { 0, 0xFEF7, GuiLib_ARAB_CHAR_ISOFIN},
jmitc91516 0:a5c253316af6 152 { 0, 0xFEF9, GuiLib_ARAB_CHAR_ISOFIN},
jmitc91516 0:a5c253316af6 153 { 0, 0xFEFB, GuiLib_ARAB_CHAR_ISOFIN}};
jmitc91516 0:a5c253316af6 154 #endif
jmitc91516 0:a5c253316af6 155
jmitc91516 0:a5c253316af6 156 //------------------------------------------------------------------------------
jmitc91516 0:a5c253316af6 157 //----------------------X-----------------------
jmitc91516 0:a5c253316af6 158
jmitc91516 0:a5c253316af6 159 GuiLib_DisplayLineRec GuiLib_DisplayRepaint[GuiConst_BYTE_LINES];
jmitc91516 0:a5c253316af6 160 #ifdef GuiConst_VNC_REMOTE_SUPPORT_ON
jmitc91516 0:a5c253316af6 161 GuiLib_DisplayLineRec GuiLib_VncRepaint[GuiConst_BYTE_LINES];
jmitc91516 0:a5c253316af6 162 #endif // GuiConst_VNC_REMOTE_SUPPORT_ON
jmitc91516 0:a5c253316af6 163
jmitc91516 0:a5c253316af6 164 #ifdef GuiConst_REMOTE_DATA
jmitc91516 0:a5c253316af6 165 void (*GuiLib_RemoteDataReadBlock) (
jmitc91516 0:a5c253316af6 166 GuiConst_INT32U SourceOffset,
jmitc91516 0:a5c253316af6 167 GuiConst_INT32U SourceSize,
jmitc91516 0:a5c253316af6 168 GuiConst_INT8U * TargetAddr);
jmitc91516 0:a5c253316af6 169 #endif // GuiConst_REMOTE_DATA
jmitc91516 0:a5c253316af6 170 #ifdef GuiConst_REMOTE_TEXT_DATA
jmitc91516 0:a5c253316af6 171 void (*GuiLib_RemoteTextReadBlock) (
jmitc91516 0:a5c253316af6 172 GuiConst_INT32U SourceOffset,
jmitc91516 0:a5c253316af6 173 GuiConst_INT32U SourceSize,
jmitc91516 0:a5c253316af6 174 void * TargetAddr);
jmitc91516 0:a5c253316af6 175 #endif // GuiConst_REMOTE_TEXT_DATA
jmitc91516 0:a5c253316af6 176
jmitc91516 0:a5c253316af6 177 #ifdef GuiConst_CURSOR_SUPPORT_ON
jmitc91516 0:a5c253316af6 178 GuiConst_INT16S GuiLib_ActiveCursorFieldNo;
jmitc91516 0:a5c253316af6 179 #endif
jmitc91516 0:a5c253316af6 180 #ifdef GuiConst_ALLOW_UPSIDEDOWN_AT_RUNTIME
jmitc91516 0:a5c253316af6 181 GuiConst_INT8U GuiLib_DisplayUpsideDown;
jmitc91516 0:a5c253316af6 182 #endif
jmitc91516 0:a5c253316af6 183
jmitc91516 0:a5c253316af6 184 GuiConst_INT16S GuiLib_CurStructureNdx;
jmitc91516 0:a5c253316af6 185 GuiConst_INT16S GuiLib_LanguageIndex;
jmitc91516 0:a5c253316af6 186
jmitc91516 0:a5c253316af6 187 PrefixLocate GuiLib_GLOBAL gl;
jmitc91516 0:a5c253316af6 188 static PrefixLocate GuiLib_STATIC sgl;
jmitc91516 0:a5c253316af6 189
jmitc91516 0:a5c253316af6 190
jmitc91516 0:a5c253316af6 191 //==============================================================================
jmitc91516 0:a5c253316af6 192 #ifdef GuiConst_ALLOW_UPSIDEDOWN_AT_RUNTIME
jmitc91516 0:a5c253316af6 193 #define GuiLib_COORD_ADJUST(X, Y) \
jmitc91516 0:a5c253316af6 194 { \
jmitc91516 0:a5c253316af6 195 if (GuiLib_DisplayUpsideDown) \
jmitc91516 0:a5c253316af6 196 { \
jmitc91516 0:a5c253316af6 197 X = GuiConst_DISPLAY_WIDTH_HW - 1 - sgl.CoordOrigoX - X; \
jmitc91516 0:a5c253316af6 198 Y = GuiConst_DISPLAY_HEIGHT_HW - 1 - sgl.CoordOrigoY - Y; \
jmitc91516 0:a5c253316af6 199 } \
jmitc91516 0:a5c253316af6 200 else \
jmitc91516 0:a5c253316af6 201 { \
jmitc91516 0:a5c253316af6 202 X = sgl.CoordOrigoX + X; \
jmitc91516 0:a5c253316af6 203 Y = sgl.CoordOrigoY + Y; \
jmitc91516 0:a5c253316af6 204 } \
jmitc91516 0:a5c253316af6 205 }
jmitc91516 0:a5c253316af6 206
jmitc91516 0:a5c253316af6 207 #define GuiLib_MIRROR_BITS(B) \
jmitc91516 0:a5c253316af6 208 { \
jmitc91516 0:a5c253316af6 209 B = (((B & 0x80) >> 7) | ((B & 0x40) >> 5) | \
jmitc91516 0:a5c253316af6 210 ((B & 0x20) >> 3) | ((B & 0x10) >> 1) | \
jmitc91516 0:a5c253316af6 211 ((B & 0x08) << 1) | ((B & 0x04) << 3) | \
jmitc91516 0:a5c253316af6 212 ((B & 0x02) << 5) | ((B & 0x01) << 7)); \
jmitc91516 0:a5c253316af6 213 }
jmitc91516 0:a5c253316af6 214 #else
jmitc91516 0:a5c253316af6 215 #ifdef GuiConst_ROTATED_OFF
jmitc91516 0:a5c253316af6 216 #ifdef GuiConst_MIRRORED_HORIZONTALLY
jmitc91516 0:a5c253316af6 217 #ifdef GuiConst_MIRRORED_VERTICALLY
jmitc91516 0:a5c253316af6 218 #define GuiLib_COORD_ADJUST(X, Y) \
jmitc91516 0:a5c253316af6 219 { \
jmitc91516 0:a5c253316af6 220 X = GuiConst_DISPLAY_WIDTH_HW - 1 - sgl.CoordOrigoX - X; \
jmitc91516 0:a5c253316af6 221 Y = GuiConst_DISPLAY_HEIGHT_HW - 1 - sgl.CoordOrigoY - Y; \
jmitc91516 0:a5c253316af6 222 }
jmitc91516 0:a5c253316af6 223 #else
jmitc91516 0:a5c253316af6 224 #define GuiLib_COORD_ADJUST(X, Y) \
jmitc91516 0:a5c253316af6 225 { \
jmitc91516 0:a5c253316af6 226 X = GuiConst_DISPLAY_WIDTH_HW - 1 - sgl.CoordOrigoX - X; \
jmitc91516 0:a5c253316af6 227 Y = sgl.CoordOrigoY + Y; \
jmitc91516 0:a5c253316af6 228 }
jmitc91516 0:a5c253316af6 229 #endif
jmitc91516 0:a5c253316af6 230 #else
jmitc91516 0:a5c253316af6 231 #ifdef GuiConst_MIRRORED_VERTICALLY
jmitc91516 0:a5c253316af6 232 #define GuiLib_COORD_ADJUST(X, Y) \
jmitc91516 0:a5c253316af6 233 { \
jmitc91516 0:a5c253316af6 234 X = sgl.CoordOrigoX + X; \
jmitc91516 0:a5c253316af6 235 Y = GuiConst_DISPLAY_HEIGHT_HW - 1 - sgl.CoordOrigoY - Y; \
jmitc91516 0:a5c253316af6 236 }
jmitc91516 0:a5c253316af6 237 #else
jmitc91516 0:a5c253316af6 238 #define GuiLib_COORD_ADJUST(X, Y) \
jmitc91516 0:a5c253316af6 239 { \
jmitc91516 0:a5c253316af6 240 X = sgl.CoordOrigoX + X; \
jmitc91516 0:a5c253316af6 241 Y = sgl.CoordOrigoY + Y; \
jmitc91516 0:a5c253316af6 242 }
jmitc91516 0:a5c253316af6 243 #endif
jmitc91516 0:a5c253316af6 244 #endif
jmitc91516 0:a5c253316af6 245 #endif
jmitc91516 0:a5c253316af6 246 #ifdef GuiConst_ROTATED_90DEGREE_RIGHT
jmitc91516 0:a5c253316af6 247 #ifdef GuiConst_MIRRORED_HORIZONTALLY
jmitc91516 0:a5c253316af6 248 #ifdef GuiConst_MIRRORED_VERTICALLY
jmitc91516 0:a5c253316af6 249 #define GuiLib_COORD_ADJUST(X, Y) \
jmitc91516 0:a5c253316af6 250 { \
jmitc91516 0:a5c253316af6 251 X = sgl.CoordOrigoX + X; \
jmitc91516 0:a5c253316af6 252 Y = GuiConst_DISPLAY_WIDTH_HW - 1 - sgl.CoordOrigoY - Y; \
jmitc91516 0:a5c253316af6 253 SwapCoord(&X, &Y); \
jmitc91516 0:a5c253316af6 254 }
jmitc91516 0:a5c253316af6 255 #else
jmitc91516 0:a5c253316af6 256 #define GuiLib_COORD_ADJUST(X, Y) \
jmitc91516 0:a5c253316af6 257 { \
jmitc91516 0:a5c253316af6 258 X = sgl.CoordOrigoX + X; \
jmitc91516 0:a5c253316af6 259 Y = sgl.CoordOrigoY + Y; \
jmitc91516 0:a5c253316af6 260 SwapCoord(&X, &Y); \
jmitc91516 0:a5c253316af6 261 }
jmitc91516 0:a5c253316af6 262 #endif
jmitc91516 0:a5c253316af6 263 #else
jmitc91516 0:a5c253316af6 264 #ifdef GuiConst_MIRRORED_VERTICALLY
jmitc91516 0:a5c253316af6 265 #define GuiLib_COORD_ADJUST(X, Y) \
jmitc91516 0:a5c253316af6 266 { \
jmitc91516 0:a5c253316af6 267 X = GuiConst_DISPLAY_HEIGHT_HW - 1 - sgl.CoordOrigoX - X; \
jmitc91516 0:a5c253316af6 268 Y = GuiConst_DISPLAY_WIDTH_HW - 1 - sgl.CoordOrigoY - Y; \
jmitc91516 0:a5c253316af6 269 SwapCoord(&X, &Y); \
jmitc91516 0:a5c253316af6 270 }
jmitc91516 0:a5c253316af6 271 #else
jmitc91516 0:a5c253316af6 272 #define GuiLib_COORD_ADJUST(X, Y) \
jmitc91516 0:a5c253316af6 273 { \
jmitc91516 0:a5c253316af6 274 X = GuiConst_DISPLAY_HEIGHT_HW - 1 - sgl.CoordOrigoX - X; \
jmitc91516 0:a5c253316af6 275 Y = sgl.CoordOrigoY + Y; \
jmitc91516 0:a5c253316af6 276 SwapCoord(&X, &Y); \
jmitc91516 0:a5c253316af6 277 }
jmitc91516 0:a5c253316af6 278 #endif
jmitc91516 0:a5c253316af6 279 #endif
jmitc91516 0:a5c253316af6 280 #endif
jmitc91516 0:a5c253316af6 281 #ifdef GuiConst_ROTATED_UPSIDEDOWN
jmitc91516 0:a5c253316af6 282 #ifdef GuiConst_MIRRORED_HORIZONTALLY
jmitc91516 0:a5c253316af6 283 #ifdef GuiConst_MIRRORED_VERTICALLY
jmitc91516 0:a5c253316af6 284 #define GuiLib_COORD_ADJUST(X, Y) \
jmitc91516 0:a5c253316af6 285 { \
jmitc91516 0:a5c253316af6 286 X = sgl.CoordOrigoX + X; \
jmitc91516 0:a5c253316af6 287 Y = sgl.CoordOrigoY + Y; \
jmitc91516 0:a5c253316af6 288 }
jmitc91516 0:a5c253316af6 289 #else
jmitc91516 0:a5c253316af6 290 #define GuiLib_COORD_ADJUST(X, Y) \
jmitc91516 0:a5c253316af6 291 { \
jmitc91516 0:a5c253316af6 292 X = sgl.CoordOrigoX + X; \
jmitc91516 0:a5c253316af6 293 Y = GuiConst_DISPLAY_HEIGHT_HW - 1 - sgl.CoordOrigoY - Y; \
jmitc91516 0:a5c253316af6 294 }
jmitc91516 0:a5c253316af6 295 #endif
jmitc91516 0:a5c253316af6 296 #else
jmitc91516 0:a5c253316af6 297 #ifdef GuiConst_MIRRORED_VERTICALLY
jmitc91516 0:a5c253316af6 298 #define GuiLib_COORD_ADJUST(X, Y) \
jmitc91516 0:a5c253316af6 299 { \
jmitc91516 0:a5c253316af6 300 X = GuiConst_DISPLAY_WIDTH_HW - 1 - sgl.CoordOrigoX - X; \
jmitc91516 0:a5c253316af6 301 Y = sgl.CoordOrigoY + Y; \
jmitc91516 0:a5c253316af6 302 }
jmitc91516 0:a5c253316af6 303 #else
jmitc91516 0:a5c253316af6 304 #define GuiLib_COORD_ADJUST(X, Y) \
jmitc91516 0:a5c253316af6 305 { \
jmitc91516 0:a5c253316af6 306 X = GuiConst_DISPLAY_WIDTH_HW - 1 - sgl.CoordOrigoX - X; \
jmitc91516 0:a5c253316af6 307 Y = GuiConst_DISPLAY_HEIGHT_HW - 1 - sgl.CoordOrigoY - Y; \
jmitc91516 0:a5c253316af6 308 }
jmitc91516 0:a5c253316af6 309 #endif
jmitc91516 0:a5c253316af6 310 #endif
jmitc91516 0:a5c253316af6 311 #endif
jmitc91516 0:a5c253316af6 312 #ifdef GuiConst_ROTATED_90DEGREE_LEFT
jmitc91516 0:a5c253316af6 313 #ifdef GuiConst_MIRRORED_HORIZONTALLY
jmitc91516 0:a5c253316af6 314 #ifdef GuiConst_MIRRORED_VERTICALLY
jmitc91516 0:a5c253316af6 315 #define GuiLib_COORD_ADJUST(X, Y) \
jmitc91516 0:a5c253316af6 316 { \
jmitc91516 0:a5c253316af6 317 X = GuiConst_DISPLAY_HEIGHT_HW - 1 - sgl.CoordOrigoX - X; \
jmitc91516 0:a5c253316af6 318 Y = sgl.CoordOrigoY + Y; \
jmitc91516 0:a5c253316af6 319 SwapCoord(&X, &Y); \
jmitc91516 0:a5c253316af6 320 }
jmitc91516 0:a5c253316af6 321 #else
jmitc91516 0:a5c253316af6 322 #define GuiLib_COORD_ADJUST(X, Y) \
jmitc91516 0:a5c253316af6 323 { \
jmitc91516 0:a5c253316af6 324 X = GuiConst_DISPLAY_HEIGHT_HW - 1 - sgl.CoordOrigoX - X; \
jmitc91516 0:a5c253316af6 325 Y = GuiConst_DISPLAY_WIDTH_HW - 1 - sgl.CoordOrigoY - Y; \
jmitc91516 0:a5c253316af6 326 SwapCoord(&X, &Y); \
jmitc91516 0:a5c253316af6 327 }
jmitc91516 0:a5c253316af6 328 #endif
jmitc91516 0:a5c253316af6 329 #else
jmitc91516 0:a5c253316af6 330 #ifdef GuiConst_MIRRORED_VERTICALLY
jmitc91516 0:a5c253316af6 331 #define GuiLib_COORD_ADJUST(X, Y) \
jmitc91516 0:a5c253316af6 332 { \
jmitc91516 0:a5c253316af6 333 X = sgl.CoordOrigoX + X; \
jmitc91516 0:a5c253316af6 334 Y = sgl.CoordOrigoY + Y; \
jmitc91516 0:a5c253316af6 335 SwapCoord(&X, &Y); \
jmitc91516 0:a5c253316af6 336 }
jmitc91516 0:a5c253316af6 337 #else
jmitc91516 0:a5c253316af6 338 #define GuiLib_COORD_ADJUST(X, Y) \
jmitc91516 0:a5c253316af6 339 { \
jmitc91516 0:a5c253316af6 340 X = sgl.CoordOrigoX + X; \
jmitc91516 0:a5c253316af6 341 Y = GuiConst_DISPLAY_WIDTH_HW - 1 - sgl.CoordOrigoY - Y; \
jmitc91516 0:a5c253316af6 342 SwapCoord(&X, &Y); \
jmitc91516 0:a5c253316af6 343 }
jmitc91516 0:a5c253316af6 344 #endif
jmitc91516 0:a5c253316af6 345 #endif
jmitc91516 0:a5c253316af6 346 #endif
jmitc91516 0:a5c253316af6 347 #endif
jmitc91516 0:a5c253316af6 348
jmitc91516 0:a5c253316af6 349 #define GuiLib_FONT_MID_Y(BaseLine, TopLine) ((BaseLine - TopLine + 1) / 2)
jmitc91516 0:a5c253316af6 350
jmitc91516 0:a5c253316af6 351 #ifdef GuiConst_COLOR_DEPTH_1
jmitc91516 0:a5c253316af6 352 #define GuiLib_COLOR_ADJUST(C) C &= 0x01;
jmitc91516 0:a5c253316af6 353 #endif
jmitc91516 0:a5c253316af6 354 #ifdef GuiConst_COLOR_DEPTH_2
jmitc91516 0:a5c253316af6 355 #define GuiLib_COLOR_ADJUST(C) C &= 0x03;
jmitc91516 0:a5c253316af6 356 #endif
jmitc91516 0:a5c253316af6 357 #ifdef GuiConst_COLOR_DEPTH_4
jmitc91516 0:a5c253316af6 358 #define GuiLib_COLOR_ADJUST(C) C &= 0x0F;
jmitc91516 0:a5c253316af6 359 #endif
jmitc91516 0:a5c253316af6 360 #ifdef GuiConst_COLOR_DEPTH_5
jmitc91516 0:a5c253316af6 361 #define GuiLib_COLOR_ADJUST(C) C = (C & 0x1F) << 3;
jmitc91516 0:a5c253316af6 362 #endif
jmitc91516 0:a5c253316af6 363 #ifndef GuiLib_COLOR_ADJUST
jmitc91516 0:a5c253316af6 364 #define GuiLib_COLOR_ADJUST_TRANSP(C)
jmitc91516 0:a5c253316af6 365 #define GuiLib_COLOR_ADJUST(C)
jmitc91516 0:a5c253316af6 366 #else
jmitc91516 0:a5c253316af6 367 #define GuiLib_COLOR_ADJUST_TRANSP(C) if (C != -1) GuiLib_COLOR_ADJUST(C)
jmitc91516 0:a5c253316af6 368 #endif
jmitc91516 0:a5c253316af6 369 //----------------------X-----------------------
jmitc91516 0:a5c253316af6 370 #define GuiLib_GET_MIN(A, B) ((A) > (B) ? (B) : (A))
jmitc91516 0:a5c253316af6 371 #define GuiLib_GET_MAX(A, B) ((A) > (B) ? (A) : (B))
jmitc91516 0:a5c253316af6 372 #define GuiLib_GET_MINMAX(X, A, B) ((X) > (A) ? (GuiLib_GET_MIN(X,B)) : (A))
jmitc91516 0:a5c253316af6 373 #define GuiLib_LIMIT_MIN(X, A) if (X < A) X = A
jmitc91516 0:a5c253316af6 374 #define GuiLib_LIMIT_MAX(X, B) if (X > B) X = B
jmitc91516 0:a5c253316af6 375 #define GuiLib_LIMIT_MINMAX(X, A, B) \
jmitc91516 0:a5c253316af6 376 { \
jmitc91516 0:a5c253316af6 377 if (X < A) \
jmitc91516 0:a5c253316af6 378 X = A; \
jmitc91516 0:a5c253316af6 379 else if ((B < A) && (X > A)) \
jmitc91516 0:a5c253316af6 380 X = A; \
jmitc91516 0:a5c253316af6 381 else if ((B >= A) && (X > B)) \
jmitc91516 0:a5c253316af6 382 X = B; \
jmitc91516 0:a5c253316af6 383 }
jmitc91516 0:a5c253316af6 384
jmitc91516 0:a5c253316af6 385 //==============================================================================
jmitc91516 0:a5c253316af6 386
jmitc91516 0:a5c253316af6 387 //------------------------------------------------------------------------------
jmitc91516 0:a5c253316af6 388 static GuiConst_INT16S CopyBytes(GuiConst_INT8U *dst, GuiConst_INT8U *src, GuiConst_INT32S size)
jmitc91516 0:a5c253316af6 389 {
jmitc91516 0:a5c253316af6 390 GuiConst_INT32S i;
jmitc91516 0:a5c253316af6 391 GuiConst_INT8U *d, *s;
jmitc91516 0:a5c253316af6 392
jmitc91516 0:a5c253316af6 393 if (size < 0)
jmitc91516 0:a5c253316af6 394 return -1;
jmitc91516 0:a5c253316af6 395
jmitc91516 0:a5c253316af6 396 if (size > GuiConst_DISPLAY_BYTES)
jmitc91516 0:a5c253316af6 397 return -1;
jmitc91516 0:a5c253316af6 398
jmitc91516 0:a5c253316af6 399 d = (GuiConst_INT8U *)dst;
jmitc91516 0:a5c253316af6 400 s = (GuiConst_INT8U *)src;
jmitc91516 0:a5c253316af6 401
jmitc91516 0:a5c253316af6 402 for (i=0;i<size;i++)
jmitc91516 0:a5c253316af6 403 *d++ = *s++;
jmitc91516 0:a5c253316af6 404
jmitc91516 0:a5c253316af6 405 return 0;
jmitc91516 0:a5c253316af6 406 }
jmitc91516 0:a5c253316af6 407 //------------------------------------------------------------------------------
jmitc91516 0:a5c253316af6 408 static void SwapCoord(
jmitc91516 0:a5c253316af6 409 GuiConst_INT16S * X1,
jmitc91516 0:a5c253316af6 410 GuiConst_INT16S * X2)
jmitc91516 0:a5c253316af6 411 {
jmitc91516 0:a5c253316af6 412 GuiConst_INT16S Tmp;
jmitc91516 0:a5c253316af6 413
jmitc91516 0:a5c253316af6 414 Tmp = *X1;
jmitc91516 0:a5c253316af6 415 *X1 = *X2;
jmitc91516 0:a5c253316af6 416 *X2 = Tmp;
jmitc91516 0:a5c253316af6 417 }
jmitc91516 0:a5c253316af6 418
jmitc91516 0:a5c253316af6 419 //------------------------------------------------------------------------------
jmitc91516 0:a5c253316af6 420 static GuiConst_INT8U OrderCoord(
jmitc91516 0:a5c253316af6 421 GuiConst_INT16S * X1,
jmitc91516 0:a5c253316af6 422 GuiConst_INT16S * X2)
jmitc91516 0:a5c253316af6 423 {
jmitc91516 0:a5c253316af6 424 if (*X1 > *X2)
jmitc91516 0:a5c253316af6 425 {
jmitc91516 0:a5c253316af6 426 SwapCoord (X1, X2);
jmitc91516 0:a5c253316af6 427 return (1);
jmitc91516 0:a5c253316af6 428 }
jmitc91516 0:a5c253316af6 429 else
jmitc91516 0:a5c253316af6 430 return (0);
jmitc91516 0:a5c253316af6 431 }
jmitc91516 0:a5c253316af6 432
jmitc91516 0:a5c253316af6 433 #ifdef GuiConst_CLIPPING_SUPPORT_ON
jmitc91516 0:a5c253316af6 434 //------------------------------------------------------------------------------
jmitc91516 0:a5c253316af6 435 static GuiConst_INT8U CheckRect(
jmitc91516 0:a5c253316af6 436 GuiConst_INT16S * X1,
jmitc91516 0:a5c253316af6 437 GuiConst_INT16S * Y1,
jmitc91516 0:a5c253316af6 438 GuiConst_INT16S * X2,
jmitc91516 0:a5c253316af6 439 GuiConst_INT16S * Y2)
jmitc91516 0:a5c253316af6 440 {
jmitc91516 0:a5c253316af6 441 if (sgl.ClippingTotal ||
jmitc91516 0:a5c253316af6 442 (*X1 > sgl.ClippingX2) || (*X2 < sgl.ClippingX1) ||
jmitc91516 0:a5c253316af6 443 (*Y1 > sgl.ClippingY2) || (*Y2 < sgl.ClippingY1))
jmitc91516 0:a5c253316af6 444 return (0);
jmitc91516 0:a5c253316af6 445 else
jmitc91516 0:a5c253316af6 446 {
jmitc91516 0:a5c253316af6 447 if (*X1 < sgl.ClippingX1)
jmitc91516 0:a5c253316af6 448 *X1 = sgl.ClippingX1;
jmitc91516 0:a5c253316af6 449 if (*X2 > sgl.ClippingX2)
jmitc91516 0:a5c253316af6 450 *X2 = sgl.ClippingX2;
jmitc91516 0:a5c253316af6 451 if (*Y1 < sgl.ClippingY1)
jmitc91516 0:a5c253316af6 452 *Y1 = sgl.ClippingY1;
jmitc91516 0:a5c253316af6 453 if (*Y2 > sgl.ClippingY2)
jmitc91516 0:a5c253316af6 454 *Y2 = sgl.ClippingY2;
jmitc91516 0:a5c253316af6 455 return (1);
jmitc91516 0:a5c253316af6 456 }
jmitc91516 0:a5c253316af6 457 }
jmitc91516 0:a5c253316af6 458 #endif
jmitc91516 0:a5c253316af6 459
jmitc91516 0:a5c253316af6 460 //==============================================================================
jmitc91516 0:a5c253316af6 461
jmitc91516 0:a5c253316af6 462 #ifdef GuiConst_COLOR_DEPTH_1
jmitc91516 0:a5c253316af6 463 #ifdef GuiConst_BYTE_HORIZONTAL
jmitc91516 0:a5c253316af6 464 #include "GuiGraph1H.c"
jmitc91516 0:a5c253316af6 465 #else
jmitc91516 0:a5c253316af6 466 #include "GuiGraph1V.c"
jmitc91516 0:a5c253316af6 467 #endif
jmitc91516 0:a5c253316af6 468 #endif
jmitc91516 0:a5c253316af6 469 #ifdef GuiConst_COLOR_DEPTH_2
jmitc91516 0:a5c253316af6 470 #ifdef GuiConst_BYTE_HORIZONTAL
jmitc91516 0:a5c253316af6 471 #ifdef GuiConst_COLOR_PLANES_2
jmitc91516 0:a5c253316af6 472 #include "GuiGraph2H2P.c"
jmitc91516 0:a5c253316af6 473 #else
jmitc91516 0:a5c253316af6 474 #include "GuiGraph2H.c"
jmitc91516 0:a5c253316af6 475 #endif
jmitc91516 0:a5c253316af6 476 #else
jmitc91516 0:a5c253316af6 477 #ifdef GuiConst_COLOR_PLANES_2
jmitc91516 0:a5c253316af6 478 #include "GuiGraph2V2P.c"
jmitc91516 0:a5c253316af6 479 #else
jmitc91516 0:a5c253316af6 480 #include "GuiGraph2V.c"
jmitc91516 0:a5c253316af6 481 #endif
jmitc91516 0:a5c253316af6 482 #endif
jmitc91516 0:a5c253316af6 483 #endif
jmitc91516 0:a5c253316af6 484 #ifdef GuiConst_COLOR_DEPTH_4
jmitc91516 0:a5c253316af6 485 #ifdef GuiConst_BYTE_HORIZONTAL
jmitc91516 0:a5c253316af6 486 #include "GuiGraph4H.c"
jmitc91516 0:a5c253316af6 487 #else
jmitc91516 0:a5c253316af6 488 #include "GuiGraph4V.c"
jmitc91516 0:a5c253316af6 489 #endif
jmitc91516 0:a5c253316af6 490 #endif
jmitc91516 0:a5c253316af6 491 #ifdef GuiConst_COLOR_DEPTH_5
jmitc91516 0:a5c253316af6 492 #include "GuiGraph5.c"
jmitc91516 0:a5c253316af6 493 #endif
jmitc91516 0:a5c253316af6 494 #ifdef GuiConst_COLOR_DEPTH_8
jmitc91516 0:a5c253316af6 495 #include "GuiGraph8.c"
jmitc91516 0:a5c253316af6 496 #endif
jmitc91516 0:a5c253316af6 497 #ifdef GuiConst_COLOR_DEPTH_12
jmitc91516 0:a5c253316af6 498 #include "GuiGraph16.c"
jmitc91516 0:a5c253316af6 499 #endif
jmitc91516 0:a5c253316af6 500 #ifdef GuiConst_COLOR_DEPTH_15
jmitc91516 0:a5c253316af6 501 #include "GuiGraph16.c"
jmitc91516 0:a5c253316af6 502 #endif
jmitc91516 0:a5c253316af6 503 #ifdef GuiConst_COLOR_DEPTH_16
jmitc91516 0:a5c253316af6 504 #include "GuiGraph16.h"
jmitc91516 0:a5c253316af6 505 #endif
jmitc91516 0:a5c253316af6 506 #ifdef GuiConst_COLOR_DEPTH_18
jmitc91516 0:a5c253316af6 507 #include "GuiGraph24.c"
jmitc91516 0:a5c253316af6 508 #endif
jmitc91516 0:a5c253316af6 509 #ifdef GuiConst_COLOR_DEPTH_24
jmitc91516 0:a5c253316af6 510 #include "GuiGraph24.h"
jmitc91516 0:a5c253316af6 511 #endif
jmitc91516 0:a5c253316af6 512 #ifdef GuiConst_COLOR_DEPTH_32
jmitc91516 0:a5c253316af6 513 #include "GuiGraph32.c"
jmitc91516 0:a5c253316af6 514 #endif
jmitc91516 0:a5c253316af6 515
jmitc91516 0:a5c253316af6 516 #include "GuiGraph.h"
jmitc91516 0:a5c253316af6 517 #ifdef GuiConst_ADV_GRAPHICS_ON
jmitc91516 0:a5c253316af6 518 //#include "GuiGraphAdv.c"
jmitc91516 0:a5c253316af6 519 #endif
jmitc91516 0:a5c253316af6 520
jmitc91516 0:a5c253316af6 521 //==============================================================================
jmitc91516 0:a5c253316af6 522 static void DrawStructure(GuiLib_StructPtr Structure, GuiConst_INT8U ColorInvert) PrefixReentrant;
jmitc91516 0:a5c253316af6 523
jmitc91516 0:a5c253316af6 524 #ifdef GuiConst_CURSOR_SUPPORT_ON
jmitc91516 0:a5c253316af6 525 static void DrawCursorItem(GuiConst_INT8U CursorVisible);
jmitc91516 0:a5c253316af6 526 #endif
jmitc91516 0:a5c253316af6 527
jmitc91516 0:a5c253316af6 528 #ifdef GuiConst_ITEM_SCROLLBOX_INUSE
jmitc91516 0:a5c253316af6 529 static void ScrollBox_DrawScrollLine(GuiConst_INT8U ScrollBoxIndex, GuiConst_INT16S LineNdx);
jmitc91516 0:a5c253316af6 530 #endif
jmitc91516 0:a5c253316af6 531
jmitc91516 0:a5c253316af6 532 #ifdef GuiConst_ITEM_GRAPHICS_LAYER_FILTER_INUSE
jmitc91516 0:a5c253316af6 533 static GuiConst_INT16S IndexOfGraphicsLayer(GuiConst_INT16S GraphicsLayerIndex);
jmitc91516 0:a5c253316af6 534 static GuiConst_INT8U GraphicsLayer_Push(GuiConst_INT8U GraphicsLayerIndex);
jmitc91516 0:a5c253316af6 535 static GuiConst_INT8U GraphicsLayer_Pop(GuiConst_INT16S GraphicsLayerIndex);
jmitc91516 0:a5c253316af6 536 static void GraphicsLayer_Copy(
jmitc91516 0:a5c253316af6 537 GuiConst_INT8U *DestAddress,
jmitc91516 0:a5c253316af6 538 GuiConst_INT16U DestLineSize,
jmitc91516 0:a5c253316af6 539 GuiConst_INT16S DestX,
jmitc91516 0:a5c253316af6 540 GuiConst_INT16S DestY,
jmitc91516 0:a5c253316af6 541 GuiConst_INT8U *SourceAddress,
jmitc91516 0:a5c253316af6 542 GuiConst_INT16U SourceLineSize,
jmitc91516 0:a5c253316af6 543 GuiConst_INT16S SourceX,
jmitc91516 0:a5c253316af6 544 GuiConst_INT16S SourceY,
jmitc91516 0:a5c253316af6 545 GuiConst_INT16U Width,
jmitc91516 0:a5c253316af6 546 GuiConst_INT16U Height);
jmitc91516 0:a5c253316af6 547 #endif
jmitc91516 0:a5c253316af6 548
jmitc91516 0:a5c253316af6 549 //==============================================================================
jmitc91516 0:a5c253316af6 550
jmitc91516 0:a5c253316af6 551 //------------------------------------------------------------------------------
jmitc91516 0:a5c253316af6 552 static void ResetLayerBufPtr(void)
jmitc91516 0:a5c253316af6 553 {
jmitc91516 0:a5c253316af6 554 #ifdef GuiConst_DISPLAY_BUFFER_EASYGUI
jmitc91516 0:a5c253316af6 555 #ifdef GuiLib_COLOR_UNIT_16
jmitc91516 0:a5c253316af6 556 sgl.CurLayerBufPtr = &(GuiLib_DisplayBuf.Bytes[0][0]);
jmitc91516 0:a5c253316af6 557 #else
jmitc91516 0:a5c253316af6 558 #ifdef GuiConst_COLOR_DEPTH_2
jmitc91516 0:a5c253316af6 559 #ifdef GuiConst_BYTE_HORIZONTAL
jmitc91516 0:a5c253316af6 560 #ifdef GuiConst_COLOR_PLANES_2
jmitc91516 0:a5c253316af6 561 sgl.CurLayerBufPtr = &(GuiLib_DisplayBuf[0][0][0]);
jmitc91516 0:a5c253316af6 562 #else
jmitc91516 0:a5c253316af6 563 sgl.CurLayerBufPtr = &(GuiLib_DisplayBuf[0][0]);
jmitc91516 0:a5c253316af6 564 #endif
jmitc91516 0:a5c253316af6 565 #else // GuiConst_BYTE_HORIZONTAL
jmitc91516 0:a5c253316af6 566 #ifdef GuiConst_COLOR_PLANES_2
jmitc91516 0:a5c253316af6 567 sgl.CurLayerBufPtr = &(GuiLib_DisplayBuf[0][0][0]);
jmitc91516 0:a5c253316af6 568 #else
jmitc91516 0:a5c253316af6 569 sgl.CurLayerBufPtr = &(GuiLib_DisplayBuf[0][0]);
jmitc91516 0:a5c253316af6 570 #endif
jmitc91516 0:a5c253316af6 571 #endif // GuiConst_BYTE_HORIZONTAL
jmitc91516 0:a5c253316af6 572 #else // GuiConst_COLOR_DEPTH_2
jmitc91516 0:a5c253316af6 573 sgl.CurLayerBufPtr = &(GuiLib_DisplayBuf[0][0]);
jmitc91516 0:a5c253316af6 574 #endif // GuiConst_COLOR_DEPTH_2
jmitc91516 0:a5c253316af6 575 #endif // GuiLib_COLOR_UNIT_16
jmitc91516 0:a5c253316af6 576 #else // GuiConst_DISPLAY_BUFFER_EASYGUI
jmitc91516 0:a5c253316af6 577 sgl.CurLayerBufPtr = 0;
jmitc91516 0:a5c253316af6 578 #endif // GuiConst_DISPLAY_BUFFER_EASYGUI
jmitc91516 0:a5c253316af6 579
jmitc91516 0:a5c253316af6 580 sgl.CurLayerLineSize = GuiConst_BYTES_PR_LINE;
jmitc91516 0:a5c253316af6 581 sgl.CurLayerWidth = GuiConst_DISPLAY_WIDTH_HW;
jmitc91516 0:a5c253316af6 582 sgl.CurLayerHeight = GuiConst_DISPLAY_HEIGHT_HW;
jmitc91516 0:a5c253316af6 583 sgl.CurLayerBytes = GuiConst_DISPLAY_BYTES;
jmitc91516 0:a5c253316af6 584 sgl.BaseLayerDrawing = 1;
jmitc91516 0:a5c253316af6 585 }
jmitc91516 0:a5c253316af6 586
jmitc91516 0:a5c253316af6 587 //------------------------------------------------------------------------------
jmitc91516 0:a5c253316af6 588 void GuiLib_Init(void)
jmitc91516 0:a5c253316af6 589 {
jmitc91516 0:a5c253316af6 590 sgl.RefreshClock = 0;
jmitc91516 0:a5c253316af6 591
jmitc91516 0:a5c253316af6 592 ResetLayerBufPtr();
jmitc91516 0:a5c253316af6 593
jmitc91516 0:a5c253316af6 594 AutoRedraw_Init();
jmitc91516 0:a5c253316af6 595
jmitc91516 0:a5c253316af6 596 #ifdef GuiConst_DISPLAY_ACTIVE_AREA
jmitc91516 0:a5c253316af6 597 #ifdef GuiConst_DISPLAY_ACTIVE_AREA_COO_REL
jmitc91516 0:a5c253316af6 598 sgl.DisplayOrigoX = GuiConst_DISPLAY_ACTIVE_AREA_X1;
jmitc91516 0:a5c253316af6 599 sgl.DisplayOrigoY = GuiConst_DISPLAY_ACTIVE_AREA_Y1;
jmitc91516 0:a5c253316af6 600 #ifdef GuiConst_CLIPPING_SUPPORT_ON
jmitc91516 0:a5c253316af6 601 sgl.DisplayActiveAreaX1 = 0;
jmitc91516 0:a5c253316af6 602 sgl.DisplayActiveAreaY1 = 0;
jmitc91516 0:a5c253316af6 603 #endif // GuiConst_CLIPPING_SUPPORT_ON
jmitc91516 0:a5c253316af6 604 #ifdef GuiConst_DISPLAY_ACTIVE_AREA_CLIPPING
jmitc91516 0:a5c253316af6 605 sgl.DisplayActiveAreaX2 =
jmitc91516 0:a5c253316af6 606 GuiConst_DISPLAY_ACTIVE_AREA_X2 - GuiConst_DISPLAY_ACTIVE_AREA_X1;
jmitc91516 0:a5c253316af6 607 sgl.DisplayActiveAreaY2 =
jmitc91516 0:a5c253316af6 608 GuiConst_DISPLAY_ACTIVE_AREA_Y2 - GuiConst_DISPLAY_ACTIVE_AREA_Y1;
jmitc91516 0:a5c253316af6 609 #else // GuiConst_DISPLAY_ACTIVE_AREA_CLIPPING
jmitc91516 0:a5c253316af6 610 sgl.DisplayActiveAreaX2 =
jmitc91516 0:a5c253316af6 611 GuiConst_DISPLAY_WIDTH - GuiConst_DISPLAY_ACTIVE_AREA_X1 - 1;
jmitc91516 0:a5c253316af6 612 sgl.DisplayActiveAreaY2 =
jmitc91516 0:a5c253316af6 613 GuiConst_DISPLAY_HEIGHT - GuiConst_DISPLAY_ACTIVE_AREA_Y1 - 1;
jmitc91516 0:a5c253316af6 614 #endif // GuiConst_DISPLAY_ACTIVE_AREA_CLIPPING
jmitc91516 0:a5c253316af6 615 #else // GuiConst_DISPLAY_ACTIVE_AREA_COO_REL
jmitc91516 0:a5c253316af6 616 sgl.DisplayOrigoX = 0;
jmitc91516 0:a5c253316af6 617 sgl.DisplayOrigoY = 0;
jmitc91516 0:a5c253316af6 618 #ifdef GuiConst_CLIPPING_SUPPORT_ON
jmitc91516 0:a5c253316af6 619 #ifdef GuiConst_DISPLAY_ACTIVE_AREA_CLIPPING
jmitc91516 0:a5c253316af6 620 sgl.DisplayActiveAreaX1 = GuiConst_DISPLAY_ACTIVE_AREA_X1;
jmitc91516 0:a5c253316af6 621 sgl.DisplayActiveAreaY1 = GuiConst_DISPLAY_ACTIVE_AREA_Y1;
jmitc91516 0:a5c253316af6 622 sgl.DisplayActiveAreaX2 = GuiConst_DISPLAY_ACTIVE_AREA_X2;
jmitc91516 0:a5c253316af6 623 sgl.DisplayActiveAreaY2 = GuiConst_DISPLAY_ACTIVE_AREA_Y2;
jmitc91516 0:a5c253316af6 624 #else // GuiConst_DISPLAY_ACTIVE_AREA_CLIPPING
jmitc91516 0:a5c253316af6 625 sgl.DisplayActiveAreaX1 = 0;
jmitc91516 0:a5c253316af6 626 sgl.DisplayActiveAreaY1 = 0;
jmitc91516 0:a5c253316af6 627 sgl.DisplayActiveAreaX2 = GuiConst_DISPLAY_WIDTH - 1;
jmitc91516 0:a5c253316af6 628 sgl.DisplayActiveAreaY2 = GuiConst_DISPLAY_HEIGHT - 1;
jmitc91516 0:a5c253316af6 629 #endif // GuiConst_DISPLAY_ACTIVE_AREA_CLIPPING
jmitc91516 0:a5c253316af6 630 #endif // GuiConst_CLIPPING_SUPPORT_ON
jmitc91516 0:a5c253316af6 631 #endif // GuiConst_DISPLAY_ACTIVE_AREA_COO_REL
jmitc91516 0:a5c253316af6 632 #else // GuiConst_DISPLAY_ACTIVE_AREA
jmitc91516 0:a5c253316af6 633 sgl.DisplayOrigoX = 0;
jmitc91516 0:a5c253316af6 634 sgl.DisplayOrigoY = 0;
jmitc91516 0:a5c253316af6 635 #ifdef GuiConst_CLIPPING_SUPPORT_ON
jmitc91516 0:a5c253316af6 636 sgl.DisplayActiveAreaX1 = 0;
jmitc91516 0:a5c253316af6 637 sgl.DisplayActiveAreaY1 = 0;
jmitc91516 0:a5c253316af6 638 sgl.DisplayActiveAreaX2 = GuiConst_DISPLAY_WIDTH - 1;
jmitc91516 0:a5c253316af6 639 sgl.DisplayActiveAreaY2 = GuiConst_DISPLAY_HEIGHT - 1;
jmitc91516 0:a5c253316af6 640 #endif // GuiConst_CLIPPING_SUPPORT_ON
jmitc91516 0:a5c253316af6 641 #endif // GuiConst_DISPLAY_ACTIVE_AREA
jmitc91516 0:a5c253316af6 642
jmitc91516 0:a5c253316af6 643 #ifdef GuiConst_ADV_GRAPHICS_ON
jmitc91516 0:a5c253316af6 644 // GuiLib_AG_Init();
jmitc91516 0:a5c253316af6 645 #endif
jmitc91516 0:a5c253316af6 646
jmitc91516 0:a5c253316af6 647 GuiDisplay_Init();
jmitc91516 0:a5c253316af6 648
jmitc91516 0:a5c253316af6 649 #ifdef GuiConst_CLIPPING_SUPPORT_ON
jmitc91516 0:a5c253316af6 650 GuiLib_ResetClipping();
jmitc91516 0:a5c253316af6 651 #endif
jmitc91516 0:a5c253316af6 652 GuiLib_ResetDisplayRepaint();
jmitc91516 0:a5c253316af6 653 GuiLib_Clear();
jmitc91516 0:a5c253316af6 654
jmitc91516 0:a5c253316af6 655 sgl.DisplayWriting = 1;
jmitc91516 0:a5c253316af6 656 sgl.InitialDrawing = 0;
jmitc91516 0:a5c253316af6 657 sgl.TopLevelStructure = 0;
jmitc91516 0:a5c253316af6 658 sgl.SwapColors = 0;
jmitc91516 0:a5c253316af6 659 GuiLib_SetLanguage(0);
jmitc91516 0:a5c253316af6 660 #ifdef GuiConst_BLINK_SUPPORT_ON
jmitc91516 0:a5c253316af6 661 sgl.BlinkBoxRate = 0;
jmitc91516 0:a5c253316af6 662 #endif
jmitc91516 0:a5c253316af6 663 sgl.InvertBoxOn = 0;
jmitc91516 0:a5c253316af6 664 sgl.DrawingLevel = 0;
jmitc91516 0:a5c253316af6 665 GuiLib_CurStructureNdx = -1;
jmitc91516 0:a5c253316af6 666 #ifdef GuiConst_ITEM_TOUCHAREA_INUSE
jmitc91516 0:a5c253316af6 667 GuiLib_TouchAdjustReset();
jmitc91516 0:a5c253316af6 668 #endif
jmitc91516 0:a5c253316af6 669 #ifdef GuiConst_ITEM_BUTTON_INUSE
jmitc91516 0:a5c253316af6 670 sgl.ButtonColorOverride = GuiLib_FALSE;
jmitc91516 0:a5c253316af6 671 sgl.DisabledButtonColor = 0;
jmitc91516 0:a5c253316af6 672 #endif
jmitc91516 0:a5c253316af6 673 #ifdef GuiConst_REMOTE_DATA
jmitc91516 0:a5c253316af6 674 GuiLib_RemoteDataReadBlock = 0;
jmitc91516 0:a5c253316af6 675 #ifdef GuiConst_REMOTE_TEXT_DATA
jmitc91516 0:a5c253316af6 676 GuiLib_RemoteTextReadBlock = 0;
jmitc91516 0:a5c253316af6 677 sgl.CurRemoteText = -1;
jmitc91516 0:a5c253316af6 678 sgl.RemoteTextTableOfs = -1;
jmitc91516 0:a5c253316af6 679 #endif
jmitc91516 0:a5c253316af6 680 #ifdef GuiConst_REMOTE_FONT_DATA
jmitc91516 0:a5c253316af6 681 sgl.CurRemoteFont = -1;
jmitc91516 0:a5c253316af6 682 #endif
jmitc91516 0:a5c253316af6 683 #ifdef GuiConst_REMOTE_BITMAP_DATA
jmitc91516 0:a5c253316af6 684 sgl.CurRemoteBitmap = -1;
jmitc91516 0:a5c253316af6 685 #endif
jmitc91516 0:a5c253316af6 686 #endif
jmitc91516 0:a5c253316af6 687
jmitc91516 0:a5c253316af6 688 #ifdef GuiConst_VNC_REMOTE_SUPPORT_ON
jmitc91516 0:a5c253316af6 689 GuiVnc_Init();
jmitc91516 0:a5c253316af6 690 #endif
jmitc91516 0:a5c253316af6 691 }
jmitc91516 0:a5c253316af6 692
jmitc91516 0:a5c253316af6 693 //------------------------------------------------------------------------------
jmitc91516 0:a5c253316af6 694 void GuiLib_Clear(void)
jmitc91516 0:a5c253316af6 695 {
jmitc91516 0:a5c253316af6 696 GuiConst_INT16S I;
jmitc91516 0:a5c253316af6 697 #ifdef GuiConst_ITEM_GRAPHICS_LAYER_FILTER_INUSE
jmitc91516 0:a5c253316af6 698 GuiConst_INT16S N;
jmitc91516 0:a5c253316af6 699 #endif
jmitc91516 0:a5c253316af6 700
jmitc91516 0:a5c253316af6 701 GuiLib_ClearDisplay();
jmitc91516 0:a5c253316af6 702
jmitc91516 0:a5c253316af6 703 GuiLib_CurStructureNdx = -1;
jmitc91516 0:a5c253316af6 704
jmitc91516 0:a5c253316af6 705 AutoRedraw_Destroy();
jmitc91516 0:a5c253316af6 706
jmitc91516 0:a5c253316af6 707 #ifdef GuiConst_CURSOR_SUPPORT_ON
jmitc91516 0:a5c253316af6 708 sgl.CursorInUse = 0;
jmitc91516 0:a5c253316af6 709 GuiLib_ActiveCursorFieldNo = -1;
jmitc91516 0:a5c253316af6 710 #endif
jmitc91516 0:a5c253316af6 711 #ifdef GuiConst_BLINK_SUPPORT_ON
jmitc91516 0:a5c253316af6 712 #ifndef GuiConst_BLINK_FIELDS_OFF
jmitc91516 0:a5c253316af6 713 for (I = 0; I < GuiConst_BLINK_FIELDS_MAX; I++)
jmitc91516 0:a5c253316af6 714 {
jmitc91516 0:a5c253316af6 715 sgl.BlinkTextItems[I].InUse = 0;
jmitc91516 0:a5c253316af6 716 sgl.BlinkTextItems[I].Active = 0;
jmitc91516 0:a5c253316af6 717 }
jmitc91516 0:a5c253316af6 718 #endif
jmitc91516 0:a5c253316af6 719 #endif
jmitc91516 0:a5c253316af6 720 #ifdef GuiConst_ITEM_TOUCHAREA_INUSE
jmitc91516 0:a5c253316af6 721 sgl.TouchAreaCnt = 0;
jmitc91516 0:a5c253316af6 722 #endif
jmitc91516 0:a5c253316af6 723
jmitc91516 0:a5c253316af6 724 #ifdef GuiConst_TEXTBOX_FIELDS_ON
jmitc91516 0:a5c253316af6 725 for (I = 0; I < GuiConst_TEXTBOX_FIELDS_MAX; I++)
jmitc91516 0:a5c253316af6 726 sgl.TextBoxScrollPositions[I].index = -1;
jmitc91516 0:a5c253316af6 727 #endif
jmitc91516 0:a5c253316af6 728
jmitc91516 0:a5c253316af6 729 sgl.LayerOrigoX = 0;
jmitc91516 0:a5c253316af6 730 sgl.LayerOrigoY = 0;
jmitc91516 0:a5c253316af6 731
jmitc91516 0:a5c253316af6 732 sgl.CoordOrigoX = sgl.DisplayOrigoX + sgl.LayerOrigoX;
jmitc91516 0:a5c253316af6 733 sgl.CoordOrigoY = sgl.DisplayOrigoY + sgl.LayerOrigoY;
jmitc91516 0:a5c253316af6 734
jmitc91516 0:a5c253316af6 735 #ifdef GuiConst_ITEM_SCROLLBOX_INUSE
jmitc91516 0:a5c253316af6 736 sgl.NextScrollLineReading = 0;
jmitc91516 0:a5c253316af6 737 sgl.GlobalScrollBoxIndex = 0;
jmitc91516 0:a5c253316af6 738 for (I = 0; I < GuiConst_SCROLLITEM_BOXES_MAX; I++)
jmitc91516 0:a5c253316af6 739 {
jmitc91516 0:a5c253316af6 740 sgl.ScrollBoxesAry[I].X1 = 0;
jmitc91516 0:a5c253316af6 741 sgl.ScrollBoxesAry[I].Y1 = 0;
jmitc91516 0:a5c253316af6 742 sgl.ScrollBoxesAry[I].InUse = GuiLib_SCROLL_STRUCTURE_UNDEF;
jmitc91516 0:a5c253316af6 743 sgl.ScrollBoxesAry[I].ScrollTopLine = 0;
jmitc91516 0:a5c253316af6 744 sgl.ScrollBoxesAry[I].LastScrollTopLine = 0;
jmitc91516 0:a5c253316af6 745 sgl.ScrollBoxesAry[I].LastMarkerLine = 0;
jmitc91516 0:a5c253316af6 746 sgl.ScrollBoxesAry[I].ScrollActiveLine = 0;
jmitc91516 0:a5c253316af6 747 sgl.ScrollBoxesAry[I].NumberOfLines = 0;
jmitc91516 0:a5c253316af6 748 }
jmitc91516 0:a5c253316af6 749 #endif
jmitc91516 0:a5c253316af6 750
jmitc91516 0:a5c253316af6 751 #ifdef GuiConst_ITEM_GRAPH_INUSE
jmitc91516 0:a5c253316af6 752 sgl.GlobalGraphIndex = 0;
jmitc91516 0:a5c253316af6 753 for (I = 0; I < GuiConst_GRAPH_MAX; I++)
jmitc91516 0:a5c253316af6 754 {
jmitc91516 0:a5c253316af6 755 sgl.GraphAry[I].InUse = GuiLib_GRAPH_STRUCTURE_UNDEF;
jmitc91516 0:a5c253316af6 756 sgl.GraphAry[I].GraphAxesCnt[GuiLib_GRAPHAXIS_X] = 0;
jmitc91516 0:a5c253316af6 757 sgl.GraphAry[I].GraphAxesCnt[GuiLib_GRAPHAXIS_Y] = 0;
jmitc91516 0:a5c253316af6 758 sgl.GraphAry[I].GraphDataSetCnt = 0;
jmitc91516 0:a5c253316af6 759 }
jmitc91516 0:a5c253316af6 760 #endif
jmitc91516 0:a5c253316af6 761
jmitc91516 0:a5c253316af6 762 #ifdef GuiConst_ITEM_GRAPHICS_LAYER_FILTER_INUSE
jmitc91516 0:a5c253316af6 763 GraphicsLayer_Pop(GuiLib_GRAPHICS_LAYER_BASE);
jmitc91516 0:a5c253316af6 764 for (I = 0; I < GuiConst_GRAPHICS_LAYER_MAX; I++)
jmitc91516 0:a5c253316af6 765 sgl.GraphicsLayerLifo[I] = -1;
jmitc91516 0:a5c253316af6 766 sgl.GraphicsLayerLifoCnt = 0;
jmitc91516 0:a5c253316af6 767 sgl.GlobalGraphicsLayerIndex = 0;
jmitc91516 0:a5c253316af6 768 for (I = 0; I < GuiConst_GRAPHICS_LAYER_MAX; I++)
jmitc91516 0:a5c253316af6 769 {
jmitc91516 0:a5c253316af6 770 sgl.GraphicsLayerList[I].InUse = GuiLib_GRAPHICS_LAYER_UNDEF;
jmitc91516 0:a5c253316af6 771 sgl.GraphicsLayerList[I].SizeMode = 0;
jmitc91516 0:a5c253316af6 772 sgl.GraphicsLayerList[I].InitMode = 0;
jmitc91516 0:a5c253316af6 773 }
jmitc91516 0:a5c253316af6 774 sgl.GlobalGraphicsFilterIndex = 0;
jmitc91516 0:a5c253316af6 775 for (I = 0; I < GuiConst_GRAPHICS_FILTER_MAX; I++)
jmitc91516 0:a5c253316af6 776 {
jmitc91516 0:a5c253316af6 777 sgl.GraphicsFilterList[I].InUse = GuiLib_GRAPHICS_FILTER_UNDEF;
jmitc91516 0:a5c253316af6 778 sgl.GraphicsFilterList[I].GraphicsFilterFunc = 0;
jmitc91516 0:a5c253316af6 779 sgl.GraphicsFilterList[I].SourceLayerIndexNo = GuiLib_GRAPHICS_LAYER_BASE;
jmitc91516 0:a5c253316af6 780 sgl.GraphicsFilterList[I].DestLayerIndexNo = GuiLib_GRAPHICS_LAYER_BASE;
jmitc91516 0:a5c253316af6 781 sgl.GraphicsFilterList[I].ContAtLayerIndexNo = GuiLib_GRAPHICS_LAYER_BASE;
jmitc91516 0:a5c253316af6 782 for (N = 0; N <= 9; N++)
jmitc91516 0:a5c253316af6 783 {
jmitc91516 0:a5c253316af6 784 sgl.GraphicsFilterList[I].ParVarType[N] = 0;
jmitc91516 0:a5c253316af6 785 sgl.GraphicsFilterList[I].ParVarPtr[N] = 0;
jmitc91516 0:a5c253316af6 786 sgl.GraphicsFilterList[I].ParValueNum[N] = 0;
jmitc91516 0:a5c253316af6 787 }
jmitc91516 0:a5c253316af6 788 }
jmitc91516 0:a5c253316af6 789 #endif
jmitc91516 0:a5c253316af6 790
jmitc91516 0:a5c253316af6 791 #ifdef GuiConst_BITMAP_SUPPORT_ON
jmitc91516 0:a5c253316af6 792 sgl.GlobalBackgrBitmapIndex = 0;
jmitc91516 0:a5c253316af6 793 for (I = 0; I < GuiConst_MAX_BACKGROUND_BITMAPS; I++)
jmitc91516 0:a5c253316af6 794 {
jmitc91516 0:a5c253316af6 795 sgl.BackgrBitmapAry[I].InUse = 0;
jmitc91516 0:a5c253316af6 796 sgl.BackgrBitmapAry[I].Index = 0;
jmitc91516 0:a5c253316af6 797 sgl.BackgrBitmapAry[I].X = 0;
jmitc91516 0:a5c253316af6 798 sgl.BackgrBitmapAry[I].Y = 0;
jmitc91516 0:a5c253316af6 799 }
jmitc91516 0:a5c253316af6 800 #endif
jmitc91516 0:a5c253316af6 801
jmitc91516 0:a5c253316af6 802 GuiLib_ClearPositionCallbacks();
jmitc91516 0:a5c253316af6 803 }
jmitc91516 0:a5c253316af6 804
jmitc91516 0:a5c253316af6 805 // Groupstart CHARS
jmitc91516 0:a5c253316af6 806
jmitc91516 0:a5c253316af6 807 #ifdef GuiConst_CHARMODE_UNICODE
jmitc91516 0:a5c253316af6 808 //------------------------------------------------------------------------------
jmitc91516 0:a5c253316af6 809 GuiConst_INT16U GuiLib_UnicodeStrLen(
jmitc91516 0:a5c253316af6 810 GuiConst_TEXT PrefixLocate *S)
jmitc91516 0:a5c253316af6 811 {
jmitc91516 0:a5c253316af6 812 GuiConst_INT16U StrLen;
jmitc91516 0:a5c253316af6 813
jmitc91516 0:a5c253316af6 814 StrLen = 0;
jmitc91516 0:a5c253316af6 815 while (*S != 0)
jmitc91516 0:a5c253316af6 816 {
jmitc91516 0:a5c253316af6 817 StrLen++;
jmitc91516 0:a5c253316af6 818 S++;
jmitc91516 0:a5c253316af6 819 }
jmitc91516 0:a5c253316af6 820 return (StrLen);
jmitc91516 0:a5c253316af6 821 }
jmitc91516 0:a5c253316af6 822
jmitc91516 0:a5c253316af6 823 //------------------------------------------------------------------------------
jmitc91516 0:a5c253316af6 824 void GuiLib_StrAnsiToUnicode(
jmitc91516 0:a5c253316af6 825 GuiConst_TEXT PrefixLocate *S2,
jmitc91516 0:a5c253316af6 826 GuiConst_CHAR PrefixLocate *S1)
jmitc91516 0:a5c253316af6 827 {
jmitc91516 0:a5c253316af6 828 do
jmitc91516 0:a5c253316af6 829 {
jmitc91516 0:a5c253316af6 830 *S2 = (GuiConst_TEXT)(*S1);
jmitc91516 0:a5c253316af6 831 *S2 &= 0x00ff;
jmitc91516 0:a5c253316af6 832 if (*S1 == 0)
jmitc91516 0:a5c253316af6 833 return;
jmitc91516 0:a5c253316af6 834 S1++;
jmitc91516 0:a5c253316af6 835 S2++;
jmitc91516 0:a5c253316af6 836 }
jmitc91516 0:a5c253316af6 837 while (1);
jmitc91516 0:a5c253316af6 838 }
jmitc91516 0:a5c253316af6 839
jmitc91516 0:a5c253316af6 840 //------------------------------------------------------------------------------
jmitc91516 0:a5c253316af6 841 GuiConst_INT16S GuiLib_UnicodeStrCmp(
jmitc91516 0:a5c253316af6 842 GuiConst_TEXT PrefixLocate *S1,
jmitc91516 0:a5c253316af6 843 GuiConst_TEXT PrefixLocate *S2)
jmitc91516 0:a5c253316af6 844 {
jmitc91516 0:a5c253316af6 845 do
jmitc91516 0:a5c253316af6 846 {
jmitc91516 0:a5c253316af6 847 if ((*S1 == 0) && (*S2 == 0))
jmitc91516 0:a5c253316af6 848 return (0);
jmitc91516 0:a5c253316af6 849
jmitc91516 0:a5c253316af6 850 else if (*S1 == 0)
jmitc91516 0:a5c253316af6 851 return (-1);
jmitc91516 0:a5c253316af6 852 else if (*S2 == 0)
jmitc91516 0:a5c253316af6 853 return (1);
jmitc91516 0:a5c253316af6 854 else if (*S1 < *S2)
jmitc91516 0:a5c253316af6 855 return (-1);
jmitc91516 0:a5c253316af6 856 else if (*S1 > *S2)
jmitc91516 0:a5c253316af6 857 return (1);
jmitc91516 0:a5c253316af6 858 S1++;
jmitc91516 0:a5c253316af6 859 S2++;
jmitc91516 0:a5c253316af6 860 }
jmitc91516 0:a5c253316af6 861 while (1);
jmitc91516 0:a5c253316af6 862 }
jmitc91516 0:a5c253316af6 863
jmitc91516 0:a5c253316af6 864 //------------------------------------------------------------------------------
jmitc91516 0:a5c253316af6 865 GuiConst_INT16S GuiLib_UnicodeStrNCmp(
jmitc91516 0:a5c253316af6 866 GuiConst_TEXT PrefixLocate *S1,
jmitc91516 0:a5c253316af6 867 GuiConst_TEXT PrefixLocate *S2,
jmitc91516 0:a5c253316af6 868 GuiConst_INT16U StrLen)
jmitc91516 0:a5c253316af6 869 {
jmitc91516 0:a5c253316af6 870 while (StrLen > 0)
jmitc91516 0:a5c253316af6 871 {
jmitc91516 0:a5c253316af6 872 if ((*S1 == 0) && (*S2 == 0))
jmitc91516 0:a5c253316af6 873 return (0);
jmitc91516 0:a5c253316af6 874 else if (*S1 == 0)
jmitc91516 0:a5c253316af6 875 return (-1);
jmitc91516 0:a5c253316af6 876 else if (*S2 == 0)
jmitc91516 0:a5c253316af6 877 return (1);
jmitc91516 0:a5c253316af6 878 else if (*S1 < *S2)
jmitc91516 0:a5c253316af6 879 return (-1);
jmitc91516 0:a5c253316af6 880 else if (*S1 > *S2)
jmitc91516 0:a5c253316af6 881 return (1);
jmitc91516 0:a5c253316af6 882 S1++;
jmitc91516 0:a5c253316af6 883 S2++;
jmitc91516 0:a5c253316af6 884 StrLen--;
jmitc91516 0:a5c253316af6 885 }
jmitc91516 0:a5c253316af6 886 return (0);
jmitc91516 0:a5c253316af6 887 }
jmitc91516 0:a5c253316af6 888
jmitc91516 0:a5c253316af6 889 //------------------------------------------------------------------------------
jmitc91516 0:a5c253316af6 890 void GuiLib_UnicodeStrCpy(
jmitc91516 0:a5c253316af6 891 GuiConst_TEXT PrefixLocate *S2,
jmitc91516 0:a5c253316af6 892 GuiConst_TEXT PrefixLocate *S1)
jmitc91516 0:a5c253316af6 893 {
jmitc91516 0:a5c253316af6 894 do
jmitc91516 0:a5c253316af6 895 {
jmitc91516 0:a5c253316af6 896 *S2 = *S1;
jmitc91516 0:a5c253316af6 897 if (*S1 == 0)
jmitc91516 0:a5c253316af6 898 return;
jmitc91516 0:a5c253316af6 899 S1++;
jmitc91516 0:a5c253316af6 900 S2++;
jmitc91516 0:a5c253316af6 901 }
jmitc91516 0:a5c253316af6 902 while (1);
jmitc91516 0:a5c253316af6 903 }
jmitc91516 0:a5c253316af6 904
jmitc91516 0:a5c253316af6 905 //------------------------------------------------------------------------------
jmitc91516 0:a5c253316af6 906 void GuiLib_UnicodeStrNCpy(
jmitc91516 0:a5c253316af6 907 GuiConst_TEXT PrefixLocate *S2,
jmitc91516 0:a5c253316af6 908 GuiConst_TEXT PrefixLocate *S1,
jmitc91516 0:a5c253316af6 909 GuiConst_INT16U StrLen)
jmitc91516 0:a5c253316af6 910 {
jmitc91516 0:a5c253316af6 911 while (StrLen > 0)
jmitc91516 0:a5c253316af6 912 {
jmitc91516 0:a5c253316af6 913 *S2 = *S1;
jmitc91516 0:a5c253316af6 914 if (*S1 != 0)
jmitc91516 0:a5c253316af6 915 S1++;
jmitc91516 0:a5c253316af6 916 S2++;
jmitc91516 0:a5c253316af6 917 StrLen--;
jmitc91516 0:a5c253316af6 918 }
jmitc91516 0:a5c253316af6 919 }
jmitc91516 0:a5c253316af6 920 #endif // GuiConst_CHARMODE_UNICODE
jmitc91516 0:a5c253316af6 921
jmitc91516 0:a5c253316af6 922 //------------------------------------------------------------------------------
jmitc91516 0:a5c253316af6 923 static void ConvertIntToStr(
jmitc91516 0:a5c253316af6 924 GuiConst_INT32U num,
jmitc91516 0:a5c253316af6 925 GuiConst_CHAR PrefixLocate *string,
jmitc91516 0:a5c253316af6 926 GuiConst_INT32U base)
jmitc91516 0:a5c253316af6 927 {
jmitc91516 0:a5c253316af6 928 #define BUFFER_SIZE 11
jmitc91516 0:a5c253316af6 929
jmitc91516 0:a5c253316af6 930 GuiConst_INT8U digits[16] =
jmitc91516 0:a5c253316af6 931 { 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 65, 66, 67, 68, 69, 70 };
jmitc91516 0:a5c253316af6 932 GuiConst_CHAR buffer[BUFFER_SIZE];
jmitc91516 0:a5c253316af6 933 GuiConst_INT8U bufferLen;
jmitc91516 0:a5c253316af6 934 GuiConst_INT8U i;
jmitc91516 0:a5c253316af6 935
jmitc91516 0:a5c253316af6 936 bufferLen = 0;
jmitc91516 0:a5c253316af6 937 do
jmitc91516 0:a5c253316af6 938 {
jmitc91516 0:a5c253316af6 939 i = num % base;
jmitc91516 0:a5c253316af6 940 buffer[bufferLen++] = digits[i];
jmitc91516 0:a5c253316af6 941 num /= base;
jmitc91516 0:a5c253316af6 942 }
jmitc91516 0:a5c253316af6 943 while ((num != 0) && (bufferLen < BUFFER_SIZE));
jmitc91516 0:a5c253316af6 944
jmitc91516 0:a5c253316af6 945 if (bufferLen <= GuiConst_MAX_VARNUM_TEXT_LEN)
jmitc91516 0:a5c253316af6 946 while (bufferLen-- > 0)
jmitc91516 0:a5c253316af6 947 *string++ = buffer[bufferLen];
jmitc91516 0:a5c253316af6 948
jmitc91516 0:a5c253316af6 949 *string = '\0';
jmitc91516 0:a5c253316af6 950 }
jmitc91516 0:a5c253316af6 951
jmitc91516 0:a5c253316af6 952 //------------------------------------------------------------------------------
jmitc91516 0:a5c253316af6 953 static GuiConst_INT16S CharDist(
jmitc91516 0:a5c253316af6 954 GuiConst_INT16U ChPos1,
jmitc91516 0:a5c253316af6 955 GuiConst_INT16U ChPos2,
jmitc91516 0:a5c253316af6 956 GuiConst_INT8U Ps)
jmitc91516 0:a5c253316af6 957 {
jmitc91516 0:a5c253316af6 958 GuiConst_INT16S Result, D;
jmitc91516 0:a5c253316af6 959 #ifndef GuiConst_REMOTE_FONT_DATA
jmitc91516 0:a5c253316af6 960 GuiConst_INT8U PrefixRom *Ps1;
jmitc91516 0:a5c253316af6 961 GuiConst_INT8U PrefixRom *Ps2;
jmitc91516 0:a5c253316af6 962 #endif
jmitc91516 0:a5c253316af6 963 #ifdef GuiConst_REMOTE_FONT_DATA
jmitc91516 0:a5c253316af6 964 GuiConst_INT8U CharHeader1[GuiLib_CHR_LINECTRL_OFS];
jmitc91516 0:a5c253316af6 965 GuiConst_INT8U CharHeader2[GuiLib_CHR_LINECTRL_OFS];
jmitc91516 0:a5c253316af6 966 #endif
jmitc91516 0:a5c253316af6 967
jmitc91516 0:a5c253316af6 968 #ifdef GuiConst_REMOTE_FONT_DATA
jmitc91516 0:a5c253316af6 969 if (Ps == GuiLib_PS_OFF)
jmitc91516 0:a5c253316af6 970 return (sgl.CurFont->XSize);
jmitc91516 0:a5c253316af6 971 else if ((Ps == GuiLib_PS_ON) || (Ps == GuiLib_PS_NUM))
jmitc91516 0:a5c253316af6 972 {
jmitc91516 0:a5c253316af6 973 GuiLib_RemoteDataReadBlock(
jmitc91516 0:a5c253316af6 974 (GuiConst_INT32U PrefixRom)GuiFont_ChPtrList[sgl.TextCharNdx[ChPos1]],
jmitc91516 0:a5c253316af6 975 GuiLib_CHR_LINECTRL_OFS, CharHeader1);
jmitc91516 0:a5c253316af6 976 GuiLib_RemoteDataReadBlock(
jmitc91516 0:a5c253316af6 977 (GuiConst_INT32U PrefixRom)GuiFont_ChPtrList[sgl.TextCharNdx[ChPos2]],
jmitc91516 0:a5c253316af6 978 GuiLib_CHR_LINECTRL_OFS, CharHeader2);
jmitc91516 0:a5c253316af6 979 if ((Ps == GuiLib_PS_ON) || (sgl.TextPsMode[ChPos1] && sgl.TextPsMode[ChPos2]))
jmitc91516 0:a5c253316af6 980 {
jmitc91516 0:a5c253316af6 981 Result = CharHeader1[GuiLib_CHR_PSRIGHT_OFS + GuiLib_CHR_PS_TOP_OFS] -
jmitc91516 0:a5c253316af6 982 CharHeader2[GuiLib_CHR_PSLEFT_OFS + GuiLib_CHR_PS_TOP_OFS];
jmitc91516 0:a5c253316af6 983 D = CharHeader1[GuiLib_CHR_PSRIGHT_OFS + GuiLib_CHR_PS_MID_OFS] -
jmitc91516 0:a5c253316af6 984 CharHeader2[GuiLib_CHR_PSLEFT_OFS + GuiLib_CHR_PS_MID_OFS];
jmitc91516 0:a5c253316af6 985 if (D > Result)
jmitc91516 0:a5c253316af6 986 Result = D;
jmitc91516 0:a5c253316af6 987 D = CharHeader1[GuiLib_CHR_PSRIGHT_OFS + GuiLib_CHR_PS_MIDBASE_OFS] -
jmitc91516 0:a5c253316af6 988 CharHeader2[GuiLib_CHR_PSLEFT_OFS + GuiLib_CHR_PS_MIDBASE_OFS];
jmitc91516 0:a5c253316af6 989 if (D > Result)
jmitc91516 0:a5c253316af6 990 Result = D;
jmitc91516 0:a5c253316af6 991 D = CharHeader1[GuiLib_CHR_PSRIGHT_OFS + GuiLib_CHR_PS_BASE_OFS] -
jmitc91516 0:a5c253316af6 992 CharHeader2[GuiLib_CHR_PSLEFT_OFS + GuiLib_CHR_PS_BASE_OFS];
jmitc91516 0:a5c253316af6 993 if (D > Result)
jmitc91516 0:a5c253316af6 994 Result = D;
jmitc91516 0:a5c253316af6 995 D = CharHeader1[GuiLib_CHR_PSRIGHT_OFS + GuiLib_CHR_PS_BOTTOM_OFS] -
jmitc91516 0:a5c253316af6 996 CharHeader2[GuiLib_CHR_PSLEFT_OFS + GuiLib_CHR_PS_BOTTOM_OFS];
jmitc91516 0:a5c253316af6 997 if (D > Result)
jmitc91516 0:a5c253316af6 998 Result = D;
jmitc91516 0:a5c253316af6 999 return (Result + sgl.CurFont->PsSpace + 1);
jmitc91516 0:a5c253316af6 1000 }
jmitc91516 0:a5c253316af6 1001 else if (sgl.TextPsMode[ChPos1])
jmitc91516 0:a5c253316af6 1002 {
jmitc91516 0:a5c253316af6 1003 Result = CharHeader1[GuiLib_CHR_PSRIGHT_OFS + GuiLib_CHR_PS_TOP_OFS];
jmitc91516 0:a5c253316af6 1004 D = CharHeader1[GuiLib_CHR_PSRIGHT_OFS + GuiLib_CHR_PS_MID_OFS];
jmitc91516 0:a5c253316af6 1005 if (D > Result)
jmitc91516 0:a5c253316af6 1006 Result = D;
jmitc91516 0:a5c253316af6 1007 D = CharHeader1[GuiLib_CHR_PSRIGHT_OFS + GuiLib_CHR_PS_MIDBASE_OFS];
jmitc91516 0:a5c253316af6 1008 if (D > Result)
jmitc91516 0:a5c253316af6 1009 Result = D;
jmitc91516 0:a5c253316af6 1010 D = CharHeader1[GuiLib_CHR_PSRIGHT_OFS + GuiLib_CHR_PS_BASE_OFS];
jmitc91516 0:a5c253316af6 1011 if (D > Result)
jmitc91516 0:a5c253316af6 1012 Result = D;
jmitc91516 0:a5c253316af6 1013 D = CharHeader1[GuiLib_CHR_PSRIGHT_OFS + GuiLib_CHR_PS_BOTTOM_OFS];
jmitc91516 0:a5c253316af6 1014 if (D > Result)
jmitc91516 0:a5c253316af6 1015 Result = D;
jmitc91516 0:a5c253316af6 1016 return (Result + sgl.CurFont->PsSpace + 1);
jmitc91516 0:a5c253316af6 1017 }
jmitc91516 0:a5c253316af6 1018 else if (sgl.TextPsMode[ChPos2])
jmitc91516 0:a5c253316af6 1019 {
jmitc91516 0:a5c253316af6 1020 Result = CharHeader2[GuiLib_CHR_PSLEFT_OFS + GuiLib_CHR_PS_TOP_OFS];
jmitc91516 0:a5c253316af6 1021 D = CharHeader2[GuiLib_CHR_PSLEFT_OFS + GuiLib_CHR_PS_MID_OFS];
jmitc91516 0:a5c253316af6 1022 if (D < Result)
jmitc91516 0:a5c253316af6 1023 Result = D;
jmitc91516 0:a5c253316af6 1024 D = CharHeader2[GuiLib_CHR_PSLEFT_OFS + GuiLib_CHR_PS_MIDBASE_OFS];
jmitc91516 0:a5c253316af6 1025 if (D < Result)
jmitc91516 0:a5c253316af6 1026 Result = D;
jmitc91516 0:a5c253316af6 1027 D = CharHeader2[GuiLib_CHR_PSLEFT_OFS + GuiLib_CHR_PS_BASE_OFS];
jmitc91516 0:a5c253316af6 1028 if (D < Result)
jmitc91516 0:a5c253316af6 1029 Result = D;
jmitc91516 0:a5c253316af6 1030 D = CharHeader2[GuiLib_CHR_PSLEFT_OFS + GuiLib_CHR_PS_BOTTOM_OFS];
jmitc91516 0:a5c253316af6 1031 if (D < Result)
jmitc91516 0:a5c253316af6 1032 Result = D;
jmitc91516 0:a5c253316af6 1033 return (sgl.CurFont->PsNumWidth - Result + sgl.CurFont->PsSpace);
jmitc91516 0:a5c253316af6 1034 }
jmitc91516 0:a5c253316af6 1035 else
jmitc91516 0:a5c253316af6 1036 return (sgl.CurFont->PsNumWidth + sgl.CurFont->PsSpace);
jmitc91516 0:a5c253316af6 1037 }
jmitc91516 0:a5c253316af6 1038 else
jmitc91516 0:a5c253316af6 1039 return (0);
jmitc91516 0:a5c253316af6 1040 #else
jmitc91516 0:a5c253316af6 1041 if (Ps == GuiLib_PS_OFF)
jmitc91516 0:a5c253316af6 1042 return (ReadByte(sgl.CurFont->XSize));
jmitc91516 0:a5c253316af6 1043 else if ((Ps == GuiLib_PS_ON) || (Ps == GuiLib_PS_NUM))
jmitc91516 0:a5c253316af6 1044 {
jmitc91516 0:a5c253316af6 1045 if ((Ps == GuiLib_PS_ON) || (sgl.TextPsMode[ChPos1] && sgl.TextPsMode[ChPos2]))
jmitc91516 0:a5c253316af6 1046 {
jmitc91516 0:a5c253316af6 1047 Ps1 = sgl.TextCharPtrAry[ChPos1] + GuiLib_CHR_PSRIGHT_OFS;
jmitc91516 0:a5c253316af6 1048 Ps2 = sgl.TextCharPtrAry[ChPos2] + GuiLib_CHR_PSLEFT_OFS;
jmitc91516 0:a5c253316af6 1049 Result = (GuiConst_INT16S)(ReadBytePtr(Ps1 + GuiLib_CHR_PS_TOP_OFS)) -
jmitc91516 0:a5c253316af6 1050 (GuiConst_INT16S)(ReadBytePtr(Ps2 + GuiLib_CHR_PS_TOP_OFS));
jmitc91516 0:a5c253316af6 1051 D = (GuiConst_INT16S)(ReadBytePtr(Ps1 + GuiLib_CHR_PS_MID_OFS)) -
jmitc91516 0:a5c253316af6 1052 (GuiConst_INT16S)(ReadBytePtr(Ps2 + GuiLib_CHR_PS_MID_OFS));
jmitc91516 0:a5c253316af6 1053 if (D > Result)
jmitc91516 0:a5c253316af6 1054 Result = D;
jmitc91516 0:a5c253316af6 1055 D = (GuiConst_INT16S)(ReadBytePtr(Ps1 + GuiLib_CHR_PS_MIDBASE_OFS)) -
jmitc91516 0:a5c253316af6 1056 (GuiConst_INT16S)(ReadBytePtr(Ps2 + GuiLib_CHR_PS_MIDBASE_OFS));
jmitc91516 0:a5c253316af6 1057 if (D > Result)
jmitc91516 0:a5c253316af6 1058 Result = D;
jmitc91516 0:a5c253316af6 1059 D = (GuiConst_INT16S)(ReadBytePtr(Ps1 + GuiLib_CHR_PS_BASE_OFS)) -
jmitc91516 0:a5c253316af6 1060 (GuiConst_INT16S)(ReadBytePtr(Ps2 + GuiLib_CHR_PS_BASE_OFS));
jmitc91516 0:a5c253316af6 1061 if (D > Result)
jmitc91516 0:a5c253316af6 1062 Result = D;
jmitc91516 0:a5c253316af6 1063 D = (GuiConst_INT16S)(ReadBytePtr(Ps1 + GuiLib_CHR_PS_BOTTOM_OFS)) -
jmitc91516 0:a5c253316af6 1064 (GuiConst_INT16S)(ReadBytePtr(Ps2 + GuiLib_CHR_PS_BOTTOM_OFS));
jmitc91516 0:a5c253316af6 1065 if (D > Result)
jmitc91516 0:a5c253316af6 1066 Result = D;
jmitc91516 0:a5c253316af6 1067 return (Result + ReadByte(sgl.CurFont->PsSpace) + 1);
jmitc91516 0:a5c253316af6 1068 }
jmitc91516 0:a5c253316af6 1069 else if (sgl.TextPsMode[ChPos1])
jmitc91516 0:a5c253316af6 1070 {
jmitc91516 0:a5c253316af6 1071 Ps1 = sgl.TextCharPtrAry[ChPos1] + GuiLib_CHR_PSRIGHT_OFS;
jmitc91516 0:a5c253316af6 1072 Result = (GuiConst_INT16S)(ReadBytePtr(Ps1 + GuiLib_CHR_PS_TOP_OFS));
jmitc91516 0:a5c253316af6 1073 D = (GuiConst_INT16S)(ReadBytePtr(Ps1 + GuiLib_CHR_PS_MID_OFS));
jmitc91516 0:a5c253316af6 1074 if (D > Result)
jmitc91516 0:a5c253316af6 1075 Result = D;
jmitc91516 0:a5c253316af6 1076 D = (GuiConst_INT16S)(ReadBytePtr(Ps1 + GuiLib_CHR_PS_MIDBASE_OFS));
jmitc91516 0:a5c253316af6 1077 if (D > Result)
jmitc91516 0:a5c253316af6 1078 Result = D;
jmitc91516 0:a5c253316af6 1079 D = (GuiConst_INT16S)(ReadBytePtr(Ps1 + GuiLib_CHR_PS_BASE_OFS));
jmitc91516 0:a5c253316af6 1080 if (D > Result)
jmitc91516 0:a5c253316af6 1081 Result = D;
jmitc91516 0:a5c253316af6 1082 D = (GuiConst_INT16S)(ReadBytePtr(Ps1 + GuiLib_CHR_PS_BOTTOM_OFS));
jmitc91516 0:a5c253316af6 1083 if (D > Result)
jmitc91516 0:a5c253316af6 1084 Result = D;
jmitc91516 0:a5c253316af6 1085 return (Result + ReadByte(sgl.CurFont->PsSpace) + 1);
jmitc91516 0:a5c253316af6 1086 }
jmitc91516 0:a5c253316af6 1087 else if (sgl.TextPsMode[ChPos2])
jmitc91516 0:a5c253316af6 1088 {
jmitc91516 0:a5c253316af6 1089 Ps2 = sgl.TextCharPtrAry[ChPos2] + GuiLib_CHR_PSLEFT_OFS;
jmitc91516 0:a5c253316af6 1090 Result = (GuiConst_INT16S)(ReadBytePtr(Ps2 + GuiLib_CHR_PS_TOP_OFS));
jmitc91516 0:a5c253316af6 1091 D = (GuiConst_INT16S)(ReadBytePtr(Ps2 + GuiLib_CHR_PS_MID_OFS));
jmitc91516 0:a5c253316af6 1092 if (D < Result)
jmitc91516 0:a5c253316af6 1093 Result = D;
jmitc91516 0:a5c253316af6 1094 D = (GuiConst_INT16S)(ReadBytePtr(Ps2 + GuiLib_CHR_PS_MIDBASE_OFS));
jmitc91516 0:a5c253316af6 1095 if (D < Result)
jmitc91516 0:a5c253316af6 1096 Result = D;
jmitc91516 0:a5c253316af6 1097 D = (GuiConst_INT16S)(ReadBytePtr(Ps2 + GuiLib_CHR_PS_BASE_OFS));
jmitc91516 0:a5c253316af6 1098 if (D < Result)
jmitc91516 0:a5c253316af6 1099 Result = D;
jmitc91516 0:a5c253316af6 1100 D = (GuiConst_INT16S)(ReadBytePtr(Ps2 + GuiLib_CHR_PS_BOTTOM_OFS));
jmitc91516 0:a5c253316af6 1101 if (D < Result)
jmitc91516 0:a5c253316af6 1102 Result = D;
jmitc91516 0:a5c253316af6 1103 return (ReadByte(sgl.CurFont->PsNumWidth) - Result +
jmitc91516 0:a5c253316af6 1104 ReadByte(sgl.CurFont->PsSpace));
jmitc91516 0:a5c253316af6 1105 }
jmitc91516 0:a5c253316af6 1106 else
jmitc91516 0:a5c253316af6 1107 return (ReadByte(sgl.CurFont->PsNumWidth) +
jmitc91516 0:a5c253316af6 1108 ReadByte(sgl.CurFont->PsSpace));
jmitc91516 0:a5c253316af6 1109 }
jmitc91516 0:a5c253316af6 1110 else
jmitc91516 0:a5c253316af6 1111 return (0);
jmitc91516 0:a5c253316af6 1112 #endif
jmitc91516 0:a5c253316af6 1113 }
jmitc91516 0:a5c253316af6 1114
jmitc91516 0:a5c253316af6 1115 //------------------------------------------------------------------------------
jmitc91516 0:a5c253316af6 1116 static GuiConst_INT16S TextPixelLength(
jmitc91516 0:a5c253316af6 1117 GuiConst_INT8U Ps,
jmitc91516 0:a5c253316af6 1118 GuiConst_INT16U CharCnt,
jmitc91516 0:a5c253316af6 1119 GuiConst_INT16S *TextXOfs)
jmitc91516 0:a5c253316af6 1120 {
jmitc91516 0:a5c253316af6 1121 GuiConst_INT16U P;
jmitc91516 0:a5c253316af6 1122 GuiConst_INT16S L;
jmitc91516 0:a5c253316af6 1123 #ifdef GuiConst_REMOTE_FONT_DATA
jmitc91516 0:a5c253316af6 1124 GuiConst_INT8U CharHeader1[GuiLib_CHR_LINECTRL_OFS + 1];
jmitc91516 0:a5c253316af6 1125 GuiConst_INT8U CharHeader2[GuiLib_CHR_LINECTRL_OFS + 1];
jmitc91516 0:a5c253316af6 1126 #endif
jmitc91516 0:a5c253316af6 1127
jmitc91516 0:a5c253316af6 1128 if (CharCnt == 0)
jmitc91516 0:a5c253316af6 1129 return (0);
jmitc91516 0:a5c253316af6 1130 else
jmitc91516 0:a5c253316af6 1131 {
jmitc91516 0:a5c253316af6 1132 #ifdef GuiConst_REMOTE_FONT_DATA
jmitc91516 0:a5c253316af6 1133 GuiLib_RemoteDataReadBlock(
jmitc91516 0:a5c253316af6 1134 (GuiConst_INT32U PrefixRom)GuiFont_ChPtrList[sgl.TextCharNdx[0]],
jmitc91516 0:a5c253316af6 1135 GuiLib_CHR_LINECTRL_OFS + 1, CharHeader1);
jmitc91516 0:a5c253316af6 1136 GuiLib_RemoteDataReadBlock(
jmitc91516 0:a5c253316af6 1137 (GuiConst_INT32U PrefixRom)GuiFont_ChPtrList[sgl.TextCharNdx[CharCnt - 1]],
jmitc91516 0:a5c253316af6 1138 GuiLib_CHR_LINECTRL_OFS + 1, CharHeader2);
jmitc91516 0:a5c253316af6 1139 #endif
jmitc91516 0:a5c253316af6 1140
jmitc91516 0:a5c253316af6 1141 if (sgl.TextPsMode[0])
jmitc91516 0:a5c253316af6 1142 {
jmitc91516 0:a5c253316af6 1143 #ifdef GuiConst_REMOTE_FONT_DATA
jmitc91516 0:a5c253316af6 1144 if (CharHeader1[GuiLib_CHR_LINECTRL_OFS] & 0x01)
jmitc91516 0:a5c253316af6 1145 L = -(GuiConst_INT16S)CharHeader1[GuiLib_CHR_PSLEFT_OFS];
jmitc91516 0:a5c253316af6 1146 else
jmitc91516 0:a5c253316af6 1147 L = -(GuiConst_INT16S)CharHeader1[GuiLib_CHR_XLEFT_OFS];
jmitc91516 0:a5c253316af6 1148 #else
jmitc91516 0:a5c253316af6 1149 if (ReadBytePtr(sgl.TextCharPtrAry[0] + GuiLib_CHR_LINECTRL_OFS) & 0x01)
jmitc91516 0:a5c253316af6 1150 L = -(GuiConst_INT16S)(ReadBytePtr(sgl.TextCharPtrAry[0] +
jmitc91516 0:a5c253316af6 1151 GuiLib_CHR_PSLEFT_OFS));
jmitc91516 0:a5c253316af6 1152 else
jmitc91516 0:a5c253316af6 1153 L = -(GuiConst_INT16S)(ReadBytePtr(sgl.TextCharPtrAry[0] +
jmitc91516 0:a5c253316af6 1154 GuiLib_CHR_XLEFT_OFS));
jmitc91516 0:a5c253316af6 1155 #endif
jmitc91516 0:a5c253316af6 1156 }
jmitc91516 0:a5c253316af6 1157 else
jmitc91516 0:a5c253316af6 1158 L = 0;
jmitc91516 0:a5c253316af6 1159
jmitc91516 0:a5c253316af6 1160 if (TextXOfs != NULL)
jmitc91516 0:a5c253316af6 1161 TextXOfs[0] = L;
jmitc91516 0:a5c253316af6 1162
jmitc91516 0:a5c253316af6 1163 for (P = 0; P < CharCnt - 1; P++)
jmitc91516 0:a5c253316af6 1164 {
jmitc91516 0:a5c253316af6 1165 L += CharDist (P, P + 1, Ps);
jmitc91516 0:a5c253316af6 1166 if (TextXOfs != NULL)
jmitc91516 0:a5c253316af6 1167 TextXOfs[P + 1] = L;
jmitc91516 0:a5c253316af6 1168 }
jmitc91516 0:a5c253316af6 1169
jmitc91516 0:a5c253316af6 1170 #ifdef GuiConst_REMOTE_FONT_DATA
jmitc91516 0:a5c253316af6 1171 if (sgl.TextPsMode[CharCnt - 1])
jmitc91516 0:a5c253316af6 1172 {
jmitc91516 0:a5c253316af6 1173 if (CharHeader2[GuiLib_CHR_LINECTRL_OFS] & 0x01)
jmitc91516 0:a5c253316af6 1174 L += (GuiConst_INT16S)CharHeader2[GuiLib_CHR_PSRIGHT_OFS] + 1;
jmitc91516 0:a5c253316af6 1175 else
jmitc91516 0:a5c253316af6 1176 L += (GuiConst_INT16S)CharHeader2[GuiLib_CHR_XLEFT_OFS] +
jmitc91516 0:a5c253316af6 1177 (GuiConst_INT16S)CharHeader2[GuiLib_CHR_XWIDTH_OFS];
jmitc91516 0:a5c253316af6 1178 }
jmitc91516 0:a5c253316af6 1179 else if (Ps == GuiLib_PS_NUM)
jmitc91516 0:a5c253316af6 1180 {
jmitc91516 0:a5c253316af6 1181 if (CharHeader2[GuiLib_CHR_LINECTRL_OFS] & 0x01)
jmitc91516 0:a5c253316af6 1182 L += (GuiConst_INT16S)CharHeader2[GuiLib_CHR_PSRIGHT_OFS] + 1;
jmitc91516 0:a5c253316af6 1183 else
jmitc91516 0:a5c253316af6 1184 L += sgl.CurFont->PsNumWidth + sgl.CurFont->PsSpace;
jmitc91516 0:a5c253316af6 1185 }
jmitc91516 0:a5c253316af6 1186 else
jmitc91516 0:a5c253316af6 1187 L += sgl.CurFont->XSize;
jmitc91516 0:a5c253316af6 1188 #else
jmitc91516 0:a5c253316af6 1189 if (sgl.TextPsMode[CharCnt - 1])
jmitc91516 0:a5c253316af6 1190 {
jmitc91516 0:a5c253316af6 1191 if (ReadBytePtr(sgl.TextCharPtrAry[CharCnt - 1] + GuiLib_CHR_LINECTRL_OFS) & 0x01)
jmitc91516 0:a5c253316af6 1192 L += (GuiConst_INT16S)(ReadBytePtr(sgl.TextCharPtrAry[CharCnt - 1] +
jmitc91516 0:a5c253316af6 1193 GuiLib_CHR_PSRIGHT_OFS)) + 1;
jmitc91516 0:a5c253316af6 1194 else
jmitc91516 0:a5c253316af6 1195 L += ReadBytePtr(sgl.TextCharPtrAry[CharCnt - 1] + GuiLib_CHR_XLEFT_OFS) +
jmitc91516 0:a5c253316af6 1196 ReadBytePtr(sgl.TextCharPtrAry[CharCnt - 1] + GuiLib_CHR_XWIDTH_OFS);
jmitc91516 0:a5c253316af6 1197 }
jmitc91516 0:a5c253316af6 1198 else if (Ps == GuiLib_PS_NUM)
jmitc91516 0:a5c253316af6 1199 {
jmitc91516 0:a5c253316af6 1200 if (ReadBytePtr(sgl.TextCharPtrAry[CharCnt - 1] +
jmitc91516 0:a5c253316af6 1201 GuiLib_CHR_LINECTRL_OFS) & 0x01)
jmitc91516 0:a5c253316af6 1202 L += (GuiConst_INT16S)(ReadBytePtr(sgl.TextCharPtrAry[CharCnt - 1] +
jmitc91516 0:a5c253316af6 1203 GuiLib_CHR_PSRIGHT_OFS)) + 1;
jmitc91516 0:a5c253316af6 1204 else
jmitc91516 0:a5c253316af6 1205 L += ReadByte(sgl.CurFont->PsNumWidth) +
jmitc91516 0:a5c253316af6 1206 ReadByte(sgl.CurFont->PsSpace);
jmitc91516 0:a5c253316af6 1207 }
jmitc91516 0:a5c253316af6 1208 else
jmitc91516 0:a5c253316af6 1209 L += ReadByte(sgl.CurFont->XSize);
jmitc91516 0:a5c253316af6 1210 #endif
jmitc91516 0:a5c253316af6 1211 if (TextXOfs != NULL)
jmitc91516 0:a5c253316af6 1212 TextXOfs[CharCnt] = L;
jmitc91516 0:a5c253316af6 1213 return (L);
jmitc91516 0:a5c253316af6 1214 }
jmitc91516 0:a5c253316af6 1215 }
jmitc91516 0:a5c253316af6 1216
jmitc91516 0:a5c253316af6 1217 //------------------------------------------------------------------------------
jmitc91516 0:a5c253316af6 1218 static GuiConst_INT16U CalcCharsWidth(
jmitc91516 0:a5c253316af6 1219 GuiConst_INT16U CharPos1,
jmitc91516 0:a5c253316af6 1220 GuiConst_INT16U CharPos2,
jmitc91516 0:a5c253316af6 1221 GuiConst_INT16S *TextXOfs,
jmitc91516 0:a5c253316af6 1222 GuiConst_INT16S *pXStart,
jmitc91516 0:a5c253316af6 1223 GuiConst_INT16S *pXEnd)
jmitc91516 0:a5c253316af6 1224 {
jmitc91516 0:a5c253316af6 1225 GuiConst_INT16S X1;
jmitc91516 0:a5c253316af6 1226 GuiConst_INT16S X2;
jmitc91516 0:a5c253316af6 1227
jmitc91516 0:a5c253316af6 1228 #ifdef GuiConst_REMOTE_FONT_DATA
jmitc91516 0:a5c253316af6 1229 GuiConst_INT8U CharHeader1[GuiLib_CHR_LINECTRL_OFS+1];
jmitc91516 0:a5c253316af6 1230 GuiConst_INT8U CharHeader2[GuiLib_CHR_LINECTRL_OFS+1];
jmitc91516 0:a5c253316af6 1231
jmitc91516 0:a5c253316af6 1232 GuiLib_RemoteDataReadBlock(
jmitc91516 0:a5c253316af6 1233 (GuiConst_INT32U PrefixRom)GuiFont_ChPtrList[sgl.TextCharNdx[CharPos1]],
jmitc91516 0:a5c253316af6 1234 GuiLib_CHR_LINECTRL_OFS+1, CharHeader1);
jmitc91516 0:a5c253316af6 1235 GuiLib_RemoteDataReadBlock(
jmitc91516 0:a5c253316af6 1236 (GuiConst_INT32U PrefixRom)GuiFont_ChPtrList[sgl.TextCharNdx[CharPos2]],
jmitc91516 0:a5c253316af6 1237 GuiLib_CHR_LINECTRL_OFS+1, CharHeader2);
jmitc91516 0:a5c253316af6 1238
jmitc91516 0:a5c253316af6 1239 if (sgl.TextPsMode[CharPos1])
jmitc91516 0:a5c253316af6 1240 {
jmitc91516 0:a5c253316af6 1241 if (CharHeader1[GuiLib_CHR_LINECTRL_OFS] & 0x01)
jmitc91516 0:a5c253316af6 1242 X1 = TextXOfs[CharPos1] +
jmitc91516 0:a5c253316af6 1243 (GuiConst_INT16S)CharHeader1[GuiLib_CHR_PSLEFT_OFS];
jmitc91516 0:a5c253316af6 1244 else
jmitc91516 0:a5c253316af6 1245 X1 = TextXOfs[CharPos1] +
jmitc91516 0:a5c253316af6 1246 (GuiConst_INT16S)CharHeader1[GuiLib_CHR_XLEFT_OFS];
jmitc91516 0:a5c253316af6 1247 }
jmitc91516 0:a5c253316af6 1248 else
jmitc91516 0:a5c253316af6 1249 X1 = TextXOfs[CharPos1];
jmitc91516 0:a5c253316af6 1250 if (sgl.TextPsMode[CharPos2])
jmitc91516 0:a5c253316af6 1251 {
jmitc91516 0:a5c253316af6 1252 if (CharHeader2[GuiLib_CHR_LINECTRL_OFS] & 0x01)
jmitc91516 0:a5c253316af6 1253 X2 = TextXOfs[CharPos2] +
jmitc91516 0:a5c253316af6 1254 (GuiConst_INT16S)CharHeader2[GuiLib_CHR_PSRIGHT_OFS];
jmitc91516 0:a5c253316af6 1255 else
jmitc91516 0:a5c253316af6 1256 X2 = TextXOfs[CharPos2] +
jmitc91516 0:a5c253316af6 1257 (GuiConst_INT16S)CharHeader1[GuiLib_CHR_XLEFT_OFS] +
jmitc91516 0:a5c253316af6 1258 (GuiConst_INT16S)CharHeader2[GuiLib_CHR_XWIDTH_OFS] - 1;
jmitc91516 0:a5c253316af6 1259 }
jmitc91516 0:a5c253316af6 1260 else
jmitc91516 0:a5c253316af6 1261 X2 = TextXOfs[CharPos2] + sgl.CurFont->XSize - 1;
jmitc91516 0:a5c253316af6 1262 #else
jmitc91516 0:a5c253316af6 1263 if (sgl.TextPsMode[CharPos1])
jmitc91516 0:a5c253316af6 1264 {
jmitc91516 0:a5c253316af6 1265 if (ReadBytePtr(sgl.TextCharPtrAry[CharPos1] +
jmitc91516 0:a5c253316af6 1266 GuiLib_CHR_LINECTRL_OFS) & 0x01)
jmitc91516 0:a5c253316af6 1267 X1 = TextXOfs[CharPos1] +
jmitc91516 0:a5c253316af6 1268 (GuiConst_INT16S)(ReadBytePtr(sgl.TextCharPtrAry[CharPos1] +
jmitc91516 0:a5c253316af6 1269 GuiLib_CHR_PSLEFT_OFS));
jmitc91516 0:a5c253316af6 1270 else
jmitc91516 0:a5c253316af6 1271 X1 = TextXOfs[CharPos1] +
jmitc91516 0:a5c253316af6 1272 (GuiConst_INT16S)(ReadBytePtr(sgl.TextCharPtrAry[CharPos1] +
jmitc91516 0:a5c253316af6 1273 GuiLib_CHR_XLEFT_OFS));
jmitc91516 0:a5c253316af6 1274 }
jmitc91516 0:a5c253316af6 1275 else
jmitc91516 0:a5c253316af6 1276 X1 = TextXOfs[CharPos1];
jmitc91516 0:a5c253316af6 1277 if (sgl.TextPsMode[CharPos2])
jmitc91516 0:a5c253316af6 1278 {
jmitc91516 0:a5c253316af6 1279 if (ReadBytePtr(sgl.TextCharPtrAry[CharPos2] +
jmitc91516 0:a5c253316af6 1280 GuiLib_CHR_LINECTRL_OFS) & 0x01)
jmitc91516 0:a5c253316af6 1281 X2 = TextXOfs[CharPos2] +
jmitc91516 0:a5c253316af6 1282 (GuiConst_INT16S)(ReadBytePtr(sgl.TextCharPtrAry[CharPos2] +
jmitc91516 0:a5c253316af6 1283 GuiLib_CHR_PSRIGHT_OFS));
jmitc91516 0:a5c253316af6 1284 else
jmitc91516 0:a5c253316af6 1285 X2 = TextXOfs[CharPos2] +
jmitc91516 0:a5c253316af6 1286 (GuiConst_INT16S)(ReadBytePtr(sgl.TextCharPtrAry[CharPos2] +
jmitc91516 0:a5c253316af6 1287 GuiLib_CHR_XLEFT_OFS)) +
jmitc91516 0:a5c253316af6 1288 (GuiConst_INT16S)(ReadBytePtr(sgl.TextCharPtrAry[CharPos2] +
jmitc91516 0:a5c253316af6 1289 GuiLib_CHR_XWIDTH_OFS)) - 1;
jmitc91516 0:a5c253316af6 1290 }
jmitc91516 0:a5c253316af6 1291 else
jmitc91516 0:a5c253316af6 1292 X2 = TextXOfs[CharPos2] + sgl.CurFont->XSize - 1;
jmitc91516 0:a5c253316af6 1293 #endif
jmitc91516 0:a5c253316af6 1294
jmitc91516 0:a5c253316af6 1295 *pXStart = X1;
jmitc91516 0:a5c253316af6 1296 *pXEnd = X2;
jmitc91516 0:a5c253316af6 1297 return(X2 - X1 + 1);
jmitc91516 0:a5c253316af6 1298 }
jmitc91516 0:a5c253316af6 1299
jmitc91516 0:a5c253316af6 1300 #ifdef GuiConst_CHARMODE_UNICODE
jmitc91516 0:a5c253316af6 1301 //------------------------------------------------------------------------------
jmitc91516 0:a5c253316af6 1302 static GuiConst_INT32U GetCharNdx(
jmitc91516 0:a5c253316af6 1303 GuiLib_FontRecPtr Font,
jmitc91516 0:a5c253316af6 1304 GuiConst_INT16U CharCode)
jmitc91516 0:a5c253316af6 1305 {
jmitc91516 0:a5c253316af6 1306 GuiConst_INT32U CharNdx,CharNdx1,CharNdx2;
jmitc91516 0:a5c253316af6 1307 GuiConst_INT32U ReturnValue;
jmitc91516 0:a5c253316af6 1308
jmitc91516 0:a5c253316af6 1309 CharNdx1 = ReadWord(Font->FirstCharNdx) + 1;
jmitc91516 0:a5c253316af6 1310 CharNdx2 = CharNdx1 + ReadWord(Font->CharCount) - 1;
jmitc91516 0:a5c253316af6 1311
jmitc91516 0:a5c253316af6 1312 ReturnValue = 0;
jmitc91516 0:a5c253316af6 1313
jmitc91516 0:a5c253316af6 1314 do
jmitc91516 0:a5c253316af6 1315 {
jmitc91516 0:a5c253316af6 1316 CharNdx = CharNdx1 + ((CharNdx2 - CharNdx1) >> 1);
jmitc91516 0:a5c253316af6 1317
jmitc91516 0:a5c253316af6 1318 if (ReadWord(GuiFont_ChUnicodeList[CharNdx]) == CharCode)
jmitc91516 0:a5c253316af6 1319 {
jmitc91516 0:a5c253316af6 1320 ReturnValue = CharNdx;
jmitc91516 0:a5c253316af6 1321 break;
jmitc91516 0:a5c253316af6 1322 }
jmitc91516 0:a5c253316af6 1323
jmitc91516 0:a5c253316af6 1324 if (CharNdx1 == CharNdx2)
jmitc91516 0:a5c253316af6 1325 {
jmitc91516 0:a5c253316af6 1326 ReturnValue = ReadWord(Font->FirstCharNdx);
jmitc91516 0:a5c253316af6 1327 break;
jmitc91516 0:a5c253316af6 1328 }
jmitc91516 0:a5c253316af6 1329
jmitc91516 0:a5c253316af6 1330 if (ReadWord(GuiFont_ChUnicodeList[CharNdx]) > CharCode)
jmitc91516 0:a5c253316af6 1331 CharNdx2 = CharNdx - 1;
jmitc91516 0:a5c253316af6 1332 else
jmitc91516 0:a5c253316af6 1333 CharNdx1 = CharNdx + 1;
jmitc91516 0:a5c253316af6 1334
jmitc91516 0:a5c253316af6 1335 if (CharNdx1 > CharNdx2)
jmitc91516 0:a5c253316af6 1336 {
jmitc91516 0:a5c253316af6 1337 ReturnValue = ReadWord(Font->FirstCharNdx);
jmitc91516 0:a5c253316af6 1338 break;
jmitc91516 0:a5c253316af6 1339 }
jmitc91516 0:a5c253316af6 1340 }
jmitc91516 0:a5c253316af6 1341 while (1);
jmitc91516 0:a5c253316af6 1342
jmitc91516 0:a5c253316af6 1343 return ReturnValue;
jmitc91516 0:a5c253316af6 1344 }
jmitc91516 0:a5c253316af6 1345 #endif
jmitc91516 0:a5c253316af6 1346
jmitc91516 0:a5c253316af6 1347 //------------------------------------------------------------------------------
jmitc91516 0:a5c253316af6 1348 static void PrepareText(
jmitc91516 0:a5c253316af6 1349 GuiConst_TEXT PrefixGeneric *CharPtr,
jmitc91516 0:a5c253316af6 1350 GuiConst_INT16U CharCnt,
jmitc91516 0:a5c253316af6 1351 GuiConst_INT8U TextNdx)
jmitc91516 0:a5c253316af6 1352 {
jmitc91516 0:a5c253316af6 1353 GuiConst_INT16S P;
jmitc91516 0:a5c253316af6 1354 #ifdef GuiConst_CHARMODE_ANSI
jmitc91516 0:a5c253316af6 1355 GuiConst_INT8U CharCode;
jmitc91516 0:a5c253316af6 1356 #else
jmitc91516 0:a5c253316af6 1357 GuiConst_INT16U CharCode;
jmitc91516 0:a5c253316af6 1358 GuiConst_INT16U CharNdx;
jmitc91516 0:a5c253316af6 1359 #endif
jmitc91516 0:a5c253316af6 1360
jmitc91516 0:a5c253316af6 1361 if (CharCnt > GuiConst_MAX_TEXT_LEN)
jmitc91516 0:a5c253316af6 1362 CharCnt = GuiConst_MAX_TEXT_LEN;
jmitc91516 0:a5c253316af6 1363
jmitc91516 0:a5c253316af6 1364 for (P = 0; P < CharCnt; P++)
jmitc91516 0:a5c253316af6 1365 {
jmitc91516 0:a5c253316af6 1366 #ifdef GuiConst_CHARMODE_ANSI
jmitc91516 0:a5c253316af6 1367
jmitc91516 0:a5c253316af6 1368 #ifdef GuiConst_AVRGCC_COMPILER
jmitc91516 0:a5c253316af6 1369 if (displayVarNow)
jmitc91516 0:a5c253316af6 1370 CharCode = (unsigned GuiConst_CHAR) *CharPtr;
jmitc91516 0:a5c253316af6 1371 else
jmitc91516 0:a5c253316af6 1372 CharCode = (unsigned GuiConst_CHAR) ReadBytePtr(CharPtr);
jmitc91516 0:a5c253316af6 1373 #else
jmitc91516 0:a5c253316af6 1374 #ifdef GuiConst_ICC_COMPILER
jmitc91516 0:a5c253316af6 1375 if (displayVarNow)
jmitc91516 0:a5c253316af6 1376 CharCode = (unsigned GuiConst_CHAR) *CharPtr;
jmitc91516 0:a5c253316af6 1377 else
jmitc91516 0:a5c253316af6 1378 CharCode = *((GuiConst_INT8U PrefixRom *)CharPtr);
jmitc91516 0:a5c253316af6 1379 #else
jmitc91516 0:a5c253316af6 1380 #ifdef GuiConst_CODEVISION_COMPILER
jmitc91516 0:a5c253316af6 1381 if (displayVarNow)
jmitc91516 0:a5c253316af6 1382 CharCode = (unsigned GuiConst_CHAR) *CharPtr;
jmitc91516 0:a5c253316af6 1383 else
jmitc91516 0:a5c253316af6 1384 CharCode = *((GuiConst_INT8U PrefixRom *)CharPtr);
jmitc91516 0:a5c253316af6 1385 #else
jmitc91516 0:a5c253316af6 1386 #ifdef GuiConst_RENESAS_COMPILER_FAR
jmitc91516 0:a5c253316af6 1387 if (displayVarNow)
jmitc91516 0:a5c253316af6 1388 CharCode = (unsigned GuiConst_CHAR) *CharPtr;
jmitc91516 0:a5c253316af6 1389 else
jmitc91516 0:a5c253316af6 1390 CharCode = *((GuiConst_INT8U PrefixRom *)CharPtr);
jmitc91516 0:a5c253316af6 1391 #else
jmitc91516 0:a5c253316af6 1392 CharCode = (unsigned GuiConst_TEXT) *CharPtr;
jmitc91516 0:a5c253316af6 1393 #endif // GuiConst_RENESAS_COMPILER_FAR
jmitc91516 0:a5c253316af6 1394 #endif // GuiConst_CODEVISION_COMPILER
jmitc91516 0:a5c253316af6 1395 #endif // GuiConst_ICC_COMPILER
jmitc91516 0:a5c253316af6 1396 #endif // GuiConst_AVRGCC_COMPILER
jmitc91516 0:a5c253316af6 1397
jmitc91516 0:a5c253316af6 1398 #ifdef GuiConst_REMOTE_FONT_DATA
jmitc91516 0:a5c253316af6 1399 if ((CharCode < sgl.CurFont->FirstChar) ||
jmitc91516 0:a5c253316af6 1400 (CharCode > sgl.CurFont->LastChar))
jmitc91516 0:a5c253316af6 1401 sgl.TextCharNdx[P] = sgl.CurFont->IllegalCharNdx;
jmitc91516 0:a5c253316af6 1402 else
jmitc91516 0:a5c253316af6 1403 {
jmitc91516 0:a5c253316af6 1404 sgl.TextCharNdx[P] =
jmitc91516 0:a5c253316af6 1405 sgl.CurFont->FirstCharNdx + (GuiConst_INT16U)CharCode -
jmitc91516 0:a5c253316af6 1406 (GuiConst_INT16U)sgl.CurFont->FirstChar;
jmitc91516 0:a5c253316af6 1407
jmitc91516 0:a5c253316af6 1408 if ((GuiConst_INT32U PrefixRom)GuiFont_ChPtrList[sgl.TextCharNdx[P] + 1] -
jmitc91516 0:a5c253316af6 1409 (GuiConst_INT32U PrefixRom)GuiFont_ChPtrList[sgl.TextCharNdx[P]] == 0)
jmitc91516 0:a5c253316af6 1410 sgl.TextCharNdx[P] = sgl.CurFont->IllegalCharNdx;
jmitc91516 0:a5c253316af6 1411 }
jmitc91516 0:a5c253316af6 1412 #else // GuiConst_REMOTE_FONT_DATA
jmitc91516 0:a5c253316af6 1413 if ((CharCode < ReadByte(sgl.CurFont->FirstChar)) ||
jmitc91516 0:a5c253316af6 1414 (CharCode > ReadByte(sgl.CurFont->LastChar)))
jmitc91516 0:a5c253316af6 1415 sgl.TextCharPtrAry[P] = (GuiConst_INT8U*)ReadWord(
jmitc91516 0:a5c253316af6 1416 GuiFont_ChPtrList[ReadWord(sgl.CurFont->IllegalCharNdx)]);
jmitc91516 0:a5c253316af6 1417 else
jmitc91516 0:a5c253316af6 1418 sgl.TextCharPtrAry[P] = (GuiConst_INT8U*)ReadWord(
jmitc91516 0:a5c253316af6 1419 GuiFont_ChPtrList[ReadWord(sgl.CurFont->FirstCharNdx) +
jmitc91516 0:a5c253316af6 1420 (GuiConst_INT16U)CharCode -
jmitc91516 0:a5c253316af6 1421 (GuiConst_INT16U)ReadByte(sgl.CurFont->FirstChar)]);
jmitc91516 0:a5c253316af6 1422 #endif // GuiConst_REMOTE_FONT_DATA
jmitc91516 0:a5c253316af6 1423
jmitc91516 0:a5c253316af6 1424 if (sgl.CurItem.TextPar[TextNdx].Ps == GuiLib_PS_ON)
jmitc91516 0:a5c253316af6 1425 sgl.TextPsMode[P] = 1;
jmitc91516 0:a5c253316af6 1426 else if (sgl.CurItem.TextPar[TextNdx].Ps == GuiLib_PS_NUM)
jmitc91516 0:a5c253316af6 1427 {
jmitc91516 0:a5c253316af6 1428 if (((CharCode >= '0') && (CharCode <= '9')) ||
jmitc91516 0:a5c253316af6 1429 (CharCode == ' ') || (CharCode == '+') || (CharCode == '-') ||
jmitc91516 0:a5c253316af6 1430 (CharCode == '*') || (CharCode == '/') || (CharCode == '='))
jmitc91516 0:a5c253316af6 1431 sgl.TextPsMode[P] = 0;
jmitc91516 0:a5c253316af6 1432 else
jmitc91516 0:a5c253316af6 1433 sgl.TextPsMode[P] = 1;
jmitc91516 0:a5c253316af6 1434 }
jmitc91516 0:a5c253316af6 1435 else
jmitc91516 0:a5c253316af6 1436 sgl.TextPsMode[P] = 0;
jmitc91516 0:a5c253316af6 1437
jmitc91516 0:a5c253316af6 1438 #else // GuiConst_CHARMODE_ANSI
jmitc91516 0:a5c253316af6 1439 CharCode = *((PrefixLocate GuiConst_INT16U*)CharPtr);
jmitc91516 0:a5c253316af6 1440 CharNdx = GetCharNdx(sgl.CurFont, CharCode);
jmitc91516 0:a5c253316af6 1441
jmitc91516 0:a5c253316af6 1442 #ifdef GuiConst_REMOTE_FONT_DATA
jmitc91516 0:a5c253316af6 1443 sgl.TextCharNdx[P] = CharNdx;
jmitc91516 0:a5c253316af6 1444 #else
jmitc91516 0:a5c253316af6 1445 sgl.TextCharPtrAry[P] =
jmitc91516 0:a5c253316af6 1446 (GuiConst_INT8U PrefixRom *)ReadWord(GuiFont_ChPtrList[CharNdx]);
jmitc91516 0:a5c253316af6 1447 #endif
jmitc91516 0:a5c253316af6 1448
jmitc91516 0:a5c253316af6 1449 if (sgl.CurItem.TextPar[TextNdx].Ps == GuiLib_PS_ON)
jmitc91516 0:a5c253316af6 1450 sgl.TextPsMode[P] = 1;
jmitc91516 0:a5c253316af6 1451 else if ((sgl.CurItem.TextPar[TextNdx].Ps == GuiLib_PS_NUM) && (CharNdx > 0))
jmitc91516 0:a5c253316af6 1452 {
jmitc91516 0:a5c253316af6 1453 if (((CharCode >= '0') && (CharCode <= '9')) ||
jmitc91516 0:a5c253316af6 1454 (CharCode == ' ') || (CharCode == '+') || (CharCode == '-') ||
jmitc91516 0:a5c253316af6 1455 (CharCode == '*') || (CharCode == '/') || (CharCode == '='))
jmitc91516 0:a5c253316af6 1456 sgl.TextPsMode[P] = 0;
jmitc91516 0:a5c253316af6 1457 else
jmitc91516 0:a5c253316af6 1458 sgl.TextPsMode[P] = 1;
jmitc91516 0:a5c253316af6 1459 }
jmitc91516 0:a5c253316af6 1460 else
jmitc91516 0:a5c253316af6 1461 sgl.TextPsMode[P] = 0;
jmitc91516 0:a5c253316af6 1462 #endif // GuiConst_CHARMODE_ANSI
jmitc91516 0:a5c253316af6 1463 CharPtr++;
jmitc91516 0:a5c253316af6 1464 }
jmitc91516 0:a5c253316af6 1465 }
jmitc91516 0:a5c253316af6 1466
jmitc91516 0:a5c253316af6 1467 #ifdef GuiConst_ARAB_CHARS_INUSE
jmitc91516 0:a5c253316af6 1468 //------------------------------------------------------------------------------
jmitc91516 0:a5c253316af6 1469 static GuiConst_INT16U ArabicCorrection(
jmitc91516 0:a5c253316af6 1470 GuiConst_TEXT PrefixGeneric *CharPtr,
jmitc91516 0:a5c253316af6 1471 GuiConst_INT16U CharCnt,
jmitc91516 0:a5c253316af6 1472 GuiConst_INT8U RightToLeftWriting)
jmitc91516 0:a5c253316af6 1473 {
jmitc91516 0:a5c253316af6 1474 GuiConst_INT16S I, J, P;
jmitc91516 0:a5c253316af6 1475 GuiConst_INT16U CharCode;
jmitc91516 0:a5c253316af6 1476 GuiConst_INT16U CharCode2;
jmitc91516 0:a5c253316af6 1477 GuiConst_TEXT PrefixLocate *CharPtr2;
jmitc91516 0:a5c253316af6 1478 GuiConst_TEXT PrefixLocate *CharPtrA;
jmitc91516 0:a5c253316af6 1479 GuiConst_TEXT PrefixLocate *CharPtrB;
jmitc91516 0:a5c253316af6 1480
jmitc91516 0:a5c253316af6 1481 if (!RightToLeftWriting)
jmitc91516 0:a5c253316af6 1482 return CharCnt;
jmitc91516 0:a5c253316af6 1483
jmitc91516 0:a5c253316af6 1484 CharPtr2 = CharPtr;
jmitc91516 0:a5c253316af6 1485
jmitc91516 0:a5c253316af6 1486 for (P = 0; P < CharCnt; P++)
jmitc91516 0:a5c253316af6 1487 {
jmitc91516 0:a5c253316af6 1488 CharCode = *((GuiConst_INT16U*)CharPtr);
jmitc91516 0:a5c253316af6 1489 switch (CharCode)
jmitc91516 0:a5c253316af6 1490 {
jmitc91516 0:a5c253316af6 1491 case 40:
jmitc91516 0:a5c253316af6 1492 *((GuiConst_INT16U*)CharPtr) = 41;
jmitc91516 0:a5c253316af6 1493 break;
jmitc91516 0:a5c253316af6 1494 case 41:
jmitc91516 0:a5c253316af6 1495 *((GuiConst_INT16U*)CharPtr) = 40;
jmitc91516 0:a5c253316af6 1496 break;
jmitc91516 0:a5c253316af6 1497
jmitc91516 0:a5c253316af6 1498 case 91:
jmitc91516 0:a5c253316af6 1499 *((GuiConst_INT16U*)CharPtr) = 93;
jmitc91516 0:a5c253316af6 1500 break;
jmitc91516 0:a5c253316af6 1501 case 93:
jmitc91516 0:a5c253316af6 1502 *((GuiConst_INT16U*)CharPtr) = 91;
jmitc91516 0:a5c253316af6 1503 break;
jmitc91516 0:a5c253316af6 1504
jmitc91516 0:a5c253316af6 1505 case 123:
jmitc91516 0:a5c253316af6 1506 *((GuiConst_INT16U*)CharPtr) = 125;
jmitc91516 0:a5c253316af6 1507 break;
jmitc91516 0:a5c253316af6 1508 case 125:
jmitc91516 0:a5c253316af6 1509 *((GuiConst_INT16U*)CharPtr) = 123;
jmitc91516 0:a5c253316af6 1510 break;
jmitc91516 0:a5c253316af6 1511 }
jmitc91516 0:a5c253316af6 1512
jmitc91516 0:a5c253316af6 1513 CharPtr++;
jmitc91516 0:a5c253316af6 1514 }
jmitc91516 0:a5c253316af6 1515
jmitc91516 0:a5c253316af6 1516 P = 0;
jmitc91516 0:a5c253316af6 1517 CharPtr = CharPtr2;
jmitc91516 0:a5c253316af6 1518 do
jmitc91516 0:a5c253316af6 1519 {
jmitc91516 0:a5c253316af6 1520 CharCode = *((GuiConst_INT16U*)CharPtr);
jmitc91516 0:a5c253316af6 1521 CharPtrA = CharPtr;
jmitc91516 0:a5c253316af6 1522 CharPtr++;
jmitc91516 0:a5c253316af6 1523 CharCode2 = *((GuiConst_INT16U*)CharPtr);
jmitc91516 0:a5c253316af6 1524
jmitc91516 0:a5c253316af6 1525 for (I = 0; I < GuiLib_ARAB_LIGATURES_CNT; I++)
jmitc91516 0:a5c253316af6 1526 if ((CharCode == GuiLib_ARAB_LIGATURES[I][0]) &&
jmitc91516 0:a5c253316af6 1527 (CharCode2 == GuiLib_ARAB_LIGATURES[I][1]))
jmitc91516 0:a5c253316af6 1528 {
jmitc91516 0:a5c253316af6 1529 *((GuiConst_INT16U*)CharPtrA) = GuiLib_ARAB_LIGATURES[I][2];
jmitc91516 0:a5c253316af6 1530 CharPtrA = CharPtr;
jmitc91516 0:a5c253316af6 1531 CharPtrB = CharPtrA;
jmitc91516 0:a5c253316af6 1532 CharPtrB++;
jmitc91516 0:a5c253316af6 1533 CharCnt--;
jmitc91516 0:a5c253316af6 1534 for (J = P + 1; J < CharCnt; J++)
jmitc91516 0:a5c253316af6 1535 {
jmitc91516 0:a5c253316af6 1536 *((GuiConst_INT16U*)CharPtrA) = *((GuiConst_INT16U*)CharPtrB);
jmitc91516 0:a5c253316af6 1537 CharPtrA++;
jmitc91516 0:a5c253316af6 1538 CharPtrB++;
jmitc91516 0:a5c253316af6 1539 }
jmitc91516 0:a5c253316af6 1540 *((GuiConst_INT16U*)CharPtrA) = 0;
jmitc91516 0:a5c253316af6 1541 break;
jmitc91516 0:a5c253316af6 1542 }
jmitc91516 0:a5c253316af6 1543
jmitc91516 0:a5c253316af6 1544 P++;
jmitc91516 0:a5c253316af6 1545 }
jmitc91516 0:a5c253316af6 1546 while (P < CharCnt - 1);
jmitc91516 0:a5c253316af6 1547
jmitc91516 0:a5c253316af6 1548 CharPtr = CharPtr2;
jmitc91516 0:a5c253316af6 1549 for (P = 0; P < CharCnt; P++)
jmitc91516 0:a5c253316af6 1550 {
jmitc91516 0:a5c253316af6 1551 CharCode = *((GuiConst_INT16U*)CharPtr);
jmitc91516 0:a5c253316af6 1552
jmitc91516 0:a5c253316af6 1553 for (I = 0; I < GuiLib_ARAB_CHAR_CONVERT_CNT; I++)
jmitc91516 0:a5c253316af6 1554 if ((CharCode == GuiLib_ARAB_CHAR_CONVERT[I][0]) && (CharCode > 0))
jmitc91516 0:a5c253316af6 1555 {
jmitc91516 0:a5c253316af6 1556 *((GuiConst_INT16U*)CharPtr) = GuiLib_ARAB_CHAR_CONVERT[I][1];
jmitc91516 0:a5c253316af6 1557 break;
jmitc91516 0:a5c253316af6 1558 }
jmitc91516 0:a5c253316af6 1559
jmitc91516 0:a5c253316af6 1560 CharPtr++;
jmitc91516 0:a5c253316af6 1561 }
jmitc91516 0:a5c253316af6 1562
jmitc91516 0:a5c253316af6 1563 gl.ArabicCharJoiningModeIndex[0] = -1;
jmitc91516 0:a5c253316af6 1564 CharPtr = CharPtr2;
jmitc91516 0:a5c253316af6 1565 for (P = 0; P < CharCnt; P++)
jmitc91516 0:a5c253316af6 1566 {
jmitc91516 0:a5c253316af6 1567 CharCode = *((GuiConst_INT16U*)CharPtr);
jmitc91516 0:a5c253316af6 1568
jmitc91516 0:a5c253316af6 1569 gl.ArabicCharJoiningModeIndex[P + 1] = -1;
jmitc91516 0:a5c253316af6 1570 for (I = 0; I < GuiLib_ARAB_CHAR_CONVERT_CNT; I++)
jmitc91516 0:a5c253316af6 1571 if ((CharCode >= GuiLib_ARAB_CHAR_CONVERT[I][1]) &&
jmitc91516 0:a5c253316af6 1572 (CharCode <= GuiLib_ARAB_CHAR_CONVERT[I][1] +
jmitc91516 0:a5c253316af6 1573 (GuiLib_ARAB_CHAR_CONVERT[I][2] & 7) - 1))
jmitc91516 0:a5c253316af6 1574 {
jmitc91516 0:a5c253316af6 1575 gl.ArabicCharJoiningModeIndex[P + 1] = I;
jmitc91516 0:a5c253316af6 1576 break;
jmitc91516 0:a5c253316af6 1577 }
jmitc91516 0:a5c253316af6 1578
jmitc91516 0:a5c253316af6 1579 CharPtr++;
jmitc91516 0:a5c253316af6 1580 }
jmitc91516 0:a5c253316af6 1581 gl.ArabicCharJoiningModeIndex[CharCnt + 1] = -1;
jmitc91516 0:a5c253316af6 1582
jmitc91516 0:a5c253316af6 1583 for (P = 0; P < CharCnt + 2; P++)
jmitc91516 0:a5c253316af6 1584 {
jmitc91516 0:a5c253316af6 1585 if (gl.ArabicCharJoiningModeIndex[P] == -1)
jmitc91516 0:a5c253316af6 1586 gl.ArabicCharJoiningMode[P] = GuiLib_ARAB_CHAR_TYPE_ISO;
jmitc91516 0:a5c253316af6 1587 else
jmitc91516 0:a5c253316af6 1588 gl.ArabicCharJoiningMode[P] =
jmitc91516 0:a5c253316af6 1589 GuiLib_ARAB_CHAR_CONVERT[gl.ArabicCharJoiningModeIndex[P]][2];
jmitc91516 0:a5c253316af6 1590 }
jmitc91516 0:a5c253316af6 1591
jmitc91516 0:a5c253316af6 1592 CharPtr = CharPtr2;
jmitc91516 0:a5c253316af6 1593 for (P = 0; P < CharCnt; P++)
jmitc91516 0:a5c253316af6 1594 {
jmitc91516 0:a5c253316af6 1595 CharCode = *((GuiConst_INT16U*)CharPtr);
jmitc91516 0:a5c253316af6 1596
jmitc91516 0:a5c253316af6 1597 I = P;
jmitc91516 0:a5c253316af6 1598 while (gl.ArabicCharJoiningMode[I] == GuiLib_ARAB_CHAR_DIACRITIC)
jmitc91516 0:a5c253316af6 1599 I--;
jmitc91516 0:a5c253316af6 1600 gl.ArabicCharJoiningModeBefore = gl.ArabicCharJoiningMode[I];
jmitc91516 0:a5c253316af6 1601 I = P + 2;
jmitc91516 0:a5c253316af6 1602 while (gl.ArabicCharJoiningMode[I] == GuiLib_ARAB_CHAR_DIACRITIC)
jmitc91516 0:a5c253316af6 1603 I++;
jmitc91516 0:a5c253316af6 1604 gl.ArabicCharJoiningModeAfter = gl.ArabicCharJoiningMode[I];
jmitc91516 0:a5c253316af6 1605
jmitc91516 0:a5c253316af6 1606 switch (gl.ArabicCharJoiningMode[P + 1])
jmitc91516 0:a5c253316af6 1607 {
jmitc91516 0:a5c253316af6 1608 case GuiLib_ARAB_CHAR_ISOFIN:
jmitc91516 0:a5c253316af6 1609 if (gl.ArabicCharJoiningModeBefore == GuiLib_ARAB_CHAR_ISOFININIMED)
jmitc91516 0:a5c253316af6 1610 *((GuiConst_INT16U*)CharPtr) =
jmitc91516 0:a5c253316af6 1611 GuiLib_ARAB_CHAR_CONVERT[gl.ArabicCharJoiningModeIndex[P + 1]][1] +
jmitc91516 0:a5c253316af6 1612 GuiLib_ARAB_CHAR_TYPE_FIN;
jmitc91516 0:a5c253316af6 1613 break;
jmitc91516 0:a5c253316af6 1614
jmitc91516 0:a5c253316af6 1615 case GuiLib_ARAB_CHAR_ISOFININIMED:
jmitc91516 0:a5c253316af6 1616 if ((gl.ArabicCharJoiningModeAfter == GuiLib_ARAB_CHAR_ISOFIN) ||
jmitc91516 0:a5c253316af6 1617 (gl.ArabicCharJoiningModeAfter == GuiLib_ARAB_CHAR_ISOFININIMED))
jmitc91516 0:a5c253316af6 1618 {
jmitc91516 0:a5c253316af6 1619 if (gl.ArabicCharJoiningModeBefore == GuiLib_ARAB_CHAR_ISOFININIMED)
jmitc91516 0:a5c253316af6 1620 *((GuiConst_INT16U*)CharPtr) =
jmitc91516 0:a5c253316af6 1621 GuiLib_ARAB_CHAR_CONVERT[gl.ArabicCharJoiningModeIndex[P + 1]][1] +
jmitc91516 0:a5c253316af6 1622 GuiLib_ARAB_CHAR_TYPE_MED;
jmitc91516 0:a5c253316af6 1623 else
jmitc91516 0:a5c253316af6 1624 *((GuiConst_INT16U*)CharPtr) =
jmitc91516 0:a5c253316af6 1625 GuiLib_ARAB_CHAR_CONVERT[gl.ArabicCharJoiningModeIndex[P + 1]][1] +
jmitc91516 0:a5c253316af6 1626 GuiLib_ARAB_CHAR_TYPE_INI;
jmitc91516 0:a5c253316af6 1627 }
jmitc91516 0:a5c253316af6 1628 else if (gl.ArabicCharJoiningModeBefore == GuiLib_ARAB_CHAR_ISOFININIMED)
jmitc91516 0:a5c253316af6 1629 *((GuiConst_INT16U*)CharPtr) =
jmitc91516 0:a5c253316af6 1630 GuiLib_ARAB_CHAR_CONVERT[gl.ArabicCharJoiningModeIndex[P + 1]][1] +
jmitc91516 0:a5c253316af6 1631 GuiLib_ARAB_CHAR_TYPE_FIN;
jmitc91516 0:a5c253316af6 1632 break;
jmitc91516 0:a5c253316af6 1633
jmitc91516 0:a5c253316af6 1634 case GuiLib_ARAB_CHAR_DIACRITIC:
jmitc91516 0:a5c253316af6 1635 if (((gl.ArabicCharJoiningMode[P + 2] == GuiLib_ARAB_CHAR_ISOFIN) ||
jmitc91516 0:a5c253316af6 1636 (gl.ArabicCharJoiningMode[P + 2] == GuiLib_ARAB_CHAR_ISOFININIMED)) &&
jmitc91516 0:a5c253316af6 1637 (gl.ArabicCharJoiningMode[P] == GuiLib_ARAB_CHAR_ISOFININIMED))
jmitc91516 0:a5c253316af6 1638 *((GuiConst_INT16U*)CharPtr) =
jmitc91516 0:a5c253316af6 1639 GuiLib_ARAB_CHAR_CONVERT[gl.ArabicCharJoiningModeIndex[P + 1]][1] + 1;
jmitc91516 0:a5c253316af6 1640 break;
jmitc91516 0:a5c253316af6 1641 }
jmitc91516 0:a5c253316af6 1642
jmitc91516 0:a5c253316af6 1643 CharPtr++;
jmitc91516 0:a5c253316af6 1644 }
jmitc91516 0:a5c253316af6 1645
jmitc91516 0:a5c253316af6 1646 return (CharCnt);
jmitc91516 0:a5c253316af6 1647 }
jmitc91516 0:a5c253316af6 1648 #endif
jmitc91516 0:a5c253316af6 1649
jmitc91516 0:a5c253316af6 1650 // Groupend CHARS
jmitc91516 0:a5c253316af6 1651 // Groupstart DRAW
jmitc91516 0:a5c253316af6 1652
jmitc91516 0:a5c253316af6 1653 //------------------------------------------------------------------------------
jmitc91516 0:a5c253316af6 1654 static void ResetDrawLimits(void)
jmitc91516 0:a5c253316af6 1655 {
jmitc91516 0:a5c253316af6 1656 gl.Drawn = 0;
jmitc91516 0:a5c253316af6 1657 gl.DrawnX1 = 0x7FFF;
jmitc91516 0:a5c253316af6 1658 gl.DrawnY1 = 0x7FFF;
jmitc91516 0:a5c253316af6 1659 gl.DrawnX2 = 0x8000;
jmitc91516 0:a5c253316af6 1660 gl.DrawnY2 = 0x8000;
jmitc91516 0:a5c253316af6 1661 }
jmitc91516 0:a5c253316af6 1662
jmitc91516 0:a5c253316af6 1663 //------------------------------------------------------------------------------
jmitc91516 0:a5c253316af6 1664 static void UpdateDrawLimits(
jmitc91516 0:a5c253316af6 1665 GuiConst_INT16S X1,
jmitc91516 0:a5c253316af6 1666 GuiConst_INT16S Y1,
jmitc91516 0:a5c253316af6 1667 GuiConst_INT16S X2,
jmitc91516 0:a5c253316af6 1668 GuiConst_INT16S Y2)
jmitc91516 0:a5c253316af6 1669 {
jmitc91516 0:a5c253316af6 1670 sgl.CurItem.Drawn = 1;
jmitc91516 0:a5c253316af6 1671 sgl.CurItem.DrawnX1 = X1;
jmitc91516 0:a5c253316af6 1672 sgl.CurItem.DrawnY1 = Y1;
jmitc91516 0:a5c253316af6 1673 sgl.CurItem.DrawnX2 = X2;
jmitc91516 0:a5c253316af6 1674 sgl.CurItem.DrawnY2 = Y2;
jmitc91516 0:a5c253316af6 1675
jmitc91516 0:a5c253316af6 1676 gl.Drawn = 1;
jmitc91516 0:a5c253316af6 1677 gl.DrawnX1 = GuiLib_GET_MIN(gl.DrawnX1, X1);
jmitc91516 0:a5c253316af6 1678 gl.DrawnY1 = GuiLib_GET_MIN(gl.DrawnY1, Y1);
jmitc91516 0:a5c253316af6 1679 gl.DrawnX2 = GuiLib_GET_MAX(gl.DrawnX2, X2);
jmitc91516 0:a5c253316af6 1680 gl.DrawnY2 = GuiLib_GET_MAX(gl.DrawnY2, Y2);
jmitc91516 0:a5c253316af6 1681 }
jmitc91516 0:a5c253316af6 1682
jmitc91516 0:a5c253316af6 1683 //------------------------------------------------------------------------------
jmitc91516 0:a5c253316af6 1684 static void DrawBorderBox(
jmitc91516 0:a5c253316af6 1685 GuiConst_INT16S X1,
jmitc91516 0:a5c253316af6 1686 GuiConst_INT16S Y1,
jmitc91516 0:a5c253316af6 1687 GuiConst_INT16S X2,
jmitc91516 0:a5c253316af6 1688 GuiConst_INT16S Y2,
jmitc91516 0:a5c253316af6 1689 GuiConst_INTCOLOR BorderColor,
jmitc91516 0:a5c253316af6 1690 GuiConst_INTCOLOR FillColor,
jmitc91516 0:a5c253316af6 1691 GuiConst_INT8U FillTransparent,
jmitc91516 0:a5c253316af6 1692 GuiConst_INT16U BorderThickness)
jmitc91516 0:a5c253316af6 1693 {
jmitc91516 0:a5c253316af6 1694 if (BorderThickness == 1)
jmitc91516 0:a5c253316af6 1695 GuiLib_Box(X1, Y1, X2, Y2, BorderColor);
jmitc91516 0:a5c253316af6 1696 else
jmitc91516 0:a5c253316af6 1697 {
jmitc91516 0:a5c253316af6 1698 GuiLib_FillBox(X1, Y1, X1 + BorderThickness - 1, Y2, BorderColor);
jmitc91516 0:a5c253316af6 1699 GuiLib_FillBox(X2 - BorderThickness + 1, Y1, X2, Y2, BorderColor);
jmitc91516 0:a5c253316af6 1700 GuiLib_FillBox(X1, Y1, X2, Y1 + BorderThickness - 1, BorderColor);
jmitc91516 0:a5c253316af6 1701 GuiLib_FillBox(X1, Y2 - BorderThickness + 1, X2, Y2, BorderColor);
jmitc91516 0:a5c253316af6 1702 }
jmitc91516 0:a5c253316af6 1703 if ((!FillTransparent) &&
jmitc91516 0:a5c253316af6 1704 (X2 - X1 >= 2 * BorderThickness) &&
jmitc91516 0:a5c253316af6 1705 (Y2 - Y1 >= 2 * BorderThickness))
jmitc91516 0:a5c253316af6 1706 GuiLib_FillBox(X1 + BorderThickness,
jmitc91516 0:a5c253316af6 1707 Y1 + BorderThickness,
jmitc91516 0:a5c253316af6 1708 X2 - BorderThickness,
jmitc91516 0:a5c253316af6 1709 Y2 - BorderThickness,
jmitc91516 0:a5c253316af6 1710 FillColor);
jmitc91516 0:a5c253316af6 1711 }
jmitc91516 0:a5c253316af6 1712
jmitc91516 0:a5c253316af6 1713 //------------------------------------------------------------------------------
jmitc91516 0:a5c253316af6 1714 static void SetBackColorBox(
jmitc91516 0:a5c253316af6 1715 GuiConst_INT16S X1,
jmitc91516 0:a5c253316af6 1716 GuiConst_INT16S Y1,
jmitc91516 0:a5c253316af6 1717 GuiConst_INT16S X2,
jmitc91516 0:a5c253316af6 1718 GuiConst_INT16S Y2,
jmitc91516 0:a5c253316af6 1719 GuiConst_INT8U TextNdx)
jmitc91516 0:a5c253316af6 1720 {
jmitc91516 0:a5c253316af6 1721 sgl.BbX1 = X1;
jmitc91516 0:a5c253316af6 1722 sgl.BbY1 = Y1;
jmitc91516 0:a5c253316af6 1723 sgl.BbX2 = X2;
jmitc91516 0:a5c253316af6 1724 sgl.BbY2 = Y2;
jmitc91516 0:a5c253316af6 1725
jmitc91516 0:a5c253316af6 1726 if ((sgl.CurItem.TextPar[TextNdx].BackBorderPixels & GuiLib_BBP_LEFT) != 0)
jmitc91516 0:a5c253316af6 1727 sgl.BbX1--;
jmitc91516 0:a5c253316af6 1728 if ((sgl.CurItem.TextPar[TextNdx].BackBorderPixels & GuiLib_BBP_RIGHT) != 0)
jmitc91516 0:a5c253316af6 1729 sgl.BbX2++;
jmitc91516 0:a5c253316af6 1730 if ((sgl.CurItem.TextPar[TextNdx].BackBorderPixels & GuiLib_BBP_TOP) != 0)
jmitc91516 0:a5c253316af6 1731 sgl.BbY1--;
jmitc91516 0:a5c253316af6 1732 if ((sgl.CurItem.TextPar[TextNdx].BackBorderPixels & GuiLib_BBP_BOTTOM) != 0)
jmitc91516 0:a5c253316af6 1733 sgl.BbY2++;
jmitc91516 0:a5c253316af6 1734 }
jmitc91516 0:a5c253316af6 1735
jmitc91516 0:a5c253316af6 1736 //------------------------------------------------------------------------------
jmitc91516 0:a5c253316af6 1737 static void SetBackBox(
jmitc91516 0:a5c253316af6 1738 GuiConst_INT8U TextNdx)
jmitc91516 0:a5c253316af6 1739 {
jmitc91516 0:a5c253316af6 1740 GuiConst_INT16S L;
jmitc91516 0:a5c253316af6 1741
jmitc91516 0:a5c253316af6 1742 L = sgl.CurItem.TextPar[TextNdx].BackBoxSizeX;
jmitc91516 0:a5c253316af6 1743 sgl.BbX1 = sgl.CurItem.X1;
jmitc91516 0:a5c253316af6 1744 sgl.BbX2 = sgl.CurItem.X1 + L - 1;
jmitc91516 0:a5c253316af6 1745
jmitc91516 0:a5c253316af6 1746 if (sgl.CurItem.TextPar[TextNdx].Alignment == GuiLib_ALIGN_CENTER)
jmitc91516 0:a5c253316af6 1747 {
jmitc91516 0:a5c253316af6 1748 sgl.BbX1 -= L / 2;
jmitc91516 0:a5c253316af6 1749 sgl.BbX2 -= L / 2;
jmitc91516 0:a5c253316af6 1750 }
jmitc91516 0:a5c253316af6 1751 else if (sgl.CurItem.TextPar[TextNdx].Alignment == GuiLib_ALIGN_RIGHT)
jmitc91516 0:a5c253316af6 1752 {
jmitc91516 0:a5c253316af6 1753 sgl.BbX1 -= L - 1;
jmitc91516 0:a5c253316af6 1754 sgl.BbX2 -= L - 1;
jmitc91516 0:a5c253316af6 1755 }
jmitc91516 0:a5c253316af6 1756
jmitc91516 0:a5c253316af6 1757 if (sgl.CurItem.TextPar[TextNdx].BackBoxSizeY1 > 0)
jmitc91516 0:a5c253316af6 1758 sgl.BbY1 = sgl.CurItem.Y1 - sgl.CurItem.TextPar[TextNdx].BackBoxSizeY1;
jmitc91516 0:a5c253316af6 1759 else
jmitc91516 0:a5c253316af6 1760 sgl.BbY1 = sgl.CurItem.Y1 - ReadByte(sgl.CurFont->BaseLine);
jmitc91516 0:a5c253316af6 1761 if (sgl.CurItem.TextPar[TextNdx].BackBoxSizeY2 > 0)
jmitc91516 0:a5c253316af6 1762 sgl.BbY2 = sgl.CurItem.Y1 + sgl.CurItem.TextPar[TextNdx].BackBoxSizeY2;
jmitc91516 0:a5c253316af6 1763 else
jmitc91516 0:a5c253316af6 1764 sgl.BbY2 = sgl.CurItem.Y1 - ReadByte(sgl.CurFont->BaseLine) +
jmitc91516 0:a5c253316af6 1765 ReadByte(sgl.CurFont->YSize) - 1;
jmitc91516 0:a5c253316af6 1766
jmitc91516 0:a5c253316af6 1767 if ((sgl.CurItem.TextPar[TextNdx].BackBorderPixels & GuiLib_BBP_LEFT) != 0)
jmitc91516 0:a5c253316af6 1768 sgl.BbX1--;
jmitc91516 0:a5c253316af6 1769 if ((sgl.CurItem.TextPar[TextNdx].BackBorderPixels & GuiLib_BBP_RIGHT) != 0)
jmitc91516 0:a5c253316af6 1770 sgl.BbX2++;
jmitc91516 0:a5c253316af6 1771 if ((sgl.CurItem.TextPar[TextNdx].BackBorderPixels & GuiLib_BBP_TOP) != 0)
jmitc91516 0:a5c253316af6 1772 sgl.BbY1--;
jmitc91516 0:a5c253316af6 1773 if ((sgl.CurItem.TextPar[TextNdx].BackBorderPixels & GuiLib_BBP_BOTTOM) != 0)
jmitc91516 0:a5c253316af6 1774 sgl.BbY2++;
jmitc91516 0:a5c253316af6 1775 }
jmitc91516 0:a5c253316af6 1776
jmitc91516 0:a5c253316af6 1777 //------------------------------------------------------------------------------
jmitc91516 0:a5c253316af6 1778 static void DrawBackBox(
jmitc91516 0:a5c253316af6 1779 GuiConst_INTCOLOR BoxColor,
jmitc91516 0:a5c253316af6 1780 GuiConst_INT8U Transparent,
jmitc91516 0:a5c253316af6 1781 GuiConst_INT8U TextNdx)
jmitc91516 0:a5c253316af6 1782 {
jmitc91516 0:a5c253316af6 1783 SetBackBox(TextNdx);
jmitc91516 0:a5c253316af6 1784
jmitc91516 0:a5c253316af6 1785 if (!Transparent)
jmitc91516 0:a5c253316af6 1786 GuiLib_FillBox(sgl.BbX1, sgl.BbY1, sgl.BbX2, sgl.BbY2, BoxColor);
jmitc91516 0:a5c253316af6 1787 }
jmitc91516 0:a5c253316af6 1788
jmitc91516 0:a5c253316af6 1789 //------------------------------------------------------------------------------
jmitc91516 0:a5c253316af6 1790 #ifdef GuiConst_CHARMODE_ANSI
jmitc91516 0:a5c253316af6 1791 #ifdef GuiConst_ICC_COMPILER
jmitc91516 0:a5c253316af6 1792 #define DRAW_ROM_TEXT(ChPtr, ChCnt, TxtNdx, FColor, BColor, Transparent) \
jmitc91516 0:a5c253316af6 1793 DrawText((GuiConst_TEXT *)ChPtr, \
jmitc91516 0:a5c253316af6 1794 ChCnt, \
jmitc91516 0:a5c253316af6 1795 TxtNdx, \
jmitc91516 0:a5c253316af6 1796 FColor, \
jmitc91516 0:a5c253316af6 1797 BColor, \
jmitc91516 0:a5c253316af6 1798 Transparent);
jmitc91516 0:a5c253316af6 1799 #else
jmitc91516 0:a5c253316af6 1800 #ifdef GuiConst_CODEVISION_COMPILER
jmitc91516 0:a5c253316af6 1801 #define DRAW_ROM_TEXT(ChPtr, ChCnt, TxtNdx, FColor, BColor, Transparent) \
jmitc91516 0:a5c253316af6 1802 DrawText((GuiConst_TEXT *)ChPtr, \
jmitc91516 0:a5c253316af6 1803 ChCnt, \
jmitc91516 0:a5c253316af6 1804 TxtNdx, \
jmitc91516 0:a5c253316af6 1805 FColor, \
jmitc91516 0:a5c253316af6 1806 BColor, \
jmitc91516 0:a5c253316af6 1807 Transparent);
jmitc91516 0:a5c253316af6 1808 #else
jmitc91516 0:a5c253316af6 1809 #ifdef GuiConst_RENESAS_COMPILER_FAR
jmitc91516 0:a5c253316af6 1810 #define DRAW_ROM_TEXT(ChPtr, ChCnt, TxtNdx, FColor, BColor, Transparent) \
jmitc91516 0:a5c253316af6 1811 DrawText((GuiConst_TEXT PrefixLocate *)ChPtr, \
jmitc91516 0:a5c253316af6 1812 ChCnt, \
jmitc91516 0:a5c253316af6 1813 TxtNdx, \
jmitc91516 0:a5c253316af6 1814 FColor, \
jmitc91516 0:a5c253316af6 1815 BColor, \
jmitc91516 0:a5c253316af6 1816 Transparent);
jmitc91516 0:a5c253316af6 1817 #else
jmitc91516 0:a5c253316af6 1818 #define DRAW_ROM_TEXT(ChPtr, ChCnt, TxtNdx, FColor, BColor, Transparent) \
jmitc91516 0:a5c253316af6 1819 DrawText((GuiConst_TEXT PrefixRom *)ChPtr, \
jmitc91516 0:a5c253316af6 1820 ChCnt, \
jmitc91516 0:a5c253316af6 1821 TxtNdx, \
jmitc91516 0:a5c253316af6 1822 FColor, \
jmitc91516 0:a5c253316af6 1823 BColor, \
jmitc91516 0:a5c253316af6 1824 Transparent);
jmitc91516 0:a5c253316af6 1825 #endif
jmitc91516 0:a5c253316af6 1826 #endif
jmitc91516 0:a5c253316af6 1827 #endif
jmitc91516 0:a5c253316af6 1828 #else
jmitc91516 0:a5c253316af6 1829 #ifdef GuiConst_ICC_COMPILER
jmitc91516 0:a5c253316af6 1830 #define DRAW_ROM_TEXT(ChPtr, ChCnt, TxtNdx, FColor, BColor, Transparent) \
jmitc91516 0:a5c253316af6 1831 ExtractUnicodeString((GuiConst_INT8U *)ChPtr, ChCnt); \
jmitc91516 0:a5c253316af6 1832 DrawText((GuiConst_TEXT *)&sgl.UnicodeTextBuf, \
jmitc91516 0:a5c253316af6 1833 ChCnt, \
jmitc91516 0:a5c253316af6 1834 TxtNdx, \
jmitc91516 0:a5c253316af6 1835 FColor, \
jmitc91516 0:a5c253316af6 1836 BColor, \
jmitc91516 0:a5c253316af6 1837 Transparent);
jmitc91516 0:a5c253316af6 1838 #else
jmitc91516 0:a5c253316af6 1839 #ifdef GuiConst_CODEVISION_COMPILER
jmitc91516 0:a5c253316af6 1840 #define DRAW_ROM_TEXT(ChPtr, ChCnt, TxtNdx, FColor, BColor, Transparent) \
jmitc91516 0:a5c253316af6 1841 ExtractUnicodeString((GuiConst_INT8U *)ChPtr, ChCnt); \
jmitc91516 0:a5c253316af6 1842 DrawText((GuiConst_TEXT *)sgl.UnicodeTextBuf, \
jmitc91516 0:a5c253316af6 1843 ChCnt, \
jmitc91516 0:a5c253316af6 1844 TxtNdx, \
jmitc91516 0:a5c253316af6 1845 FColor, \
jmitc91516 0:a5c253316af6 1846 BColor, \
jmitc91516 0:a5c253316af6 1847 Transparent);
jmitc91516 0:a5c253316af6 1848 #else
jmitc91516 0:a5c253316af6 1849 #ifdef GuiConst_RENESAS_COMPILER_FAR
jmitc91516 0:a5c253316af6 1850 #define DRAW_ROM_TEXT(ChPtr, ChCnt, TxtNdx, FColor, BColor, Transparent) \
jmitc91516 0:a5c253316af6 1851 ExtractUnicodeString((GuiConst_INT8U PrefixLocate *)ChPtr, ChCnt); \
jmitc91516 0:a5c253316af6 1852 DrawText((GuiConst_TEXT PrefixLocate *)sgl.UnicodeTextBuf, \
jmitc91516 0:a5c253316af6 1853 ChCnt, \
jmitc91516 0:a5c253316af6 1854 TxtNdx, \
jmitc91516 0:a5c253316af6 1855 FColor, \
jmitc91516 0:a5c253316af6 1856 BColor, \
jmitc91516 0:a5c253316af6 1857 Transparent);
jmitc91516 0:a5c253316af6 1858 #else
jmitc91516 0:a5c253316af6 1859 #define DRAW_ROM_TEXT(ChPtr, ChCnt, TxtNdx, FColor, BColor, Transparent) \
jmitc91516 0:a5c253316af6 1860 ExtractUnicodeString((GuiConst_INT8U PrefixRom *)ChPtr, ChCnt); \
jmitc91516 0:a5c253316af6 1861 DrawText((GuiConst_TEXT *)&sgl.UnicodeTextBuf, \
jmitc91516 0:a5c253316af6 1862 ChCnt, \
jmitc91516 0:a5c253316af6 1863 TxtNdx, \
jmitc91516 0:a5c253316af6 1864 FColor, \
jmitc91516 0:a5c253316af6 1865 BColor, \
jmitc91516 0:a5c253316af6 1866 Transparent);
jmitc91516 0:a5c253316af6 1867 #endif
jmitc91516 0:a5c253316af6 1868 #endif
jmitc91516 0:a5c253316af6 1869 #endif
jmitc91516 0:a5c253316af6 1870 #endif
jmitc91516 0:a5c253316af6 1871
jmitc91516 0:a5c253316af6 1872 //------------------------------------------------------------------------------
jmitc91516 0:a5c253316af6 1873 static void DrawText(
jmitc91516 0:a5c253316af6 1874 GuiConst_TEXT PrefixGeneric *CharPtr,
jmitc91516 0:a5c253316af6 1875 GuiConst_INT16U CharCount,
jmitc91516 0:a5c253316af6 1876 GuiConst_INT8U TextNdx,
jmitc91516 0:a5c253316af6 1877 GuiConst_INTCOLOR ForeColor,
jmitc91516 0:a5c253316af6 1878 GuiConst_INTCOLOR BackColor,
jmitc91516 0:a5c253316af6 1879 GuiConst_INT8U Transparent)
jmitc91516 0:a5c253316af6 1880 {
jmitc91516 0:a5c253316af6 1881 GuiConst_INT16S P, N;
jmitc91516 0:a5c253316af6 1882 GuiConst_INT16U CharCnt;
jmitc91516 0:a5c253316af6 1883 #ifdef GuiConst_REMOTE_FONT_DATA
jmitc91516 0:a5c253316af6 1884 GuiConst_INT32U PrefixRom TempOfs;
jmitc91516 0:a5c253316af6 1885 #else
jmitc91516 0:a5c253316af6 1886 GuiConst_INT8U PrefixRom * TempPtr;
jmitc91516 0:a5c253316af6 1887 #endif
jmitc91516 0:a5c253316af6 1888 GuiConst_INT8U TempPsMode;
jmitc91516 0:a5c253316af6 1889 GuiConst_INT16S TextPixelLen;
jmitc91516 0:a5c253316af6 1890 GuiConst_INT16S X1, Y1, X2, Y2;
jmitc91516 0:a5c253316af6 1891 GuiConst_INT16S TextXOfs[GuiConst_MAX_TEXT_LEN + 2];
jmitc91516 0:a5c253316af6 1892
jmitc91516 0:a5c253316af6 1893 #ifdef GuiConst_ARAB_CHARS_INUSE
jmitc91516 0:a5c253316af6 1894 CharCnt = ArabicCorrection(CharPtr,
jmitc91516 0:a5c253316af6 1895 CharCount,
jmitc91516 0:a5c253316af6 1896 (sgl.CurItem.TextPar[TextNdx].BitFlags &
jmitc91516 0:a5c253316af6 1897 GuiLib_BITFLAG_REVERSEWRITING) > 0);
jmitc91516 0:a5c253316af6 1898 #else
jmitc91516 0:a5c253316af6 1899 CharCnt = CharCount;
jmitc91516 0:a5c253316af6 1900 #endif
jmitc91516 0:a5c253316af6 1901 PrepareText(CharPtr, CharCnt, TextNdx);
jmitc91516 0:a5c253316af6 1902
jmitc91516 0:a5c253316af6 1903 if (sgl.CurItem.TextPar[TextNdx].BitFlags & GuiLib_BITFLAG_REVERSEWRITING)
jmitc91516 0:a5c253316af6 1904 {
jmitc91516 0:a5c253316af6 1905 for (N = 0; N < CharCnt / 2; N++)
jmitc91516 0:a5c253316af6 1906 {
jmitc91516 0:a5c253316af6 1907 #ifdef GuiConst_REMOTE_FONT_DATA
jmitc91516 0:a5c253316af6 1908 TempOfs = sgl.TextCharNdx[N];
jmitc91516 0:a5c253316af6 1909 sgl.TextCharNdx[N] = sgl.TextCharNdx[CharCnt - 1 - N];
jmitc91516 0:a5c253316af6 1910 sgl.TextCharNdx[CharCnt - 1 - N] = TempOfs;
jmitc91516 0:a5c253316af6 1911 #else
jmitc91516 0:a5c253316af6 1912 TempPtr = sgl.TextCharPtrAry[N];
jmitc91516 0:a5c253316af6 1913 sgl.TextCharPtrAry[N] =
jmitc91516 0:a5c253316af6 1914 (GuiConst_INT8U PrefixRom *)sgl.TextCharPtrAry[CharCnt - 1 - N];
jmitc91516 0:a5c253316af6 1915 sgl.TextCharPtrAry[CharCnt - 1 - N] = (GuiConst_INT8U PrefixRom *)TempPtr;
jmitc91516 0:a5c253316af6 1916 #endif
jmitc91516 0:a5c253316af6 1917 TempPsMode = sgl.TextPsMode[N];
jmitc91516 0:a5c253316af6 1918 sgl.TextPsMode[N] = sgl.TextPsMode[CharCnt - 1 - N];
jmitc91516 0:a5c253316af6 1919 sgl.TextPsMode[CharCnt - 1 - N] = TempPsMode;
jmitc91516 0:a5c253316af6 1920 }
jmitc91516 0:a5c253316af6 1921 }
jmitc91516 0:a5c253316af6 1922
jmitc91516 0:a5c253316af6 1923 TextPixelLen = TextPixelLength(sgl.CurItem.TextPar[TextNdx].Ps,
jmitc91516 0:a5c253316af6 1924 CharCnt,
jmitc91516 0:a5c253316af6 1925 TextXOfs);
jmitc91516 0:a5c253316af6 1926
jmitc91516 0:a5c253316af6 1927 X1 = sgl.CurItem.X1;
jmitc91516 0:a5c253316af6 1928 switch (sgl.CurItem.TextPar[TextNdx].Alignment)
jmitc91516 0:a5c253316af6 1929 {
jmitc91516 0:a5c253316af6 1930 case GuiLib_ALIGN_CENTER:
jmitc91516 0:a5c253316af6 1931 if (CharCnt > 0)
jmitc91516 0:a5c253316af6 1932 X1 -= TextPixelLen / 2;
jmitc91516 0:a5c253316af6 1933 break;
jmitc91516 0:a5c253316af6 1934
jmitc91516 0:a5c253316af6 1935 case GuiLib_ALIGN_RIGHT:
jmitc91516 0:a5c253316af6 1936 X1 -= TextPixelLen - 1;
jmitc91516 0:a5c253316af6 1937 break;
jmitc91516 0:a5c253316af6 1938 }
jmitc91516 0:a5c253316af6 1939 Y1 = sgl.CurItem.Y1 - ReadByte(sgl.CurFont->BaseLine);
jmitc91516 0:a5c253316af6 1940 X2 = X1 + TextPixelLen - 1;
jmitc91516 0:a5c253316af6 1941 Y2 = Y1 + ReadByte(sgl.CurFont->YSize) - 1;
jmitc91516 0:a5c253316af6 1942
jmitc91516 0:a5c253316af6 1943 sgl.FontWriteX1 = X1;
jmitc91516 0:a5c253316af6 1944 sgl.FontWriteY1 = Y1;
jmitc91516 0:a5c253316af6 1945 sgl.FontWriteX2 = X2;
jmitc91516 0:a5c253316af6 1946 sgl.FontWriteY2 = Y2;
jmitc91516 0:a5c253316af6 1947
jmitc91516 0:a5c253316af6 1948 if (sgl.DisplayWriting)
jmitc91516 0:a5c253316af6 1949 {
jmitc91516 0:a5c253316af6 1950 if (CharCnt > 0)
jmitc91516 0:a5c253316af6 1951 {
jmitc91516 0:a5c253316af6 1952 if ((Transparent == 0) && (sgl.CurItem.TextPar[TextNdx].BackBoxSizeX == 0))
jmitc91516 0:a5c253316af6 1953 {
jmitc91516 0:a5c253316af6 1954 SetBackColorBox(X1, Y1, X2, Y2, TextNdx);
jmitc91516 0:a5c253316af6 1955 GuiLib_FillBox(sgl.BbX1, sgl.BbY1, sgl.BbX2, sgl.BbY2, BackColor);
jmitc91516 0:a5c253316af6 1956 }
jmitc91516 0:a5c253316af6 1957
jmitc91516 0:a5c253316af6 1958 for (P = 0; P < CharCnt; P++)
jmitc91516 0:a5c253316af6 1959 #ifdef GuiConst_REMOTE_FONT_DATA
jmitc91516 0:a5c253316af6 1960 DrawChar(X1 + TextXOfs[P], Y1, sgl.CurFont, sgl.TextCharNdx[P], ForeColor, (Transparent == 2));
jmitc91516 0:a5c253316af6 1961 #else
jmitc91516 0:a5c253316af6 1962 DrawChar(X1 + TextXOfs[P], Y1, sgl.CurFont, sgl.TextCharPtrAry[P], ForeColor, (Transparent == 2));
jmitc91516 0:a5c253316af6 1963 #endif
jmitc91516 0:a5c253316af6 1964 }
jmitc91516 0:a5c253316af6 1965
jmitc91516 0:a5c253316af6 1966 if ((sgl.CurItem.TextPar[TextNdx].BitFlags & GuiLib_BITFLAG_UNDERLINE) &&
jmitc91516 0:a5c253316af6 1967 (CharCnt > 0))
jmitc91516 0:a5c253316af6 1968 GuiLib_FillBox(X1, Y1 + ReadByte(sgl.CurFont->Underline1), X2,
jmitc91516 0:a5c253316af6 1969 Y1 + ReadByte(sgl.CurFont->Underline2), ForeColor);
jmitc91516 0:a5c253316af6 1970
jmitc91516 0:a5c253316af6 1971 GuiLib_MarkDisplayBoxRepaint(X1, Y1, X2, Y2);
jmitc91516 0:a5c253316af6 1972
jmitc91516 0:a5c253316af6 1973 #ifdef GuiConst_BLINK_SUPPORT_ON
jmitc91516 0:a5c253316af6 1974 #ifndef GuiConst_BLINK_FIELDS_OFF
jmitc91516 0:a5c253316af6 1975 if ((sgl.CurItem.TextPar[TextNdx].BitFlags & GuiLib_BITFLAG_BLINKTEXTFIELD) &&
jmitc91516 0:a5c253316af6 1976 (sgl.CurItem.BlinkFieldNo < GuiConst_BLINK_FIELDS_MAX))
jmitc91516 0:a5c253316af6 1977 {
jmitc91516 0:a5c253316af6 1978 sgl.BlinkTextItems[sgl.CurItem.BlinkFieldNo].InUse = 1;
jmitc91516 0:a5c253316af6 1979 sgl.BlinkTextItems[sgl.CurItem.BlinkFieldNo].BlinkBoxInverted = 0;
jmitc91516 0:a5c253316af6 1980 sgl.BlinkTextItems[sgl.CurItem.BlinkFieldNo].ItemType = sgl.CurItem.ItemType;
jmitc91516 0:a5c253316af6 1981 sgl.BlinkTextItems[sgl.CurItem.BlinkFieldNo].CharCnt = CharCnt;
jmitc91516 0:a5c253316af6 1982 sgl.BlinkTextItems[sgl.CurItem.BlinkFieldNo].TextPar = sgl.CurItem.TextPar[TextNdx];
jmitc91516 0:a5c253316af6 1983 sgl.BlinkTextItems[sgl.CurItem.BlinkFieldNo].FormatFieldWidth =
jmitc91516 0:a5c253316af6 1984 sgl.CurItem.FormatFieldWidth;
jmitc91516 0:a5c253316af6 1985 sgl.BlinkTextItems[sgl.CurItem.BlinkFieldNo].FormatDecimals =
jmitc91516 0:a5c253316af6 1986 sgl.CurItem.FormatDecimals;
jmitc91516 0:a5c253316af6 1987 sgl.BlinkTextItems[sgl.CurItem.BlinkFieldNo].FormatAlignment =
jmitc91516 0:a5c253316af6 1988 sgl.CurItem.FormatAlignment;
jmitc91516 0:a5c253316af6 1989 sgl.BlinkTextItems[sgl.CurItem.BlinkFieldNo].FormatFormat = sgl.CurItem.FormatFormat;
jmitc91516 0:a5c253316af6 1990 sgl.BlinkTextItems[sgl.CurItem.BlinkFieldNo].VarType = sgl.CurItem.VarType;
jmitc91516 0:a5c253316af6 1991 sgl.BlinkTextItems[sgl.CurItem.BlinkFieldNo].XSize =
jmitc91516 0:a5c253316af6 1992 ReadByte(sgl.CurFont->XSize);
jmitc91516 0:a5c253316af6 1993 sgl.BlinkTextItems[sgl.CurItem.BlinkFieldNo].PsNumWidth =
jmitc91516 0:a5c253316af6 1994 ReadByte(sgl.CurFont->PsNumWidth);
jmitc91516 0:a5c253316af6 1995 sgl.BlinkTextItems[sgl.CurItem.BlinkFieldNo].PsSpace =
jmitc91516 0:a5c253316af6 1996 ReadByte(sgl.CurFont->PsSpace);
jmitc91516 0:a5c253316af6 1997 if (sgl.CurItem.ItemType == GuiLib_ITEM_TEXT)
jmitc91516 0:a5c253316af6 1998 sgl.BlinkTextItems[sgl.CurItem.BlinkFieldNo].TextPtr =
jmitc91516 0:a5c253316af6 1999 sgl.CurItem.TextPtr[TextNdx];
jmitc91516 0:a5c253316af6 2000 else
jmitc91516 0:a5c253316af6 2001 sgl.BlinkTextItems[sgl.CurItem.BlinkFieldNo].TextPtr =
jmitc91516 0:a5c253316af6 2002 (GuiConst_TEXT*)sgl.CurItem.VarPtr;
jmitc91516 0:a5c253316af6 2003 sgl.BlinkTextItems[sgl.CurItem.BlinkFieldNo].X1 = sgl.CurItem.X1;
jmitc91516 0:a5c253316af6 2004 sgl.BlinkTextItems[sgl.CurItem.BlinkFieldNo].X2 = sgl.CurItem.X2;
jmitc91516 0:a5c253316af6 2005 if (sgl.CurItem.TextPar[TextNdx].BackBoxSizeX > 0)
jmitc91516 0:a5c253316af6 2006 {
jmitc91516 0:a5c253316af6 2007 if (sgl.CurItem.TextPar[TextNdx].BackBoxSizeY1 > 0)
jmitc91516 0:a5c253316af6 2008 sgl.BlinkTextItems[sgl.CurItem.BlinkFieldNo].Y1 =
jmitc91516 0:a5c253316af6 2009 sgl.CurItem.Y1 - sgl.CurItem.TextPar[TextNdx].BackBoxSizeY1;
jmitc91516 0:a5c253316af6 2010 else
jmitc91516 0:a5c253316af6 2011 sgl.BlinkTextItems[sgl.CurItem.BlinkFieldNo].Y1 =
jmitc91516 0:a5c253316af6 2012 sgl.CurItem.Y1 - ReadByte(sgl.CurFont->BaseLine);
jmitc91516 0:a5c253316af6 2013 if (sgl.CurItem.TextPar[TextNdx].BackBoxSizeY1 > 0)
jmitc91516 0:a5c253316af6 2014 sgl.BlinkTextItems[sgl.CurItem.BlinkFieldNo].Y2 =
jmitc91516 0:a5c253316af6 2015 sgl.CurItem.Y1 + sgl.CurItem.TextPar[TextNdx].BackBoxSizeY2;
jmitc91516 0:a5c253316af6 2016 else
jmitc91516 0:a5c253316af6 2017 sgl.BlinkTextItems[sgl.CurItem.BlinkFieldNo].Y2 =
jmitc91516 0:a5c253316af6 2018 sgl.CurItem.Y1 - ReadByte(sgl.CurFont->BaseLine) +
jmitc91516 0:a5c253316af6 2019 ReadByte(sgl.CurFont->YSize) - 1;
jmitc91516 0:a5c253316af6 2020 }
jmitc91516 0:a5c253316af6 2021 else
jmitc91516 0:a5c253316af6 2022 {
jmitc91516 0:a5c253316af6 2023 sgl.BlinkTextItems[sgl.CurItem.BlinkFieldNo].Y1 = Y1;
jmitc91516 0:a5c253316af6 2024 sgl.BlinkTextItems[sgl.CurItem.BlinkFieldNo].Y2 = Y2;
jmitc91516 0:a5c253316af6 2025 }
jmitc91516 0:a5c253316af6 2026 }
jmitc91516 0:a5c253316af6 2027 #endif
jmitc91516 0:a5c253316af6 2028 #endif
jmitc91516 0:a5c253316af6 2029 }
jmitc91516 0:a5c253316af6 2030 }
jmitc91516 0:a5c253316af6 2031
jmitc91516 0:a5c253316af6 2032 #ifdef GuiConst_ITEM_TEXTBLOCK_INUSE
jmitc91516 0:a5c253316af6 2033
jmitc91516 0:a5c253316af6 2034 //------------------------------------------------------------------------------
jmitc91516 0:a5c253316af6 2035 #ifdef GuiConst_CHARMODE_ANSI
jmitc91516 0:a5c253316af6 2036 #ifdef GuiConst_ICC_COMPILER
jmitc91516 0:a5c253316af6 2037 #define DRAW_ROM_TEXTBLOCK(ChPtr, ChCnt, TxtNdx, FColor, BColor, Transparent) \
jmitc91516 0:a5c253316af6 2038 DrawTextBlock((GuiConst_TEXT *)ChPtr, \
jmitc91516 0:a5c253316af6 2039 ChCnt, \
jmitc91516 0:a5c253316af6 2040 TxtNdx, \
jmitc91516 0:a5c253316af6 2041 FColor, \
jmitc91516 0:a5c253316af6 2042 BColor, \
jmitc91516 0:a5c253316af6 2043 Transparent);
jmitc91516 0:a5c253316af6 2044 #else
jmitc91516 0:a5c253316af6 2045 #ifdef GuiConst_CODEVISION_COMPILER
jmitc91516 0:a5c253316af6 2046 #define DRAW_ROM_TEXTBLOCK(ChPtr, ChCnt, TxtNdx, FColor, BColor, Transparent) \
jmitc91516 0:a5c253316af6 2047 DrawTextBlock((GuiConst_TEXT *)ChPtr, \
jmitc91516 0:a5c253316af6 2048 ChCnt, \
jmitc91516 0:a5c253316af6 2049 TxtNdx, \
jmitc91516 0:a5c253316af6 2050 FColor, \
jmitc91516 0:a5c253316af6 2051 BColor, \
jmitc91516 0:a5c253316af6 2052 Transparent);
jmitc91516 0:a5c253316af6 2053 #else
jmitc91516 0:a5c253316af6 2054 #ifdef GuiConst_RENESAS_COMPILER_FAR
jmitc91516 0:a5c253316af6 2055 #define DRAW_ROM_TEXTBLOCK(ChPtr, ChCnt, TxtNdx, FColor, BColor, Transparent) \
jmitc91516 0:a5c253316af6 2056 DrawTextBlock((GuiConst_TEXT PrefixLocate *)ChPtr, \
jmitc91516 0:a5c253316af6 2057 ChCnt, \
jmitc91516 0:a5c253316af6 2058 TxtNdx, \
jmitc91516 0:a5c253316af6 2059 FColor, \
jmitc91516 0:a5c253316af6 2060 BColor, \
jmitc91516 0:a5c253316af6 2061 Transparent);
jmitc91516 0:a5c253316af6 2062 #else
jmitc91516 0:a5c253316af6 2063 #define DRAW_ROM_TEXTBLOCK(ChPtr, ChCnt, TxtNdx, FColor, BColor, Transparent) \
jmitc91516 0:a5c253316af6 2064 DrawTextBlock((GuiConst_TEXT PrefixRom *)ChPtr, \
jmitc91516 0:a5c253316af6 2065 ChCnt, \
jmitc91516 0:a5c253316af6 2066 TxtNdx, \
jmitc91516 0:a5c253316af6 2067 FColor, \
jmitc91516 0:a5c253316af6 2068 BColor, \
jmitc91516 0:a5c253316af6 2069 Transparent);
jmitc91516 0:a5c253316af6 2070 #endif
jmitc91516 0:a5c253316af6 2071 #endif
jmitc91516 0:a5c253316af6 2072 #endif
jmitc91516 0:a5c253316af6 2073 #else
jmitc91516 0:a5c253316af6 2074 #ifdef GuiConst_ICC_COMPILER
jmitc91516 0:a5c253316af6 2075 #define DRAW_ROM_TEXTBLOCK(ChPtr, ChCnt, TxtNdx, FColor, BColor, Transparent) \
jmitc91516 0:a5c253316af6 2076 ExtractUnicodeString((GuiConst_INT8U *)ChPtr, ChCnt); \
jmitc91516 0:a5c253316af6 2077 DrawTextBlock((GuiConst_TEXT *)&sgl.UnicodeTextBuf, \
jmitc91516 0:a5c253316af6 2078 ChCnt, \
jmitc91516 0:a5c253316af6 2079 TxtNdx, \
jmitc91516 0:a5c253316af6 2080 FColor, \
jmitc91516 0:a5c253316af6 2081 BColor, \
jmitc91516 0:a5c253316af6 2082 Transparent);
jmitc91516 0:a5c253316af6 2083 #else
jmitc91516 0:a5c253316af6 2084 #ifdef GuiConst_CODEVISION_COMPILER
jmitc91516 0:a5c253316af6 2085 #define DRAW_ROM_TEXTBLOCK(ChPtr, ChCnt, TxtNdx, FColor, BColor, Transparent) \
jmitc91516 0:a5c253316af6 2086 ExtractUnicodeString((GuiConst_INT8U *)ChPtr, ChCnt); \
jmitc91516 0:a5c253316af6 2087 DrawTextBlock((GuiConst_TEXT *)sgl.UnicodeTextBuf, \
jmitc91516 0:a5c253316af6 2088 ChCnt, \
jmitc91516 0:a5c253316af6 2089 TxtNdx, \
jmitc91516 0:a5c253316af6 2090 FColor, \
jmitc91516 0:a5c253316af6 2091 BColor, \
jmitc91516 0:a5c253316af6 2092 Transparent);
jmitc91516 0:a5c253316af6 2093 #else
jmitc91516 0:a5c253316af6 2094 #ifdef GuiConst_RENESAS_COMPILER_FAR
jmitc91516 0:a5c253316af6 2095 #define DRAW_ROM_TEXTBLOCK(ChPtr, ChCnt, TxtNdx, FColor, BColor, Transparent) \
jmitc91516 0:a5c253316af6 2096 ExtractUnicodeString((GuiConst_INT8U PrefixLocate *)ChPtr, ChCnt); \
jmitc91516 0:a5c253316af6 2097 DrawTextBlock((GuiConst_TEXT PrefixLocate *)sgl.UnicodeTextBuf, \
jmitc91516 0:a5c253316af6 2098 ChCnt, \
jmitc91516 0:a5c253316af6 2099 TxtNdx, \
jmitc91516 0:a5c253316af6 2100 FColor, \
jmitc91516 0:a5c253316af6 2101 BColor, \
jmitc91516 0:a5c253316af6 2102 Transparent);
jmitc91516 0:a5c253316af6 2103 #else
jmitc91516 0:a5c253316af6 2104 #define DRAW_ROM_TEXTBLOCK(ChPtr, ChCnt, TxtNdx, FColor, BColor, Transparent) \
jmitc91516 0:a5c253316af6 2105 ExtractUnicodeString((GuiConst_INT8U PrefixRom *)ChPtr, ChCnt); \
jmitc91516 0:a5c253316af6 2106 DrawTextBlock((GuiConst_TEXT *)&sgl.UnicodeTextBuf, \
jmitc91516 0:a5c253316af6 2107 ChCnt, \
jmitc91516 0:a5c253316af6 2108 TxtNdx, \
jmitc91516 0:a5c253316af6 2109 FColor, \
jmitc91516 0:a5c253316af6 2110 BColor, \
jmitc91516 0:a5c253316af6 2111 Transparent);
jmitc91516 0:a5c253316af6 2112 #endif
jmitc91516 0:a5c253316af6 2113 #endif
jmitc91516 0:a5c253316af6 2114 #endif
jmitc91516 0:a5c253316af6 2115 #endif
jmitc91516 0:a5c253316af6 2116
jmitc91516 0:a5c253316af6 2117 //------------------------------------------------------------------------------
jmitc91516 0:a5c253316af6 2118 static void DrawTextBlock(
jmitc91516 0:a5c253316af6 2119 GuiConst_TEXT PrefixGeneric *CharPtr,
jmitc91516 0:a5c253316af6 2120 GuiConst_INT16U CharCnt,
jmitc91516 0:a5c253316af6 2121 GuiConst_INT8U TextNdx,
jmitc91516 0:a5c253316af6 2122 GuiConst_INTCOLOR ForeColor,
jmitc91516 0:a5c253316af6 2123 GuiConst_INTCOLOR BackColor,
jmitc91516 0:a5c253316af6 2124 GuiConst_INT8U Transparent)
jmitc91516 0:a5c253316af6 2125 {
jmitc91516 0:a5c253316af6 2126 GuiConst_INT16S X1, Y1, X2, Y2;
jmitc91516 0:a5c253316af6 2127 #ifdef GuiConst_CLIPPING_SUPPORT_ON
jmitc91516 0:a5c253316af6 2128 GuiConst_INT16S CX1, CX2;
jmitc91516 0:a5c253316af6 2129 #endif
jmitc91516 0:a5c253316af6 2130 GuiConst_INT16S CY1, CY2;
jmitc91516 0:a5c253316af6 2131 GuiConst_INT16S TextXOfs[GuiConst_MAX_TEXT_LEN + 2];
jmitc91516 0:a5c253316af6 2132 GuiConst_INT16S TextCharLineStart[GuiConst_MAX_PARAGRAPH_LINE_CNT + 1];
jmitc91516 0:a5c253316af6 2133 GuiConst_INT16S TextCharLineEnd[GuiConst_MAX_PARAGRAPH_LINE_CNT + 1];
jmitc91516 0:a5c253316af6 2134 #ifdef GuiConst_CLIPPING_SUPPORT_ON
jmitc91516 0:a5c253316af6 2135 GuiConst_INT16S RemClipX1, RemClipY1, RemClipX2, RemClipY2;
jmitc91516 0:a5c253316af6 2136 #endif
jmitc91516 0:a5c253316af6 2137 #ifdef GuiConst_BLINK_SUPPORT_ON
jmitc91516 0:a5c253316af6 2138 #ifndef GuiConst_BLINK_FIELDS_OFF
jmitc91516 0:a5c253316af6 2139 GuiConst_INT16S BlinkNo;
jmitc91516 0:a5c253316af6 2140 #endif
jmitc91516 0:a5c253316af6 2141 #endif
jmitc91516 0:a5c253316af6 2142 GuiConst_INT16S PixWidth;
jmitc91516 0:a5c253316af6 2143 GuiConst_INT16S N, P, M, F;
jmitc91516 0:a5c253316af6 2144 GuiConst_INT16S LineLen;
jmitc91516 0:a5c253316af6 2145 GuiConst_INT16S LineCnt;
jmitc91516 0:a5c253316af6 2146 GuiConst_INT16S LineCnt2;
jmitc91516 0:a5c253316af6 2147 GuiConst_INT16S BlindLinesAtTop;
jmitc91516 0:a5c253316af6 2148 GuiConst_INT16S XPos, YPos;
jmitc91516 0:a5c253316af6 2149 GuiConst_INT16S XStart, XEnd;
jmitc91516 0:a5c253316af6 2150 GuiConst_INT8U TempPsMode;
jmitc91516 0:a5c253316af6 2151 #ifdef GuiConst_REMOTE_FONT_DATA
jmitc91516 0:a5c253316af6 2152 GuiConst_INT32U PrefixRom TempOfs;
jmitc91516 0:a5c253316af6 2153 GuiConst_INT8U CharHeader1[GuiLib_CHR_LINECTRL_OFS];
jmitc91516 0:a5c253316af6 2154 GuiConst_INT8U CharHeader2[GuiLib_CHR_LINECTRL_OFS];
jmitc91516 0:a5c253316af6 2155 #else
jmitc91516 0:a5c253316af6 2156 GuiConst_INT8U PrefixRom * TempPtr;
jmitc91516 0:a5c253316af6 2157 #endif
jmitc91516 0:a5c253316af6 2158
jmitc91516 0:a5c253316af6 2159 X1 = sgl.CurItem.X1;
jmitc91516 0:a5c253316af6 2160 Y1 = sgl.CurItem.Y1;
jmitc91516 0:a5c253316af6 2161 X2 = sgl.CurItem.X2;
jmitc91516 0:a5c253316af6 2162 Y2 = sgl.CurItem.Y2;
jmitc91516 0:a5c253316af6 2163 sgl.FontWriteX1 = X1;
jmitc91516 0:a5c253316af6 2164 sgl.FontWriteY1 = Y1;
jmitc91516 0:a5c253316af6 2165 sgl.FontWriteX2 = X2;
jmitc91516 0:a5c253316af6 2166 sgl.FontWriteY2 = Y2;
jmitc91516 0:a5c253316af6 2167
jmitc91516 0:a5c253316af6 2168 PixWidth = 0;
jmitc91516 0:a5c253316af6 2169
jmitc91516 0:a5c253316af6 2170 if (sgl.DisplayWriting)
jmitc91516 0:a5c253316af6 2171 {
jmitc91516 0:a5c253316af6 2172 if (!Transparent && (sgl.CurItem.TextPar[TextNdx].BackBoxSizeX == 0))
jmitc91516 0:a5c253316af6 2173 {
jmitc91516 0:a5c253316af6 2174 SetBackColorBox(X1, Y1, X2, Y2, TextNdx);
jmitc91516 0:a5c253316af6 2175 GuiLib_FillBox(sgl.BbX1, sgl.BbY1, sgl.BbX2, sgl.BbY2, BackColor);
jmitc91516 0:a5c253316af6 2176 }
jmitc91516 0:a5c253316af6 2177
jmitc91516 0:a5c253316af6 2178 if (sgl.CurItem.CompPars.CompTextBox.LineDistRelToFont)
jmitc91516 0:a5c253316af6 2179 {
jmitc91516 0:a5c253316af6 2180 sgl.CurItem.CompPars.CompTextBox.LineDist +=sgl.CurFont->YSize;
jmitc91516 0:a5c253316af6 2181 sgl.CurItem.CompPars.CompTextBox.LineDistRelToFont = 0;
jmitc91516 0:a5c253316af6 2182 }
jmitc91516 0:a5c253316af6 2183
jmitc91516 0:a5c253316af6 2184 LineCnt = 0;
jmitc91516 0:a5c253316af6 2185 #ifdef GuiConst_TEXTBOX_FIELDS_ON
jmitc91516 0:a5c253316af6 2186 sgl.CurItem.CompPars.CompTextBox.Lines = 1;
jmitc91516 0:a5c253316af6 2187 #endif
jmitc91516 0:a5c253316af6 2188 if (CharCnt > 0)
jmitc91516 0:a5c253316af6 2189 {
jmitc91516 0:a5c253316af6 2190 PixWidth = X2 - X1 + 1;
jmitc91516 0:a5c253316af6 2191
jmitc91516 0:a5c253316af6 2192 #ifdef GuiConst_ARAB_CHARS_INUSE
jmitc91516 0:a5c253316af6 2193 CharCnt =
jmitc91516 0:a5c253316af6 2194 ArabicCorrection(CharPtr,
jmitc91516 0:a5c253316af6 2195 CharCnt,
jmitc91516 0:a5c253316af6 2196 (sgl.CurItem.TextPar[TextNdx].BitFlags &
jmitc91516 0:a5c253316af6 2197 GuiLib_BITFLAG_REVERSEWRITING) > 0);
jmitc91516 0:a5c253316af6 2198 #endif
jmitc91516 0:a5c253316af6 2199 PrepareText(CharPtr, CharCnt, TextNdx);
jmitc91516 0:a5c253316af6 2200 TextPixelLength(sgl.CurItem.TextPar[TextNdx].Ps,
jmitc91516 0:a5c253316af6 2201 CharCnt,
jmitc91516 0:a5c253316af6 2202 TextXOfs);
jmitc91516 0:a5c253316af6 2203
jmitc91516 0:a5c253316af6 2204 TextCharLineStart[0] = 0;
jmitc91516 0:a5c253316af6 2205 TextCharLineEnd[0] = -1;
jmitc91516 0:a5c253316af6 2206 #ifdef GuiConst_TEXTBOX_FIELDS_ON
jmitc91516 0:a5c253316af6 2207 if (sgl.CurItem.CompPars.CompTextBox.ScrollIndex == 0xFF)
jmitc91516 0:a5c253316af6 2208 BlindLinesAtTop = 0;
jmitc91516 0:a5c253316af6 2209 else
jmitc91516 0:a5c253316af6 2210 BlindLinesAtTop = sgl.CurItem.CompPars.CompTextBox.ScrollPos /
jmitc91516 0:a5c253316af6 2211 sgl.CurItem.CompPars.CompTextBox.LineDist;
jmitc91516 0:a5c253316af6 2212 #else
jmitc91516 0:a5c253316af6 2213 BlindLinesAtTop = 0;
jmitc91516 0:a5c253316af6 2214 #endif
jmitc91516 0:a5c253316af6 2215 LineCnt = 1 - BlindLinesAtTop;
jmitc91516 0:a5c253316af6 2216 if (LineCnt >= 1)
jmitc91516 0:a5c253316af6 2217 LineCnt = 1;
jmitc91516 0:a5c253316af6 2218 LineCnt2 = 1;
jmitc91516 0:a5c253316af6 2219 P = 0;
jmitc91516 0:a5c253316af6 2220 #ifdef GuiConst_REMOTE_FONT_DATA
jmitc91516 0:a5c253316af6 2221 GuiLib_RemoteDataReadBlock(
jmitc91516 0:a5c253316af6 2222 (GuiConst_INT32U PrefixRom)GuiFont_ChPtrList[
jmitc91516 0:a5c253316af6 2223 sgl.TextCharNdx[TextCharLineStart[LineCnt2 - 1]]],
jmitc91516 0:a5c253316af6 2224 GuiLib_CHR_LINECTRL_OFS,
jmitc91516 0:a5c253316af6 2225 CharHeader2);
jmitc91516 0:a5c253316af6 2226 #endif
jmitc91516 0:a5c253316af6 2227 while (P < CharCnt)
jmitc91516 0:a5c253316af6 2228 {
jmitc91516 0:a5c253316af6 2229 while ((P < CharCnt - 1) &&
jmitc91516 0:a5c253316af6 2230 !((ReadBytePtr(CharPtr + P) == GuiLib_LINEFEED) ||
jmitc91516 0:a5c253316af6 2231 ((ReadBytePtr(CharPtr + P) != ' ') &&
jmitc91516 0:a5c253316af6 2232 (ReadBytePtr(CharPtr + P + 1) == ' ')) ||
jmitc91516 0:a5c253316af6 2233 ((ReadBytePtr(CharPtr + P) == '-') &&
jmitc91516 0:a5c253316af6 2234 (ReadBytePtr(CharPtr + P + 1) != ' '))))
jmitc91516 0:a5c253316af6 2235 P++;
jmitc91516 0:a5c253316af6 2236
jmitc91516 0:a5c253316af6 2237 F = 0;
jmitc91516 0:a5c253316af6 2238
jmitc91516 0:a5c253316af6 2239 if (CalcCharsWidth(TextCharLineStart[LineCnt2 - 1], P,
jmitc91516 0:a5c253316af6 2240 TextXOfs, &XStart, &XEnd) > PixWidth)
jmitc91516 0:a5c253316af6 2241 {
jmitc91516 0:a5c253316af6 2242 if (TextCharLineEnd[LineCnt2 - 1] == -1)
jmitc91516 0:a5c253316af6 2243 {
jmitc91516 0:a5c253316af6 2244 if (ReadBytePtr(CharPtr + P) == GuiLib_LINEFEED)
jmitc91516 0:a5c253316af6 2245 {
jmitc91516 0:a5c253316af6 2246 TextCharLineEnd[LineCnt2 - 1] = P - 1;
jmitc91516 0:a5c253316af6 2247 F = 1;
jmitc91516 0:a5c253316af6 2248 }
jmitc91516 0:a5c253316af6 2249 else
jmitc91516 0:a5c253316af6 2250 TextCharLineEnd[LineCnt2 - 1] = P;
jmitc91516 0:a5c253316af6 2251
jmitc91516 0:a5c253316af6 2252 TextCharLineStart[LineCnt2] = P + 1;
jmitc91516 0:a5c253316af6 2253 TextCharLineEnd[LineCnt2] = -1;
jmitc91516 0:a5c253316af6 2254 }
jmitc91516 0:a5c253316af6 2255 else
jmitc91516 0:a5c253316af6 2256 {
jmitc91516 0:a5c253316af6 2257 TextCharLineStart[LineCnt2] = TextCharLineEnd[LineCnt2 - 1] + 1;
jmitc91516 0:a5c253316af6 2258 while ((TextCharLineStart[LineCnt2] < P) &&
jmitc91516 0:a5c253316af6 2259 (ReadBytePtr(CharPtr + TextCharLineStart[LineCnt2]) == ' '))
jmitc91516 0:a5c253316af6 2260 TextCharLineStart[LineCnt2]++;
jmitc91516 0:a5c253316af6 2261 TextCharLineEnd[LineCnt2] = P;
jmitc91516 0:a5c253316af6 2262 }
jmitc91516 0:a5c253316af6 2263 if (LineCnt >= GuiConst_MAX_PARAGRAPH_LINE_CNT)
jmitc91516 0:a5c253316af6 2264 {
jmitc91516 0:a5c253316af6 2265 P = CharCnt;
jmitc91516 0:a5c253316af6 2266 break;
jmitc91516 0:a5c253316af6 2267 }
jmitc91516 0:a5c253316af6 2268 LineCnt++;
jmitc91516 0:a5c253316af6 2269 if (LineCnt > 1)
jmitc91516 0:a5c253316af6 2270 LineCnt2 = LineCnt;
jmitc91516 0:a5c253316af6 2271 else
jmitc91516 0:a5c253316af6 2272 {
jmitc91516 0:a5c253316af6 2273 TextCharLineStart[LineCnt2 - 1] = TextCharLineStart[LineCnt2];
jmitc91516 0:a5c253316af6 2274 TextCharLineEnd[LineCnt2 - 1] = TextCharLineEnd[LineCnt2];
jmitc91516 0:a5c253316af6 2275 }
jmitc91516 0:a5c253316af6 2276 #ifdef GuiConst_TEXTBOX_FIELDS_ON
jmitc91516 0:a5c253316af6 2277 sgl.CurItem.CompPars.CompTextBox.Lines++;
jmitc91516 0:a5c253316af6 2278 #endif
jmitc91516 0:a5c253316af6 2279 }
jmitc91516 0:a5c253316af6 2280 else
jmitc91516 0:a5c253316af6 2281 TextCharLineEnd[LineCnt2 - 1] = P;
jmitc91516 0:a5c253316af6 2282
jmitc91516 0:a5c253316af6 2283 if ((ReadBytePtr(CharPtr + P) == GuiLib_LINEFEED) &&
jmitc91516 0:a5c253316af6 2284 (F == 0))
jmitc91516 0:a5c253316af6 2285 {
jmitc91516 0:a5c253316af6 2286 TextCharLineEnd[LineCnt2 - 1] = P - 1;
jmitc91516 0:a5c253316af6 2287 TextCharLineStart[LineCnt2] = P + 1;
jmitc91516 0:a5c253316af6 2288 TextCharLineEnd[LineCnt2] = -1;
jmitc91516 0:a5c253316af6 2289
jmitc91516 0:a5c253316af6 2290 if (LineCnt >= GuiConst_MAX_PARAGRAPH_LINE_CNT)
jmitc91516 0:a5c253316af6 2291 {
jmitc91516 0:a5c253316af6 2292 P = CharCnt;
jmitc91516 0:a5c253316af6 2293 break;
jmitc91516 0:a5c253316af6 2294 }
jmitc91516 0:a5c253316af6 2295 LineCnt++;
jmitc91516 0:a5c253316af6 2296 if (LineCnt > 1)
jmitc91516 0:a5c253316af6 2297 LineCnt2 = LineCnt;
jmitc91516 0:a5c253316af6 2298 else
jmitc91516 0:a5c253316af6 2299 {
jmitc91516 0:a5c253316af6 2300 TextCharLineStart[LineCnt2 - 1] = TextCharLineStart[LineCnt2];
jmitc91516 0:a5c253316af6 2301 TextCharLineEnd[LineCnt2 - 1] = TextCharLineEnd[LineCnt2];
jmitc91516 0:a5c253316af6 2302 }
jmitc91516 0:a5c253316af6 2303 #ifdef GuiConst_TEXTBOX_FIELDS_ON
jmitc91516 0:a5c253316af6 2304 sgl.CurItem.CompPars.CompTextBox.Lines++;
jmitc91516 0:a5c253316af6 2305 #endif
jmitc91516 0:a5c253316af6 2306 }
jmitc91516 0:a5c253316af6 2307
jmitc91516 0:a5c253316af6 2308 P++;
jmitc91516 0:a5c253316af6 2309 }
jmitc91516 0:a5c253316af6 2310 }
jmitc91516 0:a5c253316af6 2311
jmitc91516 0:a5c253316af6 2312 if (LineCnt >= 1)
jmitc91516 0:a5c253316af6 2313 {
jmitc91516 0:a5c253316af6 2314 if (sgl.CurItem.TextPar[TextNdx].BitFlags & GuiLib_BITFLAG_REVERSEWRITING)
jmitc91516 0:a5c253316af6 2315 {
jmitc91516 0:a5c253316af6 2316 for (M = 0; M < LineCnt ; M++)
jmitc91516 0:a5c253316af6 2317 {
jmitc91516 0:a5c253316af6 2318 for (P = TextCharLineStart[M]; P <= (TextCharLineStart[M] +
jmitc91516 0:a5c253316af6 2319 ((TextCharLineEnd[M] - TextCharLineStart[M] + 1) / 2) - 1); P++)
jmitc91516 0:a5c253316af6 2320 {
jmitc91516 0:a5c253316af6 2321 #ifdef GuiConst_REMOTE_FONT_DATA
jmitc91516 0:a5c253316af6 2322 TempOfs = sgl.TextCharNdx[P];
jmitc91516 0:a5c253316af6 2323 sgl.TextCharNdx[P] =
jmitc91516 0:a5c253316af6 2324 sgl.TextCharNdx[TextCharLineEnd[M] - (P - TextCharLineStart[M])];
jmitc91516 0:a5c253316af6 2325 sgl.TextCharNdx[TextCharLineEnd[M] - (P - TextCharLineStart[M])] =
jmitc91516 0:a5c253316af6 2326 TempOfs;
jmitc91516 0:a5c253316af6 2327 #else
jmitc91516 0:a5c253316af6 2328 #ifdef GuiConst_CODEVISION_COMPILER
jmitc91516 0:a5c253316af6 2329 TempPtr = &sgl.TextCharPtrAry[P];
jmitc91516 0:a5c253316af6 2330 #else
jmitc91516 0:a5c253316af6 2331 TempPtr = sgl.TextCharPtrAry[P];
jmitc91516 0:a5c253316af6 2332 #endif
jmitc91516 0:a5c253316af6 2333 sgl.TextCharPtrAry[P] = (GuiConst_INT8U PrefixRom *)
jmitc91516 0:a5c253316af6 2334 sgl.TextCharPtrAry[TextCharLineEnd[M] - (P - TextCharLineStart[M])];
jmitc91516 0:a5c253316af6 2335 sgl.TextCharPtrAry[TextCharLineEnd[M] - (P - TextCharLineStart[M])] =
jmitc91516 0:a5c253316af6 2336 (GuiConst_INT8U PrefixRom *)TempPtr;
jmitc91516 0:a5c253316af6 2337 #endif
jmitc91516 0:a5c253316af6 2338 TempPsMode = sgl.TextPsMode[P];
jmitc91516 0:a5c253316af6 2339 sgl.TextPsMode[P] =
jmitc91516 0:a5c253316af6 2340 sgl.TextPsMode[TextCharLineEnd[M] - (P - TextCharLineStart[M])];
jmitc91516 0:a5c253316af6 2341 sgl.TextPsMode[TextCharLineEnd[M] - (P - TextCharLineStart[M])] =
jmitc91516 0:a5c253316af6 2342 TempPsMode;
jmitc91516 0:a5c253316af6 2343 }
jmitc91516 0:a5c253316af6 2344 }
jmitc91516 0:a5c253316af6 2345 TextPixelLength(sgl.CurItem.TextPar[TextNdx].Ps,
jmitc91516 0:a5c253316af6 2346 CharCnt,
jmitc91516 0:a5c253316af6 2347 TextXOfs);
jmitc91516 0:a5c253316af6 2348 }
jmitc91516 0:a5c253316af6 2349
jmitc91516 0:a5c253316af6 2350 CY1 = Y1;
jmitc91516 0:a5c253316af6 2351 CY2 = Y2;
jmitc91516 0:a5c253316af6 2352 #ifdef GuiConst_CLIPPING_SUPPORT_ON
jmitc91516 0:a5c253316af6 2353 CX1 = X1;
jmitc91516 0:a5c253316af6 2354 CX2 = X2;
jmitc91516 0:a5c253316af6 2355 RemClipX1 = sgl.CurItem.ClipRectX1;
jmitc91516 0:a5c253316af6 2356 RemClipY1 = sgl.CurItem.ClipRectY1;
jmitc91516 0:a5c253316af6 2357 RemClipX2 = sgl.CurItem.ClipRectX2;
jmitc91516 0:a5c253316af6 2358 RemClipY2 = sgl.CurItem.ClipRectY2;
jmitc91516 0:a5c253316af6 2359 if (RemClipX1 > CX1)
jmitc91516 0:a5c253316af6 2360 CX1 = RemClipX1;
jmitc91516 0:a5c253316af6 2361 if (RemClipY1 > CY1)
jmitc91516 0:a5c253316af6 2362 CY1 = RemClipY1;
jmitc91516 0:a5c253316af6 2363 if (RemClipX2 < CX2)
jmitc91516 0:a5c253316af6 2364 CX2 = RemClipX2;
jmitc91516 0:a5c253316af6 2365 if (RemClipY2 < CY2)
jmitc91516 0:a5c253316af6 2366 CY2 = RemClipY2;
jmitc91516 0:a5c253316af6 2367 GuiLib_SetClipping(CX1, CY1, CX2, CY2);
jmitc91516 0:a5c253316af6 2368 #endif
jmitc91516 0:a5c253316af6 2369
jmitc91516 0:a5c253316af6 2370 #ifdef GuiConst_BLINK_SUPPORT_ON
jmitc91516 0:a5c253316af6 2371 #ifndef GuiConst_BLINK_FIELDS_OFF
jmitc91516 0:a5c253316af6 2372 if ((sgl.CurItem.TextPar[TextNdx].BitFlags & GuiLib_BITFLAG_BLINKTEXTFIELD) &&
jmitc91516 0:a5c253316af6 2373 (sgl.CurItem.BlinkFieldNo < GuiConst_BLINK_FIELDS_MAX))
jmitc91516 0:a5c253316af6 2374 {
jmitc91516 0:a5c253316af6 2375 BlinkNo = sgl.CurItem.BlinkFieldNo;
jmitc91516 0:a5c253316af6 2376 sgl.BlinkTextItems[BlinkNo].InUse = 1;
jmitc91516 0:a5c253316af6 2377 sgl.BlinkTextItems[BlinkNo].ItemType = sgl.CurItem.ItemType;
jmitc91516 0:a5c253316af6 2378 sgl.BlinkTextItems[BlinkNo].VarType = sgl.CurItem.VarType;
jmitc91516 0:a5c253316af6 2379 sgl.BlinkTextItems[BlinkNo].CharCnt = CharCnt;
jmitc91516 0:a5c253316af6 2380 sgl.BlinkTextItems[BlinkNo].TextPar = sgl.CurItem.TextPar[TextNdx];
jmitc91516 0:a5c253316af6 2381 sgl.BlinkTextItems[BlinkNo].XSize = sgl.CurFont->XSize;
jmitc91516 0:a5c253316af6 2382 sgl.BlinkTextItems[BlinkNo].YSize = sgl.CurFont->YSize;
jmitc91516 0:a5c253316af6 2383 sgl.BlinkTextItems[BlinkNo].PsNumWidth = sgl.CurFont->PsNumWidth;
jmitc91516 0:a5c253316af6 2384 sgl.BlinkTextItems[BlinkNo].PsSpace = sgl.CurFont->PsSpace;
jmitc91516 0:a5c253316af6 2385 if (sgl.CurItem.ItemType == GuiLib_ITEM_TEXTBLOCK)
jmitc91516 0:a5c253316af6 2386 sgl.BlinkTextItems[BlinkNo].TextPtr = sgl.CurItem.TextPtr[TextNdx];
jmitc91516 0:a5c253316af6 2387 else
jmitc91516 0:a5c253316af6 2388 sgl.BlinkTextItems[BlinkNo].TextPtr = (GuiConst_TEXT*)sgl.CurItem.VarPtr;
jmitc91516 0:a5c253316af6 2389 sgl.BlinkTextItems[BlinkNo].X1 = X1;
jmitc91516 0:a5c253316af6 2390 sgl.BlinkTextItems[BlinkNo].X2 = X2;
jmitc91516 0:a5c253316af6 2391 sgl.BlinkTextItems[BlinkNo].Y1 = Y1;
jmitc91516 0:a5c253316af6 2392 sgl.BlinkTextItems[BlinkNo].Y2 = Y2;
jmitc91516 0:a5c253316af6 2393 sgl.BlinkTextItems[BlinkNo].LineCnt = LineCnt;
jmitc91516 0:a5c253316af6 2394 sgl.BlinkTextItems[BlinkNo].TextBoxLineDist =
jmitc91516 0:a5c253316af6 2395 sgl.CurItem.CompPars.CompTextBox.LineDist;
jmitc91516 0:a5c253316af6 2396 sgl.BlinkTextItems[BlinkNo].BlindLinesAtTop = BlindLinesAtTop;
jmitc91516 0:a5c253316af6 2397 sgl.BlinkTextItems[BlinkNo].FormatFieldWidth = sgl.CurItem.FormatFieldWidth;
jmitc91516 0:a5c253316af6 2398 sgl.BlinkTextItems[BlinkNo].FormatDecimals = sgl.CurItem.FormatDecimals;
jmitc91516 0:a5c253316af6 2399 sgl.BlinkTextItems[BlinkNo].FormatAlignment = sgl.CurItem.FormatAlignment;
jmitc91516 0:a5c253316af6 2400 sgl.BlinkTextItems[BlinkNo].FormatFormat = sgl.CurItem.FormatFormat;
jmitc91516 0:a5c253316af6 2401 sgl.BlinkTextItems[BlinkNo].TextBoxHorzAlignment =
jmitc91516 0:a5c253316af6 2402 sgl.CurItem.CompPars.CompTextBox.HorzAlignment;
jmitc91516 0:a5c253316af6 2403 sgl.BlinkTextItems[BlinkNo].TextBoxVertAlignment =
jmitc91516 0:a5c253316af6 2404 sgl.CurItem.CompPars.CompTextBox.VertAlignment;
jmitc91516 0:a5c253316af6 2405 #ifdef GuiConst_TEXTBOX_FIELDS_ON
jmitc91516 0:a5c253316af6 2406 sgl.BlinkTextItems[BlinkNo].TextBoxScrollPos =
jmitc91516 0:a5c253316af6 2407 sgl.CurItem.CompPars.CompTextBox.ScrollPos;
jmitc91516 0:a5c253316af6 2408 #endif
jmitc91516 0:a5c253316af6 2409 }
jmitc91516 0:a5c253316af6 2410 else
jmitc91516 0:a5c253316af6 2411 BlinkNo = -1;
jmitc91516 0:a5c253316af6 2412 #endif
jmitc91516 0:a5c253316af6 2413 #endif
jmitc91516 0:a5c253316af6 2414
jmitc91516 0:a5c253316af6 2415 YPos = Y1;
jmitc91516 0:a5c253316af6 2416 #ifdef GuiConst_TEXTBOX_FIELDS_ON
jmitc91516 0:a5c253316af6 2417 if (BlindLinesAtTop < 0)
jmitc91516 0:a5c253316af6 2418 BlindLinesAtTop = 0;
jmitc91516 0:a5c253316af6 2419 YPos -= sgl.CurItem.CompPars.CompTextBox.ScrollPos -
jmitc91516 0:a5c253316af6 2420 (sgl.CurItem.CompPars.CompTextBox.LineDist * BlindLinesAtTop);
jmitc91516 0:a5c253316af6 2421 #endif
jmitc91516 0:a5c253316af6 2422
jmitc91516 0:a5c253316af6 2423 N = ReadByte(sgl.CurFont->YSize) +
jmitc91516 0:a5c253316af6 2424 (LineCnt - 1) * sgl.CurItem.CompPars.CompTextBox.LineDist;
jmitc91516 0:a5c253316af6 2425 switch (sgl.CurItem.CompPars.CompTextBox.VertAlignment)
jmitc91516 0:a5c253316af6 2426 {
jmitc91516 0:a5c253316af6 2427 case GuiLib_ALIGN_CENTER:
jmitc91516 0:a5c253316af6 2428 YPos += (Y2 - Y1 + 1 - N) / 2;
jmitc91516 0:a5c253316af6 2429 break;
jmitc91516 0:a5c253316af6 2430
jmitc91516 0:a5c253316af6 2431 case GuiLib_ALIGN_RIGHT:
jmitc91516 0:a5c253316af6 2432 YPos += Y2 - Y1 + 1 - N;
jmitc91516 0:a5c253316af6 2433 break;
jmitc91516 0:a5c253316af6 2434 }
jmitc91516 0:a5c253316af6 2435
jmitc91516 0:a5c253316af6 2436 for (N = 0; N < LineCnt; N++)
jmitc91516 0:a5c253316af6 2437 {
jmitc91516 0:a5c253316af6 2438 if (TextCharLineEnd[N] >= TextCharLineStart[N])
jmitc91516 0:a5c253316af6 2439 {
jmitc91516 0:a5c253316af6 2440 XPos = X1;
jmitc91516 0:a5c253316af6 2441
jmitc91516 0:a5c253316af6 2442 LineLen = CalcCharsWidth(TextCharLineStart[N],
jmitc91516 0:a5c253316af6 2443 TextCharLineEnd[N],
jmitc91516 0:a5c253316af6 2444 TextXOfs,
jmitc91516 0:a5c253316af6 2445 &XStart,
jmitc91516 0:a5c253316af6 2446 &XEnd);
jmitc91516 0:a5c253316af6 2447 switch (sgl.CurItem.CompPars.CompTextBox.HorzAlignment)
jmitc91516 0:a5c253316af6 2448 {
jmitc91516 0:a5c253316af6 2449 case GuiLib_ALIGN_CENTER:
jmitc91516 0:a5c253316af6 2450 XPos += (PixWidth - LineLen) / 2;
jmitc91516 0:a5c253316af6 2451 break;
jmitc91516 0:a5c253316af6 2452
jmitc91516 0:a5c253316af6 2453 case GuiLib_ALIGN_RIGHT:
jmitc91516 0:a5c253316af6 2454 XPos += PixWidth - LineLen;
jmitc91516 0:a5c253316af6 2455 break;
jmitc91516 0:a5c253316af6 2456 }
jmitc91516 0:a5c253316af6 2457
jmitc91516 0:a5c253316af6 2458 if (sgl.CurItem.TextPar[TextNdx].BitFlags & GuiLib_BITFLAG_UNDERLINE)
jmitc91516 0:a5c253316af6 2459 GuiLib_FillBox(XPos, YPos + ReadByte(sgl.CurFont->Underline1),
jmitc91516 0:a5c253316af6 2460 XPos + LineLen - 1, YPos + ReadByte(sgl.CurFont->Underline2),
jmitc91516 0:a5c253316af6 2461 ForeColor);
jmitc91516 0:a5c253316af6 2462
jmitc91516 0:a5c253316af6 2463 XPos -= XStart;
jmitc91516 0:a5c253316af6 2464 if ((YPos + sgl.CurFont->YSize >= CY1) && (YPos <= CY2))
jmitc91516 0:a5c253316af6 2465 for (P = TextCharLineStart[N]; P <= TextCharLineEnd[N]; P++)
jmitc91516 0:a5c253316af6 2466 #ifdef GuiConst_REMOTE_FONT_DATA
jmitc91516 0:a5c253316af6 2467 DrawChar(
jmitc91516 0:a5c253316af6 2468 XPos + TextXOfs[P], YPos, sgl.CurFont, sgl.TextCharNdx[P], ForeColor, 0);
jmitc91516 0:a5c253316af6 2469 #else
jmitc91516 0:a5c253316af6 2470 DrawChar(XPos + TextXOfs[P], YPos, sgl.CurFont, sgl.TextCharPtrAry[P],
jmitc91516 0:a5c253316af6 2471 ForeColor, 0);
jmitc91516 0:a5c253316af6 2472 #endif
jmitc91516 0:a5c253316af6 2473 }
jmitc91516 0:a5c253316af6 2474 YPos += sgl.CurItem.CompPars.CompTextBox.LineDist;
jmitc91516 0:a5c253316af6 2475 }
jmitc91516 0:a5c253316af6 2476
jmitc91516 0:a5c253316af6 2477 #ifdef GuiConst_CLIPPING_SUPPORT_ON
jmitc91516 0:a5c253316af6 2478 GuiLib_SetClipping(RemClipX1, RemClipY1, RemClipX2, RemClipY2);
jmitc91516 0:a5c253316af6 2479 #endif
jmitc91516 0:a5c253316af6 2480 }
jmitc91516 0:a5c253316af6 2481 GuiLib_MarkDisplayBoxRepaint(X1, Y1, X2, Y2);
jmitc91516 0:a5c253316af6 2482 }
jmitc91516 0:a5c253316af6 2483 }
jmitc91516 0:a5c253316af6 2484 #endif
jmitc91516 0:a5c253316af6 2485 // Groupend DRAW
jmitc91516 0:a5c253316af6 2486
jmitc91516 0:a5c253316af6 2487 #ifdef GuiConst_FLOAT_SUPPORT_ON
jmitc91516 0:a5c253316af6 2488 static float Floor(float X)
jmitc91516 0:a5c253316af6 2489 {
jmitc91516 0:a5c253316af6 2490 GuiConst_INT32S I;
jmitc91516 0:a5c253316af6 2491
jmitc91516 0:a5c253316af6 2492 I = X - 2;
jmitc91516 0:a5c253316af6 2493 while(++I <= X - 1);
jmitc91516 0:a5c253316af6 2494 return I;
jmitc91516 0:a5c253316af6 2495 }
jmitc91516 0:a5c253316af6 2496 #endif
jmitc91516 0:a5c253316af6 2497
jmitc91516 0:a5c253316af6 2498 //------------------------------------------------------------------------------
jmitc91516 0:a5c253316af6 2499 static GuiConst_INT32S ReadVar(
jmitc91516 0:a5c253316af6 2500 void PrefixLocate *VarPtr,
jmitc91516 0:a5c253316af6 2501 GuiConst_INT8U VarType)
jmitc91516 0:a5c253316af6 2502 {
jmitc91516 0:a5c253316af6 2503 #ifdef GuiConst_FLOAT_SUPPORT_ON
jmitc91516 0:a5c253316af6 2504 GuiConst_INT32S tmp;
jmitc91516 0:a5c253316af6 2505 GuiConst_INT8U i;
jmitc91516 0:a5c253316af6 2506 double dfactor;
jmitc91516 0:a5c253316af6 2507 double dx;
jmitc91516 0:a5c253316af6 2508 float ffactor;
jmitc91516 0:a5c253316af6 2509 float fx;
jmitc91516 0:a5c253316af6 2510 #endif
jmitc91516 0:a5c253316af6 2511
jmitc91516 0:a5c253316af6 2512 if (VarPtr == 0)
jmitc91516 0:a5c253316af6 2513 return (0);
jmitc91516 0:a5c253316af6 2514 else
jmitc91516 0:a5c253316af6 2515 {
jmitc91516 0:a5c253316af6 2516 if (sgl.CurItem.FormatFormat == GuiLib_FORMAT_EXP)
jmitc91516 0:a5c253316af6 2517 {
jmitc91516 0:a5c253316af6 2518 #ifdef GuiConst_FLOAT_SUPPORT_ON
jmitc91516 0:a5c253316af6 2519 if ((VarType == GuiLib_VAR_FLOAT) || (VarType == GuiLib_VAR_DOUBLE))
jmitc91516 0:a5c253316af6 2520 sgl.VarExponent = 0;
jmitc91516 0:a5c253316af6 2521 else
jmitc91516 0:a5c253316af6 2522 #endif
jmitc91516 0:a5c253316af6 2523 sgl.CurItem.FormatFormat = GuiLib_FORMAT_DEC;
jmitc91516 0:a5c253316af6 2524 }
jmitc91516 0:a5c253316af6 2525 switch (VarType)
jmitc91516 0:a5c253316af6 2526 {
jmitc91516 0:a5c253316af6 2527 case GuiLib_VAR_BOOL:
jmitc91516 0:a5c253316af6 2528 if (*(GuiConst_INT8U PrefixLocate *) VarPtr == 0)
jmitc91516 0:a5c253316af6 2529 return (0);
jmitc91516 0:a5c253316af6 2530 else
jmitc91516 0:a5c253316af6 2531 return (1);
jmitc91516 0:a5c253316af6 2532
jmitc91516 0:a5c253316af6 2533 case GuiLib_VAR_UNSIGNED_CHAR:
jmitc91516 0:a5c253316af6 2534 return (*(GuiConst_INT8U PrefixLocate *) VarPtr);
jmitc91516 0:a5c253316af6 2535
jmitc91516 0:a5c253316af6 2536 case GuiLib_VAR_SIGNED_CHAR:
jmitc91516 0:a5c253316af6 2537 return (*(GuiConst_INT8S PrefixLocate *) VarPtr);
jmitc91516 0:a5c253316af6 2538
jmitc91516 0:a5c253316af6 2539 case GuiLib_VAR_UNSIGNED_INT:
jmitc91516 0:a5c253316af6 2540 return (*(GuiConst_INT16U PrefixLocate *) VarPtr);
jmitc91516 0:a5c253316af6 2541
jmitc91516 0:a5c253316af6 2542 case GuiLib_VAR_SIGNED_INT:
jmitc91516 0:a5c253316af6 2543 return (*(GuiConst_INT16S PrefixLocate *) VarPtr);
jmitc91516 0:a5c253316af6 2544
jmitc91516 0:a5c253316af6 2545 case GuiLib_VAR_UNSIGNED_LONG:
jmitc91516 0:a5c253316af6 2546 return (*(GuiConst_INT32U PrefixLocate *) VarPtr);
jmitc91516 0:a5c253316af6 2547
jmitc91516 0:a5c253316af6 2548 case GuiLib_VAR_SIGNED_LONG:
jmitc91516 0:a5c253316af6 2549 return (*(GuiConst_INT32S PrefixLocate *) VarPtr);
jmitc91516 0:a5c253316af6 2550
jmitc91516 0:a5c253316af6 2551 case GuiLib_VAR_COLOR:
jmitc91516 0:a5c253316af6 2552 return (*(GuiConst_INTCOLOR PrefixLocate *) VarPtr);
jmitc91516 0:a5c253316af6 2553
jmitc91516 0:a5c253316af6 2554 case GuiLib_VAR_FLOAT:
jmitc91516 0:a5c253316af6 2555 #ifdef GuiConst_FLOAT_SUPPORT_ON
jmitc91516 0:a5c253316af6 2556 fx = *(float PrefixLocate *) VarPtr;
jmitc91516 0:a5c253316af6 2557 if (fx < 0)
jmitc91516 0:a5c253316af6 2558 fx = -fx;
jmitc91516 0:a5c253316af6 2559 if ((sgl.CurItem.FormatFormat == GuiLib_FORMAT_EXP) && (fx != 0))
jmitc91516 0:a5c253316af6 2560 {
jmitc91516 0:a5c253316af6 2561 while (Floor(fx + 0.5) > 10)
jmitc91516 0:a5c253316af6 2562 {
jmitc91516 0:a5c253316af6 2563 fx /= 10;
jmitc91516 0:a5c253316af6 2564 sgl.VarExponent++;
jmitc91516 0:a5c253316af6 2565 }
jmitc91516 0:a5c253316af6 2566 while (Floor(fx) < 1)
jmitc91516 0:a5c253316af6 2567 {
jmitc91516 0:a5c253316af6 2568 fx *= 10;
jmitc91516 0:a5c253316af6 2569 sgl.VarExponent--;
jmitc91516 0:a5c253316af6 2570 }
jmitc91516 0:a5c253316af6 2571 }
jmitc91516 0:a5c253316af6 2572 if ((sgl.CurItem.FormatFormat == GuiLib_FORMAT_DEC) ||
jmitc91516 0:a5c253316af6 2573 (sgl.CurItem.FormatFormat == GuiLib_FORMAT_EXP))
jmitc91516 0:a5c253316af6 2574 {
jmitc91516 0:a5c253316af6 2575 ffactor=1.0;
jmitc91516 0:a5c253316af6 2576 for (i = 0; i < sgl.CurItem.FormatDecimals ; i++)
jmitc91516 0:a5c253316af6 2577 ffactor *= 10.0;
jmitc91516 0:a5c253316af6 2578 tmp = (GuiConst_INT32S) (fx * ffactor);
jmitc91516 0:a5c253316af6 2579 ffactor *= 100.0;
jmitc91516 0:a5c253316af6 2580 if (((GuiConst_INT32S) (fx * ffactor) - (tmp * 100)) >= 45)
jmitc91516 0:a5c253316af6 2581 tmp++;
jmitc91516 0:a5c253316af6 2582 if (*(float PrefixLocate *) VarPtr < 0)
jmitc91516 0:a5c253316af6 2583 tmp = -tmp;
jmitc91516 0:a5c253316af6 2584 }
jmitc91516 0:a5c253316af6 2585 else
jmitc91516 0:a5c253316af6 2586 tmp = (GuiConst_INT32S) *(float PrefixLocate *) VarPtr;
jmitc91516 0:a5c253316af6 2587 return (tmp);
jmitc91516 0:a5c253316af6 2588 #else
jmitc91516 0:a5c253316af6 2589 return (0);
jmitc91516 0:a5c253316af6 2590 #endif
jmitc91516 0:a5c253316af6 2591
jmitc91516 0:a5c253316af6 2592 case GuiLib_VAR_DOUBLE:
jmitc91516 0:a5c253316af6 2593 #ifdef GuiConst_FLOAT_SUPPORT_ON
jmitc91516 0:a5c253316af6 2594 dx = *(double PrefixLocate *) VarPtr;
jmitc91516 0:a5c253316af6 2595 if (dx < 0)
jmitc91516 0:a5c253316af6 2596 dx = -dx;
jmitc91516 0:a5c253316af6 2597 if ((sgl.CurItem.FormatFormat == GuiLib_FORMAT_EXP) && (dx != 0))
jmitc91516 0:a5c253316af6 2598 {
jmitc91516 0:a5c253316af6 2599 while (dx > 10)
jmitc91516 0:a5c253316af6 2600 {
jmitc91516 0:a5c253316af6 2601 dx /= 10;
jmitc91516 0:a5c253316af6 2602 sgl.VarExponent++;
jmitc91516 0:a5c253316af6 2603 }
jmitc91516 0:a5c253316af6 2604 while (dx < 1)
jmitc91516 0:a5c253316af6 2605 {
jmitc91516 0:a5c253316af6 2606 dx *= 10;
jmitc91516 0:a5c253316af6 2607 sgl.VarExponent--;
jmitc91516 0:a5c253316af6 2608 }
jmitc91516 0:a5c253316af6 2609 }
jmitc91516 0:a5c253316af6 2610 if ((sgl.CurItem.FormatFormat == GuiLib_FORMAT_DEC) ||
jmitc91516 0:a5c253316af6 2611 (sgl.CurItem.FormatFormat == GuiLib_FORMAT_EXP))
jmitc91516 0:a5c253316af6 2612 {
jmitc91516 0:a5c253316af6 2613 dfactor=1.0;
jmitc91516 0:a5c253316af6 2614 for (i = 0; i < sgl.CurItem.FormatDecimals ; i++)
jmitc91516 0:a5c253316af6 2615 dfactor *= 10.0;
jmitc91516 0:a5c253316af6 2616 tmp = (GuiConst_INT32S) (dx * dfactor);
jmitc91516 0:a5c253316af6 2617 dfactor *= 100.0;
jmitc91516 0:a5c253316af6 2618 if (((GuiConst_INT32S) (dx * dfactor) - (tmp * 100)) >= 45)
jmitc91516 0:a5c253316af6 2619 tmp++;
jmitc91516 0:a5c253316af6 2620 if (*(double PrefixLocate *) VarPtr < 0)
jmitc91516 0:a5c253316af6 2621 tmp = -tmp;
jmitc91516 0:a5c253316af6 2622 }
jmitc91516 0:a5c253316af6 2623 else
jmitc91516 0:a5c253316af6 2624 tmp = (GuiConst_INT32S) dx;
jmitc91516 0:a5c253316af6 2625 return (tmp);
jmitc91516 0:a5c253316af6 2626 #else
jmitc91516 0:a5c253316af6 2627 return (0);
jmitc91516 0:a5c253316af6 2628 #endif
jmitc91516 0:a5c253316af6 2629
jmitc91516 0:a5c253316af6 2630 default:
jmitc91516 0:a5c253316af6 2631 return (0);
jmitc91516 0:a5c253316af6 2632 }
jmitc91516 0:a5c253316af6 2633 }
jmitc91516 0:a5c253316af6 2634 }
jmitc91516 0:a5c253316af6 2635
jmitc91516 0:a5c253316af6 2636 //------------------------------------------------------------------------------
jmitc91516 0:a5c253316af6 2637 static GuiConst_INT8U DataNumStr(
jmitc91516 0:a5c253316af6 2638 GuiConst_INT32S DataValue,
jmitc91516 0:a5c253316af6 2639 GuiConst_INT8U VarType,
jmitc91516 0:a5c253316af6 2640 GuiConst_INT8U TextNdx)
jmitc91516 0:a5c253316af6 2641 {
jmitc91516 0:a5c253316af6 2642 GuiConst_CHAR *S1;
jmitc91516 0:a5c253316af6 2643 GuiConst_INT8U StrLen, L;
jmitc91516 0:a5c253316af6 2644 GuiConst_INT16S I, N, P;
jmitc91516 0:a5c253316af6 2645 GuiConst_INT8U Offset;
jmitc91516 0:a5c253316af6 2646 GuiConst_INT8U Sign;
jmitc91516 0:a5c253316af6 2647 GuiConst_INT8U ShowSign;
jmitc91516 0:a5c253316af6 2648 GuiConst_INT8U ZeroPadding;
jmitc91516 0:a5c253316af6 2649 GuiConst_INT8U TrailingZeros;
jmitc91516 0:a5c253316af6 2650 GuiConst_INT8U ThousandsSeparator;
jmitc91516 0:a5c253316af6 2651 GuiConst_INT8U Time;
jmitc91516 0:a5c253316af6 2652 GuiConst_INT16S TT1, TT2, TT3;
jmitc91516 0:a5c253316af6 2653 GuiConst_INT8U am;
jmitc91516 0:a5c253316af6 2654 GuiConst_INT8U DecimalsPos;
jmitc91516 0:a5c253316af6 2655 #ifdef GuiConst_FLOAT_SUPPORT_ON
jmitc91516 0:a5c253316af6 2656 GuiConst_CHAR ExponentStr[5];
jmitc91516 0:a5c253316af6 2657 #endif
jmitc91516 0:a5c253316af6 2658
jmitc91516 0:a5c253316af6 2659 sgl.VarNumTextStr[0] = 0;
jmitc91516 0:a5c253316af6 2660 am = 0;
jmitc91516 0:a5c253316af6 2661
jmitc91516 0:a5c253316af6 2662 Sign = 0;
jmitc91516 0:a5c253316af6 2663 switch (VarType)
jmitc91516 0:a5c253316af6 2664 {
jmitc91516 0:a5c253316af6 2665 case GuiLib_VAR_BOOL:
jmitc91516 0:a5c253316af6 2666 case GuiLib_VAR_UNSIGNED_CHAR:
jmitc91516 0:a5c253316af6 2667 if (DataValue > 255)
jmitc91516 0:a5c253316af6 2668 DataValue = 255;
jmitc91516 0:a5c253316af6 2669 else if (DataValue < 0)
jmitc91516 0:a5c253316af6 2670 DataValue = 0;
jmitc91516 0:a5c253316af6 2671 break;
jmitc91516 0:a5c253316af6 2672
jmitc91516 0:a5c253316af6 2673 case GuiLib_VAR_SIGNED_CHAR:
jmitc91516 0:a5c253316af6 2674 if (DataValue > 127)
jmitc91516 0:a5c253316af6 2675 DataValue = 127;
jmitc91516 0:a5c253316af6 2676 else if (DataValue < -128)
jmitc91516 0:a5c253316af6 2677 DataValue = -128;
jmitc91516 0:a5c253316af6 2678 if (DataValue < 0)
jmitc91516 0:a5c253316af6 2679 Sign = 1;
jmitc91516 0:a5c253316af6 2680 break;
jmitc91516 0:a5c253316af6 2681
jmitc91516 0:a5c253316af6 2682 case GuiLib_VAR_UNSIGNED_INT:
jmitc91516 0:a5c253316af6 2683 if (DataValue > 65535)
jmitc91516 0:a5c253316af6 2684 DataValue = 65535;
jmitc91516 0:a5c253316af6 2685 else if (DataValue < 0)
jmitc91516 0:a5c253316af6 2686 DataValue = 0;
jmitc91516 0:a5c253316af6 2687 break;
jmitc91516 0:a5c253316af6 2688
jmitc91516 0:a5c253316af6 2689 case GuiLib_VAR_SIGNED_INT:
jmitc91516 0:a5c253316af6 2690 if (DataValue > 32767)
jmitc91516 0:a5c253316af6 2691 DataValue = 32767;
jmitc91516 0:a5c253316af6 2692 else if (DataValue < -32768)
jmitc91516 0:a5c253316af6 2693 DataValue = -32768;
jmitc91516 0:a5c253316af6 2694 if (DataValue < 0)
jmitc91516 0:a5c253316af6 2695 Sign = 1;
jmitc91516 0:a5c253316af6 2696 break;
jmitc91516 0:a5c253316af6 2697
jmitc91516 0:a5c253316af6 2698 case GuiLib_VAR_SIGNED_LONG:
jmitc91516 0:a5c253316af6 2699 case GuiLib_VAR_FLOAT:
jmitc91516 0:a5c253316af6 2700 case GuiLib_VAR_DOUBLE:
jmitc91516 0:a5c253316af6 2701 if (DataValue < 0)
jmitc91516 0:a5c253316af6 2702 Sign = 1;
jmitc91516 0:a5c253316af6 2703 break;
jmitc91516 0:a5c253316af6 2704
jmitc91516 0:a5c253316af6 2705 case GuiLib_VAR_COLOR:
jmitc91516 0:a5c253316af6 2706 if (DataValue < 0)
jmitc91516 0:a5c253316af6 2707 DataValue = 0;
jmitc91516 0:a5c253316af6 2708 #if GuiConst_PIXEL_BYTE_SIZE == 1
jmitc91516 0:a5c253316af6 2709 if (DataValue > 255)
jmitc91516 0:a5c253316af6 2710 DataValue = 255;
jmitc91516 0:a5c253316af6 2711 #elif GuiConst_PIXEL_BYTE_SIZE == 2
jmitc91516 0:a5c253316af6 2712 if (DataValue > 65535)
jmitc91516 0:a5c253316af6 2713 DataValue = 65535;
jmitc91516 0:a5c253316af6 2714 #elif GuiConst_PIXEL_BYTE_SIZE == 3
jmitc91516 0:a5c253316af6 2715 if (DataValue > 16777215)
jmitc91516 0:a5c253316af6 2716 DataValue = 16777215;
jmitc91516 0:a5c253316af6 2717 #endif
jmitc91516 0:a5c253316af6 2718 break;
jmitc91516 0:a5c253316af6 2719 }
jmitc91516 0:a5c253316af6 2720
jmitc91516 0:a5c253316af6 2721 if ((sgl.CurItem.FormatFormat == GuiLib_FORMAT_DEC) ||
jmitc91516 0:a5c253316af6 2722 (sgl.CurItem.FormatFormat == GuiLib_FORMAT_EXP))
jmitc91516 0:a5c253316af6 2723 DecimalsPos = sgl.CurItem.FormatDecimals;
jmitc91516 0:a5c253316af6 2724 else
jmitc91516 0:a5c253316af6 2725 DecimalsPos = 0;
jmitc91516 0:a5c253316af6 2726 Time = ((sgl.CurItem.FormatFormat == GuiLib_FORMAT_TIME_MMSS) ||
jmitc91516 0:a5c253316af6 2727 (sgl.CurItem.FormatFormat == GuiLib_FORMAT_TIME_HHMM_24) ||
jmitc91516 0:a5c253316af6 2728 (sgl.CurItem.FormatFormat == GuiLib_FORMAT_TIME_HHMMSS_24) ||
jmitc91516 0:a5c253316af6 2729 (sgl.CurItem.FormatFormat == GuiLib_FORMAT_TIME_HHMM_12_ampm) ||
jmitc91516 0:a5c253316af6 2730 (sgl.CurItem.FormatFormat == GuiLib_FORMAT_TIME_HHMMSS_12_ampm) ||
jmitc91516 0:a5c253316af6 2731 (sgl.CurItem.FormatFormat == GuiLib_FORMAT_TIME_HHMM_12_AMPM) ||
jmitc91516 0:a5c253316af6 2732 (sgl.CurItem.FormatFormat == GuiLib_FORMAT_TIME_HHMMSS_12_AMPM));
jmitc91516 0:a5c253316af6 2733 if ((sgl.CurItem.FormatFormat == GuiLib_FORMAT_DEC) ||
jmitc91516 0:a5c253316af6 2734 (sgl.CurItem.FormatFormat == GuiLib_FORMAT_EXP))
jmitc91516 0:a5c253316af6 2735 ShowSign = ((sgl.CurItem.TextPar[TextNdx].BitFlags &
jmitc91516 0:a5c253316af6 2736 GuiLib_BITFLAG_FORMATSHOWSIGN) > 0);
jmitc91516 0:a5c253316af6 2737 else
jmitc91516 0:a5c253316af6 2738 {
jmitc91516 0:a5c253316af6 2739 Sign = 0;
jmitc91516 0:a5c253316af6 2740 ShowSign = 0;
jmitc91516 0:a5c253316af6 2741 }
jmitc91516 0:a5c253316af6 2742 if (sgl.CurItem.FormatAlignment == GuiLib_FORMAT_ALIGNMENT_RIGHT)
jmitc91516 0:a5c253316af6 2743 ZeroPadding = ((sgl.CurItem.TextPar[TextNdx].BitFlags &
jmitc91516 0:a5c253316af6 2744 GuiLib_BITFLAG_FORMATZEROPADDING) > 0);
jmitc91516 0:a5c253316af6 2745 else
jmitc91516 0:a5c253316af6 2746 ZeroPadding = 0;
jmitc91516 0:a5c253316af6 2747 if ((sgl.CurItem.FormatFormat == GuiLib_FORMAT_DEC) ||
jmitc91516 0:a5c253316af6 2748 (sgl.CurItem.FormatFormat == GuiLib_FORMAT_EXP))
jmitc91516 0:a5c253316af6 2749 TrailingZeros = ((sgl.CurItem.TextPar[TextNdx].BitFlags &
jmitc91516 0:a5c253316af6 2750 GuiLib_BITFLAG_FORMATTRAILINGZEROS) > 0);
jmitc91516 0:a5c253316af6 2751 else
jmitc91516 0:a5c253316af6 2752 TrailingZeros = 0;
jmitc91516 0:a5c253316af6 2753 if ((sgl.CurItem.FormatFormat == GuiLib_FORMAT_DEC) ||
jmitc91516 0:a5c253316af6 2754 (sgl.CurItem.FormatFormat == GuiLib_FORMAT_HEX_POSTFIX_H) ||
jmitc91516 0:a5c253316af6 2755 (sgl.CurItem.FormatFormat == GuiLib_FORMAT_HEX_PREFIX_0X) ||
jmitc91516 0:a5c253316af6 2756 (sgl.CurItem.FormatFormat == GuiLib_FORMAT_HEX_CLEAN))
jmitc91516 0:a5c253316af6 2757 ThousandsSeparator = ((sgl.CurItem.TextPar[TextNdx].BitFlags &
jmitc91516 0:a5c253316af6 2758 GuiLib_BITFLAG_FORMATTHOUSANDSSEP) > 0);
jmitc91516 0:a5c253316af6 2759 else
jmitc91516 0:a5c253316af6 2760 ThousandsSeparator = 0;
jmitc91516 0:a5c253316af6 2761
jmitc91516 0:a5c253316af6 2762 if ((sgl.CurItem.FormatFormat == GuiLib_FORMAT_DEC) ||
jmitc91516 0:a5c253316af6 2763 (sgl.CurItem.FormatFormat == GuiLib_FORMAT_EXP))
jmitc91516 0:a5c253316af6 2764 {
jmitc91516 0:a5c253316af6 2765 if (Sign)
jmitc91516 0:a5c253316af6 2766 ConvertIntToStr(-DataValue, sgl.VarNumTextStr, 10);
jmitc91516 0:a5c253316af6 2767 else
jmitc91516 0:a5c253316af6 2768 ConvertIntToStr(DataValue, sgl.VarNumTextStr, 10);
jmitc91516 0:a5c253316af6 2769 }
jmitc91516 0:a5c253316af6 2770
jmitc91516 0:a5c253316af6 2771 else if ((sgl.CurItem.FormatFormat == GuiLib_FORMAT_HEX_POSTFIX_H) ||
jmitc91516 0:a5c253316af6 2772 (sgl.CurItem.FormatFormat == GuiLib_FORMAT_HEX_PREFIX_0X) ||
jmitc91516 0:a5c253316af6 2773 (sgl.CurItem.FormatFormat == GuiLib_FORMAT_HEX_CLEAN))
jmitc91516 0:a5c253316af6 2774 {
jmitc91516 0:a5c253316af6 2775 ConvertIntToStr(DataValue, sgl.VarNumTextStr, 16);
jmitc91516 0:a5c253316af6 2776 S1 = sgl.VarNumTextStr;
jmitc91516 0:a5c253316af6 2777 StrLen = 0;
jmitc91516 0:a5c253316af6 2778 while (*S1 != 0)
jmitc91516 0:a5c253316af6 2779 {
jmitc91516 0:a5c253316af6 2780 if ((*S1 >= 'a') && (*S1 <= 'f'))
jmitc91516 0:a5c253316af6 2781 *S1 -= 32;
jmitc91516 0:a5c253316af6 2782 S1++;
jmitc91516 0:a5c253316af6 2783 StrLen++;
jmitc91516 0:a5c253316af6 2784 }
jmitc91516 0:a5c253316af6 2785 if (DataValue < 0)
jmitc91516 0:a5c253316af6 2786 {
jmitc91516 0:a5c253316af6 2787 while ((StrLen > 1) && (StrLen >= sgl.CurItem.FormatFieldWidth))
jmitc91516 0:a5c253316af6 2788 {
jmitc91516 0:a5c253316af6 2789 if (sgl.VarNumTextStr[0] == 'F')
jmitc91516 0:a5c253316af6 2790 {
jmitc91516 0:a5c253316af6 2791 for (N = 0; N < StrLen; N++)
jmitc91516 0:a5c253316af6 2792 sgl.VarNumTextStr[N] = sgl.VarNumTextStr[N + 1];
jmitc91516 0:a5c253316af6 2793 sgl.VarNumTextStr[StrLen] = 0;
jmitc91516 0:a5c253316af6 2794 StrLen--;
jmitc91516 0:a5c253316af6 2795 }
jmitc91516 0:a5c253316af6 2796 else
jmitc91516 0:a5c253316af6 2797 break;
jmitc91516 0:a5c253316af6 2798 }
jmitc91516 0:a5c253316af6 2799
jmitc91516 0:a5c253316af6 2800 }
jmitc91516 0:a5c253316af6 2801 if (StrLen >= GuiConst_MAX_VARNUM_TEXT_LEN)
jmitc91516 0:a5c253316af6 2802 return (0);
jmitc91516 0:a5c253316af6 2803
jmitc91516 0:a5c253316af6 2804 switch (sgl.CurItem.FormatFormat)
jmitc91516 0:a5c253316af6 2805 {
jmitc91516 0:a5c253316af6 2806 case GuiLib_FORMAT_HEX_POSTFIX_H:
jmitc91516 0:a5c253316af6 2807 if (StrLen < GuiConst_MAX_VARNUM_TEXT_LEN - 1)
jmitc91516 0:a5c253316af6 2808 {
jmitc91516 0:a5c253316af6 2809 #ifdef GuiConst_CODEVISION_COMPILER
jmitc91516 0:a5c253316af6 2810 strcatf(sgl.VarNumTextStr, "h");
jmitc91516 0:a5c253316af6 2811 #else
jmitc91516 0:a5c253316af6 2812 strcat(sgl.VarNumTextStr, "h");
jmitc91516 0:a5c253316af6 2813 #endif
jmitc91516 0:a5c253316af6 2814 }
jmitc91516 0:a5c253316af6 2815 break;
jmitc91516 0:a5c253316af6 2816 case GuiLib_FORMAT_HEX_PREFIX_0X:
jmitc91516 0:a5c253316af6 2817 if (StrLen < GuiConst_MAX_VARNUM_TEXT_LEN - 2)
jmitc91516 0:a5c253316af6 2818 {
jmitc91516 0:a5c253316af6 2819 for (N = StrLen - 1; N >= 0; N--)
jmitc91516 0:a5c253316af6 2820 sgl.VarNumTextStr[N + 2] = sgl.VarNumTextStr[N];
jmitc91516 0:a5c253316af6 2821 sgl.VarNumTextStr[0] = '0';
jmitc91516 0:a5c253316af6 2822 sgl.VarNumTextStr[1] = 'x';
jmitc91516 0:a5c253316af6 2823 }
jmitc91516 0:a5c253316af6 2824 break;
jmitc91516 0:a5c253316af6 2825 }
jmitc91516 0:a5c253316af6 2826 }
jmitc91516 0:a5c253316af6 2827
jmitc91516 0:a5c253316af6 2828 else if (Time)
jmitc91516 0:a5c253316af6 2829 {
jmitc91516 0:a5c253316af6 2830 if ((sgl.CurItem.FormatFormat == GuiLib_FORMAT_TIME_HHMMSS_24) ||
jmitc91516 0:a5c253316af6 2831 (sgl.CurItem.FormatFormat == GuiLib_FORMAT_TIME_HHMMSS_12_ampm) ||
jmitc91516 0:a5c253316af6 2832 (sgl.CurItem.FormatFormat == GuiLib_FORMAT_TIME_HHMMSS_12_AMPM))
jmitc91516 0:a5c253316af6 2833 {
jmitc91516 0:a5c253316af6 2834 DataValue %= 360000;
jmitc91516 0:a5c253316af6 2835 TT1 = DataValue / 3600;
jmitc91516 0:a5c253316af6 2836 TT2 = (DataValue % 3600) / 60;
jmitc91516 0:a5c253316af6 2837 TT3 = DataValue % 60;
jmitc91516 0:a5c253316af6 2838 }
jmitc91516 0:a5c253316af6 2839 else
jmitc91516 0:a5c253316af6 2840 {
jmitc91516 0:a5c253316af6 2841 DataValue %= 6000;
jmitc91516 0:a5c253316af6 2842 TT1 = DataValue / 60;
jmitc91516 0:a5c253316af6 2843 TT2 = DataValue % 60;
jmitc91516 0:a5c253316af6 2844 TT3 = -1;
jmitc91516 0:a5c253316af6 2845 }
jmitc91516 0:a5c253316af6 2846
jmitc91516 0:a5c253316af6 2847 if ((sgl.CurItem.FormatFormat == GuiLib_FORMAT_TIME_HHMM_12_ampm) ||
jmitc91516 0:a5c253316af6 2848 (sgl.CurItem.FormatFormat == GuiLib_FORMAT_TIME_HHMMSS_12_ampm) ||
jmitc91516 0:a5c253316af6 2849 (sgl.CurItem.FormatFormat == GuiLib_FORMAT_TIME_HHMM_12_AMPM) ||
jmitc91516 0:a5c253316af6 2850 (sgl.CurItem.FormatFormat == GuiLib_FORMAT_TIME_HHMMSS_12_AMPM))
jmitc91516 0:a5c253316af6 2851 {
jmitc91516 0:a5c253316af6 2852 am = ((TT1%24) < 12);
jmitc91516 0:a5c253316af6 2853 TT1 %= 12;
jmitc91516 0:a5c253316af6 2854 if (TT1 == 0)
jmitc91516 0:a5c253316af6 2855 TT1 = 12;
jmitc91516 0:a5c253316af6 2856 }
jmitc91516 0:a5c253316af6 2857 else
jmitc91516 0:a5c253316af6 2858 am = 0; // To avoid compiler warning
jmitc91516 0:a5c253316af6 2859
jmitc91516 0:a5c253316af6 2860 if (ZeroPadding && (TT1 < 10))
jmitc91516 0:a5c253316af6 2861 #ifdef GuiConst_CODEVISION_COMPILER
jmitc91516 0:a5c253316af6 2862 strcatf(sgl.VarNumTextStr, "0");
jmitc91516 0:a5c253316af6 2863 #else
jmitc91516 0:a5c253316af6 2864 strcat(sgl.VarNumTextStr, "0");
jmitc91516 0:a5c253316af6 2865 #endif
jmitc91516 0:a5c253316af6 2866 ConvertIntToStr(TT1, sgl.VarNumTextStr + strlen(sgl.VarNumTextStr), 10);
jmitc91516 0:a5c253316af6 2867
jmitc91516 0:a5c253316af6 2868 #ifdef GuiConst_CODEVISION_COMPILER
jmitc91516 0:a5c253316af6 2869 strcatf(sgl.VarNumTextStr, ":");
jmitc91516 0:a5c253316af6 2870 #else
jmitc91516 0:a5c253316af6 2871 strcat(sgl.VarNumTextStr, ":");
jmitc91516 0:a5c253316af6 2872 #endif
jmitc91516 0:a5c253316af6 2873
jmitc91516 0:a5c253316af6 2874 if (TT2 < 10)
jmitc91516 0:a5c253316af6 2875 #ifdef GuiConst_CODEVISION_COMPILER
jmitc91516 0:a5c253316af6 2876 strcatf(sgl.VarNumTextStr, "0");
jmitc91516 0:a5c253316af6 2877 #else
jmitc91516 0:a5c253316af6 2878 strcat(sgl.VarNumTextStr, "0");
jmitc91516 0:a5c253316af6 2879 #endif
jmitc91516 0:a5c253316af6 2880 ConvertIntToStr(TT2, sgl.VarNumTextStr + strlen(sgl.VarNumTextStr), 10);
jmitc91516 0:a5c253316af6 2881
jmitc91516 0:a5c253316af6 2882 if (TT3 >= 0)
jmitc91516 0:a5c253316af6 2883 {
jmitc91516 0:a5c253316af6 2884 #ifdef GuiConst_CODEVISION_COMPILER
jmitc91516 0:a5c253316af6 2885 strcatf(sgl.VarNumTextStr, ":");
jmitc91516 0:a5c253316af6 2886 #else
jmitc91516 0:a5c253316af6 2887 strcat(sgl.VarNumTextStr, ":");
jmitc91516 0:a5c253316af6 2888 #endif
jmitc91516 0:a5c253316af6 2889
jmitc91516 0:a5c253316af6 2890 if (TT3 < 10)
jmitc91516 0:a5c253316af6 2891 #ifdef GuiConst_CODEVISION_COMPILER
jmitc91516 0:a5c253316af6 2892 strcatf(sgl.VarNumTextStr, "0");
jmitc91516 0:a5c253316af6 2893 #else
jmitc91516 0:a5c253316af6 2894 strcat(sgl.VarNumTextStr, "0");
jmitc91516 0:a5c253316af6 2895 #endif
jmitc91516 0:a5c253316af6 2896 ConvertIntToStr(TT3, sgl.VarNumTextStr + strlen(sgl.VarNumTextStr), 10);
jmitc91516 0:a5c253316af6 2897 }
jmitc91516 0:a5c253316af6 2898
jmitc91516 0:a5c253316af6 2899 if ((sgl.CurItem.FormatFormat == GuiLib_FORMAT_TIME_HHMM_12_ampm) ||
jmitc91516 0:a5c253316af6 2900 (sgl.CurItem.FormatFormat == GuiLib_FORMAT_TIME_HHMMSS_12_ampm))
jmitc91516 0:a5c253316af6 2901 {
jmitc91516 0:a5c253316af6 2902 if (am)
jmitc91516 0:a5c253316af6 2903 #ifdef GuiConst_CODEVISION_COMPILER
jmitc91516 0:a5c253316af6 2904 strcatf(sgl.VarNumTextStr, "am");
jmitc91516 0:a5c253316af6 2905 #else
jmitc91516 0:a5c253316af6 2906 strcat(sgl.VarNumTextStr, "am");
jmitc91516 0:a5c253316af6 2907 #endif
jmitc91516 0:a5c253316af6 2908 else
jmitc91516 0:a5c253316af6 2909 #ifdef GuiConst_CODEVISION_COMPILER
jmitc91516 0:a5c253316af6 2910 strcatf(sgl.VarNumTextStr, "pm");
jmitc91516 0:a5c253316af6 2911 #else
jmitc91516 0:a5c253316af6 2912 strcat(sgl.VarNumTextStr, "pm");
jmitc91516 0:a5c253316af6 2913 #endif
jmitc91516 0:a5c253316af6 2914 }
jmitc91516 0:a5c253316af6 2915 else if ((sgl.CurItem.FormatFormat == GuiLib_FORMAT_TIME_HHMM_12_AMPM) ||
jmitc91516 0:a5c253316af6 2916 (sgl.CurItem.FormatFormat == GuiLib_FORMAT_TIME_HHMMSS_12_AMPM))
jmitc91516 0:a5c253316af6 2917 {
jmitc91516 0:a5c253316af6 2918 if (am)
jmitc91516 0:a5c253316af6 2919 #ifdef GuiConst_CODEVISION_COMPILER
jmitc91516 0:a5c253316af6 2920 strcatf(sgl.VarNumTextStr, "AM");
jmitc91516 0:a5c253316af6 2921 #else
jmitc91516 0:a5c253316af6 2922 strcat(sgl.VarNumTextStr, "AM");
jmitc91516 0:a5c253316af6 2923 #endif
jmitc91516 0:a5c253316af6 2924 else
jmitc91516 0:a5c253316af6 2925 #ifdef GuiConst_CODEVISION_COMPILER
jmitc91516 0:a5c253316af6 2926 strcatf(sgl.VarNumTextStr, "PM");
jmitc91516 0:a5c253316af6 2927 #else
jmitc91516 0:a5c253316af6 2928 strcat(sgl.VarNumTextStr, "PM");
jmitc91516 0:a5c253316af6 2929 #endif
jmitc91516 0:a5c253316af6 2930 }
jmitc91516 0:a5c253316af6 2931 }
jmitc91516 0:a5c253316af6 2932 else
jmitc91516 0:a5c253316af6 2933 return (0);
jmitc91516 0:a5c253316af6 2934
jmitc91516 0:a5c253316af6 2935 StrLen = 0;
jmitc91516 0:a5c253316af6 2936 S1 = sgl.VarNumTextStr;
jmitc91516 0:a5c253316af6 2937 while (*S1 != 0)
jmitc91516 0:a5c253316af6 2938 {
jmitc91516 0:a5c253316af6 2939 StrLen++;
jmitc91516 0:a5c253316af6 2940 S1++;
jmitc91516 0:a5c253316af6 2941 }
jmitc91516 0:a5c253316af6 2942
jmitc91516 0:a5c253316af6 2943 if (DecimalsPos > 0)
jmitc91516 0:a5c253316af6 2944 {
jmitc91516 0:a5c253316af6 2945 L = DecimalsPos + 1;
jmitc91516 0:a5c253316af6 2946 if (StrLen < L)
jmitc91516 0:a5c253316af6 2947 {
jmitc91516 0:a5c253316af6 2948 if (L > GuiConst_MAX_VARNUM_TEXT_LEN)
jmitc91516 0:a5c253316af6 2949 return (0);
jmitc91516 0:a5c253316af6 2950 for (N = 1; N <= StrLen; N++)
jmitc91516 0:a5c253316af6 2951 sgl.VarNumTextStr[L - N] = sgl.VarNumTextStr[StrLen - N];
jmitc91516 0:a5c253316af6 2952 for (N = 0; N < L - StrLen; N++)
jmitc91516 0:a5c253316af6 2953 sgl.VarNumTextStr[N] = '0';
jmitc91516 0:a5c253316af6 2954
jmitc91516 0:a5c253316af6 2955 StrLen = L;
jmitc91516 0:a5c253316af6 2956 }
jmitc91516 0:a5c253316af6 2957
jmitc91516 0:a5c253316af6 2958 if ((!TrailingZeros) && (!Time) && (VarType != GuiLib_VAR_BOOL))
jmitc91516 0:a5c253316af6 2959 {
jmitc91516 0:a5c253316af6 2960 L = StrLen;
jmitc91516 0:a5c253316af6 2961 for (N = L - 1; N > L - sgl.CurItem.FormatDecimals; N--)
jmitc91516 0:a5c253316af6 2962 if (sgl.VarNumTextStr[N] == '0')
jmitc91516 0:a5c253316af6 2963 {
jmitc91516 0:a5c253316af6 2964 DecimalsPos--;
jmitc91516 0:a5c253316af6 2965 StrLen--;
jmitc91516 0:a5c253316af6 2966 }
jmitc91516 0:a5c253316af6 2967 else
jmitc91516 0:a5c253316af6 2968 break;
jmitc91516 0:a5c253316af6 2969 }
jmitc91516 0:a5c253316af6 2970
jmitc91516 0:a5c253316af6 2971 if (StrLen >= GuiConst_MAX_VARNUM_TEXT_LEN)
jmitc91516 0:a5c253316af6 2972 return (0);
jmitc91516 0:a5c253316af6 2973 P = StrLen - DecimalsPos;
jmitc91516 0:a5c253316af6 2974 for (N = StrLen; N > P; N--)
jmitc91516 0:a5c253316af6 2975 sgl.VarNumTextStr[N] = sgl.VarNumTextStr[N - 1];
jmitc91516 0:a5c253316af6 2976 if (ReadByte(GuiFont_DecimalChar[GuiLib_LanguageIndex]) == GuiLib_DECIMAL_PERIOD)
jmitc91516 0:a5c253316af6 2977 sgl.VarNumTextStr[P] = '.';
jmitc91516 0:a5c253316af6 2978 else
jmitc91516 0:a5c253316af6 2979 sgl.VarNumTextStr[P] = ',';
jmitc91516 0:a5c253316af6 2980 StrLen++;
jmitc91516 0:a5c253316af6 2981 sgl.VarNumTextStr[StrLen] = 0;
jmitc91516 0:a5c253316af6 2982 }
jmitc91516 0:a5c253316af6 2983 else
jmitc91516 0:a5c253316af6 2984 P = StrLen;
jmitc91516 0:a5c253316af6 2985
jmitc91516 0:a5c253316af6 2986 if (ThousandsSeparator)
jmitc91516 0:a5c253316af6 2987 {
jmitc91516 0:a5c253316af6 2988 I = 0;
jmitc91516 0:a5c253316af6 2989 while (P > 0)
jmitc91516 0:a5c253316af6 2990 {
jmitc91516 0:a5c253316af6 2991 if ((I > 0) && (I % 3 ==0 ))
jmitc91516 0:a5c253316af6 2992 {
jmitc91516 0:a5c253316af6 2993 for (N = StrLen; N > P; N--)
jmitc91516 0:a5c253316af6 2994 sgl.VarNumTextStr[N] = sgl.VarNumTextStr[N - 1];
jmitc91516 0:a5c253316af6 2995 if (ReadByte(GuiFont_DecimalChar[GuiLib_LanguageIndex]) == GuiLib_DECIMAL_PERIOD)
jmitc91516 0:a5c253316af6 2996 sgl.VarNumTextStr[P] = ',';
jmitc91516 0:a5c253316af6 2997 else
jmitc91516 0:a5c253316af6 2998 sgl.VarNumTextStr[P] = '.';
jmitc91516 0:a5c253316af6 2999 StrLen++;
jmitc91516 0:a5c253316af6 3000 if (StrLen >= GuiConst_MAX_VARNUM_TEXT_LEN)
jmitc91516 0:a5c253316af6 3001 return (0);
jmitc91516 0:a5c253316af6 3002 sgl.VarNumTextStr[StrLen] = 0;
jmitc91516 0:a5c253316af6 3003 }
jmitc91516 0:a5c253316af6 3004 I++;
jmitc91516 0:a5c253316af6 3005 P--;
jmitc91516 0:a5c253316af6 3006 }
jmitc91516 0:a5c253316af6 3007 }
jmitc91516 0:a5c253316af6 3008
jmitc91516 0:a5c253316af6 3009 if (Sign || ShowSign)
jmitc91516 0:a5c253316af6 3010 {
jmitc91516 0:a5c253316af6 3011 if (StrLen > GuiConst_MAX_VARNUM_TEXT_LEN)
jmitc91516 0:a5c253316af6 3012 return (0);
jmitc91516 0:a5c253316af6 3013 for (N = StrLen; N >= 1; N--)
jmitc91516 0:a5c253316af6 3014 sgl.VarNumTextStr[N] = sgl.VarNumTextStr[N - 1];
jmitc91516 0:a5c253316af6 3015 if (Sign)
jmitc91516 0:a5c253316af6 3016 sgl.VarNumTextStr[0] = '-';
jmitc91516 0:a5c253316af6 3017 else
jmitc91516 0:a5c253316af6 3018 sgl.VarNumTextStr[0] = '+';
jmitc91516 0:a5c253316af6 3019 StrLen++;
jmitc91516 0:a5c253316af6 3020 sgl.VarNumTextStr[StrLen] = 0;
jmitc91516 0:a5c253316af6 3021 }
jmitc91516 0:a5c253316af6 3022
jmitc91516 0:a5c253316af6 3023 #ifdef GuiConst_FLOAT_SUPPORT_ON
jmitc91516 0:a5c253316af6 3024 if (sgl.CurItem.FormatFormat == GuiLib_FORMAT_EXP)
jmitc91516 0:a5c253316af6 3025 {
jmitc91516 0:a5c253316af6 3026 N = sgl.VarExponent;
jmitc91516 0:a5c253316af6 3027 if (N < 0)
jmitc91516 0:a5c253316af6 3028 N = -N;
jmitc91516 0:a5c253316af6 3029 ConvertIntToStr(N, ExponentStr, 10);
jmitc91516 0:a5c253316af6 3030 S1 = ExponentStr;
jmitc91516 0:a5c253316af6 3031 N = 0;
jmitc91516 0:a5c253316af6 3032 while (*S1 != 0)
jmitc91516 0:a5c253316af6 3033 {
jmitc91516 0:a5c253316af6 3034 S1++;
jmitc91516 0:a5c253316af6 3035 N++;
jmitc91516 0:a5c253316af6 3036 }
jmitc91516 0:a5c253316af6 3037 if (N == 1)
jmitc91516 0:a5c253316af6 3038 I = 2;
jmitc91516 0:a5c253316af6 3039 else
jmitc91516 0:a5c253316af6 3040 I = N;
jmitc91516 0:a5c253316af6 3041 if (StrLen + 2 + I >= GuiConst_MAX_VARNUM_TEXT_LEN)
jmitc91516 0:a5c253316af6 3042 return (0);
jmitc91516 0:a5c253316af6 3043 #ifdef GuiConst_CODEVISION_COMPILER
jmitc91516 0:a5c253316af6 3044 strcatf(sgl.VarNumTextStr, "E");
jmitc91516 0:a5c253316af6 3045 #else
jmitc91516 0:a5c253316af6 3046 strcat(sgl.VarNumTextStr, "E");
jmitc91516 0:a5c253316af6 3047 #endif
jmitc91516 0:a5c253316af6 3048 StrLen++;
jmitc91516 0:a5c253316af6 3049 if (sgl.VarExponent >= 0)
jmitc91516 0:a5c253316af6 3050 #ifdef GuiConst_CODEVISION_COMPILER
jmitc91516 0:a5c253316af6 3051 strcatf(sgl.VarNumTextStr, "+");
jmitc91516 0:a5c253316af6 3052 #else
jmitc91516 0:a5c253316af6 3053 strcat(sgl.VarNumTextStr, "+");
jmitc91516 0:a5c253316af6 3054 #endif
jmitc91516 0:a5c253316af6 3055 else
jmitc91516 0:a5c253316af6 3056 #ifdef GuiConst_CODEVISION_COMPILER
jmitc91516 0:a5c253316af6 3057 strcatf(sgl.VarNumTextStr, "-");
jmitc91516 0:a5c253316af6 3058 #else
jmitc91516 0:a5c253316af6 3059 strcat(sgl.VarNumTextStr, "-");
jmitc91516 0:a5c253316af6 3060 #endif
jmitc91516 0:a5c253316af6 3061 StrLen++;
jmitc91516 0:a5c253316af6 3062 if (N == 1)
jmitc91516 0:a5c253316af6 3063 {
jmitc91516 0:a5c253316af6 3064 #ifdef GuiConst_CODEVISION_COMPILER
jmitc91516 0:a5c253316af6 3065 strcatf(sgl.VarNumTextStr, "0");
jmitc91516 0:a5c253316af6 3066 #else
jmitc91516 0:a5c253316af6 3067 strcat(sgl.VarNumTextStr, "0");
jmitc91516 0:a5c253316af6 3068 #endif
jmitc91516 0:a5c253316af6 3069 StrLen++;
jmitc91516 0:a5c253316af6 3070 }
jmitc91516 0:a5c253316af6 3071 strcat(sgl.VarNumTextStr, ExponentStr);
jmitc91516 0:a5c253316af6 3072 StrLen += N;
jmitc91516 0:a5c253316af6 3073 }
jmitc91516 0:a5c253316af6 3074 #endif
jmitc91516 0:a5c253316af6 3075
jmitc91516 0:a5c253316af6 3076 if (sgl.CurItem.FormatFieldWidth > 0)
jmitc91516 0:a5c253316af6 3077 {
jmitc91516 0:a5c253316af6 3078 if (StrLen > sgl.CurItem.FormatFieldWidth)
jmitc91516 0:a5c253316af6 3079 {
jmitc91516 0:a5c253316af6 3080 for (N = 0; N < sgl.CurItem.FormatFieldWidth; N++)
jmitc91516 0:a5c253316af6 3081 sgl.VarNumTextStr[N] = '-';
jmitc91516 0:a5c253316af6 3082 }
jmitc91516 0:a5c253316af6 3083 else
jmitc91516 0:a5c253316af6 3084 {
jmitc91516 0:a5c253316af6 3085 if (sgl.CurItem.FormatFieldWidth > GuiConst_MAX_VARNUM_TEXT_LEN)
jmitc91516 0:a5c253316af6 3086 return (0);
jmitc91516 0:a5c253316af6 3087 if (ZeroPadding && (!Time))
jmitc91516 0:a5c253316af6 3088 {
jmitc91516 0:a5c253316af6 3089 if ((sgl.VarNumTextStr[0] == '-') || (sgl.VarNumTextStr[0] == '+'))
jmitc91516 0:a5c253316af6 3090 Offset = 1;
jmitc91516 0:a5c253316af6 3091 else
jmitc91516 0:a5c253316af6 3092 Offset = 0;
jmitc91516 0:a5c253316af6 3093 for (N = 1; N <= StrLen - Offset; N++)
jmitc91516 0:a5c253316af6 3094 sgl.VarNumTextStr[sgl.CurItem.FormatFieldWidth - N] =
jmitc91516 0:a5c253316af6 3095 sgl.VarNumTextStr[StrLen - N];
jmitc91516 0:a5c253316af6 3096 for (N = 0; N < sgl.CurItem.FormatFieldWidth - StrLen; N++)
jmitc91516 0:a5c253316af6 3097 sgl.VarNumTextStr[N + Offset] = '0';
jmitc91516 0:a5c253316af6 3098 }
jmitc91516 0:a5c253316af6 3099 else if (sgl.CurItem.FormatAlignment == GuiLib_FORMAT_ALIGNMENT_LEFT)
jmitc91516 0:a5c253316af6 3100 {
jmitc91516 0:a5c253316af6 3101 for (N = StrLen; N < sgl.CurItem.FormatFieldWidth; N++)
jmitc91516 0:a5c253316af6 3102 sgl.VarNumTextStr[N] = ' ';
jmitc91516 0:a5c253316af6 3103 }
jmitc91516 0:a5c253316af6 3104 else if (sgl.CurItem.FormatAlignment == GuiLib_FORMAT_ALIGNMENT_CENTER)
jmitc91516 0:a5c253316af6 3105 {
jmitc91516 0:a5c253316af6 3106 Offset = (sgl.CurItem.FormatFieldWidth - StrLen) / 2;
jmitc91516 0:a5c253316af6 3107 if (Offset > 0)
jmitc91516 0:a5c253316af6 3108 {
jmitc91516 0:a5c253316af6 3109 for (N = StrLen - 1; N >= 0; N--)
jmitc91516 0:a5c253316af6 3110 sgl.VarNumTextStr[N + Offset] = sgl.VarNumTextStr[N];
jmitc91516 0:a5c253316af6 3111 for (N = 0; N < Offset; N++)
jmitc91516 0:a5c253316af6 3112 sgl.VarNumTextStr[N] = ' ';
jmitc91516 0:a5c253316af6 3113 }
jmitc91516 0:a5c253316af6 3114 Offset = sgl.CurItem.FormatFieldWidth - StrLen - Offset;
jmitc91516 0:a5c253316af6 3115 if (Offset > 0)
jmitc91516 0:a5c253316af6 3116 for (N = sgl.CurItem.FormatFieldWidth - Offset;
jmitc91516 0:a5c253316af6 3117 N < sgl.CurItem.FormatFieldWidth; N++)
jmitc91516 0:a5c253316af6 3118 sgl.VarNumTextStr[N] = ' ';
jmitc91516 0:a5c253316af6 3119 }
jmitc91516 0:a5c253316af6 3120 else if (sgl.CurItem.FormatAlignment == GuiLib_FORMAT_ALIGNMENT_RIGHT)
jmitc91516 0:a5c253316af6 3121 {
jmitc91516 0:a5c253316af6 3122 for (N = 1; N <= StrLen; N++)
jmitc91516 0:a5c253316af6 3123 sgl.VarNumTextStr[sgl.CurItem.FormatFieldWidth - N] =
jmitc91516 0:a5c253316af6 3124 sgl.VarNumTextStr[StrLen - N];
jmitc91516 0:a5c253316af6 3125 for (N = 0; N < sgl.CurItem.FormatFieldWidth - StrLen; N++)
jmitc91516 0:a5c253316af6 3126 sgl.VarNumTextStr[N] = ' ';
jmitc91516 0:a5c253316af6 3127 }
jmitc91516 0:a5c253316af6 3128 }
jmitc91516 0:a5c253316af6 3129 sgl.VarNumTextStr[sgl.CurItem.FormatFieldWidth] = 0;
jmitc91516 0:a5c253316af6 3130 return (sgl.CurItem.FormatFieldWidth);
jmitc91516 0:a5c253316af6 3131 }
jmitc91516 0:a5c253316af6 3132 else
jmitc91516 0:a5c253316af6 3133 {
jmitc91516 0:a5c253316af6 3134 sgl.VarNumTextStr[StrLen] = 0;
jmitc91516 0:a5c253316af6 3135 return (StrLen);
jmitc91516 0:a5c253316af6 3136 }
jmitc91516 0:a5c253316af6 3137 }
jmitc91516 0:a5c253316af6 3138
jmitc91516 0:a5c253316af6 3139 #ifdef GuiConst_REMOTE_STRUCT_DATA
jmitc91516 0:a5c253316af6 3140 //------------------------------------------------------------------------------
jmitc91516 0:a5c253316af6 3141 static GuiLib_StructPtr GetRemoteStructData(
jmitc91516 0:a5c253316af6 3142 GuiConst_INT32S StructIndex)
jmitc91516 0:a5c253316af6 3143 {
jmitc91516 0:a5c253316af6 3144 sgl.RemoteStructOffset =
jmitc91516 0:a5c253316af6 3145 (GuiConst_INT32U PrefixRom)GuiStruct_StructPtrList[StructIndex];
jmitc91516 0:a5c253316af6 3146 GuiLib_RemoteDataReadBlock(
jmitc91516 0:a5c253316af6 3147 sgl.RemoteStructOffset,
jmitc91516 0:a5c253316af6 3148 1,
jmitc91516 0:a5c253316af6 3149 sgl.GuiLib_RemoteStructBuffer);
jmitc91516 0:a5c253316af6 3150 sgl.RemoteStructOffset++;
jmitc91516 0:a5c253316af6 3151 return((GuiLib_StructPtr)&sgl.GuiLib_RemoteStructBuffer[0]);
jmitc91516 0:a5c253316af6 3152 }
jmitc91516 0:a5c253316af6 3153
jmitc91516 0:a5c253316af6 3154 #ifdef GuiConst_REMOTE_TEXT_DATA
jmitc91516 0:a5c253316af6 3155 //------------------------------------------------------------------------------
jmitc91516 0:a5c253316af6 3156 static GuiConst_INT16U GetRemoteText(
jmitc91516 0:a5c253316af6 3157 GuiConst_INT16U TextIndex)
jmitc91516 0:a5c253316af6 3158 {
jmitc91516 0:a5c253316af6 3159 GuiConst_INT32S TextOfs;
jmitc91516 0:a5c253316af6 3160
jmitc91516 0:a5c253316af6 3161 if (TextIndex != sgl.CurRemoteText)
jmitc91516 0:a5c253316af6 3162 {
jmitc91516 0:a5c253316af6 3163 if (sgl.RemoteTextTableOfs == -1)
jmitc91516 0:a5c253316af6 3164 GuiLib_RemoteTextReadBlock(4, 4, &sgl.RemoteTextTableOfs);
jmitc91516 0:a5c253316af6 3165
jmitc91516 0:a5c253316af6 3166 GuiLib_RemoteTextReadBlock(sgl.RemoteTextTableOfs + 6 * TextIndex, 4, &TextOfs);
jmitc91516 0:a5c253316af6 3167 GuiLib_RemoteTextReadBlock(
jmitc91516 0:a5c253316af6 3168 sgl.RemoteTextTableOfs + 6 * TextIndex + 4, 2, &sgl.RemoteTextLen);
jmitc91516 0:a5c253316af6 3169
jmitc91516 0:a5c253316af6 3170 #ifdef GuiConst_CHARMODE_ANSI
jmitc91516 0:a5c253316af6 3171 GuiLib_RemoteTextReadBlock(TextOfs, sgl.RemoteTextLen, sgl.GuiLib_RemoteTextBuffer);
jmitc91516 0:a5c253316af6 3172 #else
jmitc91516 0:a5c253316af6 3173 GuiLib_RemoteTextReadBlock(TextOfs, 2 * sgl.RemoteTextLen, sgl.GuiLib_RemoteTextBuffer);
jmitc91516 0:a5c253316af6 3174 #endif
jmitc91516 0:a5c253316af6 3175 sgl.CurRemoteText = TextIndex;
jmitc91516 0:a5c253316af6 3176 }
jmitc91516 0:a5c253316af6 3177 return(sgl.RemoteTextLen);
jmitc91516 0:a5c253316af6 3178 }
jmitc91516 0:a5c253316af6 3179 #endif
jmitc91516 0:a5c253316af6 3180
jmitc91516 0:a5c253316af6 3181 #endif
jmitc91516 0:a5c253316af6 3182
jmitc91516 0:a5c253316af6 3183 #ifdef GuiConst_CHARMODE_UNICODE
jmitc91516 0:a5c253316af6 3184 //------------------------------------------------------------------------------
jmitc91516 0:a5c253316af6 3185 static void ExtractUnicodeString(
jmitc91516 0:a5c253316af6 3186 GuiConst_INT8U PrefixLocate *ItemTextPtr,
jmitc91516 0:a5c253316af6 3187 GuiConst_INT16U TextLength)
jmitc91516 0:a5c253316af6 3188 {
jmitc91516 0:a5c253316af6 3189 GuiConst_INT16U P;
jmitc91516 0:a5c253316af6 3190
jmitc91516 0:a5c253316af6 3191 for (P = 0; P < TextLength; P++)
jmitc91516 0:a5c253316af6 3192 sgl.UnicodeTextBuf[P] = GetItemWord(&ItemTextPtr);
jmitc91516 0:a5c253316af6 3193 sgl.UnicodeTextBuf[TextLength] = 0;
jmitc91516 0:a5c253316af6 3194 }
jmitc91516 0:a5c253316af6 3195 #endif
jmitc91516 0:a5c253316af6 3196
jmitc91516 0:a5c253316af6 3197 //------------------------------------------------------------------------------
jmitc91516 0:a5c253316af6 3198 static void SetCurFont(
jmitc91516 0:a5c253316af6 3199 GuiConst_INT8U FontIndex)
jmitc91516 0:a5c253316af6 3200 {
jmitc91516 0:a5c253316af6 3201 if (FontIndex >= GuiFont_FontCnt)
jmitc91516 0:a5c253316af6 3202 sgl.CurFont = (GuiLib_FontRecPtr)ReadWord(GuiFont_FontList[0]);
jmitc91516 0:a5c253316af6 3203 else
jmitc91516 0:a5c253316af6 3204 sgl.CurFont = (GuiLib_FontRecPtr)ReadWord(GuiFont_FontList[FontIndex]);
jmitc91516 0:a5c253316af6 3205 }
jmitc91516 0:a5c253316af6 3206
jmitc91516 0:a5c253316af6 3207 #ifdef GuiConst_BITMAP_SUPPORT_ON
jmitc91516 0:a5c253316af6 3208 //------------------------------------------------------------------------------
jmitc91516 0:a5c253316af6 3209 static void UpdateBackgroundBitmap(void)
jmitc91516 0:a5c253316af6 3210 {
jmitc91516 0:a5c253316af6 3211 GuiConst_INT8U BackgroundOn;
jmitc91516 0:a5c253316af6 3212 GuiConst_INT16U BackgroundX1, BackgroundY1, BackgroundX2, BackgroundY2;
jmitc91516 0:a5c253316af6 3213 GuiConst_INT16S N;
jmitc91516 0:a5c253316af6 3214
jmitc91516 0:a5c253316af6 3215 for (N = 0; N < GuiConst_MAX_BACKGROUND_BITMAPS; N++)
jmitc91516 0:a5c253316af6 3216 if (sgl.BackgrBitmapAry[N].InUse)
jmitc91516 0:a5c253316af6 3217 {
jmitc91516 0:a5c253316af6 3218 BackgroundOn = 0;
jmitc91516 0:a5c253316af6 3219 switch (sgl.CurItem.ItemType)
jmitc91516 0:a5c253316af6 3220 {
jmitc91516 0:a5c253316af6 3221 case GuiLib_ITEM_TEXT:
jmitc91516 0:a5c253316af6 3222 case GuiLib_ITEM_VAR:
jmitc91516 0:a5c253316af6 3223 BackgroundOn = 1;
jmitc91516 0:a5c253316af6 3224 if (sgl.CurItem.TextPar[0].BackBoxSizeX == 0)
jmitc91516 0:a5c253316af6 3225 {
jmitc91516 0:a5c253316af6 3226 BackgroundX1 = sgl.CurItem.DrawnX1;
jmitc91516 0:a5c253316af6 3227 BackgroundY1 = sgl.CurItem.DrawnY1;
jmitc91516 0:a5c253316af6 3228 BackgroundX2 = sgl.CurItem.DrawnX2;
jmitc91516 0:a5c253316af6 3229 BackgroundY2 = sgl.CurItem.DrawnY2;
jmitc91516 0:a5c253316af6 3230 }
jmitc91516 0:a5c253316af6 3231 else
jmitc91516 0:a5c253316af6 3232 {
jmitc91516 0:a5c253316af6 3233 SetCurFont(sgl.CurItem.TextPar[0].FontIndex);
jmitc91516 0:a5c253316af6 3234 SetBackBox(0);
jmitc91516 0:a5c253316af6 3235 BackgroundX1 = sgl.BbX1;
jmitc91516 0:a5c253316af6 3236 BackgroundY1 = sgl.BbY1;
jmitc91516 0:a5c253316af6 3237 BackgroundX2 = sgl.BbX2;
jmitc91516 0:a5c253316af6 3238 BackgroundY2 = sgl.BbY2;
jmitc91516 0:a5c253316af6 3239 }
jmitc91516 0:a5c253316af6 3240 break;
jmitc91516 0:a5c253316af6 3241
jmitc91516 0:a5c253316af6 3242 case GuiLib_ITEM_STRUCTURE:
jmitc91516 0:a5c253316af6 3243 case GuiLib_ITEM_STRUCTARRAY:
jmitc91516 0:a5c253316af6 3244 case GuiLib_ITEM_STRUCTCOND:
jmitc91516 0:a5c253316af6 3245 if (sgl.CurItem.Drawn)
jmitc91516 0:a5c253316af6 3246 {
jmitc91516 0:a5c253316af6 3247 BackgroundOn = 1;
jmitc91516 0:a5c253316af6 3248 BackgroundX1 = sgl.CurItem.DrawnX1;
jmitc91516 0:a5c253316af6 3249 BackgroundY1 = sgl.CurItem.DrawnY1;
jmitc91516 0:a5c253316af6 3250 BackgroundX2 = sgl.CurItem.DrawnX2;
jmitc91516 0:a5c253316af6 3251 BackgroundY2 = sgl.CurItem.DrawnY2;
jmitc91516 0:a5c253316af6 3252 }
jmitc91516 0:a5c253316af6 3253 break;
jmitc91516 0:a5c253316af6 3254
jmitc91516 0:a5c253316af6 3255 case GuiLib_ITEM_TEXTBLOCK:
jmitc91516 0:a5c253316af6 3256 case GuiLib_ITEM_VARBLOCK:
jmitc91516 0:a5c253316af6 3257 case GuiLib_ITEM_CHECKBOX:
jmitc91516 0:a5c253316af6 3258 case GuiLib_ITEM_BUTTON:
jmitc91516 0:a5c253316af6 3259 case GuiLib_ITEM_EDITBOX:
jmitc91516 0:a5c253316af6 3260 case GuiLib_ITEM_PANEL:
jmitc91516 0:a5c253316af6 3261 case GuiLib_ITEM_MEMO:
jmitc91516 0:a5c253316af6 3262 case GuiLib_ITEM_LISTBOX:
jmitc91516 0:a5c253316af6 3263 case GuiLib_ITEM_COMBOBOX:
jmitc91516 0:a5c253316af6 3264 case GuiLib_ITEM_SCROLLBOX:
jmitc91516 0:a5c253316af6 3265 case GuiLib_ITEM_SCROLLAREA:
jmitc91516 0:a5c253316af6 3266 case GuiLib_ITEM_PROGRESSBAR:
jmitc91516 0:a5c253316af6 3267 if (sgl.CurItem.TextPar[0].BitFlags & GuiLib_BITFLAG_TRANSPARENT)
jmitc91516 0:a5c253316af6 3268 {
jmitc91516 0:a5c253316af6 3269 BackgroundOn = 1;
jmitc91516 0:a5c253316af6 3270 SetBackColorBox(sgl.CurItem.X1, sgl.CurItem.Y1,
jmitc91516 0:a5c253316af6 3271 sgl.CurItem.X2, sgl.CurItem.Y2,
jmitc91516 0:a5c253316af6 3272 0);
jmitc91516 0:a5c253316af6 3273 BackgroundX1 = sgl.BbX1;
jmitc91516 0:a5c253316af6 3274 BackgroundY1 = sgl.BbY1;
jmitc91516 0:a5c253316af6 3275 BackgroundX2 = sgl.BbX2;
jmitc91516 0:a5c253316af6 3276 BackgroundY2 = sgl.BbY2;
jmitc91516 0:a5c253316af6 3277 }
jmitc91516 0:a5c253316af6 3278 break;
jmitc91516 0:a5c253316af6 3279 #ifdef GuiConst_ITEM_RADIOBUTTON_INUSE
jmitc91516 0:a5c253316af6 3280 case GuiLib_ITEM_RADIOBUTTON:
jmitc91516 0:a5c253316af6 3281 if (sgl.CurItem.TextPar[0].BitFlags & GuiLib_BITFLAG_TRANSPARENT)
jmitc91516 0:a5c253316af6 3282 {
jmitc91516 0:a5c253316af6 3283 BackgroundOn = 1;
jmitc91516 0:a5c253316af6 3284 SetBackColorBox(sgl.CurItem.X1,
jmitc91516 0:a5c253316af6 3285 sgl.CurItem.Y1,
jmitc91516 0:a5c253316af6 3286 sgl.CurItem.X2,
jmitc91516 0:a5c253316af6 3287 sgl.CurItem.Y2 +
jmitc91516 0:a5c253316af6 3288 (sgl.CurItem.CompPars.CompRadioButton.Count - 1) *
jmitc91516 0:a5c253316af6 3289 sgl.CurItem.CompPars.CompRadioButton.InterDistance,
jmitc91516 0:a5c253316af6 3290 0);
jmitc91516 0:a5c253316af6 3291 BackgroundX1 = sgl.BbX1;
jmitc91516 0:a5c253316af6 3292 BackgroundY1 = sgl.BbY1;
jmitc91516 0:a5c253316af6 3293 BackgroundX2 = sgl.BbX2;
jmitc91516 0:a5c253316af6 3294 BackgroundY2 = sgl.BbY2;
jmitc91516 0:a5c253316af6 3295 }
jmitc91516 0:a5c253316af6 3296 break;
jmitc91516 0:a5c253316af6 3297 #endif
jmitc91516 0:a5c253316af6 3298 }
jmitc91516 0:a5c253316af6 3299 if (BackgroundOn)
jmitc91516 0:a5c253316af6 3300 GuiLib_ShowBitmapArea(sgl.BackgrBitmapAry[N].Index,
jmitc91516 0:a5c253316af6 3301 sgl.BackgrBitmapAry[N].X, sgl.BackgrBitmapAry[N].Y,
jmitc91516 0:a5c253316af6 3302 BackgroundX1, BackgroundY1, BackgroundX2, BackgroundY2, -1);
jmitc91516 0:a5c253316af6 3303 }
jmitc91516 0:a5c253316af6 3304 }
jmitc91516 0:a5c253316af6 3305 #endif
jmitc91516 0:a5c253316af6 3306
jmitc91516 0:a5c253316af6 3307 #ifdef GuiConst_CLIPPING_SUPPORT_ON
jmitc91516 0:a5c253316af6 3308 //------------------------------------------------------------------------------
jmitc91516 0:a5c253316af6 3309 static void StartClipping(
jmitc91516 0:a5c253316af6 3310 GuiConst_INT8U Clipping)
jmitc91516 0:a5c253316af6 3311 {
jmitc91516 0:a5c253316af6 3312 #ifdef GuiConst_REL_COORD_ORIGO_INUSE
jmitc91516 0:a5c253316af6 3313 sgl.CurItem.ClipRectX1 += sgl.CoordOrigoX;
jmitc91516 0:a5c253316af6 3314 sgl.CurItem.ClipRectY1 += sgl.CoordOrigoY;
jmitc91516 0:a5c253316af6 3315 sgl.CurItem.ClipRectX2 += sgl.CoordOrigoX;
jmitc91516 0:a5c253316af6 3316 sgl.CurItem.ClipRectY2 += sgl.CoordOrigoY;
jmitc91516 0:a5c253316af6 3317 #endif
jmitc91516 0:a5c253316af6 3318 if (Clipping)
jmitc91516 0:a5c253316af6 3319 {
jmitc91516 0:a5c253316af6 3320 OrderCoord(&sgl.CurItem.ClipRectX1, &sgl.CurItem.ClipRectX2);
jmitc91516 0:a5c253316af6 3321 OrderCoord(&sgl.CurItem.ClipRectY1, &sgl.CurItem.ClipRectY2);
jmitc91516 0:a5c253316af6 3322 if (sgl.CurItem.ClipRectX1 < sgl.ActiveAreaX1)
jmitc91516 0:a5c253316af6 3323 sgl.CurItem.ClipRectX1 = sgl.ActiveAreaX1;
jmitc91516 0:a5c253316af6 3324 if (sgl.CurItem.ClipRectY1 < sgl.ActiveAreaY1)
jmitc91516 0:a5c253316af6 3325 sgl.CurItem.ClipRectY1 = sgl.ActiveAreaY1;
jmitc91516 0:a5c253316af6 3326 if (sgl.CurItem.ClipRectX2 > sgl.ActiveAreaX2)
jmitc91516 0:a5c253316af6 3327 sgl.CurItem.ClipRectX2 = sgl.ActiveAreaX2;
jmitc91516 0:a5c253316af6 3328 if (sgl.CurItem.ClipRectY2 > sgl.ActiveAreaY2)
jmitc91516 0:a5c253316af6 3329 sgl.CurItem.ClipRectY2 = sgl.ActiveAreaY2;
jmitc91516 0:a5c253316af6 3330 }
jmitc91516 0:a5c253316af6 3331 else
jmitc91516 0:a5c253316af6 3332 {
jmitc91516 0:a5c253316af6 3333 sgl.CurItem.ClipRectX1 = sgl.ActiveAreaX1;
jmitc91516 0:a5c253316af6 3334 sgl.CurItem.ClipRectY1 = sgl.ActiveAreaY1;
jmitc91516 0:a5c253316af6 3335 sgl.CurItem.ClipRectX2 = sgl.ActiveAreaX2;
jmitc91516 0:a5c253316af6 3336 sgl.CurItem.ClipRectY2 = sgl.ActiveAreaY2;
jmitc91516 0:a5c253316af6 3337 }
jmitc91516 0:a5c253316af6 3338 #ifdef GuiConst_REL_COORD_ORIGO_INUSE
jmitc91516 0:a5c253316af6 3339 sgl.CurItem.ClipRectX1 -= sgl.CoordOrigoX;
jmitc91516 0:a5c253316af6 3340 sgl.CurItem.ClipRectY1 -= sgl.CoordOrigoY;
jmitc91516 0:a5c253316af6 3341 sgl.CurItem.ClipRectX2 -= sgl.CoordOrigoX;
jmitc91516 0:a5c253316af6 3342 sgl.CurItem.ClipRectY2 -= sgl.CoordOrigoY;
jmitc91516 0:a5c253316af6 3343 #endif
jmitc91516 0:a5c253316af6 3344 GuiLib_SetClipping(sgl.CurItem.ClipRectX1, sgl.CurItem.ClipRectY1,
jmitc91516 0:a5c253316af6 3345 sgl.CurItem.ClipRectX2, sgl.CurItem.ClipRectY2);
jmitc91516 0:a5c253316af6 3346 }
jmitc91516 0:a5c253316af6 3347 #endif
jmitc91516 0:a5c253316af6 3348
jmitc91516 0:a5c253316af6 3349 //------------------------------------------------------------------------------
jmitc91516 0:a5c253316af6 3350 static void PrepareInternalStruct(void)
jmitc91516 0:a5c253316af6 3351 {
jmitc91516 0:a5c253316af6 3352 sgl.Memory.X[GuiLib_MEMORY_CNT] = sgl.CurItem.X1;
jmitc91516 0:a5c253316af6 3353 sgl.Memory.Y[GuiLib_MEMORY_CNT] = sgl.CurItem.Y1;
jmitc91516 0:a5c253316af6 3354 }
jmitc91516 0:a5c253316af6 3355
jmitc91516 0:a5c253316af6 3356 //------------------------------------------------------------------------------
jmitc91516 0:a5c253316af6 3357 static void DrawSubStruct(
jmitc91516 0:a5c253316af6 3358 GuiConst_INT16U SubStructIndex,
jmitc91516 0:a5c253316af6 3359 GuiConst_INT8U ColorInvert,
jmitc91516 0:a5c253316af6 3360 GuiConst_INT8U SubInt)
jmitc91516 0:a5c253316af6 3361 {
jmitc91516 0:a5c253316af6 3362 GuiLib_ItemRec RemCurItem;
jmitc91516 0:a5c253316af6 3363 GuiLib_StructPtr StructToCall;
jmitc91516 0:a5c253316af6 3364 GuiConst_INT8U RemBackBox;
jmitc91516 0:a5c253316af6 3365 GuiConst_INT16S RemBbX1, RemBbX2;
jmitc91516 0:a5c253316af6 3366 GuiConst_INT16S RemBbY1, RemBbY2;
jmitc91516 0:a5c253316af6 3367 GuiConst_INT8U RemDrawn;
jmitc91516 0:a5c253316af6 3368 GuiConst_INT16S RemDrawnX1, RemDrawnY1, RemDrawnX2, RemDrawnY2;
jmitc91516 0:a5c253316af6 3369 GuiConst_INT16S RemAutoRedrawSaveIndex;
jmitc91516 0:a5c253316af6 3370 GuiConst_INT16S RemAutoRedrawParent;
jmitc91516 0:a5c253316af6 3371 GuiConst_INT16S RemAutoRedrawLatest;
jmitc91516 0:a5c253316af6 3372 #ifdef GuiConst_REMOTE_STRUCT_DATA
jmitc91516 0:a5c253316af6 3373 GuiConst_INT32U RemRemoteStructOffset;
jmitc91516 0:a5c253316af6 3374 #endif
jmitc91516 0:a5c253316af6 3375
jmitc91516 0:a5c253316af6 3376 if (SubStructIndex != 0xFFFF)
jmitc91516 0:a5c253316af6 3377 {
jmitc91516 0:a5c253316af6 3378 RemAutoRedrawParent = sgl.AutoRedrawParent;
jmitc91516 0:a5c253316af6 3379 RemAutoRedrawLatest = sgl.AutoRedrawLatest;
jmitc91516 0:a5c253316af6 3380
jmitc91516 0:a5c253316af6 3381 sgl.AutoRedrawParent = sgl.AutoRedrawLatest;
jmitc91516 0:a5c253316af6 3382
jmitc91516 0:a5c253316af6 3383 if (SubInt)
jmitc91516 0:a5c253316af6 3384 memcpy(&RemCurItem, &sgl.CurItem, sizeof(GuiLib_ItemRec));
jmitc91516 0:a5c253316af6 3385
jmitc91516 0:a5c253316af6 3386 #ifdef GuiConst_REMOTE_STRUCT_DATA
jmitc91516 0:a5c253316af6 3387 RemRemoteStructOffset = sgl.RemoteStructOffset;
jmitc91516 0:a5c253316af6 3388 #endif
jmitc91516 0:a5c253316af6 3389 RemBackBox = (sgl.CurItem.TextPar[0].BackBoxSizeX);
jmitc91516 0:a5c253316af6 3390 RemBbX1 = sgl.BbX1;
jmitc91516 0:a5c253316af6 3391 RemBbX2 = sgl.BbX2;
jmitc91516 0:a5c253316af6 3392 RemBbY1 = sgl.BbY1;
jmitc91516 0:a5c253316af6 3393 RemBbY2 = sgl.BbY2;
jmitc91516 0:a5c253316af6 3394 RemDrawn = gl.Drawn;
jmitc91516 0:a5c253316af6 3395 RemDrawnX1 = gl.DrawnX1;
jmitc91516 0:a5c253316af6 3396 RemDrawnY1 = gl.DrawnY1;
jmitc91516 0:a5c253316af6 3397 RemDrawnX2 = gl.DrawnX2;
jmitc91516 0:a5c253316af6 3398 RemDrawnY2 = gl.DrawnY2;
jmitc91516 0:a5c253316af6 3399 ResetDrawLimits();
jmitc91516 0:a5c253316af6 3400 RemAutoRedrawSaveIndex = sgl.AutoRedrawSaveIndex;
jmitc91516 0:a5c253316af6 3401
jmitc91516 0:a5c253316af6 3402 sgl.DisplayLevel++;
jmitc91516 0:a5c253316af6 3403 StructToCall =
jmitc91516 0:a5c253316af6 3404 #ifdef GuiConst_REMOTE_STRUCT_DATA
jmitc91516 0:a5c253316af6 3405 GetRemoteStructData(SubStructIndex);
jmitc91516 0:a5c253316af6 3406 #else
jmitc91516 0:a5c253316af6 3407 (GuiLib_StructPtr)ReadWord(GuiStruct_StructPtrList[SubStructIndex]);
jmitc91516 0:a5c253316af6 3408 #endif
jmitc91516 0:a5c253316af6 3409 DrawStructure(StructToCall, ColorInvert);
jmitc91516 0:a5c253316af6 3410 sgl.DisplayLevel--;
jmitc91516 0:a5c253316af6 3411
jmitc91516 0:a5c253316af6 3412 if (RemBackBox)
jmitc91516 0:a5c253316af6 3413 {
jmitc91516 0:a5c253316af6 3414 sgl.CurItem.Drawn = 1;
jmitc91516 0:a5c253316af6 3415 sgl.CurItem.DrawnX1 = RemBbX1;
jmitc91516 0:a5c253316af6 3416 sgl.CurItem.DrawnY1 = RemBbY1;
jmitc91516 0:a5c253316af6 3417 sgl.CurItem.DrawnX2 = RemBbX2;
jmitc91516 0:a5c253316af6 3418 sgl.CurItem.DrawnY2 = RemBbY2;
jmitc91516 0:a5c253316af6 3419
jmitc91516 0:a5c253316af6 3420 gl.DrawnX1 = GuiLib_GET_MIN(sgl.BbX1, RemDrawnX1);
jmitc91516 0:a5c253316af6 3421 gl.DrawnY1 = GuiLib_GET_MIN(sgl.BbY1, RemDrawnY1);
jmitc91516 0:a5c253316af6 3422 gl.DrawnX2 = GuiLib_GET_MAX(sgl.BbX2, RemDrawnX2);
jmitc91516 0:a5c253316af6 3423 gl.DrawnY2 = GuiLib_GET_MAX(sgl.BbY2, RemDrawnY2);
jmitc91516 0:a5c253316af6 3424 }
jmitc91516 0:a5c253316af6 3425 else if (gl.Drawn)
jmitc91516 0:a5c253316af6 3426 {
jmitc91516 0:a5c253316af6 3427 sgl.CurItem.Drawn = 1;
jmitc91516 0:a5c253316af6 3428 sgl.CurItem.DrawnX1 = gl.DrawnX1;
jmitc91516 0:a5c253316af6 3429 sgl.CurItem.DrawnY1 = gl.DrawnY1;
jmitc91516 0:a5c253316af6 3430 sgl.CurItem.DrawnX2 = gl.DrawnX2;
jmitc91516 0:a5c253316af6 3431 sgl.CurItem.DrawnY2 = gl.DrawnY2;
jmitc91516 0:a5c253316af6 3432
jmitc91516 0:a5c253316af6 3433 gl.DrawnX1 = GuiLib_GET_MIN(gl.DrawnX1, RemDrawnX1);
jmitc91516 0:a5c253316af6 3434 gl.DrawnY1 = GuiLib_GET_MIN(gl.DrawnY1, RemDrawnY1);
jmitc91516 0:a5c253316af6 3435 gl.DrawnX2 = GuiLib_GET_MAX(gl.DrawnX2, RemDrawnX2);
jmitc91516 0:a5c253316af6 3436 gl.DrawnY2 = GuiLib_GET_MAX(gl.DrawnY2, RemDrawnY2);
jmitc91516 0:a5c253316af6 3437 }
jmitc91516 0:a5c253316af6 3438 else
jmitc91516 0:a5c253316af6 3439 {
jmitc91516 0:a5c253316af6 3440 gl.Drawn = RemDrawn;
jmitc91516 0:a5c253316af6 3441 gl.DrawnX1 = RemDrawnX1;
jmitc91516 0:a5c253316af6 3442 gl.DrawnY1 = RemDrawnY1;
jmitc91516 0:a5c253316af6 3443 gl.DrawnX2 = RemDrawnX2;
jmitc91516 0:a5c253316af6 3444 gl.DrawnY2 = RemDrawnY2;
jmitc91516 0:a5c253316af6 3445 }
jmitc91516 0:a5c253316af6 3446 sgl.AutoRedrawSaveIndex = RemAutoRedrawSaveIndex;
jmitc91516 0:a5c253316af6 3447
jmitc91516 0:a5c253316af6 3448 #ifdef GuiConst_REMOTE_STRUCT_DATA
jmitc91516 0:a5c253316af6 3449 sgl.RemoteStructOffset = RemRemoteStructOffset;
jmitc91516 0:a5c253316af6 3450 #endif
jmitc91516 0:a5c253316af6 3451
jmitc91516 0:a5c253316af6 3452 if (SubInt)
jmitc91516 0:a5c253316af6 3453 memcpy(&sgl.CurItem, &RemCurItem, sizeof(GuiLib_ItemRec));
jmitc91516 0:a5c253316af6 3454
jmitc91516 0:a5c253316af6 3455 sgl.AutoRedrawLatest = RemAutoRedrawLatest;
jmitc91516 0:a5c253316af6 3456 sgl.AutoRedrawParent = RemAutoRedrawParent;
jmitc91516 0:a5c253316af6 3457 }
jmitc91516 0:a5c253316af6 3458 }
jmitc91516 0:a5c253316af6 3459
jmitc91516 0:a5c253316af6 3460 #include "GuiItems.h"
jmitc91516 0:a5c253316af6 3461
jmitc91516 0:a5c253316af6 3462 //------------------------------------------------------------------------------
jmitc91516 0:a5c253316af6 3463 static void DrawStructure(
jmitc91516 0:a5c253316af6 3464 GuiLib_StructPtr Structure,
jmitc91516 0:a5c253316af6 3465 GuiConst_INT8U ColorInvert) PrefixReentrant
jmitc91516 0:a5c253316af6 3466 {
jmitc91516 0:a5c253316af6 3467 GuiConst_INT16S ItemNdx;
jmitc91516 0:a5c253316af6 3468 GuiConst_INT16S X, RemAutoRedrawLatest;
jmitc91516 0:a5c253316af6 3469 void PrefixLocate *XVarPtr;
jmitc91516 0:a5c253316af6 3470 void PrefixLocate *YVarPtr;
jmitc91516 0:a5c253316af6 3471 GuiConst_INT8U ItemCnt;
jmitc91516 0:a5c253316af6 3472 GuiConst_INT8U PrefixLocate *LocalItemDataPtr;
jmitc91516 0:a5c253316af6 3473 #ifdef GuiConst_ITEM_GRAPHICS_LAYER_FILTER_INUSE
jmitc91516 0:a5c253316af6 3474 GuiConst_INT16S I;
jmitc91516 0:a5c253316af6 3475 #endif
jmitc91516 0:a5c253316af6 3476 #ifdef GuiConst_REMOTE_STRUCT_DATA
jmitc91516 0:a5c253316af6 3477 GuiConst_INT8U ItemSizeBuf[2];
jmitc91516 0:a5c253316af6 3478 GuiConst_INT16U ItemSize;
jmitc91516 0:a5c253316af6 3479 #endif
jmitc91516 0:a5c253316af6 3480
jmitc91516 0:a5c253316af6 3481 #ifdef GuiConst_REMOTE_STRUCT_DATA
jmitc91516 0:a5c253316af6 3482 LocalItemDataPtr = sgl.GuiLib_RemoteStructBuffer;
jmitc91516 0:a5c253316af6 3483 #else
jmitc91516 0:a5c253316af6 3484 LocalItemDataPtr = (GuiConst_INT8U PrefixLocate *)Structure;
jmitc91516 0:a5c253316af6 3485 #endif
jmitc91516 0:a5c253316af6 3486 ItemCnt = GetItemByte(&LocalItemDataPtr);
jmitc91516 0:a5c253316af6 3487
jmitc91516 0:a5c253316af6 3488 for (ItemNdx = 0; ItemNdx < ItemCnt; ItemNdx++)
jmitc91516 0:a5c253316af6 3489 {
jmitc91516 0:a5c253316af6 3490 RemAutoRedrawLatest = sgl.AutoRedrawLatest;
jmitc91516 0:a5c253316af6 3491
jmitc91516 0:a5c253316af6 3492 #ifdef GuiConst_REMOTE_STRUCT_DATA
jmitc91516 0:a5c253316af6 3493 GuiLib_RemoteDataReadBlock(
jmitc91516 0:a5c253316af6 3494 sgl.RemoteStructOffset,
jmitc91516 0:a5c253316af6 3495 2,
jmitc91516 0:a5c253316af6 3496 (GuiConst_INT8U*)&ItemSizeBuf);
jmitc91516 0:a5c253316af6 3497 ItemSize = (256 * (GuiConst_INT16U)ItemSizeBuf[1]) + ItemSizeBuf[0];
jmitc91516 0:a5c253316af6 3498 sgl.RemoteStructOffset += 2;
jmitc91516 0:a5c253316af6 3499 GuiLib_RemoteDataReadBlock(
jmitc91516 0:a5c253316af6 3500 sgl.RemoteStructOffset,
jmitc91516 0:a5c253316af6 3501 ItemSize,
jmitc91516 0:a5c253316af6 3502 sgl.GuiLib_RemoteItemBuffer);
jmitc91516 0:a5c253316af6 3503 sgl.RemoteStructOffset += ItemSize;
jmitc91516 0:a5c253316af6 3504 LocalItemDataPtr = &sgl.GuiLib_RemoteItemBuffer[0];
jmitc91516 0:a5c253316af6 3505 #endif
jmitc91516 0:a5c253316af6 3506
jmitc91516 0:a5c253316af6 3507 sgl.ItemDataPtr = LocalItemDataPtr;
jmitc91516 0:a5c253316af6 3508 ReadItem(GuiLib_LanguageIndex);
jmitc91516 0:a5c253316af6 3509 LocalItemDataPtr = sgl.ItemDataPtr;
jmitc91516 0:a5c253316af6 3510
jmitc91516 0:a5c253316af6 3511 if ((sgl.ItemTypeBit1 & (GuiLib_ITEMBIT_CLEARAREA +
jmitc91516 0:a5c253316af6 3512 GuiLib_ITEMBIT_TEXT +
jmitc91516 0:a5c253316af6 3513 GuiLib_ITEMBIT_TEXTBLOCK +
jmitc91516 0:a5c253316af6 3514 GuiLib_ITEMBIT_DOT +
jmitc91516 0:a5c253316af6 3515 GuiLib_ITEMBIT_LINE +
jmitc91516 0:a5c253316af6 3516 GuiLib_ITEMBIT_FRAME +
jmitc91516 0:a5c253316af6 3517 GuiLib_ITEMBIT_BLOCK +
jmitc91516 0:a5c253316af6 3518 GuiLib_ITEMBIT_CIRCLE +
jmitc91516 0:a5c253316af6 3519 GuiLib_ITEMBIT_ELLIPSE +
jmitc91516 0:a5c253316af6 3520 GuiLib_ITEMBIT_BITMAP +
jmitc91516 0:a5c253316af6 3521 GuiLib_ITEMBIT_BACKGROUND +
jmitc91516 0:a5c253316af6 3522 GuiLib_ITEMBIT_STRUCTURE +
jmitc91516 0:a5c253316af6 3523 GuiLib_ITEMBIT_STRUCTARRAY +
jmitc91516 0:a5c253316af6 3524 GuiLib_ITEMBIT_ACTIVEAREA +
jmitc91516 0:a5c253316af6 3525 GuiLib_ITEMBIT_CLIPRECT +
jmitc91516 0:a5c253316af6 3526 GuiLib_ITEMBIT_VAR +
jmitc91516 0:a5c253316af6 3527 GuiLib_ITEMBIT_VARBLOCK +
jmitc91516 0:a5c253316af6 3528 GuiLib_ITEMBIT_TOUCHAREA +
jmitc91516 0:a5c253316af6 3529 GuiLib_ITEMBIT_SCROLLBOX +
jmitc91516 0:a5c253316af6 3530 GuiLib_ITEMBIT_GRAPH +
jmitc91516 0:a5c253316af6 3531 GuiLib_ITEMBIT_GRAPHICSLAYER)) ||
jmitc91516 0:a5c253316af6 3532 (sgl.ItemTypeBit2 & (GuiLib_ITEMBIT_ROUNDEDFRAME +
jmitc91516 0:a5c253316af6 3533 GuiLib_ITEMBIT_ROUNDEDBLOCK +
jmitc91516 0:a5c253316af6 3534 GuiLib_ITEMBIT_QUARTERCIRCLE +
jmitc91516 0:a5c253316af6 3535 GuiLib_ITEMBIT_QUARTERELLIPSE +
jmitc91516 0:a5c253316af6 3536 GuiLib_ITEMBIT_CHECKBOX +
jmitc91516 0:a5c253316af6 3537 GuiLib_ITEMBIT_RADIOBUTTON +
jmitc91516 0:a5c253316af6 3538 GuiLib_ITEMBIT_BUTTON +
jmitc91516 0:a5c253316af6 3539 GuiLib_ITEMBIT_EDITBOX +
jmitc91516 0:a5c253316af6 3540 GuiLib_ITEMBIT_PANEL +
jmitc91516 0:a5c253316af6 3541 GuiLib_ITEMBIT_MEMO +
jmitc91516 0:a5c253316af6 3542 GuiLib_ITEMBIT_LISTBOX +
jmitc91516 0:a5c253316af6 3543 GuiLib_ITEMBIT_COMBOBOX +
jmitc91516 0:a5c253316af6 3544 GuiLib_ITEMBIT_SCROLLAREA +
jmitc91516 0:a5c253316af6 3545 GuiLib_ITEMBIT_PROGRESSBAR +
jmitc91516 0:a5c253316af6 3546 GuiLib_ITEMBIT_STRUCTCOND +
jmitc91516 0:a5c253316af6 3547 GuiLib_ITEMBIT_POSCALLBACK)))
jmitc91516 0:a5c253316af6 3548 {
jmitc91516 0:a5c253316af6 3549 if (sgl.CommonByte2 & 0x10)
jmitc91516 0:a5c253316af6 3550 {
jmitc91516 0:a5c253316af6 3551 XVarPtr = (void PrefixLocate *)ReadWord(GuiStruct_VarPtrList[sgl.X1VarIdx]);
jmitc91516 0:a5c253316af6 3552 sgl.X1VarType = ReadByte(GuiStruct_VarTypeList[sgl.X1VarIdx]);
jmitc91516 0:a5c253316af6 3553 }
jmitc91516 0:a5c253316af6 3554 else
jmitc91516 0:a5c253316af6 3555 XVarPtr = 0;
jmitc91516 0:a5c253316af6 3556 if (XVarPtr != 0)
jmitc91516 0:a5c253316af6 3557 sgl.ItemX1 += ReadVar(XVarPtr, sgl.X1VarType);
jmitc91516 0:a5c253316af6 3558 if (sgl.X1MemoryRead > 0)
jmitc91516 0:a5c253316af6 3559 sgl.ItemX1 += sgl.Memory.X[sgl.X1MemoryRead - 1];
jmitc91516 0:a5c253316af6 3560 if (sgl.X1Mode == GuiLib_COOR_REL)
jmitc91516 0:a5c253316af6 3561 sgl.ItemX1 += sgl.CurItem.RX;
jmitc91516 0:a5c253316af6 3562 else if (sgl.X1Mode == GuiLib_COOR_REL_1)
jmitc91516 0:a5c253316af6 3563 sgl.ItemX1 += sgl.CurItem.RX1;
jmitc91516 0:a5c253316af6 3564 else if (sgl.X1Mode == GuiLib_COOR_REL_2)
jmitc91516 0:a5c253316af6 3565 sgl.ItemX1 += sgl.CurItem.RX2;
jmitc91516 0:a5c253316af6 3566 if (sgl.X1MemoryWrite > 0)
jmitc91516 0:a5c253316af6 3567 sgl.Memory.X[sgl.X1MemoryWrite - 1] = sgl.ItemX1;
jmitc91516 0:a5c253316af6 3568 sgl.CurItem.X1 = sgl.ItemX1;
jmitc91516 0:a5c253316af6 3569
jmitc91516 0:a5c253316af6 3570 if (sgl.CommonByte2 & 0x20)
jmitc91516 0:a5c253316af6 3571 {
jmitc91516 0:a5c253316af6 3572 YVarPtr = (void PrefixLocate *)ReadWord(GuiStruct_VarPtrList[sgl.Y1VarIdx]);
jmitc91516 0:a5c253316af6 3573 sgl.Y1VarType = ReadByte(GuiStruct_VarTypeList[sgl.Y1VarIdx]);
jmitc91516 0:a5c253316af6 3574 }
jmitc91516 0:a5c253316af6 3575 else
jmitc91516 0:a5c253316af6 3576 YVarPtr = 0;
jmitc91516 0:a5c253316af6 3577 if (YVarPtr != 0)
jmitc91516 0:a5c253316af6 3578 sgl.ItemY1 += ReadVar(YVarPtr, sgl.Y1VarType);
jmitc91516 0:a5c253316af6 3579 if (sgl.Y1MemoryRead > 0)
jmitc91516 0:a5c253316af6 3580 sgl.ItemY1 += sgl.Memory.Y[sgl.Y1MemoryRead - 1];
jmitc91516 0:a5c253316af6 3581 if (sgl.Y1Mode == GuiLib_COOR_REL)
jmitc91516 0:a5c253316af6 3582 sgl.ItemY1 += sgl.CurItem.RY;
jmitc91516 0:a5c253316af6 3583 else if (sgl.Y1Mode == GuiLib_COOR_REL_1)
jmitc91516 0:a5c253316af6 3584 sgl.ItemY1 += sgl.CurItem.RY1;
jmitc91516 0:a5c253316af6 3585 else if (sgl.Y1Mode == GuiLib_COOR_REL_2)
jmitc91516 0:a5c253316af6 3586 sgl.ItemY1 += sgl.CurItem.RY2;
jmitc91516 0:a5c253316af6 3587 if (sgl.Y1MemoryWrite > 0)
jmitc91516 0:a5c253316af6 3588 sgl.Memory.Y[sgl.Y1MemoryWrite - 1] = sgl.ItemY1;
jmitc91516 0:a5c253316af6 3589 sgl.CurItem.Y1 = sgl.ItemY1;
jmitc91516 0:a5c253316af6 3590
jmitc91516 0:a5c253316af6 3591 sgl.CurItem.RX = sgl.CurItem.X1;
jmitc91516 0:a5c253316af6 3592 sgl.CurItem.RY = sgl.CurItem.Y1;
jmitc91516 0:a5c253316af6 3593 }
jmitc91516 0:a5c253316af6 3594
jmitc91516 0:a5c253316af6 3595 #ifdef GuiConst_ITEM_SCROLLBOX_INUSE
jmitc91516 0:a5c253316af6 3596 if (sgl.ItemTypeBit1 & GuiLib_ITEMBIT_SCROLLBOX)
jmitc91516 0:a5c253316af6 3597 {
jmitc91516 0:a5c253316af6 3598 sgl.ScrollBoxesAry[sgl.GlobalScrollBoxIndex].X1 = sgl.CurItem.X1;
jmitc91516 0:a5c253316af6 3599 sgl.ScrollBoxesAry[sgl.GlobalScrollBoxIndex].Y1 = sgl.CurItem.Y1;
jmitc91516 0:a5c253316af6 3600 sgl.ScrollBoxesAry[sgl.GlobalScrollBoxIndex].BackColor = sgl.CurItem.BackColor;
jmitc91516 0:a5c253316af6 3601
jmitc91516 0:a5c253316af6 3602 #ifndef GuiConst_SCROLLITEM_BAR_NONE
jmitc91516 0:a5c253316af6 3603 if ((sgl.ScrollBoxesAry[sgl.GlobalScrollBoxIndex].BarMode & 0x03) ==
jmitc91516 0:a5c253316af6 3604 GuiLib_COOR_REL)
jmitc91516 0:a5c253316af6 3605 sgl.ScrollBoxesAry[sgl.GlobalScrollBoxIndex].BarPositionX += sgl.CurItem.X1;
jmitc91516 0:a5c253316af6 3606 if (((sgl.ScrollBoxesAry[sgl.GlobalScrollBoxIndex].BarMode >> 2) & 0x03) ==
jmitc91516 0:a5c253316af6 3607 GuiLib_COOR_REL)
jmitc91516 0:a5c253316af6 3608 sgl.ScrollBoxesAry[sgl.GlobalScrollBoxIndex].BarPositionY += sgl.CurItem.Y1;
jmitc91516 0:a5c253316af6 3609 #endif
jmitc91516 0:a5c253316af6 3610 #ifndef GuiConst_SCROLLITEM_INDICATOR_NONE
jmitc91516 0:a5c253316af6 3611 if ((sgl.ScrollBoxesAry[sgl.GlobalScrollBoxIndex].IndicatorMode & 0x03) ==
jmitc91516 0:a5c253316af6 3612 GuiLib_COOR_REL)
jmitc91516 0:a5c253316af6 3613 sgl.ScrollBoxesAry[sgl.GlobalScrollBoxIndex].IndicatorPositionX += sgl.CurItem.X1;
jmitc91516 0:a5c253316af6 3614 if (((sgl.ScrollBoxesAry[sgl.GlobalScrollBoxIndex].IndicatorMode >> 2) & 0x03) ==
jmitc91516 0:a5c253316af6 3615 GuiLib_COOR_REL)
jmitc91516 0:a5c253316af6 3616 sgl.ScrollBoxesAry[sgl.GlobalScrollBoxIndex].IndicatorPositionY += sgl.CurItem.Y1;
jmitc91516 0:a5c253316af6 3617 #endif
jmitc91516 0:a5c253316af6 3618 }
jmitc91516 0:a5c253316af6 3619 #endif
jmitc91516 0:a5c253316af6 3620
jmitc91516 0:a5c253316af6 3621 if ((sgl.ItemTypeBit1 & (GuiLib_ITEMBIT_CLEARAREA +
jmitc91516 0:a5c253316af6 3622 GuiLib_ITEMBIT_TEXTBLOCK +
jmitc91516 0:a5c253316af6 3623 GuiLib_ITEMBIT_VARBLOCK +
jmitc91516 0:a5c253316af6 3624 GuiLib_ITEMBIT_LINE +
jmitc91516 0:a5c253316af6 3625 GuiLib_ITEMBIT_FRAME +
jmitc91516 0:a5c253316af6 3626 GuiLib_ITEMBIT_BLOCK +
jmitc91516 0:a5c253316af6 3627 GuiLib_ITEMBIT_BITMAP +
jmitc91516 0:a5c253316af6 3628 GuiLib_ITEMBIT_BACKGROUND +
jmitc91516 0:a5c253316af6 3629 GuiLib_ITEMBIT_ACTIVEAREA +
jmitc91516 0:a5c253316af6 3630 GuiLib_ITEMBIT_CLIPRECT +
jmitc91516 0:a5c253316af6 3631 GuiLib_ITEMBIT_TOUCHAREA +
jmitc91516 0:a5c253316af6 3632 GuiLib_ITEMBIT_GRAPH +
jmitc91516 0:a5c253316af6 3633 GuiLib_ITEMBIT_GRAPHICSLAYER)) ||
jmitc91516 0:a5c253316af6 3634 (sgl.ItemTypeBit2 & (GuiLib_ITEMBIT_ROUNDEDFRAME +
jmitc91516 0:a5c253316af6 3635 GuiLib_ITEMBIT_ROUNDEDBLOCK +
jmitc91516 0:a5c253316af6 3636 GuiLib_ITEMBIT_BUTTON +
jmitc91516 0:a5c253316af6 3637 GuiLib_ITEMBIT_EDITBOX +
jmitc91516 0:a5c253316af6 3638 GuiLib_ITEMBIT_PANEL +
jmitc91516 0:a5c253316af6 3639 GuiLib_ITEMBIT_MEMO +
jmitc91516 0:a5c253316af6 3640 GuiLib_ITEMBIT_LISTBOX +
jmitc91516 0:a5c253316af6 3641 GuiLib_ITEMBIT_COMBOBOX +
jmitc91516 0:a5c253316af6 3642 GuiLib_ITEMBIT_SCROLLAREA +
jmitc91516 0:a5c253316af6 3643 GuiLib_ITEMBIT_PROGRESSBAR)))
jmitc91516 0:a5c253316af6 3644 {
jmitc91516 0:a5c253316af6 3645 if (sgl.CommonByte2 & 0x40)
jmitc91516 0:a5c253316af6 3646 {
jmitc91516 0:a5c253316af6 3647 XVarPtr = (void PrefixLocate *)ReadWord(GuiStruct_VarPtrList[sgl.X2VarIdx]);
jmitc91516 0:a5c253316af6 3648 sgl.X2VarType = ReadByte(GuiStruct_VarTypeList[sgl.X2VarIdx]);
jmitc91516 0:a5c253316af6 3649 }
jmitc91516 0:a5c253316af6 3650 else
jmitc91516 0:a5c253316af6 3651 XVarPtr = 0;
jmitc91516 0:a5c253316af6 3652 if (XVarPtr != 0)
jmitc91516 0:a5c253316af6 3653 sgl.ItemX2 += ReadVar(XVarPtr, sgl.X2VarType);
jmitc91516 0:a5c253316af6 3654 if (sgl.X2MemoryRead > 0)
jmitc91516 0:a5c253316af6 3655 sgl.ItemX2 += sgl.Memory.X[sgl.X2MemoryRead - 1];
jmitc91516 0:a5c253316af6 3656 if (sgl.X2Mode == GuiLib_COOR_REL)
jmitc91516 0:a5c253316af6 3657 sgl.ItemX2 += sgl.CurItem.X1;
jmitc91516 0:a5c253316af6 3658 else if (sgl.X2Mode == GuiLib_COOR_REL_1)
jmitc91516 0:a5c253316af6 3659 sgl.ItemX2 += sgl.CurItem.RX1;
jmitc91516 0:a5c253316af6 3660 else if (sgl.X2Mode == GuiLib_COOR_REL_2)
jmitc91516 0:a5c253316af6 3661 sgl.ItemX2 += sgl.CurItem.RX2;
jmitc91516 0:a5c253316af6 3662 if (sgl.X2MemoryWrite > 0)
jmitc91516 0:a5c253316af6 3663 sgl.Memory.X[sgl.X2MemoryWrite - 1] = sgl.ItemX2;
jmitc91516 0:a5c253316af6 3664 sgl.CurItem.X2 = sgl.ItemX2;
jmitc91516 0:a5c253316af6 3665
jmitc91516 0:a5c253316af6 3666 if (sgl.CommonByte2 & 0x80)
jmitc91516 0:a5c253316af6 3667 {
jmitc91516 0:a5c253316af6 3668 YVarPtr = (void PrefixLocate *)ReadWord(GuiStruct_VarPtrList[sgl.Y2VarIdx]);
jmitc91516 0:a5c253316af6 3669 sgl.Y2VarType = ReadByte(GuiStruct_VarTypeList[sgl.Y2VarIdx]);
jmitc91516 0:a5c253316af6 3670 }
jmitc91516 0:a5c253316af6 3671 else
jmitc91516 0:a5c253316af6 3672 YVarPtr = 0;
jmitc91516 0:a5c253316af6 3673 if (YVarPtr != 0)
jmitc91516 0:a5c253316af6 3674 sgl.ItemY2 += ReadVar(YVarPtr, sgl.Y2VarType);
jmitc91516 0:a5c253316af6 3675 if (sgl.Y2MemoryRead > 0)
jmitc91516 0:a5c253316af6 3676 sgl.ItemY2 += sgl.Memory.Y[sgl.Y2MemoryRead - 1];
jmitc91516 0:a5c253316af6 3677 if (sgl.Y2Mode == GuiLib_COOR_REL)
jmitc91516 0:a5c253316af6 3678 sgl.ItemY2 += sgl.CurItem.Y1;
jmitc91516 0:a5c253316af6 3679 else if (sgl.Y2Mode == GuiLib_COOR_REL_1)
jmitc91516 0:a5c253316af6 3680 sgl.ItemY2 += sgl.CurItem.RY1;
jmitc91516 0:a5c253316af6 3681 else if (sgl.Y2Mode == GuiLib_COOR_REL_2)
jmitc91516 0:a5c253316af6 3682 sgl.ItemY2 += sgl.CurItem.RY2;
jmitc91516 0:a5c253316af6 3683 if (sgl.Y2MemoryWrite > 0)
jmitc91516 0:a5c253316af6 3684 sgl.Memory.Y[sgl.Y2MemoryWrite - 1] = sgl.ItemY2;
jmitc91516 0:a5c253316af6 3685 sgl.CurItem.Y2 = sgl.ItemY2;
jmitc91516 0:a5c253316af6 3686 }
jmitc91516 0:a5c253316af6 3687 #ifdef GuiConst_ITEM_CHECKBOX_INUSE
jmitc91516 0:a5c253316af6 3688 else if (sgl.ItemTypeBit2 & GuiLib_ITEMBIT_CHECKBOX)
jmitc91516 0:a5c253316af6 3689 {
jmitc91516 0:a5c253316af6 3690 switch (sgl.CurItem.CompPars.CompCheckBox.Style)
jmitc91516 0:a5c253316af6 3691 {
jmitc91516 0:a5c253316af6 3692 case GuiLib_CHECKBOX_FLAT:
jmitc91516 0:a5c253316af6 3693 case GuiLib_CHECKBOX_3D:
jmitc91516 0:a5c253316af6 3694 case GuiLib_CHECKBOX_NONE:
jmitc91516 0:a5c253316af6 3695 sgl.CurItem.X2 = sgl.CurItem.X1 +
jmitc91516 0:a5c253316af6 3696 sgl.CurItem.CompPars.CompCheckBox.Size - 1;
jmitc91516 0:a5c253316af6 3697 sgl.CurItem.Y2 = sgl.CurItem.Y1 +
jmitc91516 0:a5c253316af6 3698 sgl.CurItem.CompPars.CompCheckBox.Size - 1;
jmitc91516 0:a5c253316af6 3699 break;
jmitc91516 0:a5c253316af6 3700 case GuiLib_CHECKBOX_ICON:
jmitc91516 0:a5c253316af6 3701 sgl.CurItem.X2 = sgl.CurItem.X1;
jmitc91516 0:a5c253316af6 3702 sgl.CurItem.Y2 = sgl.CurItem.Y1;
jmitc91516 0:a5c253316af6 3703 break;
jmitc91516 0:a5c253316af6 3704 case GuiLib_CHECKBOX_BITMAP:
jmitc91516 0:a5c253316af6 3705 sgl.CurItem.X2 = sgl.CurItem.X1;
jmitc91516 0:a5c253316af6 3706 sgl.CurItem.Y2 = sgl.CurItem.Y1;
jmitc91516 0:a5c253316af6 3707 break;
jmitc91516 0:a5c253316af6 3708 }
jmitc91516 0:a5c253316af6 3709 }
jmitc91516 0:a5c253316af6 3710 #endif
jmitc91516 0:a5c253316af6 3711 #ifdef GuiConst_ITEM_RADIOBUTTON_INUSE
jmitc91516 0:a5c253316af6 3712 else if (sgl.ItemTypeBit2 & GuiLib_ITEMBIT_RADIOBUTTON)
jmitc91516 0:a5c253316af6 3713 {
jmitc91516 0:a5c253316af6 3714 switch (sgl.CurItem.CompPars.CompRadioButton.Style)
jmitc91516 0:a5c253316af6 3715 {
jmitc91516 0:a5c253316af6 3716 case GuiLib_RADIOBUTTON_FLAT:
jmitc91516 0:a5c253316af6 3717 case GuiLib_RADIOBUTTON_3D:
jmitc91516 0:a5c253316af6 3718 sgl.CurItem.X2 = sgl.CurItem.X1 +
jmitc91516 0:a5c253316af6 3719 2 * sgl.CurItem.CompPars.CompRadioButton.Size;
jmitc91516 0:a5c253316af6 3720 sgl.CurItem.Y2 = sgl.CurItem.Y1 +
jmitc91516 0:a5c253316af6 3721 2 * sgl.CurItem.CompPars.CompRadioButton.Size;
jmitc91516 0:a5c253316af6 3722 break;
jmitc91516 0:a5c253316af6 3723 case GuiLib_RADIOBUTTON_ICON:
jmitc91516 0:a5c253316af6 3724 sgl.CurItem.X2 = sgl.CurItem.X1;
jmitc91516 0:a5c253316af6 3725 sgl.CurItem.Y2 = sgl.CurItem.Y1;
jmitc91516 0:a5c253316af6 3726 break;
jmitc91516 0:a5c253316af6 3727 case GuiLib_RADIOBUTTON_BITMAP:
jmitc91516 0:a5c253316af6 3728 sgl.CurItem.X2 = sgl.CurItem.X1;
jmitc91516 0:a5c253316af6 3729 sgl.CurItem.Y2 = sgl.CurItem.Y1;
jmitc91516 0:a5c253316af6 3730 break;
jmitc91516 0:a5c253316af6 3731 }
jmitc91516 0:a5c253316af6 3732 }
jmitc91516 0:a5c253316af6 3733 #endif
jmitc91516 0:a5c253316af6 3734 #ifdef GuiConst_ITEM_BUTTON_INUSE
jmitc91516 0:a5c253316af6 3735 else if (sgl.ItemTypeBit2 & GuiLib_ITEMBIT_BUTTON)
jmitc91516 0:a5c253316af6 3736 {
jmitc91516 0:a5c253316af6 3737 sgl.CurItem.X2 = sgl.CurItem.X1;
jmitc91516 0:a5c253316af6 3738 sgl.CurItem.Y2 = sgl.CurItem.Y1;
jmitc91516 0:a5c253316af6 3739 }
jmitc91516 0:a5c253316af6 3740 #endif
jmitc91516 0:a5c253316af6 3741
jmitc91516 0:a5c253316af6 3742 if ((sgl.ItemTypeBit1 & (GuiLib_ITEMBIT_CIRCLE +
jmitc91516 0:a5c253316af6 3743 GuiLib_ITEMBIT_ELLIPSE)) ||
jmitc91516 0:a5c253316af6 3744 (sgl.ItemTypeBit2 & (GuiLib_ITEMBIT_ROUNDEDFRAME +
jmitc91516 0:a5c253316af6 3745 GuiLib_ITEMBIT_ROUNDEDBLOCK +
jmitc91516 0:a5c253316af6 3746 GuiLib_ITEMBIT_QUARTERCIRCLE +
jmitc91516 0:a5c253316af6 3747 GuiLib_ITEMBIT_QUARTERELLIPSE +
jmitc91516 0:a5c253316af6 3748 GuiLib_ITEMBIT_BUTTON +
jmitc91516 0:a5c253316af6 3749 GuiLib_ITEMBIT_PANEL)))
jmitc91516 0:a5c253316af6 3750 {
jmitc91516 0:a5c253316af6 3751 if (sgl.CommonByte6 & 0x40)
jmitc91516 0:a5c253316af6 3752 {
jmitc91516 0:a5c253316af6 3753 XVarPtr = (void PrefixLocate *)ReadWord(GuiStruct_VarPtrList[sgl.R1VarIdx]);
jmitc91516 0:a5c253316af6 3754 sgl.R1VarType = ReadByte(GuiStruct_VarTypeList[sgl.R1VarIdx]);
jmitc91516 0:a5c253316af6 3755 }
jmitc91516 0:a5c253316af6 3756 else
jmitc91516 0:a5c253316af6 3757 XVarPtr = 0;
jmitc91516 0:a5c253316af6 3758 if (XVarPtr != 0)
jmitc91516 0:a5c253316af6 3759 sgl.ItemR1 += ReadVar(XVarPtr, sgl.R1VarType);
jmitc91516 0:a5c253316af6 3760 if (sgl.R1MemoryRead > 0)
jmitc91516 0:a5c253316af6 3761 sgl.ItemR1 += sgl.Memory.X[sgl.R1MemoryRead - 1];
jmitc91516 0:a5c253316af6 3762 if (sgl.R1Mode == GuiLib_COOR_REL)
jmitc91516 0:a5c253316af6 3763 sgl.ItemR1 += sgl.CurItem.X1;
jmitc91516 0:a5c253316af6 3764 else if (sgl.R1Mode == GuiLib_COOR_REL_1)
jmitc91516 0:a5c253316af6 3765 sgl.ItemR1 += sgl.CurItem.RX1;
jmitc91516 0:a5c253316af6 3766 else if (sgl.R1Mode == GuiLib_COOR_REL_2)
jmitc91516 0:a5c253316af6 3767 sgl.ItemR1 += sgl.CurItem.RX2;
jmitc91516 0:a5c253316af6 3768 if (sgl.R1MemoryWrite > 0)
jmitc91516 0:a5c253316af6 3769 sgl.Memory.X[sgl.R1MemoryWrite - 1] = sgl.ItemR1;
jmitc91516 0:a5c253316af6 3770 sgl.CurItem.R1 = sgl.ItemR1;
jmitc91516 0:a5c253316af6 3771 }
jmitc91516 0:a5c253316af6 3772
jmitc91516 0:a5c253316af6 3773 if ((sgl.ItemTypeBit1 & (GuiLib_ITEMBIT_ELLIPSE)) ||
jmitc91516 0:a5c253316af6 3774 (sgl.ItemTypeBit2 & (GuiLib_ITEMBIT_QUARTERELLIPSE)))
jmitc91516 0:a5c253316af6 3775 {
jmitc91516 0:a5c253316af6 3776 if (sgl.CommonByte6 & 0x80)
jmitc91516 0:a5c253316af6 3777 {
jmitc91516 0:a5c253316af6 3778 YVarPtr = (void PrefixLocate *)ReadWord(GuiStruct_VarPtrList[sgl.R2VarIdx]);
jmitc91516 0:a5c253316af6 3779 sgl.R2VarType = ReadByte(GuiStruct_VarTypeList[sgl.R2VarIdx]);
jmitc91516 0:a5c253316af6 3780 }
jmitc91516 0:a5c253316af6 3781 else
jmitc91516 0:a5c253316af6 3782 YVarPtr = 0;
jmitc91516 0:a5c253316af6 3783 if (YVarPtr != 0)
jmitc91516 0:a5c253316af6 3784 sgl.ItemR2 += ReadVar(YVarPtr, sgl.R2VarType);
jmitc91516 0:a5c253316af6 3785 if (sgl.R2MemoryRead > 0)
jmitc91516 0:a5c253316af6 3786 sgl.ItemR2 += sgl.Memory.Y[sgl.R2MemoryRead - 1];
jmitc91516 0:a5c253316af6 3787 if (sgl.R2Mode == GuiLib_COOR_REL)
jmitc91516 0:a5c253316af6 3788 sgl.ItemR2 += sgl.CurItem.Y1;
jmitc91516 0:a5c253316af6 3789 else if (sgl.R2Mode == GuiLib_COOR_REL_1)
jmitc91516 0:a5c253316af6 3790 sgl.ItemR2 += sgl.CurItem.RY1;
jmitc91516 0:a5c253316af6 3791 else if (sgl.R2Mode == GuiLib_COOR_REL_2)
jmitc91516 0:a5c253316af6 3792 sgl.ItemR2 += sgl.CurItem.RY2;
jmitc91516 0:a5c253316af6 3793 if (sgl.R2MemoryWrite > 0)
jmitc91516 0:a5c253316af6 3794 sgl.Memory.Y[sgl.R2MemoryWrite - 1] = sgl.ItemR2;
jmitc91516 0:a5c253316af6 3795 sgl.CurItem.R2 = sgl.ItemR2;
jmitc91516 0:a5c253316af6 3796 }
jmitc91516 0:a5c253316af6 3797
jmitc91516 0:a5c253316af6 3798 if ((sgl.ItemTypeBit1 & (GuiLib_ITEMBIT_CLEARAREA +
jmitc91516 0:a5c253316af6 3799 GuiLib_ITEMBIT_TEXTBLOCK +
jmitc91516 0:a5c253316af6 3800 GuiLib_ITEMBIT_VARBLOCK +
jmitc91516 0:a5c253316af6 3801 GuiLib_ITEMBIT_LINE +
jmitc91516 0:a5c253316af6 3802 GuiLib_ITEMBIT_FRAME +
jmitc91516 0:a5c253316af6 3803 GuiLib_ITEMBIT_BLOCK +
jmitc91516 0:a5c253316af6 3804 GuiLib_ITEMBIT_BITMAP +
jmitc91516 0:a5c253316af6 3805 GuiLib_ITEMBIT_BACKGROUND +
jmitc91516 0:a5c253316af6 3806 GuiLib_ITEMBIT_ACTIVEAREA +
jmitc91516 0:a5c253316af6 3807 GuiLib_ITEMBIT_CLIPRECT +
jmitc91516 0:a5c253316af6 3808 GuiLib_ITEMBIT_TOUCHAREA +
jmitc91516 0:a5c253316af6 3809 GuiLib_ITEMBIT_GRAPH +
jmitc91516 0:a5c253316af6 3810 GuiLib_ITEMBIT_GRAPHICSLAYER)) ||
jmitc91516 0:a5c253316af6 3811 (sgl.ItemTypeBit2 & (GuiLib_ITEMBIT_ROUNDEDFRAME +
jmitc91516 0:a5c253316af6 3812 GuiLib_ITEMBIT_ROUNDEDBLOCK +
jmitc91516 0:a5c253316af6 3813 GuiLib_ITEMBIT_CHECKBOX +
jmitc91516 0:a5c253316af6 3814 GuiLib_ITEMBIT_RADIOBUTTON +
jmitc91516 0:a5c253316af6 3815 GuiLib_ITEMBIT_BUTTON +
jmitc91516 0:a5c253316af6 3816 GuiLib_ITEMBIT_EDITBOX +
jmitc91516 0:a5c253316af6 3817 GuiLib_ITEMBIT_PANEL +
jmitc91516 0:a5c253316af6 3818 GuiLib_ITEMBIT_MEMO +
jmitc91516 0:a5c253316af6 3819 GuiLib_ITEMBIT_LISTBOX +
jmitc91516 0:a5c253316af6 3820 GuiLib_ITEMBIT_COMBOBOX +
jmitc91516 0:a5c253316af6 3821 GuiLib_ITEMBIT_SCROLLAREA +
jmitc91516 0:a5c253316af6 3822 GuiLib_ITEMBIT_PROGRESSBAR)))
jmitc91516 0:a5c253316af6 3823 {
jmitc91516 0:a5c253316af6 3824 X = sgl.CurItem.X2 - sgl.CurItem.X1;
jmitc91516 0:a5c253316af6 3825 if (sgl.CurItem.TextPar[0].Alignment == GuiLib_ALIGN_CENTER)
jmitc91516 0:a5c253316af6 3826 {
jmitc91516 0:a5c253316af6 3827 sgl.CurItem.X1 -= X / 2;
jmitc91516 0:a5c253316af6 3828 sgl.CurItem.X2 -= X / 2;
jmitc91516 0:a5c253316af6 3829 }
jmitc91516 0:a5c253316af6 3830 else if (sgl.CurItem.TextPar[0].Alignment == GuiLib_ALIGN_RIGHT)
jmitc91516 0:a5c253316af6 3831 {
jmitc91516 0:a5c253316af6 3832 sgl.CurItem.X1 -= X;
jmitc91516 0:a5c253316af6 3833 sgl.CurItem.X2 -= X;
jmitc91516 0:a5c253316af6 3834 }
jmitc91516 0:a5c253316af6 3835 }
jmitc91516 0:a5c253316af6 3836 else if ((sgl.ItemTypeBit1 & (GuiLib_ITEMBIT_CIRCLE +
jmitc91516 0:a5c253316af6 3837 GuiLib_ITEMBIT_ELLIPSE)) ||
jmitc91516 0:a5c253316af6 3838 (sgl.ItemTypeBit2 & (GuiLib_ITEMBIT_QUARTERCIRCLE +
jmitc91516 0:a5c253316af6 3839 GuiLib_ITEMBIT_QUARTERELLIPSE)))
jmitc91516 0:a5c253316af6 3840 {
jmitc91516 0:a5c253316af6 3841 if (sgl.CurItem.TextPar[0].Alignment == GuiLib_ALIGN_CENTER)
jmitc91516 0:a5c253316af6 3842 sgl.CurItem.X1 -= sgl.CurItem.R1;
jmitc91516 0:a5c253316af6 3843 else if (sgl.CurItem.TextPar[0].Alignment == GuiLib_ALIGN_RIGHT)
jmitc91516 0:a5c253316af6 3844 sgl.CurItem.X1 -= 2 * sgl.CurItem.R1;
jmitc91516 0:a5c253316af6 3845 }
jmitc91516 0:a5c253316af6 3846
jmitc91516 0:a5c253316af6 3847 #ifdef GuiConst_ITEM_SCROLLBOX_INUSE
jmitc91516 0:a5c253316af6 3848 if (sgl.ItemTypeBit1 & GuiLib_ITEMBIT_SCROLLBOX)
jmitc91516 0:a5c253316af6 3849 memcpy(&sgl.ScrollBoxesAry[sgl.GlobalScrollBoxIndex].ScrollBoxItem, &sgl.CurItem,
jmitc91516 0:a5c253316af6 3850 sizeof(GuiLib_ItemRec));
jmitc91516 0:a5c253316af6 3851 #endif
jmitc91516 0:a5c253316af6 3852
jmitc91516 0:a5c253316af6 3853 #ifdef GuiConst_ITEM_GRAPH_INUSE
jmitc91516 0:a5c253316af6 3854 if (sgl.ItemTypeBit1 & GuiLib_ITEMBIT_GRAPH)
jmitc91516 0:a5c253316af6 3855 {
jmitc91516 0:a5c253316af6 3856 memcpy(&sgl.GraphAry[sgl.GlobalGraphIndex].GraphItem, &sgl.CurItem,
jmitc91516 0:a5c253316af6 3857 sizeof(GuiLib_ItemRec));
jmitc91516 0:a5c253316af6 3858 OrderCoord(&sgl.GraphAry[sgl.GlobalGraphIndex].GraphItem.X1,
jmitc91516 0:a5c253316af6 3859 &sgl.GraphAry[sgl.GlobalGraphIndex].GraphItem.X2);
jmitc91516 0:a5c253316af6 3860 OrderCoord(&sgl.GraphAry[sgl.GlobalGraphIndex].GraphItem.Y1,
jmitc91516 0:a5c253316af6 3861 &sgl.GraphAry[sgl.GlobalGraphIndex].GraphItem.Y2);
jmitc91516 0:a5c253316af6 3862 sgl.GraphAry[sgl.GlobalGraphIndex].OrigoX =
jmitc91516 0:a5c253316af6 3863 sgl.GraphAry[sgl.GlobalGraphIndex].GraphItem.X1 +
jmitc91516 0:a5c253316af6 3864 sgl.GraphAry[sgl.GlobalGraphIndex].OriginOffsetX;
jmitc91516 0:a5c253316af6 3865 sgl.GraphAry[sgl.GlobalGraphIndex].OrigoY =
jmitc91516 0:a5c253316af6 3866 sgl.GraphAry[sgl.GlobalGraphIndex].GraphItem.Y2 -
jmitc91516 0:a5c253316af6 3867 sgl.GraphAry[sgl.GlobalGraphIndex].OriginOffsetY;
jmitc91516 0:a5c253316af6 3868 }
jmitc91516 0:a5c253316af6 3869 #endif
jmitc91516 0:a5c253316af6 3870
jmitc91516 0:a5c253316af6 3871 #ifdef GuiConst_ITEM_SCROLLBOX_INUSE
jmitc91516 0:a5c253316af6 3872 if (sgl.NextScrollLineReading)
jmitc91516 0:a5c253316af6 3873 sgl.DisplayWriting = 0;
jmitc91516 0:a5c253316af6 3874 else
jmitc91516 0:a5c253316af6 3875 #endif
jmitc91516 0:a5c253316af6 3876 sgl.DisplayWriting = 1;
jmitc91516 0:a5c253316af6 3877 DrawItem(ColorInvert);
jmitc91516 0:a5c253316af6 3878
jmitc91516 0:a5c253316af6 3879 sgl.DisplayWriting = 1;
jmitc91516 0:a5c253316af6 3880
jmitc91516 0:a5c253316af6 3881 switch (sgl.CurItem.ItemType)
jmitc91516 0:a5c253316af6 3882 {
jmitc91516 0:a5c253316af6 3883 case GuiLib_ITEM_TEXT:
jmitc91516 0:a5c253316af6 3884 case GuiLib_ITEM_VAR:
jmitc91516 0:a5c253316af6 3885 sgl.CurItem.RX1 = sgl.FontWriteX1;
jmitc91516 0:a5c253316af6 3886 sgl.CurItem.RY1 = sgl.FontWriteY1;
jmitc91516 0:a5c253316af6 3887 sgl.CurItem.RX2 = sgl.FontWriteX2 + 1;
jmitc91516 0:a5c253316af6 3888 sgl.CurItem.RY2 = sgl.FontWriteY2;
jmitc91516 0:a5c253316af6 3889 break;
jmitc91516 0:a5c253316af6 3890 case GuiLib_ITEM_DOT:
jmitc91516 0:a5c253316af6 3891 sgl.CurItem.RX1 = sgl.CurItem.X1;
jmitc91516 0:a5c253316af6 3892 sgl.CurItem.RY1 = sgl.CurItem.Y1;
jmitc91516 0:a5c253316af6 3893 sgl.CurItem.RX2 = sgl.CurItem.X1 + 1;
jmitc91516 0:a5c253316af6 3894 sgl.CurItem.RY2 = sgl.CurItem.Y1;
jmitc91516 0:a5c253316af6 3895 break;
jmitc91516 0:a5c253316af6 3896 case GuiLib_ITEM_CIRCLE:
jmitc91516 0:a5c253316af6 3897 case GuiLib_ITEM_QUARTERCIRCLE:
jmitc91516 0:a5c253316af6 3898 sgl.CurItem.RX1 = sgl.CurItem.X1;
jmitc91516 0:a5c253316af6 3899 sgl.CurItem.RY1 = sgl.CurItem.Y1 - sgl.CurItem.R1;
jmitc91516 0:a5c253316af6 3900 sgl.CurItem.RX2 = sgl.CurItem.X1 + (2 * sgl.CurItem.R1) + 1;
jmitc91516 0:a5c253316af6 3901 sgl.CurItem.RY2 = sgl.CurItem.Y1 + sgl.CurItem.R1;
jmitc91516 0:a5c253316af6 3902 break;
jmitc91516 0:a5c253316af6 3903 case GuiLib_ITEM_ELLIPSE:
jmitc91516 0:a5c253316af6 3904 case GuiLib_ITEM_QUARTERELLIPSE:
jmitc91516 0:a5c253316af6 3905 sgl.CurItem.RX1 = sgl.CurItem.X1;
jmitc91516 0:a5c253316af6 3906 sgl.CurItem.RY1 = sgl.CurItem.Y1 - sgl.CurItem.R2;
jmitc91516 0:a5c253316af6 3907 sgl.CurItem.RX2 = sgl.CurItem.X1 + (2 * sgl.CurItem.R1) + 1;
jmitc91516 0:a5c253316af6 3908 sgl.CurItem.RY2 = sgl.CurItem.Y1 + sgl.CurItem.R2;
jmitc91516 0:a5c253316af6 3909 break;
jmitc91516 0:a5c253316af6 3910 case GuiLib_ITEM_CLEARAREA:
jmitc91516 0:a5c253316af6 3911 case GuiLib_ITEM_LINE:
jmitc91516 0:a5c253316af6 3912 case GuiLib_ITEM_FRAME:
jmitc91516 0:a5c253316af6 3913 case GuiLib_ITEM_ROUNDEDFRAME:
jmitc91516 0:a5c253316af6 3914 case GuiLib_ITEM_BLOCK:
jmitc91516 0:a5c253316af6 3915 case GuiLib_ITEM_ROUNDEDBLOCK:
jmitc91516 0:a5c253316af6 3916 case GuiLib_ITEM_BITMAP:
jmitc91516 0:a5c253316af6 3917 case GuiLib_ITEM_BACKGROUND:
jmitc91516 0:a5c253316af6 3918 case GuiLib_ITEM_ACTIVEAREA:
jmitc91516 0:a5c253316af6 3919 case GuiLib_ITEM_CLIPRECT:
jmitc91516 0:a5c253316af6 3920 case GuiLib_ITEM_TEXTBLOCK:
jmitc91516 0:a5c253316af6 3921 case GuiLib_ITEM_VARBLOCK:
jmitc91516 0:a5c253316af6 3922 case GuiLib_ITEM_CHECKBOX:
jmitc91516 0:a5c253316af6 3923 case GuiLib_ITEM_BUTTON:
jmitc91516 0:a5c253316af6 3924 case GuiLib_ITEM_EDITBOX:
jmitc91516 0:a5c253316af6 3925 case GuiLib_ITEM_PANEL:
jmitc91516 0:a5c253316af6 3926 case GuiLib_ITEM_MEMO:
jmitc91516 0:a5c253316af6 3927 case GuiLib_ITEM_LISTBOX:
jmitc91516 0:a5c253316af6 3928 case GuiLib_ITEM_COMBOBOX:
jmitc91516 0:a5c253316af6 3929 case GuiLib_ITEM_SCROLLAREA:
jmitc91516 0:a5c253316af6 3930 case GuiLib_ITEM_PROGRESSBAR:
jmitc91516 0:a5c253316af6 3931 case GuiLib_ITEM_TOUCHAREA:
jmitc91516 0:a5c253316af6 3932 case GuiLib_ITEM_SCROLLBOX:
jmitc91516 0:a5c253316af6 3933 case GuiLib_ITEM_GRAPH:
jmitc91516 0:a5c253316af6 3934 case GuiLib_ITEM_GRAPHICSLAYER:
jmitc91516 0:a5c253316af6 3935 sgl.CurItem.RX1 = sgl.CurItem.X1;
jmitc91516 0:a5c253316af6 3936 sgl.CurItem.RY1 = sgl.CurItem.Y1;
jmitc91516 0:a5c253316af6 3937 sgl.CurItem.RX2 = sgl.CurItem.X2 + 1;
jmitc91516 0:a5c253316af6 3938 sgl.CurItem.RY2 = sgl.CurItem.Y2;
jmitc91516 0:a5c253316af6 3939 break;
jmitc91516 0:a5c253316af6 3940 case GuiLib_ITEM_POSCALLBACK:
jmitc91516 0:a5c253316af6 3941 sgl.CurItem.RX1 = sgl.CurItem.X1;
jmitc91516 0:a5c253316af6 3942 sgl.CurItem.RY1 = sgl.CurItem.Y1;
jmitc91516 0:a5c253316af6 3943 sgl.CurItem.RX2 = sgl.CurItem.X1;
jmitc91516 0:a5c253316af6 3944 sgl.CurItem.RY2 = sgl.CurItem.Y1;
jmitc91516 0:a5c253316af6 3945 break;
jmitc91516 0:a5c253316af6 3946 #ifdef GuiConst_ITEM_RADIOBUTTON_INUSE
jmitc91516 0:a5c253316af6 3947 case GuiLib_ITEM_RADIOBUTTON:
jmitc91516 0:a5c253316af6 3948 sgl.CurItem.RX1 = sgl.CurItem.X1;
jmitc91516 0:a5c253316af6 3949 sgl.CurItem.RY1 = sgl.CurItem.Y1;
jmitc91516 0:a5c253316af6 3950 sgl.CurItem.RX2 = sgl.CurItem.X2 + 1;
jmitc91516 0:a5c253316af6 3951 sgl.CurItem.RY2 = sgl.CurItem.Y2 +
jmitc91516 0:a5c253316af6 3952 (sgl.CurItem.CompPars.CompRadioButton.Count - 1) *
jmitc91516 0:a5c253316af6 3953 sgl.CurItem.CompPars.CompRadioButton.InterDistance;
jmitc91516 0:a5c253316af6 3954 break;
jmitc91516 0:a5c253316af6 3955 #endif
jmitc91516 0:a5c253316af6 3956 }
jmitc91516 0:a5c253316af6 3957
jmitc91516 0:a5c253316af6 3958 sgl.AutoRedrawLatest = RemAutoRedrawLatest;
jmitc91516 0:a5c253316af6 3959 }
jmitc91516 0:a5c253316af6 3960 }
jmitc91516 0:a5c253316af6 3961
jmitc91516 0:a5c253316af6 3962 //------------------------------------------------------------------------------
jmitc91516 0:a5c253316af6 3963 void GuiLib_ShowScreen(
jmitc91516 0:a5c253316af6 3964 const GuiConst_INT16U StructureNdx,
jmitc91516 0:a5c253316af6 3965 GuiConst_INT16S CursorFieldToShow,
jmitc91516 0:a5c253316af6 3966 GuiConst_INT8U ResetAutoRedraw)
jmitc91516 0:a5c253316af6 3967 {
jmitc91516 0:a5c253316af6 3968 #ifdef GuiConst_ITEM_SCROLLBOX_INUSE
jmitc91516 0:a5c253316af6 3969 GuiConst_INT16S M;
jmitc91516 0:a5c253316af6 3970 #endif
jmitc91516 0:a5c253316af6 3971 GuiConst_INT16S N;
jmitc91516 0:a5c253316af6 3972 GuiLib_StructPtr StructureToCall;
jmitc91516 0:a5c253316af6 3973
jmitc91516 0:a5c253316af6 3974 GuiDisplay_Lock();
jmitc91516 0:a5c253316af6 3975
jmitc91516 0:a5c253316af6 3976 GuiLib_CurStructureNdx = StructureNdx;
jmitc91516 0:a5c253316af6 3977 StructureToCall =
jmitc91516 0:a5c253316af6 3978 #ifdef GuiConst_REMOTE_STRUCT_DATA
jmitc91516 0:a5c253316af6 3979 GetRemoteStructData(StructureNdx);
jmitc91516 0:a5c253316af6 3980 #else
jmitc91516 0:a5c253316af6 3981 (GuiLib_StructPtr)ReadWord(GuiStruct_StructPtrList[StructureNdx]);
jmitc91516 0:a5c253316af6 3982 #endif
jmitc91516 0:a5c253316af6 3983
jmitc91516 0:a5c253316af6 3984 #ifdef GuiConst_CURSOR_SUPPORT_ON
jmitc91516 0:a5c253316af6 3985 sgl.CursorFieldFound = -1;
jmitc91516 0:a5c253316af6 3986 sgl.CursorActiveFieldFound = 0;
jmitc91516 0:a5c253316af6 3987 GuiLib_ActiveCursorFieldNo = CursorFieldToShow;
jmitc91516 0:a5c253316af6 3988 sgl.CursorInUse = (GuiLib_ActiveCursorFieldNo >= 0);
jmitc91516 0:a5c253316af6 3989 #else
jmitc91516 0:a5c253316af6 3990 gl.Dummy1_16S = CursorFieldToShow; // To avoid compiler warning
jmitc91516 0:a5c253316af6 3991 #endif
jmitc91516 0:a5c253316af6 3992
jmitc91516 0:a5c253316af6 3993 if ((GuiLib_StructPtr)StructureToCall != 0)
jmitc91516 0:a5c253316af6 3994 {
jmitc91516 0:a5c253316af6 3995 sgl.CurItem.X1 = 0;
jmitc91516 0:a5c253316af6 3996 sgl.CurItem.Y1 = 0;
jmitc91516 0:a5c253316af6 3997 sgl.CurItem.X2 = 0;
jmitc91516 0:a5c253316af6 3998 sgl.CurItem.Y2 = 0;
jmitc91516 0:a5c253316af6 3999 sgl.CurItem.R1 = 0;
jmitc91516 0:a5c253316af6 4000 sgl.CurItem.R2 = 0;
jmitc91516 0:a5c253316af6 4001
jmitc91516 0:a5c253316af6 4002 sgl.CurItem.RX = 0;
jmitc91516 0:a5c253316af6 4003 sgl.CurItem.RY = 0;
jmitc91516 0:a5c253316af6 4004 sgl.CurItem.RX1 = 0;
jmitc91516 0:a5c253316af6 4005 sgl.CurItem.RY1 = 0;
jmitc91516 0:a5c253316af6 4006 sgl.CurItem.RX2 = 0;
jmitc91516 0:a5c253316af6 4007 sgl.CurItem.RY2 = 0;
jmitc91516 0:a5c253316af6 4008
jmitc91516 0:a5c253316af6 4009 for (N = 0; N < 2 * GuiLib_MEMORY_CNT; N++)
jmitc91516 0:a5c253316af6 4010 {
jmitc91516 0:a5c253316af6 4011 sgl.Memory.X[N] = 0;
jmitc91516 0:a5c253316af6 4012 sgl.Memory.Y[N] = 0;
jmitc91516 0:a5c253316af6 4013 }
jmitc91516 0:a5c253316af6 4014 for (N = 0; N < GuiLib_MEMORY_CNT; N++)
jmitc91516 0:a5c253316af6 4015 sgl.Memory.C[N] = 0;
jmitc91516 0:a5c253316af6 4016 sgl.ThicknessMemory = 1;
jmitc91516 0:a5c253316af6 4017
jmitc91516 0:a5c253316af6 4018 sgl.CurItem.ForeColor = GuiConst_PIXEL_ON;
jmitc91516 0:a5c253316af6 4019 sgl.CurItem.BackColor = GuiConst_PIXEL_OFF;
jmitc91516 0:a5c253316af6 4020 sgl.CurItem.BarForeColor = GuiConst_PIXEL_OFF;
jmitc91516 0:a5c253316af6 4021 sgl.CurItem.BarBackColor = GuiConst_PIXEL_ON;
jmitc91516 0:a5c253316af6 4022 sgl.CurItem.ForeColorIndex = 0xFFFF;
jmitc91516 0:a5c253316af6 4023 sgl.CurItem.BackColorIndex = 0xFFFF;
jmitc91516 0:a5c253316af6 4024 sgl.CurItem.BarForeColorIndex = 0xFFFF;
jmitc91516 0:a5c253316af6 4025 sgl.CurItem.BarBackColorIndex = 0xFFFF;
jmitc91516 0:a5c253316af6 4026
jmitc91516 0:a5c253316af6 4027
jmitc91516 0:a5c253316af6 4028 for (N = 0; N < 3; N++)
jmitc91516 0:a5c253316af6 4029 {
jmitc91516 0:a5c253316af6 4030 sgl.CurItem.TextPar[N].BitFlags = GuiLib_BITFLAG_TRANSPARENT;
jmitc91516 0:a5c253316af6 4031 sgl.CurItem.TextPar[N].Alignment = GuiLib_ALIGN_LEFT;
jmitc91516 0:a5c253316af6 4032 sgl.CurItem.TextPar[N].BackBoxSizeX = 0;
jmitc91516 0:a5c253316af6 4033 sgl.CurItem.TextPar[N].FontIndex = 0;
jmitc91516 0:a5c253316af6 4034 sgl.CurItem.TextPar[N].Ps = GuiLib_PS_ON;
jmitc91516 0:a5c253316af6 4035 }
jmitc91516 0:a5c253316af6 4036
jmitc91516 0:a5c253316af6 4037 sgl.CurItem.FormatFieldWidth = 10;
jmitc91516 0:a5c253316af6 4038 sgl.CurItem.FormatDecimals = 0;
jmitc91516 0:a5c253316af6 4039 sgl.CurItem.FormatAlignment = GuiLib_FORMAT_ALIGNMENT_RIGHT;
jmitc91516 0:a5c253316af6 4040 sgl.CurItem.FormatFormat = GuiLib_FORMAT_DEC;
jmitc91516 0:a5c253316af6 4041
jmitc91516 0:a5c253316af6 4042 #ifdef GuiConst_BLINK_SUPPORT_ON
jmitc91516 0:a5c253316af6 4043 #ifndef GuiConst_BLINK_FIELDS_OFF
jmitc91516 0:a5c253316af6 4044 for (N = 0; N < GuiConst_BLINK_FIELDS_MAX; N++)
jmitc91516 0:a5c253316af6 4045 {
jmitc91516 0:a5c253316af6 4046 sgl.BlinkTextItems[N].InUse = 0;
jmitc91516 0:a5c253316af6 4047 sgl.BlinkTextItems[N].Active = 0;
jmitc91516 0:a5c253316af6 4048 }
jmitc91516 0:a5c253316af6 4049 #endif
jmitc91516 0:a5c253316af6 4050 #endif
jmitc91516 0:a5c253316af6 4051
jmitc91516 0:a5c253316af6 4052 #ifdef GuiConst_ITEM_TOUCHAREA_INUSE
jmitc91516 0:a5c253316af6 4053 sgl.TouchAreaCnt = 0;
jmitc91516 0:a5c253316af6 4054 #endif
jmitc91516 0:a5c253316af6 4055
jmitc91516 0:a5c253316af6 4056 #ifdef GuiConst_ITEM_SCROLLBOX_INUSE
jmitc91516 0:a5c253316af6 4057 for (M = 0; M < GuiConst_SCROLLITEM_BOXES_MAX; M++)
jmitc91516 0:a5c253316af6 4058 {
jmitc91516 0:a5c253316af6 4059 sgl.ScrollBoxesAry[M].InUse = GuiLib_SCROLL_STRUCTURE_UNDEF;
jmitc91516 0:a5c253316af6 4060 for (N = 0; N < GuiConst_SCROLLITEM_MARKERS_MAX; N++)
jmitc91516 0:a5c253316af6 4061 {
jmitc91516 0:a5c253316af6 4062 sgl.ScrollBoxesAry[M].MarkerColor[N] = GuiConst_PIXEL_ON;
jmitc91516 0:a5c253316af6 4063 sgl.ScrollBoxesAry[M].MarkerColorTransparent[N] = 1;
jmitc91516 0:a5c253316af6 4064 }
jmitc91516 0:a5c253316af6 4065 }
jmitc91516 0:a5c253316af6 4066 #endif
jmitc91516 0:a5c253316af6 4067
jmitc91516 0:a5c253316af6 4068 #ifdef GuiConst_ITEM_GRAPH_INUSE
jmitc91516 0:a5c253316af6 4069 for (N = 0; N < GuiConst_GRAPH_MAX; N++)
jmitc91516 0:a5c253316af6 4070 sgl.GraphAry[N].InUse = GuiLib_GRAPH_STRUCTURE_UNDEF;
jmitc91516 0:a5c253316af6 4071 #endif
jmitc91516 0:a5c253316af6 4072
jmitc91516 0:a5c253316af6 4073 sgl.BaseLayerDrawing = 1;
jmitc91516 0:a5c253316af6 4074 #ifdef GuiConst_ITEM_GRAPHICS_LAYER_FILTER_INUSE
jmitc91516 0:a5c253316af6 4075 GraphicsLayer_Pop(GuiLib_GRAPHICS_LAYER_BASE);
jmitc91516 0:a5c253316af6 4076 for (N = 0; N < GuiConst_GRAPHICS_LAYER_MAX; N++)
jmitc91516 0:a5c253316af6 4077 {
jmitc91516 0:a5c253316af6 4078 sgl.GraphicsLayerList[N].InUse = GuiLib_GRAPHICS_LAYER_UNDEF;
jmitc91516 0:a5c253316af6 4079 sgl.GraphicsFilterList[N].InUse = GuiLib_GRAPHICS_FILTER_UNDEF;
jmitc91516 0:a5c253316af6 4080 }
jmitc91516 0:a5c253316af6 4081 #endif
jmitc91516 0:a5c253316af6 4082
jmitc91516 0:a5c253316af6 4083 #ifdef GuiConst_BITMAP_SUPPORT_ON
jmitc91516 0:a5c253316af6 4084 sgl.GlobalBackgrBitmapIndex = 0;
jmitc91516 0:a5c253316af6 4085 for (N = 0; N < GuiConst_MAX_BACKGROUND_BITMAPS; N++)
jmitc91516 0:a5c253316af6 4086 sgl.BackgrBitmapAry[N].InUse = 0;
jmitc91516 0:a5c253316af6 4087 #endif
jmitc91516 0:a5c253316af6 4088
jmitc91516 0:a5c253316af6 4089 if (ResetAutoRedraw)
jmitc91516 0:a5c253316af6 4090 AutoRedraw_Destroy();
jmitc91516 0:a5c253316af6 4091 #ifdef GuiConst_CURSOR_SUPPORT_ON
jmitc91516 0:a5c253316af6 4092 else
jmitc91516 0:a5c253316af6 4093 AutoRedraw_ResetCursor();
jmitc91516 0:a5c253316af6 4094 #endif
jmitc91516 0:a5c253316af6 4095
jmitc91516 0:a5c253316af6 4096 sgl.DrawingLevel = 0;
jmitc91516 0:a5c253316af6 4097 sgl.TopLevelStructure = 0;
jmitc91516 0:a5c253316af6 4098
jmitc91516 0:a5c253316af6 4099 #ifdef GuiConst_TEXTBOX_FIELDS_ON
jmitc91516 0:a5c253316af6 4100 sgl.CurItem.CompPars.CompTextBox.ScrollIndex = 0;
jmitc91516 0:a5c253316af6 4101 sgl.CurItem.CompPars.CompTextBox.ScrollPos = 0;
jmitc91516 0:a5c253316af6 4102 for (N = 0; N < GuiConst_TEXTBOX_FIELDS_MAX; N++)
jmitc91516 0:a5c253316af6 4103 sgl.TextBoxScrollPositions[N].index = -1;
jmitc91516 0:a5c253316af6 4104 #endif
jmitc91516 0:a5c253316af6 4105
jmitc91516 0:a5c253316af6 4106 sgl.CoordOrigoX = sgl.DisplayOrigoX + sgl.LayerOrigoX;
jmitc91516 0:a5c253316af6 4107 sgl.CoordOrigoY = sgl.DisplayOrigoY + sgl.LayerOrigoY;
jmitc91516 0:a5c253316af6 4108 #ifdef GuiConst_CLIPPING_SUPPORT_ON
jmitc91516 0:a5c253316af6 4109 sgl.CurItem.ClipRectX1 = sgl.DisplayActiveAreaX1;
jmitc91516 0:a5c253316af6 4110 sgl.CurItem.ClipRectY1 = sgl.DisplayActiveAreaY1;
jmitc91516 0:a5c253316af6 4111 sgl.CurItem.ClipRectX2 = sgl.DisplayActiveAreaX2;
jmitc91516 0:a5c253316af6 4112 sgl.CurItem.ClipRectY2 = sgl.DisplayActiveAreaY2;
jmitc91516 0:a5c253316af6 4113 sgl.ActiveAreaX1 = sgl.DisplayActiveAreaX1;
jmitc91516 0:a5c253316af6 4114 sgl.ActiveAreaY1 = sgl.DisplayActiveAreaY1;
jmitc91516 0:a5c253316af6 4115 sgl.ActiveAreaX2 = sgl.DisplayActiveAreaX2;
jmitc91516 0:a5c253316af6 4116 sgl.ActiveAreaY2 = sgl.DisplayActiveAreaY2;
jmitc91516 0:a5c253316af6 4117 if (sgl.DisplayWriting)
jmitc91516 0:a5c253316af6 4118 {
jmitc91516 0:a5c253316af6 4119 if ((sgl.DisplayActiveAreaX1 != 0) || (sgl.DisplayActiveAreaY1 != 0) ||
jmitc91516 0:a5c253316af6 4120 (sgl.DisplayActiveAreaX2 != GuiConst_DISPLAY_WIDTH - 1) ||
jmitc91516 0:a5c253316af6 4121 (sgl.DisplayActiveAreaY2 != GuiConst_DISPLAY_HEIGHT - 1))
jmitc91516 0:a5c253316af6 4122 GuiLib_SetClipping(sgl.DisplayActiveAreaX1, sgl.DisplayActiveAreaY1,
jmitc91516 0:a5c253316af6 4123 sgl.DisplayActiveAreaX2, sgl.DisplayActiveAreaY2);
jmitc91516 0:a5c253316af6 4124 else
jmitc91516 0:a5c253316af6 4125 GuiLib_ResetClipping();
jmitc91516 0:a5c253316af6 4126 }
jmitc91516 0:a5c253316af6 4127 #endif
jmitc91516 0:a5c253316af6 4128 #ifdef GuiConst_CURSOR_SUPPORT_ON
jmitc91516 0:a5c253316af6 4129 sgl.CurItem.CursorFieldLevel = 0;
jmitc91516 0:a5c253316af6 4130 #endif
jmitc91516 0:a5c253316af6 4131 sgl.DisplayLevel = 0;
jmitc91516 0:a5c253316af6 4132 sgl.InitialDrawing = 1;
jmitc91516 0:a5c253316af6 4133 sgl.SwapColors = 0;
jmitc91516 0:a5c253316af6 4134 DrawStructure((GuiLib_StructPtr) StructureToCall,
jmitc91516 0:a5c253316af6 4135 GuiLib_COL_INVERT_IF_CURSOR);
jmitc91516 0:a5c253316af6 4136 ResetLayerBufPtr();
jmitc91516 0:a5c253316af6 4137 sgl.InitialDrawing = 0;
jmitc91516 0:a5c253316af6 4138 sgl.CoordOrigoX = sgl.DisplayOrigoX + sgl.LayerOrigoX;
jmitc91516 0:a5c253316af6 4139 sgl.CoordOrigoY = sgl.DisplayOrigoY + sgl.LayerOrigoY;
jmitc91516 0:a5c253316af6 4140
jmitc91516 0:a5c253316af6 4141 #ifdef GuiConst_CLIPPING_SUPPORT_ON
jmitc91516 0:a5c253316af6 4142 if (sgl.DisplayWriting)
jmitc91516 0:a5c253316af6 4143 GuiLib_ResetClipping();
jmitc91516 0:a5c253316af6 4144 #endif
jmitc91516 0:a5c253316af6 4145 }
jmitc91516 0:a5c253316af6 4146
jmitc91516 0:a5c253316af6 4147 #ifdef GuiConst_CURSOR_SUPPORT_ON
jmitc91516 0:a5c253316af6 4148 if (sgl.CursorFieldFound == -1)
jmitc91516 0:a5c253316af6 4149 {
jmitc91516 0:a5c253316af6 4150 sgl.CursorInUse = 0;
jmitc91516 0:a5c253316af6 4151 GuiLib_ActiveCursorFieldNo = -1;
jmitc91516 0:a5c253316af6 4152 }
jmitc91516 0:a5c253316af6 4153 else if (sgl.CursorInUse)
jmitc91516 0:a5c253316af6 4154 {
jmitc91516 0:a5c253316af6 4155 if (sgl.CursorActiveFieldFound == 0)
jmitc91516 0:a5c253316af6 4156 {
jmitc91516 0:a5c253316af6 4157 GuiLib_ActiveCursorFieldNo = sgl.CursorFieldFound;
jmitc91516 0:a5c253316af6 4158
jmitc91516 0:a5c253316af6 4159 DrawCursorItem(1);
jmitc91516 0:a5c253316af6 4160 }
jmitc91516 0:a5c253316af6 4161 }
jmitc91516 0:a5c253316af6 4162 #endif
jmitc91516 0:a5c253316af6 4163
jmitc91516 0:a5c253316af6 4164 #ifdef GuiConst_BLINK_SUPPORT_ON
jmitc91516 0:a5c253316af6 4165 sgl.BlinkBoxInverted = 0;
jmitc91516 0:a5c253316af6 4166 #endif
jmitc91516 0:a5c253316af6 4167
jmitc91516 0:a5c253316af6 4168 GuiDisplay_Unlock();
jmitc91516 0:a5c253316af6 4169 }
jmitc91516 0:a5c253316af6 4170
jmitc91516 0:a5c253316af6 4171 //------------------------------------------------------------------------------
jmitc91516 0:a5c253316af6 4172 GuiConst_INT16S CheckLanguageIndex(
jmitc91516 0:a5c253316af6 4173 GuiConst_INT16S LanguageIndex)
jmitc91516 0:a5c253316af6 4174 {
jmitc91516 0:a5c253316af6 4175 if ((LanguageIndex < 0) || (LanguageIndex > GuiConst_LANGUAGE_CNT - 1))
jmitc91516 0:a5c253316af6 4176 LanguageIndex = 0;
jmitc91516 0:a5c253316af6 4177
jmitc91516 0:a5c253316af6 4178 #ifdef GuiConst_LANGUAGE_SOME_ACTIVE
jmitc91516 0:a5c253316af6 4179 if (!ReadByte(GuiFont_LanguageActive[LanguageIndex]))
jmitc91516 0:a5c253316af6 4180 LanguageIndex = GuiConst_LANGUAGE_FIRST;
jmitc91516 0:a5c253316af6 4181 #endif
jmitc91516 0:a5c253316af6 4182
jmitc91516 0:a5c253316af6 4183 return(LanguageIndex);
jmitc91516 0:a5c253316af6 4184 }
jmitc91516 0:a5c253316af6 4185
jmitc91516 0:a5c253316af6 4186 //------------------------------------------------------------------------------
jmitc91516 0:a5c253316af6 4187 GuiConst_TEXT PrefixLocate *GuiLib_GetTextLanguagePtr(
jmitc91516 0:a5c253316af6 4188 const GuiConst_INT16U StructureNdx,
jmitc91516 0:a5c253316af6 4189 GuiConst_INT16U TextNo,
jmitc91516 0:a5c253316af6 4190 GuiConst_INT16S LanguageIndex)
jmitc91516 0:a5c253316af6 4191 {
jmitc91516 0:a5c253316af6 4192 GuiConst_INT16U I;
jmitc91516 0:a5c253316af6 4193 GuiConst_INT16S ItemNdx;
jmitc91516 0:a5c253316af6 4194 GuiConst_INT8U ItemCnt;
jmitc91516 0:a5c253316af6 4195 GuiLib_StructPtr StructureToCall;
jmitc91516 0:a5c253316af6 4196 #ifdef GuiConst_REMOTE_STRUCT_DATA
jmitc91516 0:a5c253316af6 4197 GuiConst_INT8U ItemSizeBuf[2];
jmitc91516 0:a5c253316af6 4198 GuiConst_INT16U ItemSize;
jmitc91516 0:a5c253316af6 4199 #endif
jmitc91516 0:a5c253316af6 4200
jmitc91516 0:a5c253316af6 4201 StructureToCall =
jmitc91516 0:a5c253316af6 4202 #ifdef GuiConst_REMOTE_STRUCT_DATA
jmitc91516 0:a5c253316af6 4203 GetRemoteStructData(StructureNdx);
jmitc91516 0:a5c253316af6 4204 #else
jmitc91516 0:a5c253316af6 4205 (GuiLib_StructPtr)ReadWord(GuiStruct_StructPtrList[StructureNdx]);
jmitc91516 0:a5c253316af6 4206 #endif
jmitc91516 0:a5c253316af6 4207
jmitc91516 0:a5c253316af6 4208 if (StructureToCall != 0)
jmitc91516 0:a5c253316af6 4209 {
jmitc91516 0:a5c253316af6 4210 LanguageIndex = CheckLanguageIndex(LanguageIndex);
jmitc91516 0:a5c253316af6 4211
jmitc91516 0:a5c253316af6 4212 sgl.ItemDataPtr = (GuiConst_INT8U PrefixLocate *)StructureToCall;
jmitc91516 0:a5c253316af6 4213 ItemCnt = GetItemByte(&sgl.ItemDataPtr);
jmitc91516 0:a5c253316af6 4214
jmitc91516 0:a5c253316af6 4215 I = 0;
jmitc91516 0:a5c253316af6 4216 for (ItemNdx = 0; ItemNdx < ItemCnt; ItemNdx++)
jmitc91516 0:a5c253316af6 4217 {
jmitc91516 0:a5c253316af6 4218 #ifdef GuiConst_REMOTE_STRUCT_DATA
jmitc91516 0:a5c253316af6 4219 GuiLib_RemoteDataReadBlock(
jmitc91516 0:a5c253316af6 4220 sgl.RemoteStructOffset,
jmitc91516 0:a5c253316af6 4221 2,
jmitc91516 0:a5c253316af6 4222 (GuiConst_INT8U*)&ItemSizeBuf);
jmitc91516 0:a5c253316af6 4223 ItemSize = (256 * (GuiConst_INT16U)ItemSizeBuf[1]) + ItemSizeBuf[0];
jmitc91516 0:a5c253316af6 4224 sgl.RemoteStructOffset += 2;
jmitc91516 0:a5c253316af6 4225 GuiLib_RemoteDataReadBlock(
jmitc91516 0:a5c253316af6 4226 sgl.RemoteStructOffset,
jmitc91516 0:a5c253316af6 4227 ItemSize,
jmitc91516 0:a5c253316af6 4228 sgl.GuiLib_RemoteItemBuffer);
jmitc91516 0:a5c253316af6 4229 sgl.RemoteStructOffset += ItemSize;
jmitc91516 0:a5c253316af6 4230 sgl.ItemDataPtr = &sgl.GuiLib_RemoteItemBuffer[0];
jmitc91516 0:a5c253316af6 4231 #endif
jmitc91516 0:a5c253316af6 4232
jmitc91516 0:a5c253316af6 4233 ReadItem(LanguageIndex);
jmitc91516 0:a5c253316af6 4234
jmitc91516 0:a5c253316af6 4235 if ((sgl.CurItem.ItemType == GuiLib_ITEM_TEXT) ||
jmitc91516 0:a5c253316af6 4236 (sgl.CurItem.ItemType == GuiLib_ITEM_TEXTBLOCK))
jmitc91516 0:a5c253316af6 4237 {
jmitc91516 0:a5c253316af6 4238 if (I == TextNo)
jmitc91516 0:a5c253316af6 4239 {
jmitc91516 0:a5c253316af6 4240 #ifdef GuiConst_CHARMODE_ANSI
jmitc91516 0:a5c253316af6 4241 return (GuiConst_TEXT PrefixLocate *) sgl.CurItem.TextPtr[0];
jmitc91516 0:a5c253316af6 4242 #else
jmitc91516 0:a5c253316af6 4243 #ifdef GuiConst_ICC_COMPILER
jmitc91516 0:a5c253316af6 4244 ExtractUnicodeString((GuiConst_INT8U *)sgl.CurItem.TextPtr[0],
jmitc91516 0:a5c253316af6 4245 sgl.CurItem.TextLength[0]);
jmitc91516 0:a5c253316af6 4246 #else
jmitc91516 0:a5c253316af6 4247 #ifdef GuiConst_CODEVISION_COMPILER
jmitc91516 0:a5c253316af6 4248 ExtractUnicodeString((GuiConst_INT8U *)sgl.CurItem.TextPtr[0],
jmitc91516 0:a5c253316af6 4249 sgl.CurItem.TextLength[0]);
jmitc91516 0:a5c253316af6 4250 #else
jmitc91516 0:a5c253316af6 4251 ExtractUnicodeString((GuiConst_INT8U PrefixRom *)sgl.CurItem.TextPtr[0],
jmitc91516 0:a5c253316af6 4252 sgl.CurItem.TextLength[0]);
jmitc91516 0:a5c253316af6 4253 #endif
jmitc91516 0:a5c253316af6 4254 #endif
jmitc91516 0:a5c253316af6 4255
jmitc91516 0:a5c253316af6 4256 return (sgl.UnicodeTextBuf);
jmitc91516 0:a5c253316af6 4257 #endif
jmitc91516 0:a5c253316af6 4258 }
jmitc91516 0:a5c253316af6 4259 I++;
jmitc91516 0:a5c253316af6 4260 }
jmitc91516 0:a5c253316af6 4261 }
jmitc91516 0:a5c253316af6 4262 }
jmitc91516 0:a5c253316af6 4263
jmitc91516 0:a5c253316af6 4264 return (0);
jmitc91516 0:a5c253316af6 4265 }
jmitc91516 0:a5c253316af6 4266
jmitc91516 0:a5c253316af6 4267 //------------------------------------------------------------------------------
jmitc91516 0:a5c253316af6 4268 GuiConst_TEXT PrefixLocate *GuiLib_GetTextPtr(
jmitc91516 0:a5c253316af6 4269 const GuiConst_INT16U StructureNdx,
jmitc91516 0:a5c253316af6 4270 GuiConst_INT16U TextNo)
jmitc91516 0:a5c253316af6 4271 {
jmitc91516 0:a5c253316af6 4272 return (GuiLib_GetTextLanguagePtr(StructureNdx, TextNo, GuiLib_LanguageIndex));
jmitc91516 0:a5c253316af6 4273 }
jmitc91516 0:a5c253316af6 4274
jmitc91516 0:a5c253316af6 4275 //------------------------------------------------------------------------------
jmitc91516 0:a5c253316af6 4276 GuiConst_INT16U GuiLib_GetTextWidth(
jmitc91516 0:a5c253316af6 4277 GuiConst_TEXT PrefixLocate *String,
jmitc91516 0:a5c253316af6 4278 GuiLib_FontRecConstPtr Font,
jmitc91516 0:a5c253316af6 4279 GuiConst_INT8U PsWriting)
jmitc91516 0:a5c253316af6 4280 {
jmitc91516 0:a5c253316af6 4281 GuiLib_ItemRec TextData;
jmitc91516 0:a5c253316af6 4282 GuiConst_INT16U CharCnt;
jmitc91516 0:a5c253316af6 4283
jmitc91516 0:a5c253316af6 4284 if ((String[0] != 0) && (Font != 0))
jmitc91516 0:a5c253316af6 4285 {
jmitc91516 0:a5c253316af6 4286 TextData.TextPar[0].Ps = PsWriting;
jmitc91516 0:a5c253316af6 4287 sgl.CurItem.TextPar[0].Ps = TextData.TextPar[0].Ps;
jmitc91516 0:a5c253316af6 4288 #ifdef GuiConst_CHARMODE_ANSI
jmitc91516 0:a5c253316af6 4289 CharCnt = strlen(String);
jmitc91516 0:a5c253316af6 4290 #else
jmitc91516 0:a5c253316af6 4291 CharCnt = GuiLib_UnicodeStrLen(String);
jmitc91516 0:a5c253316af6 4292 #endif
jmitc91516 0:a5c253316af6 4293 sgl.CurFont = (GuiLib_FontRecPtr)Font;
jmitc91516 0:a5c253316af6 4294 #ifdef GuiConst_DISP_VAR_NOW
jmitc91516 0:a5c253316af6 4295 displayVarNow = 1;
jmitc91516 0:a5c253316af6 4296 #endif
jmitc91516 0:a5c253316af6 4297
jmitc91516 0:a5c253316af6 4298 #ifdef GuiConst_CODEVISION_COMPILER
jmitc91516 0:a5c253316af6 4299 PrepareText((GuiConst_TEXT *)String, CharCnt, 0);
jmitc91516 0:a5c253316af6 4300 #else
jmitc91516 0:a5c253316af6 4301 #ifdef GuiConst_RENESAS_COMPILER_FAR
jmitc91516 0:a5c253316af6 4302 PrepareText((GuiConst_TEXT PrefixGeneric *)String, CharCnt, 0);
jmitc91516 0:a5c253316af6 4303 #else
jmitc91516 0:a5c253316af6 4304 PrepareText(String, CharCnt, 0);
jmitc91516 0:a5c253316af6 4305 #endif
jmitc91516 0:a5c253316af6 4306 #endif
jmitc91516 0:a5c253316af6 4307 #ifdef GuiConst_DISP_VAR_NOW
jmitc91516 0:a5c253316af6 4308 displayVarNow = 0;
jmitc91516 0:a5c253316af6 4309 #endif
jmitc91516 0:a5c253316af6 4310
jmitc91516 0:a5c253316af6 4311 return (TextPixelLength(TextData.TextPar[0].Ps, CharCnt, 0));
jmitc91516 0:a5c253316af6 4312 }
jmitc91516 0:a5c253316af6 4313
jmitc91516 0:a5c253316af6 4314 return (0);
jmitc91516 0:a5c253316af6 4315 }
jmitc91516 0:a5c253316af6 4316
jmitc91516 0:a5c253316af6 4317 //---------------------------------------------------------------
jmitc91516 0:a5c253316af6 4318 static GuiConst_TEXT GetCharCode(
jmitc91516 0:a5c253316af6 4319 GuiConst_TEXT PrefixRom * CharPtr,
jmitc91516 0:a5c253316af6 4320 GuiConst_INT16U CharCnt,
jmitc91516 0:a5c253316af6 4321 GuiConst_INT16U CharNo,
jmitc91516 0:a5c253316af6 4322 GuiConst_INT16U OmitCtrlCode)
jmitc91516 0:a5c253316af6 4323 {
jmitc91516 0:a5c253316af6 4324 GuiConst_INT16U P;
jmitc91516 0:a5c253316af6 4325 GuiConst_TEXT CharCode, PreviousCharCode;
jmitc91516 0:a5c253316af6 4326
jmitc91516 0:a5c253316af6 4327 if (CharCnt > GuiConst_MAX_TEXT_LEN)
jmitc91516 0:a5c253316af6 4328 CharCnt = GuiConst_MAX_TEXT_LEN;
jmitc91516 0:a5c253316af6 4329
jmitc91516 0:a5c253316af6 4330 if (CharNo > CharCnt)
jmitc91516 0:a5c253316af6 4331 return 0;
jmitc91516 0:a5c253316af6 4332
jmitc91516 0:a5c253316af6 4333 if (CharCnt > GuiConst_MAX_TEXT_LEN)
jmitc91516 0:a5c253316af6 4334 CharCnt = GuiConst_MAX_TEXT_LEN;
jmitc91516 0:a5c253316af6 4335
jmitc91516 0:a5c253316af6 4336 if (OmitCtrlCode)
jmitc91516 0:a5c253316af6 4337 {
jmitc91516 0:a5c253316af6 4338 for (P = 0; P < CharNo + 1; P++)
jmitc91516 0:a5c253316af6 4339 {
jmitc91516 0:a5c253316af6 4340 #ifdef GuiConst_CHARMODE_ANSI
jmitc91516 0:a5c253316af6 4341 #ifdef GuiConst_AVRGCC_COMPILER
jmitc91516 0:a5c253316af6 4342 CharCode = (unsigned GuiConst_CHAR) ReadBytePtr(CharPtr);
jmitc91516 0:a5c253316af6 4343 #else
jmitc91516 0:a5c253316af6 4344 #ifdef GuiConst_ICC_COMPILER
jmitc91516 0:a5c253316af6 4345 CharCode = *((GuiConst_INT8U PrefixRom *)CharPtr);
jmitc91516 0:a5c253316af6 4346 #else
jmitc91516 0:a5c253316af6 4347 #ifdef GuiConst_CODEVISION_COMPILER
jmitc91516 0:a5c253316af6 4348 CharCode = *((GuiConst_INT8U PrefixRom *)CharPtr);
jmitc91516 0:a5c253316af6 4349 #else
jmitc91516 0:a5c253316af6 4350 CharCode = (unsigned GuiConst_TEXT) *CharPtr;
jmitc91516 0:a5c253316af6 4351 #endif
jmitc91516 0:a5c253316af6 4352 #endif
jmitc91516 0:a5c253316af6 4353 #endif
jmitc91516 0:a5c253316af6 4354 #else
jmitc91516 0:a5c253316af6 4355 CharCode = *((GuiConst_INT16U PrefixLocate *)CharPtr);
jmitc91516 0:a5c253316af6 4356 #endif
jmitc91516 0:a5c253316af6 4357
jmitc91516 0:a5c253316af6 4358 if (P)
jmitc91516 0:a5c253316af6 4359 {
jmitc91516 0:a5c253316af6 4360 if ((CharCode == GuiLib_LINEFEED) ||
jmitc91516 0:a5c253316af6 4361 ((CharCode == ' ') && (PreviousCharCode == ' ')) ||
jmitc91516 0:a5c253316af6 4362 ((CharCode == ' ') && (PreviousCharCode == '-')))
jmitc91516 0:a5c253316af6 4363 CharNo++;
jmitc91516 0:a5c253316af6 4364 }
jmitc91516 0:a5c253316af6 4365 PreviousCharCode = CharCode;
jmitc91516 0:a5c253316af6 4366
jmitc91516 0:a5c253316af6 4367 CharPtr++;
jmitc91516 0:a5c253316af6 4368 }
jmitc91516 0:a5c253316af6 4369 }
jmitc91516 0:a5c253316af6 4370 else
jmitc91516 0:a5c253316af6 4371 {
jmitc91516 0:a5c253316af6 4372 CharPtr += CharNo;
jmitc91516 0:a5c253316af6 4373
jmitc91516 0:a5c253316af6 4374 #ifdef GuiConst_CHARMODE_ANSI
jmitc91516 0:a5c253316af6 4375 #ifdef GuiConst_AVRGCC_COMPILER
jmitc91516 0:a5c253316af6 4376 CharCode = (unsigned GuiConst_CHAR) ReadBytePtr(CharPtr);
jmitc91516 0:a5c253316af6 4377 #else
jmitc91516 0:a5c253316af6 4378 #ifdef GuiConst_ICC_COMPILER
jmitc91516 0:a5c253316af6 4379 CharCode = *((GuiConst_INT8U PrefixRom *)CharPtr);
jmitc91516 0:a5c253316af6 4380 #else
jmitc91516 0:a5c253316af6 4381 #ifdef GuiConst_CODEVISION_COMPILER
jmitc91516 0:a5c253316af6 4382 CharCode = *((GuiConst_INT8U PrefixRom *)CharPtr);
jmitc91516 0:a5c253316af6 4383 #else
jmitc91516 0:a5c253316af6 4384 CharCode = (unsigned GuiConst_TEXT) *CharPtr;
jmitc91516 0:a5c253316af6 4385 #endif
jmitc91516 0:a5c253316af6 4386 #endif
jmitc91516 0:a5c253316af6 4387 #endif
jmitc91516 0:a5c253316af6 4388 #else
jmitc91516 0:a5c253316af6 4389 CharCode = *((GuiConst_INT16U PrefixLocate *)CharPtr);
jmitc91516 0:a5c253316af6 4390 #endif
jmitc91516 0:a5c253316af6 4391 }
jmitc91516 0:a5c253316af6 4392
jmitc91516 0:a5c253316af6 4393 return (GuiConst_TEXT)CharCode;
jmitc91516 0:a5c253316af6 4394 }
jmitc91516 0:a5c253316af6 4395
jmitc91516 0:a5c253316af6 4396 //------------------------------------------------------------------------------
jmitc91516 0:a5c253316af6 4397 GuiConst_TEXT GuiLib_GetCharCode(
jmitc91516 0:a5c253316af6 4398 const GuiConst_INT16U StructureNdx,
jmitc91516 0:a5c253316af6 4399 GuiConst_INT16U TextNo,
jmitc91516 0:a5c253316af6 4400 GuiConst_INT16U CharNo,
jmitc91516 0:a5c253316af6 4401 GuiConst_INT16U OmitCtrlCode)
jmitc91516 0:a5c253316af6 4402 {
jmitc91516 0:a5c253316af6 4403 GuiConst_TEXT PrefixRom * CharPtr;
jmitc91516 0:a5c253316af6 4404
jmitc91516 0:a5c253316af6 4405 CharPtr = GuiLib_GetTextPtr(StructureNdx, TextNo);
jmitc91516 0:a5c253316af6 4406
jmitc91516 0:a5c253316af6 4407 if (CharPtr == 0) return 0;
jmitc91516 0:a5c253316af6 4408
jmitc91516 0:a5c253316af6 4409 #ifdef GuiConst_CHARMODE_ANSI
jmitc91516 0:a5c253316af6 4410 return GetCharCode(CharPtr,
jmitc91516 0:a5c253316af6 4411 strlen(CharPtr),
jmitc91516 0:a5c253316af6 4412 CharNo,
jmitc91516 0:a5c253316af6 4413 OmitCtrlCode);
jmitc91516 0:a5c253316af6 4414 #else
jmitc91516 0:a5c253316af6 4415 return GetCharCode(CharPtr,
jmitc91516 0:a5c253316af6 4416 GuiLib_UnicodeStrLen(CharPtr),
jmitc91516 0:a5c253316af6 4417 CharNo,
jmitc91516 0:a5c253316af6 4418 OmitCtrlCode);
jmitc91516 0:a5c253316af6 4419 #endif
jmitc91516 0:a5c253316af6 4420 }
jmitc91516 0:a5c253316af6 4421
jmitc91516 0:a5c253316af6 4422 //------------------------------------------------------------------------------
jmitc91516 0:a5c253316af6 4423 #ifdef GuiConst_BLINK_SUPPORT_ON
jmitc91516 0:a5c253316af6 4424 GuiConst_TEXT GuiLib_GetBlinkingCharCode(
jmitc91516 0:a5c253316af6 4425 GuiConst_INT16U BlinkFieldNo,
jmitc91516 0:a5c253316af6 4426 GuiConst_INT16U CharNo,
jmitc91516 0:a5c253316af6 4427 GuiConst_INT16U OmitCtrlCode)
jmitc91516 0:a5c253316af6 4428 {
jmitc91516 0:a5c253316af6 4429 #ifndef GuiConst_BLINK_FIELDS_OFF
jmitc91516 0:a5c253316af6 4430 GuiConst_INT16U StrLen;
jmitc91516 0:a5c253316af6 4431
jmitc91516 0:a5c253316af6 4432 if (BlinkFieldNo >= GuiConst_BLINK_FIELDS_MAX)
jmitc91516 0:a5c253316af6 4433 return 0;
jmitc91516 0:a5c253316af6 4434
jmitc91516 0:a5c253316af6 4435 if (sgl.BlinkTextItems[BlinkFieldNo].InUse)
jmitc91516 0:a5c253316af6 4436 {
jmitc91516 0:a5c253316af6 4437 #ifdef GuiConst_CHARMODE_ANSI
jmitc91516 0:a5c253316af6 4438 StrLen = strlen((GuiConst_TEXT*)sgl.BlinkTextItems[BlinkFieldNo].TextPtr);
jmitc91516 0:a5c253316af6 4439 #else
jmitc91516 0:a5c253316af6 4440 #ifdef GuiConst_CODEVISION_COMPILER
jmitc91516 0:a5c253316af6 4441 StrLen = GuiLib_UnicodeStrLen(
jmitc91516 0:a5c253316af6 4442 (GuiConst_TEXT*)sgl.BlinkTextItems[BlinkFieldNo].TextPtr);
jmitc91516 0:a5c253316af6 4443 #else
jmitc91516 0:a5c253316af6 4444 StrLen = GuiLib_UnicodeStrLen((GuiConst_TEXT*)sgl.BlinkTextItems[BlinkFieldNo].TextPtr);
jmitc91516 0:a5c253316af6 4445 #endif
jmitc91516 0:a5c253316af6 4446 #endif
jmitc91516 0:a5c253316af6 4447
jmitc91516 0:a5c253316af6 4448 return GetCharCode((GuiConst_TEXT PrefixRom *)sgl.BlinkTextItems[BlinkFieldNo].TextPtr,
jmitc91516 0:a5c253316af6 4449 StrLen,
jmitc91516 0:a5c253316af6 4450 CharNo,
jmitc91516 0:a5c253316af6 4451 OmitCtrlCode);
jmitc91516 0:a5c253316af6 4452 }
jmitc91516 0:a5c253316af6 4453 else
jmitc91516 0:a5c253316af6 4454 #endif
jmitc91516 0:a5c253316af6 4455 return 0;
jmitc91516 0:a5c253316af6 4456 }
jmitc91516 0:a5c253316af6 4457 #endif
jmitc91516 0:a5c253316af6 4458
jmitc91516 0:a5c253316af6 4459 //------------------------------------------------------------------------------
jmitc91516 0:a5c253316af6 4460 void GuiLib_SetLanguage(
jmitc91516 0:a5c253316af6 4461 GuiConst_INT16S NewLanguage)
jmitc91516 0:a5c253316af6 4462 {
jmitc91516 0:a5c253316af6 4463 GuiLib_LanguageIndex = CheckLanguageIndex(NewLanguage);
jmitc91516 0:a5c253316af6 4464 }
jmitc91516 0:a5c253316af6 4465
jmitc91516 0:a5c253316af6 4466 //------------------------------------------------------------------------------
jmitc91516 0:a5c253316af6 4467 static void InvertBox(void)
jmitc91516 0:a5c253316af6 4468 {
jmitc91516 0:a5c253316af6 4469 if (sgl.DisplayWriting)
jmitc91516 0:a5c253316af6 4470 GuiLib_InvertBox(sgl.InvertBoxX1, sgl.InvertBoxY1, sgl.InvertBoxX2, sgl.InvertBoxY2);
jmitc91516 0:a5c253316af6 4471 sgl.InvertBoxOn = !sgl.InvertBoxOn;
jmitc91516 0:a5c253316af6 4472 }
jmitc91516 0:a5c253316af6 4473
jmitc91516 0:a5c253316af6 4474 //------------------------------------------------------------------------------
jmitc91516 0:a5c253316af6 4475 void GuiLib_InvertBoxStart(
jmitc91516 0:a5c253316af6 4476 GuiConst_INT16S X1,
jmitc91516 0:a5c253316af6 4477 GuiConst_INT16S Y1,
jmitc91516 0:a5c253316af6 4478 GuiConst_INT16S X2,
jmitc91516 0:a5c253316af6 4479 GuiConst_INT16S Y2)
jmitc91516 0:a5c253316af6 4480 {
jmitc91516 0:a5c253316af6 4481 GuiLib_InvertBoxStop();
jmitc91516 0:a5c253316af6 4482 sgl.InvertBoxX1 = X1;
jmitc91516 0:a5c253316af6 4483 sgl.InvertBoxY1 = Y1;
jmitc91516 0:a5c253316af6 4484 sgl.InvertBoxX2 = X2;
jmitc91516 0:a5c253316af6 4485 sgl.InvertBoxY2 = Y2;
jmitc91516 0:a5c253316af6 4486 InvertBox();
jmitc91516 0:a5c253316af6 4487 }
jmitc91516 0:a5c253316af6 4488
jmitc91516 0:a5c253316af6 4489 //------------------------------------------------------------------------------
jmitc91516 0:a5c253316af6 4490 void GuiLib_InvertBoxStop(void)
jmitc91516 0:a5c253316af6 4491 {
jmitc91516 0:a5c253316af6 4492 if (sgl.InvertBoxOn)
jmitc91516 0:a5c253316af6 4493 InvertBox();
jmitc91516 0:a5c253316af6 4494 }
jmitc91516 0:a5c253316af6 4495
jmitc91516 0:a5c253316af6 4496 //------------------------------------------------------------------------------
jmitc91516 0:a5c253316af6 4497 void GuiLib_Refresh(void)
jmitc91516 0:a5c253316af6 4498 {
jmitc91516 0:a5c253316af6 4499 #ifdef WANT_DOUBLE_BUFFERING // Otherwise we are writing direct to the display - no need for this code
jmitc91516 0:a5c253316af6 4500 GuiConst_INT16S N, L;
jmitc91516 0:a5c253316af6 4501 GuiConst_INT8U RedrawBottomLevel;
jmitc91516 0:a5c253316af6 4502 ItemMemory RemMemory;
jmitc91516 0:a5c253316af6 4503 GuiConst_INT8U ColorInvert;
jmitc91516 0:a5c253316af6 4504
jmitc91516 0:a5c253316af6 4505 GuiDisplay_Lock();
jmitc91516 0:a5c253316af6 4506
jmitc91516 0:a5c253316af6 4507 sgl.RefreshClock++;
jmitc91516 0:a5c253316af6 4508
jmitc91516 0:a5c253316af6 4509 RedrawBottomLevel = 0;
jmitc91516 0:a5c253316af6 4510
jmitc91516 0:a5c253316af6 4511 N = AutoRedraw_Reset();
jmitc91516 0:a5c253316af6 4512
jmitc91516 0:a5c253316af6 4513 memcpy(&RemMemory, &sgl.Memory, sizeof(ItemMemory));
jmitc91516 0:a5c253316af6 4514
jmitc91516 0:a5c253316af6 4515 while (N != -1)
jmitc91516 0:a5c253316af6 4516 {
jmitc91516 0:a5c253316af6 4517 #ifdef GuiConst_CURSOR_SUPPORT_ON
jmitc91516 0:a5c253316af6 4518 if (!AutoRedraw_IsOnlyCursor(N))
jmitc91516 0:a5c253316af6 4519 #endif
jmitc91516 0:a5c253316af6 4520 {
jmitc91516 0:a5c253316af6 4521 if (AutoRedraw_VarChanged(N) != 0)
jmitc91516 0:a5c253316af6 4522 {
jmitc91516 0:a5c253316af6 4523 memcpy(&sgl.CurItem, AutoRedraw_GetItem(N), sizeof(GuiLib_ItemRec));
jmitc91516 0:a5c253316af6 4524 memcpy(&sgl.Memory, AutoRedraw_GetItemMemory(N), sizeof(ItemMemory));
jmitc91516 0:a5c253316af6 4525
jmitc91516 0:a5c253316af6 4526 AutoRedraw_UpdateVar(N);
jmitc91516 0:a5c253316af6 4527
jmitc91516 0:a5c253316af6 4528 ColorInvert = GuiLib_COL_INVERT_IF_CURSOR;
jmitc91516 0:a5c253316af6 4529
jmitc91516 0:a5c253316af6 4530 #ifdef GuiConst_CURSOR_SUPPORT_ON
jmitc91516 0:a5c253316af6 4531 if (AutoRedraw_CheckCursorInheritance(N) == 0)
jmitc91516 0:a5c253316af6 4532 ColorInvert = GuiLib_COL_INVERT_ON;
jmitc91516 0:a5c253316af6 4533 #endif
jmitc91516 0:a5c253316af6 4534
jmitc91516 0:a5c253316af6 4535 L = AutoRedraw_GetLevel(N);
jmitc91516 0:a5c253316af6 4536
jmitc91516 0:a5c253316af6 4537 if (AutoRedraw_ItemIsStruct(N))
jmitc91516 0:a5c253316af6 4538 {
jmitc91516 0:a5c253316af6 4539 N = AutoRedraw_DeleteStruct(N);
jmitc91516 0:a5c253316af6 4540 sgl.AutoRedrawUpdate = GuiLib_TRUE;
jmitc91516 0:a5c253316af6 4541 if (sgl.AutoRedrawInsertPoint >= 0)
jmitc91516 0:a5c253316af6 4542 N = AutoRedraw_GetNext(N);
jmitc91516 0:a5c253316af6 4543 }
jmitc91516 0:a5c253316af6 4544 else
jmitc91516 0:a5c253316af6 4545 {
jmitc91516 0:a5c253316af6 4546 sgl.AutoRedrawUpdate = GuiLib_FALSE;
jmitc91516 0:a5c253316af6 4547 N = AutoRedraw_GetNext(N);
jmitc91516 0:a5c253316af6 4548 }
jmitc91516 0:a5c253316af6 4549
jmitc91516 0:a5c253316af6 4550 #ifdef GuiConst_BITMAP_SUPPORT_ON
jmitc91516 0:a5c253316af6 4551 UpdateBackgroundBitmap();
jmitc91516 0:a5c253316af6 4552 #endif
jmitc91516 0:a5c253316af6 4553
jmitc91516 0:a5c253316af6 4554 sgl.DisplayLevel = 0;
jmitc91516 0:a5c253316af6 4555 sgl.SwapColors = 0;
jmitc91516 0:a5c253316af6 4556
jmitc91516 0:a5c253316af6 4557 #ifdef GuiConst_BLINK_SUPPORT_ON
jmitc91516 0:a5c253316af6 4558 #ifndef GuiConst_BLINK_FIELDS_OFF
jmitc91516 0:a5c253316af6 4559 if ((sgl.CurItem.TextPar[0].BitFlags & GuiLib_BITFLAG_BLINKTEXTFIELD) &&
jmitc91516 0:a5c253316af6 4560 (sgl.CurItem.BlinkFieldNo < GuiConst_BLINK_FIELDS_MAX) &&
jmitc91516 0:a5c253316af6 4561 sgl.BlinkTextItems[sgl.CurItem.BlinkFieldNo].InUse &&
jmitc91516 0:a5c253316af6 4562 sgl.BlinkTextItems[sgl.CurItem.BlinkFieldNo].Active &&
jmitc91516 0:a5c253316af6 4563 sgl.BlinkTextItems[sgl.CurItem.BlinkFieldNo].BlinkBoxInverted)
jmitc91516 0:a5c253316af6 4564 GuiLib_InvertBox(sgl.BlinkTextItems[sgl.CurItem.BlinkFieldNo].BlinkBoxX1,
jmitc91516 0:a5c253316af6 4565 sgl.BlinkTextItems[sgl.CurItem.BlinkFieldNo].BlinkBoxY1,
jmitc91516 0:a5c253316af6 4566 sgl.BlinkTextItems[sgl.CurItem.BlinkFieldNo].BlinkBoxX2,
jmitc91516 0:a5c253316af6 4567 sgl.BlinkTextItems[sgl.CurItem.BlinkFieldNo].BlinkBoxY2);
jmitc91516 0:a5c253316af6 4568 #endif
jmitc91516 0:a5c253316af6 4569 #endif
jmitc91516 0:a5c253316af6 4570
jmitc91516 0:a5c253316af6 4571 DrawItem(ColorInvert);
jmitc91516 0:a5c253316af6 4572
jmitc91516 0:a5c253316af6 4573 if (L == 0)
jmitc91516 0:a5c253316af6 4574 RedrawBottomLevel = 1;
jmitc91516 0:a5c253316af6 4575
jmitc91516 0:a5c253316af6 4576 sgl.AutoRedrawUpdate = GuiLib_FALSE;
jmitc91516 0:a5c253316af6 4577 }
jmitc91516 0:a5c253316af6 4578 else
jmitc91516 0:a5c253316af6 4579 N = AutoRedraw_GetNext(N);
jmitc91516 0:a5c253316af6 4580 }
jmitc91516 0:a5c253316af6 4581 #ifdef GuiConst_CURSOR_SUPPORT_ON
jmitc91516 0:a5c253316af6 4582 else
jmitc91516 0:a5c253316af6 4583 N = AutoRedraw_GetNext(N);
jmitc91516 0:a5c253316af6 4584 #endif
jmitc91516 0:a5c253316af6 4585 }
jmitc91516 0:a5c253316af6 4586
jmitc91516 0:a5c253316af6 4587 memcpy(&sgl.Memory, &RemMemory, sizeof(ItemMemory));
jmitc91516 0:a5c253316af6 4588
jmitc91516 0:a5c253316af6 4589
jmitc91516 0:a5c253316af6 4590 if ((sgl.DrawingLevel > 0) && RedrawBottomLevel && (sgl.TopLevelStructure != 0))
jmitc91516 0:a5c253316af6 4591 {
jmitc91516 0:a5c253316af6 4592 sgl.DisplayLevel = 0;
jmitc91516 0:a5c253316af6 4593 sgl.SwapColors = 0;
jmitc91516 0:a5c253316af6 4594 DrawStructure(sgl.TopLevelStructure, GuiLib_COL_INVERT_IF_CURSOR);
jmitc91516 0:a5c253316af6 4595 ResetLayerBufPtr();
jmitc91516 0:a5c253316af6 4596 }
jmitc91516 0:a5c253316af6 4597
jmitc91516 0:a5c253316af6 4598 #ifdef GuiConst_BLINK_SUPPORT_ON
jmitc91516 0:a5c253316af6 4599 #ifndef GuiConst_BLINK_FIELDS_OFF
jmitc91516 0:a5c253316af6 4600 for (N = 0; N < GuiConst_BLINK_FIELDS_MAX; N++)
jmitc91516 0:a5c253316af6 4601 if (sgl.BlinkTextItems[N].InUse &&
jmitc91516 0:a5c253316af6 4602 sgl.BlinkTextItems[N].Active)
jmitc91516 0:a5c253316af6 4603 {
jmitc91516 0:a5c253316af6 4604 if (sgl.BlinkTextItems[N].BlinkBoxInverted !=
jmitc91516 0:a5c253316af6 4605 sgl.BlinkTextItems[N].BlinkBoxLast)
jmitc91516 0:a5c253316af6 4606 {
jmitc91516 0:a5c253316af6 4607 GuiLib_InvertBox(sgl.BlinkTextItems[N].BlinkBoxX1,
jmitc91516 0:a5c253316af6 4608 sgl.BlinkTextItems[N].BlinkBoxY1,
jmitc91516 0:a5c253316af6 4609 sgl.BlinkTextItems[N].BlinkBoxX2,
jmitc91516 0:a5c253316af6 4610 sgl.BlinkTextItems[N].BlinkBoxY2);
jmitc91516 0:a5c253316af6 4611 sgl.BlinkTextItems[N].BlinkBoxInverted =
jmitc91516 0:a5c253316af6 4612 sgl.BlinkTextItems[N].BlinkBoxLast;
jmitc91516 0:a5c253316af6 4613 }
jmitc91516 0:a5c253316af6 4614 if (sgl.BlinkTextItems[N].BlinkBoxState < 255)
jmitc91516 0:a5c253316af6 4615 {
jmitc91516 0:a5c253316af6 4616 sgl.BlinkTextItems[N].BlinkBoxState--;
jmitc91516 0:a5c253316af6 4617 if (sgl.BlinkTextItems[N].BlinkBoxState == 0)
jmitc91516 0:a5c253316af6 4618 {
jmitc91516 0:a5c253316af6 4619 sgl.BlinkTextItems[N].BlinkBoxState = sgl.BlinkTextItems[N].BlinkBoxRate;
jmitc91516 0:a5c253316af6 4620 if (sgl.DisplayWriting)
jmitc91516 0:a5c253316af6 4621 {
jmitc91516 0:a5c253316af6 4622 GuiLib_InvertBox(sgl.BlinkTextItems[N].BlinkBoxX1,
jmitc91516 0:a5c253316af6 4623 sgl.BlinkTextItems[N].BlinkBoxY1,
jmitc91516 0:a5c253316af6 4624 sgl.BlinkTextItems[N].BlinkBoxX2,
jmitc91516 0:a5c253316af6 4625 sgl.BlinkTextItems[N].BlinkBoxY2);
jmitc91516 0:a5c253316af6 4626 sgl.BlinkTextItems[N].BlinkBoxInverted =
jmitc91516 0:a5c253316af6 4627 !sgl.BlinkTextItems[N].BlinkBoxInverted;
jmitc91516 0:a5c253316af6 4628 sgl.BlinkTextItems[N].BlinkBoxLast =
jmitc91516 0:a5c253316af6 4629 sgl.BlinkTextItems[N].BlinkBoxInverted;
jmitc91516 0:a5c253316af6 4630 }
jmitc91516 0:a5c253316af6 4631 }
jmitc91516 0:a5c253316af6 4632 }
jmitc91516 0:a5c253316af6 4633 }
jmitc91516 0:a5c253316af6 4634 if (sgl.BlinkBoxRate)
jmitc91516 0:a5c253316af6 4635 {
jmitc91516 0:a5c253316af6 4636 if (sgl.BlinkBoxState < 255)
jmitc91516 0:a5c253316af6 4637 sgl.BlinkBoxState--;
jmitc91516 0:a5c253316af6 4638 if (sgl.BlinkBoxState == 0)
jmitc91516 0:a5c253316af6 4639 {
jmitc91516 0:a5c253316af6 4640 sgl.BlinkBoxState = sgl.BlinkBoxRate;
jmitc91516 0:a5c253316af6 4641 BlinkBox();
jmitc91516 0:a5c253316af6 4642 }
jmitc91516 0:a5c253316af6 4643 }
jmitc91516 0:a5c253316af6 4644 #endif
jmitc91516 0:a5c253316af6 4645 #endif
jmitc91516 0:a5c253316af6 4646
jmitc91516 0:a5c253316af6 4647 GuiDisplay_Unlock();
jmitc91516 0:a5c253316af6 4648
jmitc91516 0:a5c253316af6 4649 GuiDisplay_Refresh();
jmitc91516 0:a5c253316af6 4650 #endif // WANT_DOUBLE_BUFFERING
jmitc91516 0:a5c253316af6 4651 }
jmitc91516 0:a5c253316af6 4652
jmitc91516 0:a5c253316af6 4653 //------------------------------------------------------------------------------
jmitc91516 0:a5c253316af6 4654 void GuiLib_DrawChar(
jmitc91516 0:a5c253316af6 4655 GuiConst_INT16S X,
jmitc91516 0:a5c253316af6 4656 GuiConst_INT16S Y,
jmitc91516 0:a5c253316af6 4657 GuiConst_INT16U FontNo,
jmitc91516 0:a5c253316af6 4658 GuiConst_TEXT Character,
jmitc91516 0:a5c253316af6 4659 GuiConst_INTCOLOR Color)
jmitc91516 0:a5c253316af6 4660 {
jmitc91516 0:a5c253316af6 4661 GuiLib_FontRecPtr Font;
jmitc91516 0:a5c253316af6 4662 #ifndef GuiConst_REMOTE_FONT_DATA
jmitc91516 0:a5c253316af6 4663 GuiConst_INT8U PrefixRom *CharPtr;
jmitc91516 0:a5c253316af6 4664 #endif
jmitc91516 0:a5c253316af6 4665 GuiConst_INT16S X1,Y1,X2,Y2;
jmitc91516 0:a5c253316af6 4666 #ifdef GuiConst_REMOTE_FONT_DATA
jmitc91516 0:a5c253316af6 4667 GuiConst_INT32U CharNdx;
jmitc91516 0:a5c253316af6 4668 #else
jmitc91516 0:a5c253316af6 4669 #ifdef GuiConst_CHARMODE_UNICODE
jmitc91516 0:a5c253316af6 4670 GuiConst_INT32U CharNdx;
jmitc91516 0:a5c253316af6 4671 #endif
jmitc91516 0:a5c253316af6 4672 #endif
jmitc91516 0:a5c253316af6 4673
jmitc91516 0:a5c253316af6 4674 Font = (GuiLib_FontRecPtr) ReadWord(GuiFont_FontList[FontNo]);
jmitc91516 0:a5c253316af6 4675
jmitc91516 0:a5c253316af6 4676 Y -= ReadByte(Font->BaseLine);
jmitc91516 0:a5c253316af6 4677
jmitc91516 0:a5c253316af6 4678 #ifdef GuiConst_CHARMODE_ANSI
jmitc91516 0:a5c253316af6 4679 #ifdef GuiConst_REMOTE_FONT_DATA
jmitc91516 0:a5c253316af6 4680 if ((Character < Font->FirstChar) || (Character > Font->LastChar))
jmitc91516 0:a5c253316af6 4681 CharNdx =
jmitc91516 0:a5c253316af6 4682 (GuiConst_INT32U PrefixRom)GuiFont_ChPtrList[Font->IllegalCharNdx];
jmitc91516 0:a5c253316af6 4683 else
jmitc91516 0:a5c253316af6 4684 CharNdx =
jmitc91516 0:a5c253316af6 4685 (GuiConst_INT32U PrefixRom)GuiFont_ChPtrList[Font->FirstCharNdx +
jmitc91516 0:a5c253316af6 4686 (GuiConst_INT16U)Character - (GuiConst_INT16U)Font->FirstChar];
jmitc91516 0:a5c253316af6 4687 DrawChar(X, Y, Font, CharNdx, Color, 0);
jmitc91516 0:a5c253316af6 4688 #else
jmitc91516 0:a5c253316af6 4689 if ((Character < ReadByte(Font->FirstChar)) ||
jmitc91516 0:a5c253316af6 4690 (Character > ReadByte(Font->LastChar)))
jmitc91516 0:a5c253316af6 4691 CharPtr = (GuiConst_INT8U PrefixRom *)ReadWord(
jmitc91516 0:a5c253316af6 4692 GuiFont_ChPtrList[ReadWord(Font->IllegalCharNdx)]);
jmitc91516 0:a5c253316af6 4693 else
jmitc91516 0:a5c253316af6 4694 CharPtr = (GuiConst_INT8U PrefixRom *)ReadWord(
jmitc91516 0:a5c253316af6 4695 GuiFont_ChPtrList[ReadWord(Font->FirstCharNdx) +
jmitc91516 0:a5c253316af6 4696 (GuiConst_INT16U)Character -
jmitc91516 0:a5c253316af6 4697 (GuiConst_INT16U)ReadByte(Font->FirstChar)]);
jmitc91516 0:a5c253316af6 4698 DrawChar(X, Y, Font, CharPtr, Color, 0);
jmitc91516 0:a5c253316af6 4699 #endif
jmitc91516 0:a5c253316af6 4700 #else
jmitc91516 0:a5c253316af6 4701 CharNdx = GetCharNdx(Font, Character);
jmitc91516 0:a5c253316af6 4702 #ifdef GuiConst_REMOTE_FONT_DATA
jmitc91516 0:a5c253316af6 4703 DrawChar(X, Y, Font, CharNdx, Color, 0);
jmitc91516 0:a5c253316af6 4704 #else
jmitc91516 0:a5c253316af6 4705 CharPtr = (GuiConst_INT8U PrefixRom *)ReadWord(GuiFont_ChPtrList[CharNdx]);
jmitc91516 0:a5c253316af6 4706 DrawChar(X, Y, Font, CharPtr, Color, 0);
jmitc91516 0:a5c253316af6 4707 #endif
jmitc91516 0:a5c253316af6 4708 #endif
jmitc91516 0:a5c253316af6 4709
jmitc91516 0:a5c253316af6 4710 #ifdef GuiConst_REMOTE_FONT_DATA
jmitc91516 0:a5c253316af6 4711 X1 = X + sgl.GuiLib_RemoteFontBuffer[GuiLib_CHR_XLEFT_OFS];
jmitc91516 0:a5c253316af6 4712 X2 = X1 + sgl.GuiLib_RemoteFontBuffer[GuiLib_CHR_XWIDTH_OFS] - 1;
jmitc91516 0:a5c253316af6 4713 Y1 = Y + sgl.GuiLib_RemoteFontBuffer[GuiLib_CHR_YTOP_OFS];
jmitc91516 0:a5c253316af6 4714 Y2 = Y1 + sgl.GuiLib_RemoteFontBuffer[GuiLib_CHR_YHEIGHT_OFS] - 1;
jmitc91516 0:a5c253316af6 4715 #else
jmitc91516 0:a5c253316af6 4716 X1 = X + ReadBytePtr(CharPtr + GuiLib_CHR_XLEFT_OFS);
jmitc91516 0:a5c253316af6 4717 X2 = X1 + ReadBytePtr(CharPtr + GuiLib_CHR_XWIDTH_OFS) - 1;
jmitc91516 0:a5c253316af6 4718 Y1 = Y + ReadBytePtr(CharPtr + GuiLib_CHR_YTOP_OFS);
jmitc91516 0:a5c253316af6 4719 Y2 = Y1 + ReadBytePtr(CharPtr + GuiLib_CHR_YHEIGHT_OFS) - 1;
jmitc91516 0:a5c253316af6 4720 #endif
jmitc91516 0:a5c253316af6 4721
jmitc91516 0:a5c253316af6 4722 GuiLib_MarkDisplayBoxRepaint(X1,Y1,X2,Y2);
jmitc91516 0:a5c253316af6 4723 }
jmitc91516 0:a5c253316af6 4724
jmitc91516 0:a5c253316af6 4725 //------------------------------------------------------------------------------
jmitc91516 0:a5c253316af6 4726 void GuiLib_DrawStr(
jmitc91516 0:a5c253316af6 4727 GuiConst_INT16S X,
jmitc91516 0:a5c253316af6 4728 GuiConst_INT16S Y,
jmitc91516 0:a5c253316af6 4729 GuiConst_INT16U FontNo,
jmitc91516 0:a5c253316af6 4730 GuiConst_TEXT *String,
jmitc91516 0:a5c253316af6 4731 GuiConst_INT8U Alignment,
jmitc91516 0:a5c253316af6 4732 GuiConst_INT8U PsWriting,
jmitc91516 0:a5c253316af6 4733 GuiConst_INT8U Transparent,
jmitc91516 0:a5c253316af6 4734 GuiConst_INT8U Underlining,
jmitc91516 0:a5c253316af6 4735 GuiConst_INT16S BackBoxSizeX,
jmitc91516 0:a5c253316af6 4736 GuiConst_INT16S BackBoxSizeY1,
jmitc91516 0:a5c253316af6 4737 GuiConst_INT16S BackBoxSizeY2,
jmitc91516 0:a5c253316af6 4738 GuiConst_INT8U BackBorderPixels,
jmitc91516 0:a5c253316af6 4739 GuiConst_INTCOLOR ForeColor,
jmitc91516 0:a5c253316af6 4740 GuiConst_INTCOLOR BackColor)
jmitc91516 0:a5c253316af6 4741 {
jmitc91516 0:a5c253316af6 4742 if (FontNo >= GuiFont_FontCnt)
jmitc91516 0:a5c253316af6 4743 return;
jmitc91516 0:a5c253316af6 4744 if (*String == 0)
jmitc91516 0:a5c253316af6 4745 return;
jmitc91516 0:a5c253316af6 4746
jmitc91516 0:a5c253316af6 4747 SetCurFont(FontNo);
jmitc91516 0:a5c253316af6 4748
jmitc91516 0:a5c253316af6 4749 #ifdef GuiConst_AVRGCC_COMPILER
jmitc91516 0:a5c253316af6 4750 #ifdef GuiConst_CHARMODE_ANSI
jmitc91516 0:a5c253316af6 4751 sgl.CurItem.TextPtr[0] = (GuiConst_INT8U *)String;
jmitc91516 0:a5c253316af6 4752 #else
jmitc91516 0:a5c253316af6 4753 sgl.CurItem.TextPtr[0] = (GuiConst_INT16U *)String;
jmitc91516 0:a5c253316af6 4754 #endif
jmitc91516 0:a5c253316af6 4755 #else
jmitc91516 0:a5c253316af6 4756 #ifdef GuiConst_ICC_COMPILER
jmitc91516 0:a5c253316af6 4757 #ifdef GuiConst_CHARMODE_ANSI
jmitc91516 0:a5c253316af6 4758 sgl.CurItem.TextPtr[0] = (GuiConst_INT8U *)String;
jmitc91516 0:a5c253316af6 4759 #else
jmitc91516 0:a5c253316af6 4760 sgl.CurItem.TextPtr[0] = (GuiConst_INT16U *)String;
jmitc91516 0:a5c253316af6 4761 #endif
jmitc91516 0:a5c253316af6 4762 #else
jmitc91516 0:a5c253316af6 4763 #ifdef GuiConst_CODEVISION_COMPILER
jmitc91516 0:a5c253316af6 4764 #ifdef GuiConst_CHARMODE_ANSI
jmitc91516 0:a5c253316af6 4765 sgl.CurItem.TextPtr[0] = (GuiConst_INT8U *)String;
jmitc91516 0:a5c253316af6 4766 #else
jmitc91516 0:a5c253316af6 4767 sgl.CurItem.TextPtr[0] = (GuiConst_INT16U *)String;
jmitc91516 0:a5c253316af6 4768 #endif
jmitc91516 0:a5c253316af6 4769 #else
jmitc91516 0:a5c253316af6 4770 #ifdef GuiConst_RENESAS_COMPILER_FAR
jmitc91516 0:a5c253316af6 4771 #ifdef GuiConst_CHARMODE_ANSI
jmitc91516 0:a5c253316af6 4772 sgl.CurItem.TextPtr[0] = (GuiConst_INT8U PrefixLocate *)String;
jmitc91516 0:a5c253316af6 4773 #else
jmitc91516 0:a5c253316af6 4774 sgl.CurItem.TextPtr[0] = (GuiConst_INT16U PrefixLocate *)String;
jmitc91516 0:a5c253316af6 4775 #endif
jmitc91516 0:a5c253316af6 4776 #else
jmitc91516 0:a5c253316af6 4777 sgl.CurItem.TextPtr[0] = String;
jmitc91516 0:a5c253316af6 4778 #endif
jmitc91516 0:a5c253316af6 4779 #endif
jmitc91516 0:a5c253316af6 4780 #endif
jmitc91516 0:a5c253316af6 4781 #endif
jmitc91516 0:a5c253316af6 4782
jmitc91516 0:a5c253316af6 4783 sgl.CurItem.TextLength[0] = 0;
jmitc91516 0:a5c253316af6 4784 while (*String != 0)
jmitc91516 0:a5c253316af6 4785 {
jmitc91516 0:a5c253316af6 4786 sgl.CurItem.TextLength[0]++;
jmitc91516 0:a5c253316af6 4787 String++;
jmitc91516 0:a5c253316af6 4788 }
jmitc91516 0:a5c253316af6 4789 sgl.CurItem.X1 = X;
jmitc91516 0:a5c253316af6 4790 sgl.CurItem.Y1 = Y;
jmitc91516 0:a5c253316af6 4791 sgl.CurItem.TextPar[0].FontIndex = FontNo;
jmitc91516 0:a5c253316af6 4792 sgl.CurItem.TextPar[0].Alignment = Alignment;
jmitc91516 0:a5c253316af6 4793 sgl.CurItem.TextPar[0].Ps = PsWriting;
jmitc91516 0:a5c253316af6 4794 sgl.CurItem.TextPar[0].BitFlags = 0;
jmitc91516 0:a5c253316af6 4795 if (Underlining)
jmitc91516 0:a5c253316af6 4796 sgl.CurItem.TextPar[0].BitFlags |= GuiLib_BITFLAG_UNDERLINE;
jmitc91516 0:a5c253316af6 4797 sgl.CurItem.TextPar[0].BackBoxSizeX = BackBoxSizeX;
jmitc91516 0:a5c253316af6 4798 sgl.CurItem.TextPar[0].BackBoxSizeY1 = BackBoxSizeY1;
jmitc91516 0:a5c253316af6 4799 sgl.CurItem.TextPar[0].BackBoxSizeY2 = BackBoxSizeY2;
jmitc91516 0:a5c253316af6 4800 sgl.CurItem.TextPar[0].BackBorderPixels = BackBorderPixels;
jmitc91516 0:a5c253316af6 4801 if (sgl.CurItem.TextPar[0].BackBoxSizeX > 0)
jmitc91516 0:a5c253316af6 4802 DrawBackBox(BackColor, Transparent, 0);
jmitc91516 0:a5c253316af6 4803
jmitc91516 0:a5c253316af6 4804 #ifdef GuiConst_DISP_VAR_NOW
jmitc91516 0:a5c253316af6 4805 displayVarNow = 1;
jmitc91516 0:a5c253316af6 4806 #endif
jmitc91516 0:a5c253316af6 4807
jmitc91516 0:a5c253316af6 4808 DrawText(sgl.CurItem.TextPtr[0],
jmitc91516 0:a5c253316af6 4809 sgl.CurItem.TextLength[0],
jmitc91516 0:a5c253316af6 4810 0,
jmitc91516 0:a5c253316af6 4811 ForeColor,
jmitc91516 0:a5c253316af6 4812 BackColor,
jmitc91516 0:a5c253316af6 4813 Transparent);
jmitc91516 0:a5c253316af6 4814
jmitc91516 0:a5c253316af6 4815 #ifdef GuiConst_DISP_VAR_NOW
jmitc91516 0:a5c253316af6 4816 displayVarNow = 0;
jmitc91516 0:a5c253316af6 4817 #endif
jmitc91516 0:a5c253316af6 4818 }
jmitc91516 0:a5c253316af6 4819
jmitc91516 0:a5c253316af6 4820 //------------------------------------------------------------------------------
jmitc91516 0:a5c253316af6 4821 void GuiLib_DrawVar(
jmitc91516 0:a5c253316af6 4822 GuiConst_INT16S X,
jmitc91516 0:a5c253316af6 4823 GuiConst_INT16S Y,
jmitc91516 0:a5c253316af6 4824 GuiConst_INT16U FontNo,
jmitc91516 0:a5c253316af6 4825 void PrefixLocate *VarPtr,
jmitc91516 0:a5c253316af6 4826 GuiConst_INT8U VarType,
jmitc91516 0:a5c253316af6 4827 GuiConst_INT8U FormatterFormat,
jmitc91516 0:a5c253316af6 4828 GuiConst_INT8U FormatterFieldWidth,
jmitc91516 0:a5c253316af6 4829 GuiConst_INT8U FormatterAlignment,
jmitc91516 0:a5c253316af6 4830 GuiConst_INT8U FormatterDecimals,
jmitc91516 0:a5c253316af6 4831 GuiConst_INT8U FormatterShowSign,
jmitc91516 0:a5c253316af6 4832 GuiConst_INT8U FormatterZeroPadding,
jmitc91516 0:a5c253316af6 4833 GuiConst_INT8U FormatterTrailingZeros,
jmitc91516 0:a5c253316af6 4834 GuiConst_INT8U FormatterThousandsSeparator,
jmitc91516 0:a5c253316af6 4835 GuiConst_INT8U Alignment,
jmitc91516 0:a5c253316af6 4836 GuiConst_INT8U PsWriting,
jmitc91516 0:a5c253316af6 4837 GuiConst_INT8U Transparent,
jmitc91516 0:a5c253316af6 4838 GuiConst_INT8U Underlining,
jmitc91516 0:a5c253316af6 4839 GuiConst_INT16S BackBoxSizeX,
jmitc91516 0:a5c253316af6 4840 GuiConst_INT16S BackBoxSizeY1,
jmitc91516 0:a5c253316af6 4841 GuiConst_INT16S BackBoxSizeY2,
jmitc91516 0:a5c253316af6 4842 GuiConst_INT8U BackBorderPixels,
jmitc91516 0:a5c253316af6 4843 GuiConst_INTCOLOR ForeColor,
jmitc91516 0:a5c253316af6 4844 GuiConst_INTCOLOR BackColor)
jmitc91516 0:a5c253316af6 4845 {
jmitc91516 0:a5c253316af6 4846 GuiConst_INT32S VarValue;
jmitc91516 0:a5c253316af6 4847 GuiConst_INT16U StrLen;
jmitc91516 0:a5c253316af6 4848 #ifndef GuiConst_CHARMODE_ANSI
jmitc91516 0:a5c253316af6 4849 GuiConst_INT16U P;
jmitc91516 0:a5c253316af6 4850 #endif
jmitc91516 0:a5c253316af6 4851 GuiConst_TEXT PrefixGeneric *CharPtr;
jmitc91516 0:a5c253316af6 4852
jmitc91516 0:a5c253316af6 4853 if (FontNo >= GuiFont_FontCnt)
jmitc91516 0:a5c253316af6 4854 return;
jmitc91516 0:a5c253316af6 4855
jmitc91516 0:a5c253316af6 4856 SetCurFont(FontNo);
jmitc91516 0:a5c253316af6 4857
jmitc91516 0:a5c253316af6 4858 sgl.CurItem.VarPtr = VarPtr;
jmitc91516 0:a5c253316af6 4859 sgl.CurItem.VarType = VarType;
jmitc91516 0:a5c253316af6 4860 sgl.CurItem.FormatFormat = FormatterFormat;
jmitc91516 0:a5c253316af6 4861 sgl.CurItem.FormatFieldWidth = FormatterFieldWidth;
jmitc91516 0:a5c253316af6 4862 sgl.CurItem.FormatAlignment = FormatterAlignment;
jmitc91516 0:a5c253316af6 4863 sgl.CurItem.FormatDecimals = FormatterDecimals;
jmitc91516 0:a5c253316af6 4864 sgl.CurItem.TextPar[0].BitFlags = 0;
jmitc91516 0:a5c253316af6 4865 if (FormatterShowSign)
jmitc91516 0:a5c253316af6 4866 sgl.CurItem.TextPar[0].BitFlags |= GuiLib_BITFLAG_FORMATSHOWSIGN;
jmitc91516 0:a5c253316af6 4867 if (FormatterZeroPadding)
jmitc91516 0:a5c253316af6 4868 sgl.CurItem.TextPar[0].BitFlags |= GuiLib_BITFLAG_FORMATZEROPADDING;
jmitc91516 0:a5c253316af6 4869 if (FormatterTrailingZeros)
jmitc91516 0:a5c253316af6 4870 sgl.CurItem.TextPar[0].BitFlags |= GuiLib_BITFLAG_FORMATTRAILINGZEROS;
jmitc91516 0:a5c253316af6 4871 if (FormatterThousandsSeparator)
jmitc91516 0:a5c253316af6 4872 sgl.CurItem.TextPar[0].BitFlags |= GuiLib_BITFLAG_FORMATTHOUSANDSSEP;
jmitc91516 0:a5c253316af6 4873 sgl.CurItem.X1 = X;
jmitc91516 0:a5c253316af6 4874 sgl.CurItem.Y1 = Y;
jmitc91516 0:a5c253316af6 4875 sgl.CurItem.TextPar[0].FontIndex = FontNo;
jmitc91516 0:a5c253316af6 4876 sgl.CurItem.TextPar[0].Alignment = Alignment;
jmitc91516 0:a5c253316af6 4877 sgl.CurItem.TextPar[0].Ps = PsWriting;
jmitc91516 0:a5c253316af6 4878 if (Underlining)
jmitc91516 0:a5c253316af6 4879 sgl.CurItem.TextPar[0].BitFlags |= GuiLib_BITFLAG_UNDERLINE;
jmitc91516 0:a5c253316af6 4880 sgl.CurItem.TextPar[0].BackBoxSizeX = BackBoxSizeX;
jmitc91516 0:a5c253316af6 4881 sgl.CurItem.TextPar[0].BackBoxSizeY1 = BackBoxSizeY1;
jmitc91516 0:a5c253316af6 4882 sgl.CurItem.TextPar[0].BackBoxSizeY2 = BackBoxSizeY2;
jmitc91516 0:a5c253316af6 4883 sgl.CurItem.TextPar[0].BackBorderPixels = BackBorderPixels;
jmitc91516 0:a5c253316af6 4884 if (sgl.CurItem.TextPar[0].BackBoxSizeX > 0)
jmitc91516 0:a5c253316af6 4885 DrawBackBox(BackColor, Transparent, 0);
jmitc91516 0:a5c253316af6 4886
jmitc91516 0:a5c253316af6 4887 #ifdef GuiConst_DISP_VAR_NOW
jmitc91516 0:a5c253316af6 4888 displayVarNow = 1;
jmitc91516 0:a5c253316af6 4889 #endif
jmitc91516 0:a5c253316af6 4890
jmitc91516 0:a5c253316af6 4891 if (sgl.CurItem.VarType == GuiLib_VAR_STRING)
jmitc91516 0:a5c253316af6 4892 {
jmitc91516 0:a5c253316af6 4893 CharPtr = (GuiConst_TEXT PrefixLocate *)sgl.CurItem.VarPtr;
jmitc91516 0:a5c253316af6 4894 #ifdef GuiConst_CHARMODE_ANSI
jmitc91516 0:a5c253316af6 4895 StrLen = strlen(CharPtr);
jmitc91516 0:a5c253316af6 4896 #else
jmitc91516 0:a5c253316af6 4897 #ifdef GuiConst_CODEVISION_COMPILER
jmitc91516 0:a5c253316af6 4898 StrLen = GuiLib_UnicodeStrLen((GuiConst_TEXT*)CharPtr);
jmitc91516 0:a5c253316af6 4899 #else
jmitc91516 0:a5c253316af6 4900 StrLen = GuiLib_UnicodeStrLen(CharPtr);
jmitc91516 0:a5c253316af6 4901 #endif
jmitc91516 0:a5c253316af6 4902 #endif
jmitc91516 0:a5c253316af6 4903 }
jmitc91516 0:a5c253316af6 4904 else
jmitc91516 0:a5c253316af6 4905 {
jmitc91516 0:a5c253316af6 4906 VarValue = ReadVar(sgl.CurItem.VarPtr, sgl.CurItem.VarType);
jmitc91516 0:a5c253316af6 4907 StrLen = DataNumStr(VarValue, sgl.CurItem.VarType, 0);
jmitc91516 0:a5c253316af6 4908 #ifdef GuiConst_CHARMODE_ANSI
jmitc91516 0:a5c253316af6 4909 CharPtr = (GuiConst_TEXT PrefixGeneric *) sgl.VarNumTextStr;
jmitc91516 0:a5c253316af6 4910 #else
jmitc91516 0:a5c253316af6 4911 for (P = 0; P <= StrLen; P++)
jmitc91516 0:a5c253316af6 4912 sgl.VarNumUnicodeTextStr[P] = sgl.VarNumTextStr[P];
jmitc91516 0:a5c253316af6 4913 CharPtr = (GuiConst_TEXT PrefixGeneric *) sgl.VarNumUnicodeTextStr;
jmitc91516 0:a5c253316af6 4914 #endif
jmitc91516 0:a5c253316af6 4915 }
jmitc91516 0:a5c253316af6 4916
jmitc91516 0:a5c253316af6 4917 DrawText(CharPtr,
jmitc91516 0:a5c253316af6 4918 StrLen,
jmitc91516 0:a5c253316af6 4919 0,
jmitc91516 0:a5c253316af6 4920 ForeColor,
jmitc91516 0:a5c253316af6 4921 BackColor,
jmitc91516 0:a5c253316af6 4922 Transparent);
jmitc91516 0:a5c253316af6 4923
jmitc91516 0:a5c253316af6 4924 #ifdef GuiConst_DISP_VAR_NOW
jmitc91516 0:a5c253316af6 4925 displayVarNow = 0;
jmitc91516 0:a5c253316af6 4926 #endif
jmitc91516 0:a5c253316af6 4927 }
jmitc91516 0:a5c253316af6 4928
jmitc91516 0:a5c253316af6 4929 //------------------------------------------------------------------------------
jmitc91516 0:a5c253316af6 4930 void GuiLib_TestPattern(void)
jmitc91516 0:a5c253316af6 4931 {
jmitc91516 0:a5c253316af6 4932 GuiLib_HLine(0, 31, 0, GuiConst_PIXEL_ON);
jmitc91516 0:a5c253316af6 4933 GuiLib_VLine(0, 1, 31, GuiConst_PIXEL_ON);
jmitc91516 0:a5c253316af6 4934 GuiLib_HLine(2, 8, 2, GuiConst_PIXEL_ON);
jmitc91516 0:a5c253316af6 4935 GuiLib_HLine(11, 16, 2, GuiConst_PIXEL_ON);
jmitc91516 0:a5c253316af6 4936 GuiLib_VLine(4, 4, 10, GuiConst_PIXEL_ON);
jmitc91516 0:a5c253316af6 4937 GuiLib_VLine(4, 13, 18, GuiConst_PIXEL_ON);
jmitc91516 0:a5c253316af6 4938 }
jmitc91516 0:a5c253316af6 4939
jmitc91516 0:a5c253316af6 4940 #include "GuiComponents.h"
jmitc91516 0:a5c253316af6 4941
jmitc91516 0:a5c253316af6 4942 #ifdef GuiConst_REMOTE_DATA
jmitc91516 0:a5c253316af6 4943 //------------------------------------------------------------------------------
jmitc91516 0:a5c253316af6 4944 GuiConst_INT8U GuiLib_RemoteCheck(void)
jmitc91516 0:a5c253316af6 4945 {
jmitc91516 0:a5c253316af6 4946 union
jmitc91516 0:a5c253316af6 4947 {
jmitc91516 0:a5c253316af6 4948 GuiConst_INT8U Bytes[4];
jmitc91516 0:a5c253316af6 4949 GuiConst_INT32U IdInFile;
jmitc91516 0:a5c253316af6 4950 } RemoteIdUnion;
jmitc91516 0:a5c253316af6 4951 GuiConst_INT8U ok;
jmitc91516 0:a5c253316af6 4952
jmitc91516 0:a5c253316af6 4953 GuiLib_RemoteDataReadBlock(0, 4, RemoteIdUnion.Bytes);
jmitc91516 0:a5c253316af6 4954 ok = (RemoteIdUnion.IdInFile == GuiConst_REMOTE_ID);
jmitc91516 0:a5c253316af6 4955
jmitc91516 0:a5c253316af6 4956 #ifdef GuiConst_REMOTE_TEXT_DATA
jmitc91516 0:a5c253316af6 4957 GuiLib_RemoteTextReadBlock(0, 4, RemoteIdUnion.Bytes);
jmitc91516 0:a5c253316af6 4958 ok = ok && (RemoteIdUnion.IdInFile == GuiConst_REMOTE_ID);
jmitc91516 0:a5c253316af6 4959 #endif
jmitc91516 0:a5c253316af6 4960
jmitc91516 0:a5c253316af6 4961 return (ok);
jmitc91516 0:a5c253316af6 4962 }
jmitc91516 0:a5c253316af6 4963 #endif
jmitc91516 0:a5c253316af6 4964
jmitc91516 0:a5c253316af6 4965