comparison 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
comparison
equal deleted inserted replaced
109:65a6e352ce08 110:cc8e24374b83
184 // draw_tMEdesign(); 184 // draw_tMEdesign();
185 // GFX_SetFramesTopBottom(tMEscreen.FBStartAdress, tMEcursor.FBStartAdress,480); 185 // GFX_SetFramesTopBottom(tMEscreen.FBStartAdress, tMEcursor.FBStartAdress,480);
186 uint8_t line = 1; 186 uint8_t line = 1;
187 // GFX_SetFramesTopBottom(tMEscreen.FBStartAdress, (tMEcursorNew.FBStartAdress) + 65*2*(line - 1),390); 187 // GFX_SetFramesTopBottom(tMEscreen.FBStartAdress, (tMEcursorNew.FBStartAdress) + 65*2*(line - 1),390);
188 GFX_SetFrameTop(tMEscreen.FBStartAdress); 188 GFX_SetFrameTop(tMEscreen.FBStartAdress);
189 GFX_SetFrameBottom((tMEcursorNew.FBStartAdress) + 65*2*(line - 1), 0, 25, 800, 390); 189 if(!settingsGetPointer()->FlipDisplay)
190 {
191 GFX_SetFrameBottom((tMEcursorNew.FBStartAdress) + 65*2*(line - 1), 0, 25, 800, 390);
192 }
193 else
194 {
195 GFX_SetFrameBottom((tMEcursorNew.FBStartAdress)+ (390 - 65 *(line)) *2, 0, 480-390-25, 800, 390);
196 }
190 } 197 }
191 198
192 199
193 void tMenuEdit_refresh_live_content(void) 200 void tMenuEdit_refresh_live_content(void)
194 { 201 {
1590 void set_cursorNew(uint8_t forThisIdentID) 1597 void set_cursorNew(uint8_t forThisIdentID)
1591 { 1598 {
1592 int16_t y0; 1599 int16_t y0;
1593 uint8_t lineMinusOne; 1600 uint8_t lineMinusOne;
1594 1601
1595 y0 = (int16_t)ident[forThisIdentID].coord[2]; 1602 if(!settingsGetPointer()->FlipDisplay)
1596 1603 {
1604 y0 = (int16_t)ident[forThisIdentID].coord[2];
1605 }
1606 else
1607 {
1608 y0 = 390 - (int16_t)ident[forThisIdentID].coord[2];
1609 }
1597 y0 -= ME_Y_LINE1; 1610 y0 -= ME_Y_LINE1;
1598 y0 /= ME_Y_LINE_STEP; 1611 y0 /= ME_Y_LINE_STEP;
1599 if((y0 >= 0) && (y0 <=5)) 1612 if((y0 >= 0) && (y0 <=5))
1600 lineMinusOne = y0; 1613 lineMinusOne = y0;
1601 else 1614 else
1602 lineMinusOne = 0; 1615 lineMinusOne = 0;
1603 GFX_SetFrameBottom((tMEcursorNew.FBStartAdress) + 65*2*(lineMinusOne), 0, 25, 800, 390); 1616
1617 if(!settingsGetPointer()->FlipDisplay)
1618 {
1619 GFX_SetFrameBottom((tMEcursorNew.FBStartAdress) + 65*2*(lineMinusOne), 0, 25, 800, 390);
1620 }
1621 else
1622 {
1623 GFX_SetFrameBottom((tMEcursorNew.FBStartAdress)+ (390 - 65 *(5-lineMinusOne-1)) *2, 0, 480-390-25, 800, 390);
1624 }
1604 } 1625 }
1605 1626
1606 1627
1607 void write_topline( char *text) 1628 void write_topline( char *text)
1608 { 1629 {
1613 hgfx.WindowNumberOfTextLines = 1; 1634 hgfx.WindowNumberOfTextLines = 1;
1614 hgfx.WindowLineSpacing = 0; 1635 hgfx.WindowLineSpacing = 0;
1615 hgfx.WindowTab = 0; 1636 hgfx.WindowTab = 0;
1616 hgfx.WindowX0 = 20; 1637 hgfx.WindowX0 = 20;
1617 hgfx.WindowX1 = 779; 1638 hgfx.WindowX1 = 779;
1618 hgfx.WindowY1 = 479; 1639 if(!settingsGetPointer()->FlipDisplay)
1619 hgfx.WindowY0 = hgfx.WindowY1 - Font->height; 1640 {
1620 1641 hgfx.WindowY1 = 479;
1642 hgfx.WindowY0 = hgfx.WindowY1 - Font->height;
1643 }
1644 else
1645 {
1646 hgfx.WindowY0 = 0;
1647 hgfx.WindowY1 = hgfx.WindowY0 + Font->height;
1648 }
1621 GFX_write_label(Font, &hgfx, text, menuColor); 1649 GFX_write_label(Font, &hgfx, text, menuColor);
1622 } 1650 }
1623 1651
1624 1652
1625 void write_buttonTextline( uint8_t left2ByteCode, char middle2ByteCode, char right2ByteCode) 1653 void write_buttonTextline( uint8_t left2ByteCode, char middle2ByteCode, char right2ByteCode)
1626 { 1654 {
1627 GFX_clean_area(&tMEscreen, 0, 800, 480-24,480); 1655
1656 SSettings* pSettings;
1657 pSettings = settingsGetPointer();
1658
1659 if(!pSettings->FlipDisplay)
1660 {
1661 GFX_clean_area(&tMEscreen, 0, 800, 480-24,480);
1662 }
1663 else
1664 {
1665 GFX_clean_area(&tMEscreen, 0, 800, 0, 24);
1666 }
1628 1667
1629 char localtext[32]; 1668 char localtext[32];
1630 1669
1631 if(left2ByteCode) 1670 if(left2ByteCode)
1632 { 1671 {
1633 localtext[0] = TXT_2BYTE; 1672 localtext[0] = TXT_2BYTE;
1634 localtext[1] = left2ByteCode; 1673 localtext[1] = left2ByteCode;
1635 localtext[2] = 0; 1674 localtext[2] = 0;
1636 write_content_simple(&tMEscreen, 0, 800, 480-24, &FontT24,localtext,CLUT_ButtonSurfaceScreen); 1675 if(!pSettings->FlipDisplay)
1676 {
1677 write_content_simple(&tMEscreen, 0, 800, 480-24, &FontT24,localtext,CLUT_ButtonSurfaceScreen);
1678 }
1679 else
1680 {
1681 write_content_simple(&tMEscreen, 0, 800, 0, &FontT24,localtext,CLUT_ButtonSurfaceScreen);
1682 }
1637 } 1683 }
1638 1684
1639 if(middle2ByteCode) 1685 if(middle2ByteCode)
1640 { 1686 {
1641 localtext[0] = '\001'; 1687 localtext[0] = '\001';
1642 localtext[1] = TXT_2BYTE; 1688 localtext[1] = TXT_2BYTE;
1643 localtext[2] = middle2ByteCode; 1689 localtext[2] = middle2ByteCode;
1644 localtext[3] = 0; 1690 localtext[3] = 0;
1645 write_content_simple(&tMEscreen, 0, 800, 480-24, &FontT24,localtext,CLUT_ButtonSurfaceScreen); 1691 if(!pSettings->FlipDisplay)
1692 {
1693 write_content_simple(&tMEscreen, 0, 800, 480-24, &FontT24,localtext,CLUT_ButtonSurfaceScreen);
1694 }
1695 else
1696 {
1697 write_content_simple(&tMEscreen, 0, 800, 0, &FontT24,localtext,CLUT_ButtonSurfaceScreen);
1698 }
1646 } 1699 }
1647 1700
1648 if(right2ByteCode) 1701 if(right2ByteCode)
1649 { 1702 {
1650 localtext[0] = '\002'; 1703 localtext[0] = '\002';
1651 localtext[1] = TXT_2BYTE; 1704 localtext[1] = TXT_2BYTE;
1652 localtext[2] = right2ByteCode; 1705 localtext[2] = right2ByteCode;
1653 localtext[3] = 0; 1706 localtext[3] = 0;
1654 write_content_simple(&tMEscreen, 0, 800, 480-24, &FontT24,localtext,CLUT_ButtonSurfaceScreen); 1707 if(!pSettings->FlipDisplay)
1708 {
1709 write_content_simple(&tMEscreen, 0, 800, 480-24, &FontT24,localtext,CLUT_ButtonSurfaceScreen);
1710 }
1711 else
1712 {
1713 write_content_simple(&tMEscreen, 0, 800, 0, &FontT24,localtext,CLUT_ButtonSurfaceScreen);
1714 }
1655 } 1715 }
1656 } 1716 }
1657 1717
1658 1718
1659 1719
1669 YtopGimpStyle = 479; 1729 YtopGimpStyle = 479;
1670 hgfx.Image = &tMEscreen; 1730 hgfx.Image = &tMEscreen;
1671 hgfx.WindowNumberOfTextLines = 1; 1731 hgfx.WindowNumberOfTextLines = 1;
1672 hgfx.WindowLineSpacing = 0; 1732 hgfx.WindowLineSpacing = 0;
1673 hgfx.WindowTab = 0; 1733 hgfx.WindowTab = 0;
1674 hgfx.WindowX0 = XleftGimpStyle; 1734 if(!settingsGetPointer()->FlipDisplay)
1675 hgfx.WindowX1 = XrightGimpStyle; 1735 {
1676 hgfx.WindowY1 = 479 - YtopGimpStyle; 1736 hgfx.WindowX0 = XleftGimpStyle;
1677 if(hgfx.WindowY1 < Font->height) 1737 hgfx.WindowX1 = XrightGimpStyle;
1678 hgfx.WindowY0 = 0; 1738 hgfx.WindowY1 = 479 - YtopGimpStyle;
1679 else 1739 if(hgfx.WindowY1 < Font->height)
1680 hgfx.WindowY0 = hgfx.WindowY1 - Font->height; 1740 hgfx.WindowY0 = 0;
1681 1741 else
1742 hgfx.WindowY0 = hgfx.WindowY1 - Font->height;
1743 }
1744 else
1745 {
1746 hgfx.WindowX0 = 800 - XrightGimpStyle;
1747 hgfx.WindowX1 = 800 - XleftGimpStyle;
1748 hgfx.WindowY0 = YtopGimpStyle;
1749 if(hgfx.WindowY0 < Font->height)
1750 hgfx.WindowY1 = 0;
1751 else
1752 hgfx.WindowY1 = hgfx.WindowY0 + Font->height;
1753 }
1682 GFX_write_label(Font, &hgfx, text, 0);/*menuColor);*/ 1754 GFX_write_label(Font, &hgfx, text, 0);/*menuColor);*/
1683 } 1755 }
1684 1756
1685 1757
1686 void write_content(uint16_t XleftGimpStyle, uint16_t XrightGimpStyle, uint16_t YtopGimpStyle, const tFont *Font, const char *text, uint8_t color) 1758 void write_content(uint16_t XleftGimpStyle, uint16_t XrightGimpStyle, uint16_t YtopGimpStyle, const tFont *Font, const char *text, uint8_t color)
1695 YtopGimpStyle = 479; 1767 YtopGimpStyle = 479;
1696 hgfx.Image = &tMEscreen; 1768 hgfx.Image = &tMEscreen;
1697 hgfx.WindowNumberOfTextLines = 1; 1769 hgfx.WindowNumberOfTextLines = 1;
1698 hgfx.WindowLineSpacing = 0; 1770 hgfx.WindowLineSpacing = 0;
1699 hgfx.WindowTab = 0; 1771 hgfx.WindowTab = 0;
1700 hgfx.WindowX0 = XleftGimpStyle; 1772
1701 hgfx.WindowX1 = XrightGimpStyle; 1773 if(!settingsGetPointer()->FlipDisplay)
1702 hgfx.WindowY1 = 479 - YtopGimpStyle; 1774 {
1703 if(hgfx.WindowY1 < Font->height) 1775 hgfx.WindowX0 = XleftGimpStyle;
1704 hgfx.WindowY0 = 0; 1776 hgfx.WindowX1 = XrightGimpStyle;
1705 else 1777 hgfx.WindowY1 = 479 - YtopGimpStyle;
1706 hgfx.WindowY0 = hgfx.WindowY1 - Font->height; 1778 if(hgfx.WindowY1 < Font->height)
1707 1779 hgfx.WindowY0 = 0;
1780 else
1781 hgfx.WindowY0 = hgfx.WindowY1 - Font->height;
1782 }
1783 else
1784 {
1785 hgfx.WindowX0 = 800 - XrightGimpStyle;
1786 hgfx.WindowX1 = 800 - XleftGimpStyle;
1787 hgfx.WindowY0 = YtopGimpStyle;
1788 if(hgfx.WindowY0 < Font->height)
1789 hgfx.WindowY1 = 0;
1790 else
1791 hgfx.WindowY1 = hgfx.WindowY0 + Font->height;
1792 }
1708 GFX_write_label(Font, &hgfx, text, color); 1793 GFX_write_label(Font, &hgfx, text, color);
1709 } 1794 }
1710 1795
1711 1796
1712 void write_label_fix(uint16_t XleftGimpStyle, uint16_t XrightGimpStyle, uint16_t YtopGimpStyle, const tFont *Font, const char textId) 1797 void write_label_fix(uint16_t XleftGimpStyle, uint16_t XrightGimpStyle, uint16_t YtopGimpStyle, const tFont *Font, const char textId)
1729 if(XleftGimpStyle >= XrightGimpStyle) 1814 if(XleftGimpStyle >= XrightGimpStyle)
1730 XleftGimpStyle = 0; 1815 XleftGimpStyle = 0;
1731 if(YtopGimpStyle > 479) 1816 if(YtopGimpStyle > 479)
1732 YtopGimpStyle = 479; 1817 YtopGimpStyle = 479;
1733 hgfx.Image = &tMEscreen; 1818 hgfx.Image = &tMEscreen;
1819 if(!settingsGetPointer()->FlipDisplay)
1820 {
1734 hgfx.WindowX0 = XleftGimpStyle; 1821 hgfx.WindowX0 = XleftGimpStyle;
1735 hgfx.WindowX1 = XrightGimpStyle; 1822 hgfx.WindowX1 = XrightGimpStyle;
1736 hgfx.WindowY1 = 479 - YtopGimpStyle; 1823 hgfx.WindowY1 = 479 - YtopGimpStyle;
1737 if(hgfx.WindowY1 < Font->height) 1824 if(hgfx.WindowY1 < Font->height)
1738 hgfx.WindowY0 = 0; 1825 hgfx.WindowY0 = 0;
1739 else 1826 else
1740 hgfx.WindowY0 = hgfx.WindowY1 - Font->height; 1827 hgfx.WindowY0 = hgfx.WindowY1 - Font->height;
1741 1828 }
1829 else
1830 {
1831 hgfx.WindowX0 = 800 - XrightGimpStyle;
1832 hgfx.WindowX1 = 800 - XleftGimpStyle;
1833 hgfx.WindowY0 = YtopGimpStyle;
1834 if(hgfx.WindowY0 < Font->height)
1835 hgfx.WindowY1 = 0;
1836 else
1837 hgfx.WindowY1 = hgfx.WindowY0 + Font->height;
1838 }
1742 GFX_clear_window_immediately(&hgfx); 1839 GFX_clear_window_immediately(&hgfx);
1743 } 1840 }
1744 1841
1745 1842
1746 /* Private functions ---------------------------------------------------------*/ 1843 /* Private functions ---------------------------------------------------------*/