# HG changeset patch # User Ideenmodellierer # Date 1602086830 -7200 # Node ID 0ad0b26ec56bd238336481afb40dada7c428a4e1 # Parent 54c5ec8416c4cdc82033c605172fc2c1f5961f9c Added center / right alignment option to custom text display: Per default custom text was shown left aligned. Using '^' for center and '?' for right alignment the display of the custom text may now be improved. For proper operation the alignment had to be set to common handling mode and the blank characters had to be removed from the transmitted string. To avoid display of special strings (e.g. multilanguage) the write text via com interface will now block special characters diff -r 54c5ec8416c4 -r 0ad0b26ec56b Discovery/Src/gfx_engine.c --- a/Discovery/Src/gfx_engine.c Wed Oct 07 17:15:27 2020 +0200 +++ b/Discovery/Src/gfx_engine.c Wed Oct 07 18:07:10 2020 +0200 @@ -2033,10 +2033,10 @@ if(*pText == '\r') // carriage return, no newline settings.Xdelta = 0; else - if((*pText == '\001') && !minimal) // center + if((*pText == '\001')) // center settings.Xdelta = GFX_write__Modify_Xdelta__Centered(&settings, hgfx, pText+1); else - if((*pText == '\002') && !minimal) // right + if((*pText == '\002')) // right settings.Xdelta = GFX_write__Modify_Xdelta__RightAlign(&settings, hgfx, pText+1); else if((*pText == '\003') && !minimal) // doubleSize @@ -2986,7 +2986,7 @@ pText = (uint32_t)pTextInput; counter = 0; - while((counter < 100) && (*(char*)pText != 0) && (*(char*)pText != '\r')) + while((counter < 100) && (*(char*)pText != 0) && (*(char*)pText != '\r') && (*(char*)pText != '\n')) { if((*(char*)pText) == TXT_2BYTE) { diff -r 54c5ec8416c4 -r 0ad0b26ec56b Discovery/Src/t7.c --- a/Discovery/Src/t7.c Wed Oct 07 17:15:27 2020 +0200 +++ b/Discovery/Src/t7.c Wed Oct 07 18:07:10 2020 +0200 @@ -2762,12 +2762,34 @@ do { nextChar = settingsGetPointer()->customtext[i+j]; - i++; - if((!nextChar) || (nextChar =='\n') || (nextChar =='\r')) - break; - text[textptr++] = nextChar; + if(nextChar == '^') /* center */ + { + text[textptr++] = '\001'; + i++; + }else + if(nextChar == 180) /* '´' => Right */ + { + text[textptr++] = '\002'; + i++; + }else + { + i++; + if((!nextChar) || (nextChar =='\n') || (nextChar =='\r')) + { + break; + } + text[textptr++] = nextChar; + } } while (i < 12); + if(i == 12) /* exit by limit => check for blanks at the end of the string */ + { + while((textptr - 1 > 0) && (text[textptr - 1] == 32)) + { + textptr--; + } + } + if(!nextChar) break; diff -r 54c5ec8416c4 -r 0ad0b26ec56b Discovery/Src/tComm.c --- a/Discovery/Src/tComm.c Wed Oct 07 17:15:27 2020 +0200 +++ b/Discovery/Src/tComm.c Wed Oct 07 18:07:10 2020 +0200 @@ -240,6 +240,8 @@ void tComm_refresh(void) { + char localString[255]; + if(tCscreen.FBStartAdress == 0) { GFX_hwBackgroundOn(); @@ -258,11 +260,13 @@ else if(display_text[255]) { display_text[(uint8_t)display_text[255]] = 0; + localString[0] = TXT_MINIMAL; + strcpy (&localString[1],display_text); releaseFrame(18,tCscreen.FBStartAdress); tCscreen.FBStartAdress = getFrame(18); write_content_simple(&tCscreen, 0, 800, 480-24, &FontT24,"Exit",CLUT_ButtonSurfaceScreen); write_content_simple(&tCscreen, 800 - 70, 800, 480-24, &FontT24,"Signal",CLUT_ButtonSurfaceScreen); - GFX_write_string(&FontT48, &tCwindow, display_text,2); + GFX_write_string(&FontT48, &tCwindow, localString,2); GFX_SetFrameTop(tCscreen.FBStartAdress); display_text[0] = 0; display_text[255] = 0;