Show File button in demo player

to easily get the file instead of having to search for it in the file
browser again. Complements #2946
This commit is contained in:
def 2020-09-29 08:18:04 +02:00
parent 6beab4a42b
commit 8efff70d88

View file

@ -463,6 +463,23 @@ void CMenus::RenderDemoPlayer(CUIRect MainView)
DemolistOnUpdate(false);
}
// file button
ButtonBar.VSplitRight(Margins, &ButtonBar, 0);
ButtonBar.VSplitRight(ButtonbarHeight * 3, &ButtonBar, &Button);
static int s_FileButton = 0;
if(DoButton_DemoPlayer(&s_FileButton, Localize("File"), 0, &Button))
{
char aBuf[MAX_PATH_LENGTH];
char aBufFull[MAX_PATH_LENGTH + 7];
str_format(aBufFull, sizeof(aBufFull), "%s/%s", m_aCurrentDemoFolder, m_lDemos[m_DemolistSelectedIndex].m_aFilename);
Storage()->GetCompletePath(m_lDemos[m_DemolistSelectedIndex].m_StorageType, aBufFull, aBuf, sizeof(aBuf));
str_format(aBufFull, sizeof(aBufFull), "file://%s", aBuf);
if(!open_link(aBufFull))
{
dbg_msg("menus", "couldn't open link");
}
}
// toggle keyboard shortcuts button
ButtonBar.VSplitRight(Margins * 3, &ButtonBar, 0);
ButtonBar.VSplitRight(ButtonbarHeight, &ButtonBar, &Button);