display 2 lines for long files.
This commit is contained in:
2
cfg.cpp
2
cfg.cpp
@@ -69,6 +69,7 @@ static const ini_var_t ini_vars[] =
|
||||
{ "JAMMASD_VID", (void*)(&(cfg.jammasd_vid)), UINT16, 0, 0xFFFF },
|
||||
{ "JAMMASD_PID", (void*)(&(cfg.jammasd_pid)), UINT16, 0, 0xFFFF },
|
||||
{ "SNIPER_MODE", (void*)(&(cfg.sniper_mode)), UINT8, 0, 1 },
|
||||
{ "BROWSE_EXPAND", (void*)(&(cfg.browse_expand)), UINT8, 0, 1 },
|
||||
};
|
||||
|
||||
static const int nvars = (int)(sizeof(ini_vars) / sizeof(ini_var_t));
|
||||
@@ -313,5 +314,6 @@ void cfg_parse()
|
||||
cfg.bootscreen = 1;
|
||||
cfg.fb_terminal = 1;
|
||||
cfg.controller_info = 6;
|
||||
cfg.browse_expand = 1;
|
||||
ini_parse(altcfg());
|
||||
}
|
||||
|
||||
1
cfg.h
1
cfg.h
@@ -43,6 +43,7 @@ typedef struct {
|
||||
uint16_t jammasd_vid;
|
||||
uint16_t jammasd_pid;
|
||||
uint8_t sniper_mode;
|
||||
uint8_t browse_expand;
|
||||
char bootcore[256];
|
||||
char video_conf[1024];
|
||||
char video_conf_pal[1024];
|
||||
|
||||
@@ -1571,7 +1571,7 @@ int ScanDirectory(char* path, int mode, const char *extension, int options, cons
|
||||
}
|
||||
else if (mode == SCANF_NEXT_PAGE)
|
||||
{
|
||||
if (iSelectedEntry < iFirstEntry + OsdGetSize() - 1)
|
||||
if (iSelectedEntry < iFirstEntry + OsdGetSize() - 2)
|
||||
{
|
||||
iSelectedEntry = iFirstEntry + OsdGetSize() - 1;
|
||||
if (iSelectedEntry >= flist_nDirEntries()) iSelectedEntry = flist_nDirEntries() - 1;
|
||||
@@ -1672,6 +1672,11 @@ int flist_iFirstEntry()
|
||||
return iFirstEntry;
|
||||
}
|
||||
|
||||
void flist_iFirstEntryInc()
|
||||
{
|
||||
iFirstEntry++;
|
||||
}
|
||||
|
||||
int flist_iSelectedEntry()
|
||||
{
|
||||
return iSelectedEntry;
|
||||
|
||||
@@ -34,6 +34,7 @@ struct direntext_t
|
||||
|
||||
int flist_nDirEntries();
|
||||
int flist_iFirstEntry();
|
||||
void flist_iFirstEntryInc();
|
||||
int flist_iSelectedEntry();
|
||||
direntext_t* flist_DirItem(int n);
|
||||
direntext_t* flist_SelectedItem();
|
||||
|
||||
52
menu.cpp
52
menu.cpp
@@ -884,6 +884,9 @@ void HandleUI(void)
|
||||
// get user control codes
|
||||
uint32_t c = menu_key_get();
|
||||
|
||||
int release = 0;
|
||||
if (c & UPSTROKE) release = 1;
|
||||
|
||||
// decode and set events
|
||||
menu = false;
|
||||
select = false;
|
||||
@@ -3594,7 +3597,7 @@ void HandleUI(void)
|
||||
case MENU_FILE_SELECT1:
|
||||
helptext = helptexts[HELPTEXT_NONE];
|
||||
OsdSetTitle((fs_Options & SCANO_CORES) ? "Cores" : "Select", 0);
|
||||
PrintDirectory();
|
||||
PrintDirectory(hold_cnt<2);
|
||||
menustate = MENU_FILE_SELECT2;
|
||||
break;
|
||||
|
||||
@@ -3734,6 +3737,7 @@ void HandleUI(void)
|
||||
}
|
||||
}
|
||||
|
||||
if (release) PrintDirectory(1);
|
||||
break;
|
||||
|
||||
/******************************************************************/
|
||||
@@ -5156,26 +5160,42 @@ void ScrollLongName(void)
|
||||
}
|
||||
|
||||
// print directory contents
|
||||
void PrintDirectory(void)
|
||||
void PrintDirectory(int expand)
|
||||
{
|
||||
int k;
|
||||
int len;
|
||||
|
||||
char s[40];
|
||||
ScrollReset();
|
||||
|
||||
for(int i = 0; i < OsdGetSize(); i++)
|
||||
if (expand && cfg.browse_expand)
|
||||
{
|
||||
int k = flist_iFirstEntry() + OsdGetSize() - 1;
|
||||
if (flist_nDirEntries() && k == flist_iSelectedEntry() && k <= flist_nDirEntries() &&
|
||||
strlen(flist_DirItem(k)->altname) > 28 && !flist_DirItem(k)->datecode[0] && flist_DirItem(k)->de.d_type != DT_DIR)
|
||||
{
|
||||
//make room for last expanded line
|
||||
flist_iFirstEntryInc();
|
||||
}
|
||||
}
|
||||
|
||||
int i = 0;
|
||||
int k = flist_iFirstEntry();
|
||||
while(i < OsdGetSize())
|
||||
{
|
||||
char leftchar = 0;
|
||||
memset(s, ' ', 32); // clear line buffer
|
||||
s[32] = 0;
|
||||
int len2 = 0;
|
||||
leftchar = 0;
|
||||
int len = 0;
|
||||
|
||||
if (i < flist_nDirEntries())
|
||||
{
|
||||
k = flist_iFirstEntry() + i;
|
||||
len = strlen(flist_DirItem(k)->altname); // get name length
|
||||
if (len > 28)
|
||||
{
|
||||
len2 = len - 27;
|
||||
if (len2 > 27) len2 = 27;
|
||||
if (!expand) len2 = 0;
|
||||
|
||||
len = 27; // trim display length if longer than 30 characters
|
||||
s[28] = 22;
|
||||
}
|
||||
@@ -5200,6 +5220,7 @@ void PrintDirectory(void)
|
||||
{
|
||||
strcpy(&s[22], " <DIR>");
|
||||
}
|
||||
len2 = 0;
|
||||
}
|
||||
else if (!cfg.rbf_hide_datecode && datecode[0])
|
||||
{
|
||||
@@ -5219,10 +5240,11 @@ void PrintDirectory(void)
|
||||
s[19] = 22;
|
||||
s[28] = ' ';
|
||||
}
|
||||
len2 = 0;
|
||||
}
|
||||
|
||||
if (!i && k) leftchar = 17;
|
||||
if ((i == OsdGetSize() - 1) && (k < flist_nDirEntries() - 1)) leftchar = 16;
|
||||
if (i && k < flist_nDirEntries() - 1) leftchar = 16;
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -5230,7 +5252,19 @@ void PrintDirectory(void)
|
||||
strcpy(s, " No files!");
|
||||
}
|
||||
|
||||
OsdWriteOffset(i, s, i == (flist_iSelectedEntry() - flist_iFirstEntry()), 0, 0, leftchar);
|
||||
int sel = (i == (flist_iSelectedEntry() - flist_iFirstEntry()));
|
||||
OsdWriteOffset(i, s, sel, 0, 0, leftchar);
|
||||
i++;
|
||||
|
||||
if (sel && len2)
|
||||
{
|
||||
len = strlen(flist_DirItem(k)->altname);
|
||||
strcpy(s+1, flist_DirItem(k)->altname + len - len2);
|
||||
OsdWriteOffset(i, s, sel, 0, 0, leftchar);
|
||||
i++;
|
||||
}
|
||||
|
||||
k++;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
2
menu.h
2
menu.h
@@ -5,7 +5,7 @@
|
||||
|
||||
void HandleUI(void);
|
||||
void menu_key_set(unsigned int c);
|
||||
void PrintDirectory(void);
|
||||
void PrintDirectory(int expand = 0);
|
||||
void ScrollLongName(void);
|
||||
|
||||
void ErrorMessage(const char *message, unsigned char code);
|
||||
|
||||
Reference in New Issue
Block a user