eGUI alias D4D  Release 3.0
Reference Manual
 All Data Structures Files Functions Variables Typedefs Enumerations Enumerator Macros Groups Pages
d4d_string.c
Go to the documentation of this file.
1 /**************************************************************************
2 *
3 * Copyright 2014 by Petr Gargulak. eGUI Community.
4 * Copyright 2009-2013 by Petr Gargulak. Freescale Semiconductor, Inc.
5 *
6 ***************************************************************************
7 * This program is free software: you can redistribute it and/or modify
8 * it under the terms of the GNU Lesser General Public License Version 3
9 * or later (the "LGPL").
10 *
11 * As a special exception, the copyright holders of the eGUI project give you
12 * permission to link the eGUI sources with independent modules to produce an
13 * executable, regardless of the license terms of these independent modules,
14 * and to copy and distribute the resulting executable under terms of your
15 * choice, provided that you also meet, for each linked independent module,
16 * the terms and conditions of the license of that module.
17 * An independent module is a module which is not derived from or based
18 * on this library.
19 * If you modify the eGUI sources, you may extend this exception
20 * to your version of the eGUI sources, but you are not obligated
21 * to do so. If you do not wish to do so, delete this
22 * exception statement from your version.
23 *
24 * This program is distributed in the hope that it will be useful,
25 * but WITHOUT ANY WARRANTY; without even the implied warranty of
26 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
27 *
28 * You should have received a copy of the GNU General Public License
29 * and the GNU Lesser General Public License along with this program.
30 * If not, see <http://www.gnu.org/licenses/>.
31 *
32 ***************************************************************************/
46 #include "d4d.h"
49 
50 #if D4D_STRINGTABLE_PREFIX
51 
52 // Current used language
53 static D4D_INDEX d4d_strTableIndex = 0;
54 
55 static int D4D_StringToInt(const D4D_TCHAR* pText);
56 
57 #endif
58 
59 /******************************************************************************
60 * Begin of D4D_STRING public functions
61 */
65 #if D4D_STRINGTABLE_PREFIX
66 
67 /**************************************************************************/
73 void D4D_ChangeStringTable(LWord stringId)
74 {
75  LWord i = 0;
76 
77  while(d4d_StringTable[i].stringTable != NULL)
78  {
79  if(d4d_StringTable[i].stringId == stringId)
80  {
81  d4d_strTableIndex = i;
83  return;
84  }
85  i++;
86  }
87 }
88 
89 /**************************************************************************/
96 {
97  return d4d_StringTable[d4d_strTableIndex].stringId;
98 }
99 #endif
100 
101 /**************************************************************************/
109 {
110 #if D4D_STRINGTABLE_PREFIX
111  int tableIx;
112 #endif
113  if(originTxt == NULL)
114  return NULL;
115 
116 #if D4D_STRINGTABLE_PREFIX
117  if(*originTxt == D4D_STRINGTABLE_PREFIX)
118  {
119  if((tableIx = D4D_StringToInt(&originTxt[1])) < 0)
120  return NULL;
121 
122  if(tableIx > d4d_StringTable[d4d_strTableIndex].stringCount)
123  return NULL;
124 
125  return d4d_StringTable[d4d_strTableIndex].stringTable[tableIx];
126  }
127 #endif
128 
129  return (D4D_TCHAR*)originTxt;
130 }
131 
132 /**************************************************************************/
141 {
142  LWord value;
143  LWord divider;
144  Byte cnt = 1;
145  Byte fill_cnt = 0;
146  Byte tmp_cnt;
147  value = val;
148  divider = 1000000000;
149 
150  for(tmp_cnt = 0; tmp_cnt < 9; tmp_cnt++)
151  {
152  if((value > divider - 1) || (cnt > 1))
153  {
154  if(pText != NULL)
155  *pText++ = (D4D_TCHAR)((value/divider)+'0');
156  cnt++;
157  } else if((pText != NULL) && (fill))
158  {
159  fill_cnt++;
160  *pText++ = fill;
161  }
162 
163  value %= divider;
164  divider /= 10;
165  }
166 
167  if(pText != NULL)
168  *pText++ = (D4D_TCHAR)((value)+'0');
169 
170  return (Byte)(cnt + fill_cnt);
171 }
172 
173 /**************************************************************************/
182 {
183  Byte cnt = 0;
184  if(val < 0)
185  {
186  *pText++ = '-';
187  cnt++;
188  val *= -1;
189  }
190  return (Byte)(cnt + D4D_SprintDecU32((LWord)val, pText, fill));
191 }
192 
193 /**************************************************************************/
202 {
203  Word value;
204  Word divider;
205  Byte cnt = 1;
206  Byte fill_cnt = 0;
207  Byte tmp_cnt;
208  value = val;
209  divider = 10000;
210 
211  for(tmp_cnt = 0; tmp_cnt < 4; tmp_cnt++)
212  {
213  if((value > divider - 1) || (cnt > 1))
214  {
215  if(pText != NULL)
216  *pText++ = (D4D_TCHAR)((value/divider)+'0');
217  cnt++;
218  }else if((pText != NULL) && (fill))
219  {
220  fill_cnt++;
221  *pText++ = fill;
222  }
223 
224  value %= divider;
225  divider /= 10;
226  }
227 
228  if(pText != NULL)
229  *pText++ = (D4D_TCHAR)((value)+'0');
230 
231  return (Byte)(cnt + fill_cnt);
232 }
233 
234 /**************************************************************************/
243 {
244  Byte cnt = 0;
245  if(val < 0)
246  {
247  *pText++ = '-';
248  cnt++;
249  val *= -1;
250  }
251  return (Byte)(cnt + D4D_SprintDecU16((Word)val, pText, fill));
252 }
253 
254 /**************************************************************************/
263 {
264  Byte value;
265  Byte cnt = 1;
266  Byte fill_cnt = 0;
267  value = val;
268 
269  if(value > 99)
270  {
271  cnt++;
272  if(pText != NULL)
273  *pText++ = (D4D_TCHAR)((value/100)+'0');
274  value %= 100;
275 
276  }else if((pText != NULL) && (fill))
277  {
278  fill_cnt++;
279  *pText++ = fill;
280  }
281 
282  if((value > 9) || (cnt > 1))
283  {
284  cnt++;
285  if(pText != NULL)
286  *pText++ = (D4D_TCHAR)((value/10)+'0');
287  value %= 10;
288 
289  }else if((pText != NULL) && (fill))
290  {
291  fill_cnt++;
292  *pText++ = fill;
293  }
294 
295 
296 
297  if(pText != NULL)
298  *pText++ = (D4D_TCHAR)((value)+'0');
299 
300  return (Byte)(cnt + fill_cnt);
301 }
302 
303 /**************************************************************************/
312 {
313  Byte cnt = 0;
314  if(val < 0)
315  {
316  *pText++ = '-';
317  cnt++;
318  val *= -1;
319  }
320  return (Byte)(cnt + D4D_SprintDecU8((Byte)val, pText, fill));
321 }
322 
323 /**************************************************************************/
330 {
331  D4D_INDEX cnt = 0;
332  D4D_TCHAR* pTextInt;
333  if(pText == NULL)
334  return 0;
335 
336  pTextInt = D4D_GetInternalStringPointer(pText);
337 
338 #if D4D_EXTSRC_TEXT_ENABLE != D4D_FALSE
339  if(pTextInt == NULL)
341  else
342 #endif
343  {
344  while (*pTextInt++)
345  cnt++;
346  }
347  return cnt;
348 }
349 
350 /**************************************************************************/
358 
359  D4D_COOR width = 0;
360  D4D_TCHAR* pTextInt;
361 
362  if(pText == NULL)
363  return 0;
364 
365  pTextInt = D4D_GetInternalStringPointer(pText);
366 
367 #if D4D_EXTSRC_TEXT_ENABLE != D4D_FALSE
368 
369  if(pTextInt == NULL)
370  {
371  D4D_INDEX charCnt = 0;
372  D4D_INDEX charOff = 0;
373  D4D_INDEX charCntTmp;
374 
375  do
376  {
377  charOff += charCnt;
378 
380 
381  for(charCntTmp = 0; charCntTmp < charCnt; charCntTmp++)
382  width += D4D_GetCharWidth(ix, ((D4D_TCHAR*)d4d_extsrcBuffer)[charCntTmp]);
383 
384  }while(charCnt == D4D_EXTSRC_BUFF_SIZE);
385 
386 
387  }else
388 #endif
389  {
390  while(*(pTextInt) != 0)
391  width += D4D_GetCharWidth(ix, *pTextInt++);
392  }
393  return width;
394 }
395 
396 /**************************************************************************/
404 
405  D4D_COOR width = 0;
406  D4D_COOR tab;
407  D4D_INDEX char_ix = 0;
408  D4D_TCHAR* pText = text_buffer->pText;
409  D4D_TCHAR* pTextInt;
410 
411  if(pText == NULL)
412  return 0;
413 
414  pTextInt = D4D_GetInternalStringPointer(pText);
415 
416 #if D4D_EXTSRC_TEXT_ENABLE != D4D_FALSE
417 
418  if(pTextInt == NULL)
419  {
420  D4D_INDEX charCnt = 0;
421  D4D_INDEX charOff = text_buffer->printOff;
422  D4D_INDEX charCntTmp;
423 
424  do
425  {
426  charOff += charCnt;
427 
429 
430  for(charCntTmp = 0; charCntTmp < charCnt; charCntTmp++)
431  {
432  if(++char_ix > text_buffer->printLen)
433  return width;
434 
435  if(((D4D_TCHAR*)d4d_extsrcBuffer)[charCntTmp] == '\t')
436  {
437  tab = D4D_GetNextTab(pTab, width);
438 
439  if(tab)
440  {
441  width = (D4D_COOR)(tab - (pTab->tabOffset));
442  continue;
443  }
444  }
445 
446  width += D4D_GetCharWidth(text_buffer->fontId, ((D4D_TCHAR*)d4d_extsrcBuffer)[charCntTmp]);
447  }
448  }while(charCnt == D4D_EXTSRC_BUFF_SIZE);
449 
450 
451  }else
452 
453 #endif
454 
455  {
456  pTextInt += text_buffer->printOff;
457 
458  while(*pTextInt != 0)
459  {
460 
461  if(++char_ix > text_buffer->printLen)
462  break;
463 
464  if(*pTextInt == '\t')
465  {
466  tab = D4D_GetNextTab(pTab, width);
467 
468  if(tab)
469  {
470  width = (D4D_COOR)(tab - (pTab->tabOffset));
471  pTextInt++;
472  continue;
473  }
474  }
475 
476  width += D4D_GetCharWidth(text_buffer->fontId, *pTextInt);
477  pTextInt++;
478  }
479  }
480 
481 
482  return width;
483 }
484 
485 /**************************************************************************/
493 {
494  D4D_TCHAR* pText;
495  D4D_COOR width;
496  D4D_INDEX cnt = 0;
497  D4D_TCHAR* pTextInt;
498 
499  if(pString == NULL)
500  return 0;
501 
502  pText = pString->pText;
503 
504  if(pText == NULL)
505  return 0;
506 
507  pTextInt = D4D_GetInternalStringPointer(pText);
508 
509 #if D4D_EXTSRC_TEXT_ENABLE != D4D_FALSE
510  if(pTextInt == NULL)
511  {
512  D4D_INDEX charCnt = 0;
513  D4D_INDEX charOff = pString->printOff;
514  D4D_INDEX charCntTmp;
515 
516  do
517  {
518  charOff += charCnt;
519 
521 
522  for(charCntTmp = 0; charCntTmp < charCnt; charCntTmp++)
523  {
524  if(((D4D_TCHAR*)d4d_extsrcBuffer)[charCntTmp] == 0)
525  return cnt;
526 
527  if(cnt >= pString->printLen)
528  return cnt;
529 
530  width = D4D_GetCharWidth(pString->fontId, *pText);
531 
532  if(width > maxWidth)
533  return cnt;
534 
535  maxWidth -= width;
536  cnt++;
537  }
538  }while(charCnt == D4D_EXTSRC_BUFF_SIZE);
539 
540 
541  }
542  else
543 #endif
544  {
545  pTextInt += pString->printOff;
546 
547  while(*pTextInt != 0)
548  {
549  if(cnt >= pString->printLen)
550  break;
551 
552  width = D4D_GetCharWidth(pString->fontId, *pTextInt);
553 
554  if(width > maxWidth)
555  break;
556 
557  maxWidth -= width;
558  pTextInt++;
559  cnt++;
560  }
561  }
562 
563  return cnt;
564 }
565 
566 /**************************************************************************/
573 void D4D_SetText(D4D_OBJECT_PTR pObject, D4D_TCHAR* pText)
574 {
575  D4D_STRING* p_TextBuff = NULL;
576 
577  if(pObject->pObjFunc->GetTextBuffer)
578  p_TextBuff = pObject->pObjFunc->GetTextBuffer((D4D_OBJECT*)pObject);
579 
580  if(p_TextBuff)
581  {
582  D4D_ChangeText(p_TextBuff, pText, 0);
584  }
585 
586 }
587 
588 /******************************************************************************
589 * End of public functions */
591 /******************************************************************************/
592 
593 /**************************************************************/
599 void D4D_ChangeText(D4D_STRING* pBuff, D4D_TCHAR* pNewText, D4D_TCHAR fillChar)
600 {
601  D4D_INDEX n = pBuff->buffSize;
602  D4D_TCHAR* pDest = pBuff->pText;
603 
604  // preserve one byte in the buffer
605  if(pDest != pNewText)
606  while(n > 1 && *pNewText)
607  {
608  *pDest = *pNewText;
609  pNewText++;
610  pDest++;
611  n--;
612  } else
613  {
614  D4D_INDEX i;
615  i = D4D_GetTextLength(pDest);
616  n -= i;
617  pDest += i;
618  }
619 
620  while(n > 1 && fillChar)
621  {
622  *(pDest++) = fillChar;
623  n--;
624  }
625 
626  // terminate string always
627  *pDest = 0;
628 }
629 
630 /**************************************************************/
636 {
637  D4D_INDEX str_len, ch_ix;
638 
639  D4D_COOR orig_x = p_StrDes->x;
640  D4D_COOR base_y, base_x;
641  D4D_FONT_TYPE* pFontType = (D4D_FONT_TYPE*)p_StrDes->pFontType;
642  D4D_FONT_DESCRIPTOR* pFontDescriptor = (D4D_FONT_DESCRIPTOR*)(pFontType->pFontDescriptor);
643  const D4D_TCHAR pLongTextEnd[] = D4D_DEFSTR("...");
644  D4D_BOOL longText = D4D_FALSE;
645  D4D_COOR tmp_MaxLen = p_StrDes->maxWidth;
646  D4D_COOR longTextLen;
647  D4D_TCHAR* pTextInt;
648  // check if fontdescriptor exist and check the font scale value
649  if((pFontDescriptor == NULL) || (pFontType->scale.width == 0) || (pFontType->scale.height == 0))
650  return;
651 
652  // long strings restriction
653  if(tmp_MaxLen)
654  {
655  // check if the text fits into enabled width
656  D4D_STRING tmpString;
657  D4D_COOR tmp_txtLen;
658 
659  tmpString.pText = p_StrDes->pText;
660  tmpString.buffSize = 0;
661  tmpString.fontId = p_StrDes->pFontType->ix_font;
662  tmpString.printLen = p_StrDes->textLength;
663  tmpString.printOff = p_StrDes->textOffset;
664  tmp_txtLen = D4D_GetTextBuffWidthTab(&tmpString, p_StrDes->pTab);
665 
666  if(p_StrDes->pTab)
667  {
668  if(tmp_txtLen > p_StrDes->pTab->tabOffset)
669  tmp_txtLen -= p_StrDes->pTab->tabOffset;
670  else
671  return;
672  }
673 
674  longTextLen = D4D_GetTextWidth(tmpString.fontId, (D4D_TCHAR*)pLongTextEnd);
675 
676  if(tmp_txtLen > p_StrDes->maxWidth)
677  {
678  if(tmp_txtLen < longTextLen)
679  return;
680 
681  tmp_MaxLen -= longTextLen;
682  longText = D4D_TRUE;
683  }
684  }
685 
686  pTextInt = D4D_GetInternalStringPointer(p_StrDes->pText);
687 
688 #if D4D_EXTSRC_TEXT_ENABLE != D4D_FALSE
689 
690  if(pTextInt == NULL)
691  {
692  D4D_INDEX charCnt = 0;
693  D4D_INDEX charOff = p_StrDes->textOffset;
694  D4D_INDEX charCntTmp;
695 
696  do
697  {
698  charOff += charCnt;
699 
701 
702  // get the lenght of string
703  str_len = charCnt;
704 
705  if(p_StrDes->textLength)
706  if(str_len > p_StrDes->textLength)
707  str_len = p_StrDes->textLength;
708 
709  str_len += (charOff - 1);
710 
711  for(charCntTmp = 0; charCntTmp < charCnt; charCntTmp++)
712  {
713  if((!((D4D_TCHAR*)d4d_extsrcBuffer)[charCntTmp]) || (str_len < (charCntTmp + charOff)))
714  {
715  charCnt = 0;
716  break;
717  }
718  if(longText)
719  {
720  D4D_COOR tmp_Len;
721  tmp_Len = D4D_GetCharWidth(p_StrDes->pFontType->ix_font, ((D4D_TCHAR*)d4d_extsrcBuffer)[charCntTmp]);
722 
723  if(tmp_MaxLen - tmp_Len <= 0)
724  {
725  charCnt = 0;
726  break;
727  }
728  tmp_MaxLen -= tmp_Len;
729  }
730 
731  p_StrDes->x += D4D_LCD_PrintChr(((D4D_TCHAR*)d4d_extsrcBuffer)[charCntTmp], p_StrDes); // print the char and automatically update the coordintaion of next char
732  }
733  }while(charCnt == D4D_EXTSRC_BUFF_SIZE);
734 
735 
736  }else
737 #endif
738  {
739  pTextInt = &pTextInt[p_StrDes->textOffset];
740 
741  // get the lenght of string
742  str_len = D4D_GetTextLength(pTextInt);
743 
744  if(p_StrDes->textLength)
745  if(str_len > p_StrDes->textLength)
746  str_len = p_StrDes->textLength;
747 
748  // Draw the text
749  for (ch_ix=0; ch_ix<str_len; ++ch_ix) // For each character in the string
750  {
751  if(longText)
752  {
753  D4D_COOR tmp_Len;
754  tmp_Len = D4D_GetCharWidth(p_StrDes->pFontType->ix_font, *pTextInt);
755 
756  if(tmp_MaxLen - tmp_Len <= 0)
757  {
758  break;
759  }
760  tmp_MaxLen -= tmp_Len;
761  }
762 
763  p_StrDes->x += D4D_LCD_PrintChr(*pTextInt++, p_StrDes); // print the char and automatically update the coordintaion of next char
764  }
765  }
766 
767 
768 
769  if(longText)
770  {
771  ch_ix=0;
772  while(pLongTextEnd[ch_ix])
773  p_StrDes->x += D4D_LCD_PrintChr(pLongTextEnd[ch_ix++], p_StrDes); // print the char and automatically update the coordintaion of next char
774 
775  if(!(p_StrDes->properties & D4D_FNT_PRTY_TRANSPARENT_MASK))
776  D4D_FillRectXY(p_StrDes->x, p_StrDes->y, (D4D_COOR)(orig_x + p_StrDes->maxWidth - 1), (D4D_COOR)(p_StrDes->y + D4D_GetFontHeight(p_StrDes->pFontType->ix_font) - 1), p_StrDes->colorBack);
777 
778 
779  }
780 
781  // Draw the Underline option
782  switch(p_StrDes->properties & D4D_FNT_PRTY_UNDERLINE_MASK)
783  {
784  case D4D_FNT_PRTY_UNDERLINE_LINE_MASK: // Draw the full line
785  base_y = (D4D_COOR)(p_StrDes->y + pFontDescriptor->charBaseLine * pFontType->scale.height);
786  base_x = p_StrDes->x;
787  D4D_FillRectXY(orig_x, base_y, (D4D_COOR)(base_x - 1), (D4D_COOR)(base_y + pFontType->scale.height - 1), p_StrDes->colorText);
788  break;
789 
790  case D4D_FNT_PRTY_UNDERLINE_DOT_MASK: // Draw the dot line
791  base_y = (D4D_COOR)(p_StrDes->y + pFontDescriptor->charBaseLine * pFontType->scale.height);
792 
793  ch_ix = 0;
794  for(base_x = orig_x; base_x < p_StrDes->x; base_x += pFontType->scale.height)
795  {
796  if(++ch_ix % 2)
797  D4D_FillRectXY(base_x, base_y, (D4D_COOR)(base_x + pFontType->scale.width - 1), (D4D_COOR)(base_y + pFontType->scale.height - 1), p_StrDes->colorText);
798  }
799  break;
800  default:
801  break;
802  }
803 
804  // Draw the Strike Through option
806  {
808 
809  base_y = (D4D_COOR)(p_StrDes->y + (pFontDescriptor->charBaseLine - (pFontDescriptor->charSize / 3)) * pFontType->scale.height);
810  base_x = p_StrDes->x;
811  // Draw Strike Through line as many as specified by parameter
812  while(line_cnt)
813  {
814  D4D_FillRectXY(orig_x, base_y, (D4D_COOR)(base_x - 1), (D4D_COOR)(base_y - 1), p_StrDes->colorText);
815  base_y -=2;
816  line_cnt--;
817  }
818 
819  }
820 #if D4D_LLD_FLUSH_ELEMENT != D4D_FALSE
822 #endif
823 
824 }
825 
826 #if D4D_STRINGTABLE_PREFIX
827  /*-----------------------------------------------------------------------------
828  * FUNCTION: Strings_ChangeLanguage
829  * SCOPE: language strings related function
830  * DESCRIPTION: Function changes the current language
831  *
832  * PARAMETERS: ix - index of language
833  *
834  * RETURNS: none
835  *-----------------------------------------------------------------------------*/
836  static int D4D_StringToInt(const D4D_TCHAR* pText)
837  {
838  int res = 0;
839  int tens = 1;
840  // simple implementation of string to integer
841  // just for example of external strings
842 
843  int i = D4D_GetTextLength((D4D_TCHAR*)pText);
844 
845  if(i > D4D_STR_TABLE_MAX_CNT)
846  return -1;
847 
848  if(i == 0)
849  return -1;
850 
851  // check if the chars a really numbers
852  while(i--)
853  {
854  if(!D4D_IsDigit(pText[i]))
855  return -1;
856 
857  res += (pText[i] - '0') * tens;
858  tens *= 10;
859  }
860 
861  return res;
862  }
863 #endif
D4D_INDEX buffSize
size of text buffer array
Definition: d4d_string.h:103
D4D_WCHAR D4D_TCHAR
Type definition of eGUI character (it depends on UNICODE setting if this is D4D_CHAR or D4D_WCHAR)...
Definition: d4d_types.h:284
Byte D4D_FONT
Definition: d4d_font.h:171
D4D_FONT_TYPE * pFontType
Definition: d4d_font.h:220
D4D_OBJECT_SYS_FUNCTION * pObjFunc
The pointer on object system functions.
Definition: d4d_object.h:174
D4D_FONT_SIZE height
Definition: d4d_font.h:183
void D4D_InvalidateScreen(const D4D_SCREEN *pScreen, D4D_BOOL bComplete)
The function mark the screen and its abject as &quot;redraw pending&quot;.
Definition: d4d_screen.c:238
D4DLOCALE_GET_TRANSLATE_STR_LEN D4DLOCALE_GetTranslateStrLength
Pointer to Get Translate String Length Function.
Definition: d4d_extsrc.h:191
D4D_INDEX printLen
Length of string that should be used (printed).
Definition: d4d_string.h:106
signed long sLWord
Type definition of sLWord (signed 32-bit).
Definition: d4d_types.h:171
D4D_COOR D4D_LCD_PrintChr(D4D_TCHAR ch, D4D_PRINT_DESC *p_CharDes)
Definition: d4d_font.c:645
void(* D4DLCD_FlushBuffer)(D4DLCD_FLUSH_MODE mode)
The LCD driver flush function.
Definition: d4d_lldapi.h:154
void D4D_FillRectXY(D4D_COOR x1, D4D_COOR y1, D4D_COOR x2, D4D_COOR y2, D4D_COLOR color)
Function draw filled rectangle on the screen.
D4D_INDEX textLength
Definition: d4d_font.h:225
#define D4D_FALSE
This is definition of boolean operation value in eGUI - FALSE.
Definition: d4d_types.h:104
D4D_COOR tabOffset
Start offset of tabulator.
Definition: d4d_types.h:256
The string type. This structure contains all properties about string in eGUI.
Definition: d4d_string.h:100
D4D_COOR maxWidth
Definition: d4d_font.h:227
D4D_TCHAR * D4D_GetInternalStringPointer(const D4D_TCHAR *originTxt)
The function gets the real internal pointer to string.
Definition: d4d_string.c:108
D4D_COLOR colorText
Definition: d4d_font.h:222
D4D_COOR y
Definition: d4d_font.h:218
D4D_FONT_PROPERTIES properties
Definition: d4d_font.h:224
D4D_FONT fontId
index of used font
Definition: d4d_string.h:104
The flush after one basic element is draw.
Definition: d4d_lldapi.h:138
#define D4D_FNT_PRTY_UNDERLINE_MASK
Font Underline property masks.
Definition: d4d_font.h:85
#define D4D_TRUE
This is definition of boolean operation value in eGUI - TRUE.
Definition: d4d_types.h:106
D4D_INDEX D4D_GetTextMaxLength(D4D_STRING *pString, D4D_COOR maxWidth)
The function find out the maximal text length that fits to maximal pixel width.
Definition: d4d_string.c:492
D4D Driver main header file.
#define D4D_FNT_PRTY_UNDERLINE_DOT_MASK
Dot Line Underline Text Property mask.
Definition: d4d_font.h:88
D4D_COOR D4D_GetTextBuffWidthTab(D4D_STRING *text_buffer, D4D_TAB *pTab)
The function returns width of text in pixels, also with tab table.
Definition: d4d_string.c:403
D4D Driver private header file.
Byte D4D_SprintDecU32(LWord val, D4D_TCHAR *pText, D4D_TCHAR fill)
The function convert decimal unsigned 32 bit number to string.
Definition: d4d_string.c:140
D4D_FONT ix_font
Definition: d4d_font.h:209
#define D4D_DEFSTR(str)
Macro that helps declare the strings in eGUI.
Definition: d4d_string.h:246
D4D_INDEX textOffset
Definition: d4d_font.h:226
D4D_TCHAR * pText
Definition: d4d_font.h:219
Byte D4D_COOR
Type definition of eGUI coordination variables.
Definition: d4d_types.h:219
D4D_INDEX stringId
Definition: d4d_string.h:118
#define D4D_STR_TABLE_MAX_CNT
This is maximal count of string table. If not defined, it sets to 4 string tables (languages) as a de...
Definition: d4d_string.h:63
unsigned char Byte
Type definition of Byte (unsigned 8-bit).
Definition: d4d_types.h:151
D4D_TCHAR ** stringTable
Definition: d4d_string.h:119
const D4D_STRING_TABLE d4d_StringTable[]
Byte D4D_SprintDecS8(sByte val, D4D_TCHAR *pText, D4D_TCHAR fill)
The function convert decimal signed 8 bit number to string.
Definition: d4d_string.c:311
D4D_FONT_DESCRIPTOR * pFontDescriptor
Definition: d4d_font.h:210
D4D_INDEX D4D_GetTextLength(D4D_TCHAR *pText)
The function returns lenght of text.
Definition: d4d_string.c:329
#define D4D_FNT_PRTY_UNDERLINE_LINE_MASK
One Line Underline Text Property mask.
Definition: d4d_font.h:87
#define D4D_EXTSRC_BUFF_SIZE
This macro is used to specify size of buffer that is using when external file support is enabled...
Definition: d4d_base.h:167
#define NULL
Type definition of null pointer.
Definition: d4d_types.h:184
D4D_TCHAR * pText
pointer to text array
Definition: d4d_string.h:102
unsigned long LWord
Type definition of LWord (unsigned 32-bit).
Definition: d4d_types.h:167
D4D_COOR x
Definition: d4d_font.h:217
D4D_SCREEN * D4D_GetActiveScreen(void)
Returns pointer to current active screen.
Definition: d4d_screen.c:78
void D4D_ChangeText(D4D_STRING *pBuff, D4D_TCHAR *pNewText, D4D_TCHAR fillChar)
Definition: d4d_string.c:599
signed short sWord
Type definition of sWord (signed 16-bit).
Definition: d4d_types.h:163
#define D4D_FNT_PRTY_TRANSPARENT_MASK
Definition: d4d_font.h:112
D4D_COLOR colorBack
Definition: d4d_font.h:223
LWord D4D_GetCurrentStringId(void)
const D4DLOCALE_FUNCTIONS d4d_extsrcLocale
Type definition of eGUI tabulation structure.
Definition: d4d_types.h:253
LWord D4D_INDEX
Type definition of eGUI general index variables.
Definition: d4d_types.h:206
The object main structure type definition.
Definition: d4d_object.h:167
signed char sByte
Type definition of sByte (signed 8-bit).
Definition: d4d_types.h:155
Byte D4D_SprintDecS32(sLWord val, D4D_TCHAR *pText, D4D_TCHAR fill)
The function convert decimal signed 32 bit number to string.
Definition: d4d_string.c:181
Byte D4D_SprintDecS16(sWord val, D4D_TCHAR *pText, D4D_TCHAR fill)
The function convert decimal signed 16 bit number to string.
Definition: d4d_string.c:242
void D4D_LCD_PrintStr(D4D_PRINT_DESC *p_StrDes)
Definition: d4d_string.c:635
void D4D_ChangeStringTable(LWord stringId)
D4D_FONT_SIZES scale
Definition: d4d_font.h:211
#define D4D_FNT_PRTY_STRIKETHROUGH_SHIFT
Strike through property bits shift.
Definition: d4d_font.h:109
const D4DLCD_FUNCTIONS D4D_LLD_LCD
LWord D4D_BOOL
Type definition of eGUI boolean.
Definition: d4d_types.h:204
Byte D4D_SprintDecU8(Byte val, D4D_TCHAR *pText, D4D_TCHAR fill)
The function convert decimal unsigned 8 bit number to string.
Definition: d4d_string.c:262
#define D4D_IsDigit(x)
Macro that returns if the input cahr is digit or not. Here is an example demonstrating how to used it...
Definition: d4d_string.h:265
struct D4D_STRING_S *(* GetTextBuffer)(struct D4D_OBJECT_S *pObj)
Object get text buffer function pointer (the function returns the pointer of the object text buffer...
Definition: d4d_object.h:139
D4D_COOR D4D_GetTextWidth(D4D_FONT ix, D4D_TCHAR *pText)
The function returns width of text in pixels.
Definition: d4d_string.c:357
D4D_FONT_SIZE D4D_GetCharWidth(D4D_FONT ix, D4D_TCHAR ch)
Definition: d4d_font.c:415
D4D_FONT_SIZE width
Definition: d4d_font.h:182
D4D_TAB * pTab
Definition: d4d_font.h:221
#define D4D_STRINGTABLE_PREFIX
Definition: d4d_types.h:88
Byte d4d_extsrcBuffer[D4D_EXTSRC_BUFF_SIZE]
void D4D_InvalidateObject(D4D_OBJECT_PTR pObject, D4D_BOOL bComplete)
Function invalidate object to redraw on screen.
Definition: d4d_object.c:71
#define D4D_FNT_PRTY_STRIKETHROUGH_MASK
Font Strike through property masks.
Definition: d4d_font.h:103
D4D driver - resistive touch screen driver function header file.
D4D_COOR D4D_GetNextTab(D4D_TAB *pTab, D4D_COOR pos)
Definition: d4d_font.c:618
Byte D4D_SprintDecU16(Word val, D4D_TCHAR *pText, D4D_TCHAR fill)
The function convert decimal unsigned 16 bit number to string.
Definition: d4d_string.c:201
D4DLOCALE_TRANSLATE_STR D4DLOCALE_TranslateStr
Pointer to Translate String Function.
Definition: d4d_extsrc.h:190
void D4D_SetText(D4D_OBJECT_PTR pObject, D4D_TCHAR *pText)
The function change the text in main object text buffer.
Definition: d4d_string.c:573
D4D_FONT_SIZE D4D_GetFontHeight(D4D_FONT ix)
Definition: d4d_font.c:381
unsigned short Word
Type definition of Word (unsigned 16-bit).
Definition: d4d_types.h:159
D4D_INDEX printOff
Offset of string that should be used (printed).
Definition: d4d_string.h:107