|
@@ -70,10 +70,10 @@ void FilesScreen::onEntry() {
|
70
|
70
|
BaseScreen::onEntry();
|
71
|
71
|
}
|
72
|
72
|
|
73
|
|
-const char *FilesScreen::getSelectedFilename(bool longName) {
|
|
73
|
+const char *FilesScreen::getSelectedFilename(bool shortName) {
|
74
|
74
|
FileList files;
|
75
|
75
|
files.seek(getSelectedFileIndex(), true);
|
76
|
|
- return longName ? files.longFilename() : files.shortFilename();
|
|
76
|
+ return shortName ? files.shortFilename() : files.filename();
|
77
|
77
|
}
|
78
|
78
|
|
79
|
79
|
void FilesScreen::drawSelectedFile() {
|
|
@@ -132,13 +132,13 @@ void FilesScreen::drawFileList() {
|
132
|
132
|
mydata.num_page = max(1,ceil(float(files.count()) / FILES_PER_PAGE));
|
133
|
133
|
mydata.cur_page = min(mydata.cur_page, mydata.num_page-1);
|
134
|
134
|
mydata.flags.is_root = files.isAtRootDir();
|
|
135
|
+ mydata.flags.is_empty = true;
|
135
|
136
|
|
136
|
137
|
uint16_t fileIndex = mydata.cur_page * FILES_PER_PAGE;
|
137
|
138
|
for (uint8_t i = 0; i < FILES_PER_PAGE; i++, fileIndex++) {
|
138
|
|
- if (files.seek(fileIndex))
|
139
|
|
- drawFileButton(files.filename(), getTagForLine(i), files.isDir(), false);
|
140
|
|
- else
|
141
|
|
- break;
|
|
139
|
+ if (!files.seek(fileIndex)) break;
|
|
140
|
+ drawFileButton(files.filename(), getTagForLine(i), files.isDir(), false);
|
|
141
|
+ mydata.flags.is_empty = false;
|
142
|
142
|
}
|
143
|
143
|
}
|
144
|
144
|
|
|
@@ -252,11 +252,11 @@ bool FilesScreen::onTouchEnd(uint8_t tag) {
|
252
|
252
|
mydata.scroll_pos = 0;
|
253
|
253
|
mydata.scroll_max = 0;
|
254
|
254
|
if (FTDI::ftdi_chip >= 810) {
|
255
|
|
- const char *longFilename = getSelectedLongFilename();
|
256
|
|
- if (longFilename[0]) {
|
|
255
|
+ const char *filename = getSelectedFilename();
|
|
256
|
+ if (filename[0]) {
|
257
|
257
|
CommandProcessor cmd;
|
258
|
258
|
constexpr int dim[4] = {LIST_POS};
|
259
|
|
- const uint16_t text_width = cmd.font(font_medium).text_width(longFilename);
|
|
259
|
+ const uint16_t text_width = cmd.font(font_medium).text_width(filename);
|
260
|
260
|
if (text_width > dim[2])
|
261
|
261
|
mydata.scroll_max = text_width - dim[2] + MARGIN_L + MARGIN_R + 10;
|
262
|
262
|
}
|