Format more nicely

print-performance-number
probonopd 1 year ago committed by GitHub
parent e08583026b
commit a4221a619e
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
  1. 26
      src/uimenu.cpp

@ -1318,14 +1318,28 @@ void CUIMenu::PerformanceMenu (CUIMenu *pUIMenu, TMenuEvent Event)
{ {
Value = pUIMenu->m_pMiniDexed->GetPerformanceFileName(nValue); Value = pUIMenu->m_pMiniDexed->GetPerformanceFileName(nValue);
std::string nPSelected = ""; // Remove leading 0s
if(nValue == pUIMenu->m_pMiniDexed->GetActualPerformanceID()) Value.erase(0, std::min(Value.find_first_not_of('0'), Value.size()-1));
// Replace "_" after the performance number with "="
size_t nPos = Value.find_first_not_of("0123456789");
if (nPos != std::string::npos && Value[nPos] == '_')
{ {
nPSelected = std::to_string(pUIMenu->m_pMiniDexed->GetActualPerformanceID()) + " [L]"; Value[nPos] = '=';
} }
else
// Remove suffix
Value = Value.substr(0, Value.find_last_of("."));
// Limit length to 14 characters
if (Value.length() > 14) {
Value = Value.substr(0, 14);
}
std::string nPSelected = "";
if(nValue == pUIMenu->m_pMiniDexed->GetActualPerformanceID())
{ {
nPSelected = std::to_string(pUIMenu->m_pMiniDexed->GetActualPerformanceID()); nPSelected = "[L]";
} }
pUIMenu->m_pUI->DisplayWrite (pUIMenu->m_pParentMenu[pUIMenu->m_nCurrentMenuItem].Name, nPSelected.c_str(), pUIMenu->m_pUI->DisplayWrite (pUIMenu->m_pParentMenu[pUIMenu->m_nCurrentMenuItem].Name, nPSelected.c_str(),
@ -1556,5 +1570,3 @@ void CUIMenu::EditTGParameterModulation (CUIMenu *pUIMenu, TMenuEvent Event)
nValue > rParam.Minimum, nValue < rParam.Maximum); nValue > rParam.Minimum, nValue < rParam.Maximum);
} }

Loading…
Cancel
Save