| 995 | ***************************************************************************************/ |
| 996 | #define MAX_ITEMS (int)(tftHeight - 20) / (LH * FM) |
| 997 | Opt_Coord listFiles(int index, std::vector<FileList> fileList) { |
| 998 | Opt_Coord coord; |
| 999 | tft.drawPixel(0, 0, bruceConfig.bgColor); |
| 1000 | if (index == 0) { |
| 1001 | tft.fillScreen(bruceConfig.bgColor); |
| 1002 | tft.drawRoundRect(5, 5, tftWidth - 10, tftHeight - 10, 5, bruceConfig.priColor); |
| 1003 | } |
| 1004 | tft.setCursor(10, 10); |
| 1005 | tft.setTextSize(FM); |
| 1006 | int i = 0; |
| 1007 | int arraySize = fileList.size(); |
| 1008 | int start = 0; |
| 1009 | if (index >= MAX_ITEMS) { |
| 1010 | start = index - MAX_ITEMS + 1; |
| 1011 | if (start < 0) start = 0; |
| 1012 | } |
| 1013 | int nchars = (tftWidth - 20) / (6 * tft.getTextSize()); |
| 1014 | String txt = ">"; |
| 1015 | while (i < arraySize) { |
| 1016 | if (i >= start) { |
| 1017 | tft.setCursor(10, tft.getCursorY()); |
| 1018 | if (fileList[i].folder == true) |
| 1019 | tft.setTextColor(getColorVariation(bruceConfig.priColor), bruceConfig.bgColor); |
| 1020 | else if (fileList[i].operation == true) tft.setTextColor(ALCOLOR, bruceConfig.bgColor); |
| 1021 | else { tft.setTextColor(bruceConfig.priColor, bruceConfig.bgColor); } |
| 1022 | |
| 1023 | if (index == i) { |
| 1024 | txt = ">"; |
| 1025 | coord.x = 10 + FM * LW; |
| 1026 | coord.y = tft.getCursorY(); |
| 1027 | coord.size = nchars; |
| 1028 | coord.fgcolor = |
| 1029 | fileList[i].folder ? getColorVariation(bruceConfig.priColor) : bruceConfig.priColor; |
| 1030 | coord.bgcolor = bruceConfig.bgColor; |
| 1031 | } else txt = " "; |
| 1032 | txt += fileList[i].filename + " "; |
| 1033 | tft.println(txt.substring(0, nchars)); |
| 1034 | } |
| 1035 | i++; |
| 1036 | if (i == (start + MAX_ITEMS) || i == arraySize) break; |
| 1037 | } |
| 1038 | return coord; |
| 1039 | } |
| 1040 | |
| 1041 | // desenhos do menu principal, sprite "draw" com 80x80 pixels |
| 1042 |
no test coverage detected