|
@ -70,10 +70,10 @@ void FilesScreen::onEntry() { |
|
|
BaseScreen::onEntry(); |
|
|
BaseScreen::onEntry(); |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
const char *FilesScreen::getSelectedFilename(bool longName) { |
|
|
const char *FilesScreen::getSelectedFilename(bool shortName) { |
|
|
FileList files; |
|
|
FileList files; |
|
|
files.seek(getSelectedFileIndex(), true); |
|
|
files.seek(getSelectedFileIndex(), true); |
|
|
return longName ? files.longFilename() : files.shortFilename(); |
|
|
return shortName ? files.shortFilename() : files.filename(); |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
void FilesScreen::drawSelectedFile() { |
|
|
void FilesScreen::drawSelectedFile() { |
|
@ -132,13 +132,13 @@ void FilesScreen::drawFileList() { |
|
|
mydata.num_page = max(1,ceil(float(files.count()) / FILES_PER_PAGE)); |
|
|
mydata.num_page = max(1,ceil(float(files.count()) / FILES_PER_PAGE)); |
|
|
mydata.cur_page = min(mydata.cur_page, mydata.num_page-1); |
|
|
mydata.cur_page = min(mydata.cur_page, mydata.num_page-1); |
|
|
mydata.flags.is_root = files.isAtRootDir(); |
|
|
mydata.flags.is_root = files.isAtRootDir(); |
|
|
|
|
|
mydata.flags.is_empty = true; |
|
|
|
|
|
|
|
|
uint16_t fileIndex = mydata.cur_page * FILES_PER_PAGE; |
|
|
uint16_t fileIndex = mydata.cur_page * FILES_PER_PAGE; |
|
|
for (uint8_t i = 0; i < FILES_PER_PAGE; i++, fileIndex++) { |
|
|
for (uint8_t i = 0; i < FILES_PER_PAGE; i++, fileIndex++) { |
|
|
if (files.seek(fileIndex)) |
|
|
if (!files.seek(fileIndex)) break; |
|
|
drawFileButton(files.filename(), getTagForLine(i), files.isDir(), false); |
|
|
drawFileButton(files.filename(), getTagForLine(i), files.isDir(), false); |
|
|
else |
|
|
mydata.flags.is_empty = false; |
|
|
break; |
|
|
|
|
|
} |
|
|
} |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
@ -252,11 +252,11 @@ bool FilesScreen::onTouchEnd(uint8_t tag) { |
|
|
mydata.scroll_pos = 0; |
|
|
mydata.scroll_pos = 0; |
|
|
mydata.scroll_max = 0; |
|
|
mydata.scroll_max = 0; |
|
|
if (FTDI::ftdi_chip >= 810) { |
|
|
if (FTDI::ftdi_chip >= 810) { |
|
|
const char *longFilename = getSelectedLongFilename(); |
|
|
const char *filename = getSelectedFilename(); |
|
|
if (longFilename[0]) { |
|
|
if (filename[0]) { |
|
|
CommandProcessor cmd; |
|
|
CommandProcessor cmd; |
|
|
constexpr int dim[4] = {LIST_POS}; |
|
|
constexpr int dim[4] = {LIST_POS}; |
|
|
const uint16_t text_width = cmd.font(font_medium).text_width(longFilename); |
|
|
const uint16_t text_width = cmd.font(font_medium).text_width(filename); |
|
|
if (text_width > dim[2]) |
|
|
if (text_width > dim[2]) |
|
|
mydata.scroll_max = text_width - dim[2] + MARGIN_L + MARGIN_R + 10; |
|
|
mydata.scroll_max = text_width - dim[2] + MARGIN_L + MARGIN_R + 10; |
|
|
} |
|
|
} |
|
|