Mercurial > public > ostc4
diff Discovery/Src/tMenuEdit.c @ 110:cc8e24374b83 FlipDisplay
Added option to handled mirrored display to existing functions
author | Ideenmodellierer |
---|---|
date | Tue, 01 Jan 2019 21:02:17 +0100 |
parents | 5f11787b4f42 |
children | e6b190f5fbc7 |
line wrap: on
line diff
--- a/Discovery/Src/tMenuEdit.c Tue Jan 01 21:00:55 2019 +0100 +++ b/Discovery/Src/tMenuEdit.c Tue Jan 01 21:02:17 2019 +0100 @@ -186,7 +186,14 @@ uint8_t line = 1; // GFX_SetFramesTopBottom(tMEscreen.FBStartAdress, (tMEcursorNew.FBStartAdress) + 65*2*(line - 1),390); GFX_SetFrameTop(tMEscreen.FBStartAdress); - GFX_SetFrameBottom((tMEcursorNew.FBStartAdress) + 65*2*(line - 1), 0, 25, 800, 390); + if(!settingsGetPointer()->FlipDisplay) + { + GFX_SetFrameBottom((tMEcursorNew.FBStartAdress) + 65*2*(line - 1), 0, 25, 800, 390); + } + else + { + GFX_SetFrameBottom((tMEcursorNew.FBStartAdress)+ (390 - 65 *(line)) *2, 0, 480-390-25, 800, 390); + } } @@ -1592,15 +1599,29 @@ int16_t y0; uint8_t lineMinusOne; - y0 = (int16_t)ident[forThisIdentID].coord[2]; - + if(!settingsGetPointer()->FlipDisplay) + { + y0 = (int16_t)ident[forThisIdentID].coord[2]; + } + else + { + y0 = 390 - (int16_t)ident[forThisIdentID].coord[2]; + } y0 -= ME_Y_LINE1; y0 /= ME_Y_LINE_STEP; if((y0 >= 0) && (y0 <=5)) lineMinusOne = y0; else lineMinusOne = 0; - GFX_SetFrameBottom((tMEcursorNew.FBStartAdress) + 65*2*(lineMinusOne), 0, 25, 800, 390); + + if(!settingsGetPointer()->FlipDisplay) + { + GFX_SetFrameBottom((tMEcursorNew.FBStartAdress) + 65*2*(lineMinusOne), 0, 25, 800, 390); + } + else + { + GFX_SetFrameBottom((tMEcursorNew.FBStartAdress)+ (390 - 65 *(5-lineMinusOne-1)) *2, 0, 480-390-25, 800, 390); + } } @@ -1615,16 +1636,34 @@ hgfx.WindowTab = 0; hgfx.WindowX0 = 20; hgfx.WindowX1 = 779; - hgfx.WindowY1 = 479; - hgfx.WindowY0 = hgfx.WindowY1 - Font->height; - + if(!settingsGetPointer()->FlipDisplay) + { + hgfx.WindowY1 = 479; + hgfx.WindowY0 = hgfx.WindowY1 - Font->height; + } + else + { + hgfx.WindowY0 = 0; + hgfx.WindowY1 = hgfx.WindowY0 + Font->height; + } GFX_write_label(Font, &hgfx, text, menuColor); } void write_buttonTextline( uint8_t left2ByteCode, char middle2ByteCode, char right2ByteCode) { - GFX_clean_area(&tMEscreen, 0, 800, 480-24,480); + + SSettings* pSettings; + pSettings = settingsGetPointer(); + + if(!pSettings->FlipDisplay) + { + GFX_clean_area(&tMEscreen, 0, 800, 480-24,480); + } + else + { + GFX_clean_area(&tMEscreen, 0, 800, 0, 24); + } char localtext[32]; @@ -1633,7 +1672,14 @@ localtext[0] = TXT_2BYTE; localtext[1] = left2ByteCode; localtext[2] = 0; - write_content_simple(&tMEscreen, 0, 800, 480-24, &FontT24,localtext,CLUT_ButtonSurfaceScreen); + if(!pSettings->FlipDisplay) + { + write_content_simple(&tMEscreen, 0, 800, 480-24, &FontT24,localtext,CLUT_ButtonSurfaceScreen); + } + else + { + write_content_simple(&tMEscreen, 0, 800, 0, &FontT24,localtext,CLUT_ButtonSurfaceScreen); + } } if(middle2ByteCode) @@ -1642,7 +1688,14 @@ localtext[1] = TXT_2BYTE; localtext[2] = middle2ByteCode; localtext[3] = 0; - write_content_simple(&tMEscreen, 0, 800, 480-24, &FontT24,localtext,CLUT_ButtonSurfaceScreen); + if(!pSettings->FlipDisplay) + { + write_content_simple(&tMEscreen, 0, 800, 480-24, &FontT24,localtext,CLUT_ButtonSurfaceScreen); + } + else + { + write_content_simple(&tMEscreen, 0, 800, 0, &FontT24,localtext,CLUT_ButtonSurfaceScreen); + } } if(right2ByteCode) @@ -1651,7 +1704,14 @@ localtext[1] = TXT_2BYTE; localtext[2] = right2ByteCode; localtext[3] = 0; - write_content_simple(&tMEscreen, 0, 800, 480-24, &FontT24,localtext,CLUT_ButtonSurfaceScreen); + if(!pSettings->FlipDisplay) + { + write_content_simple(&tMEscreen, 0, 800, 480-24, &FontT24,localtext,CLUT_ButtonSurfaceScreen); + } + else + { + write_content_simple(&tMEscreen, 0, 800, 0, &FontT24,localtext,CLUT_ButtonSurfaceScreen); + } } } @@ -1671,14 +1731,26 @@ hgfx.WindowNumberOfTextLines = 1; hgfx.WindowLineSpacing = 0; hgfx.WindowTab = 0; - hgfx.WindowX0 = XleftGimpStyle; - hgfx.WindowX1 = XrightGimpStyle; - hgfx.WindowY1 = 479 - YtopGimpStyle; - if(hgfx.WindowY1 < Font->height) - hgfx.WindowY0 = 0; + if(!settingsGetPointer()->FlipDisplay) + { + hgfx.WindowX0 = XleftGimpStyle; + hgfx.WindowX1 = XrightGimpStyle; + hgfx.WindowY1 = 479 - YtopGimpStyle; + if(hgfx.WindowY1 < Font->height) + hgfx.WindowY0 = 0; + else + hgfx.WindowY0 = hgfx.WindowY1 - Font->height; + } else - hgfx.WindowY0 = hgfx.WindowY1 - Font->height; - + { + hgfx.WindowX0 = 800 - XrightGimpStyle; + hgfx.WindowX1 = 800 - XleftGimpStyle; + hgfx.WindowY0 = YtopGimpStyle; + if(hgfx.WindowY0 < Font->height) + hgfx.WindowY1 = 0; + else + hgfx.WindowY1 = hgfx.WindowY0 + Font->height; + } GFX_write_label(Font, &hgfx, text, 0);/*menuColor);*/ } @@ -1697,14 +1769,27 @@ hgfx.WindowNumberOfTextLines = 1; hgfx.WindowLineSpacing = 0; hgfx.WindowTab = 0; - hgfx.WindowX0 = XleftGimpStyle; - hgfx.WindowX1 = XrightGimpStyle; - hgfx.WindowY1 = 479 - YtopGimpStyle; - if(hgfx.WindowY1 < Font->height) - hgfx.WindowY0 = 0; + + if(!settingsGetPointer()->FlipDisplay) + { + hgfx.WindowX0 = XleftGimpStyle; + hgfx.WindowX1 = XrightGimpStyle; + hgfx.WindowY1 = 479 - YtopGimpStyle; + if(hgfx.WindowY1 < Font->height) + hgfx.WindowY0 = 0; + else + hgfx.WindowY0 = hgfx.WindowY1 - Font->height; + } else - hgfx.WindowY0 = hgfx.WindowY1 - Font->height; - + { + hgfx.WindowX0 = 800 - XrightGimpStyle; + hgfx.WindowX1 = 800 - XleftGimpStyle; + hgfx.WindowY0 = YtopGimpStyle; + if(hgfx.WindowY0 < Font->height) + hgfx.WindowY1 = 0; + else + hgfx.WindowY1 = hgfx.WindowY0 + Font->height; + } GFX_write_label(Font, &hgfx, text, color); } @@ -1731,6 +1816,8 @@ if(YtopGimpStyle > 479) YtopGimpStyle = 479; hgfx.Image = &tMEscreen; + if(!settingsGetPointer()->FlipDisplay) + { hgfx.WindowX0 = XleftGimpStyle; hgfx.WindowX1 = XrightGimpStyle; hgfx.WindowY1 = 479 - YtopGimpStyle; @@ -1738,7 +1825,17 @@ hgfx.WindowY0 = 0; else hgfx.WindowY0 = hgfx.WindowY1 - Font->height; - + } + else + { + hgfx.WindowX0 = 800 - XrightGimpStyle; + hgfx.WindowX1 = 800 - XleftGimpStyle; + hgfx.WindowY0 = YtopGimpStyle; + if(hgfx.WindowY0 < Font->height) + hgfx.WindowY1 = 0; + else + hgfx.WindowY1 = hgfx.WindowY0 + Font->height; + } GFX_clear_window_immediately(&hgfx); }