fix: Missing navigation button labels in Roundedraff theme (#1905)
This commit is contained in:
@@ -5,7 +5,6 @@
|
|||||||
#include <I18n.h>
|
#include <I18n.h>
|
||||||
|
|
||||||
#include <algorithm>
|
#include <algorithm>
|
||||||
#include <cctype>
|
|
||||||
#include <string>
|
#include <string>
|
||||||
#include <vector>
|
#include <vector>
|
||||||
|
|
||||||
@@ -44,18 +43,6 @@ void drawScrollBar(const GfxRenderer& renderer, Rect rect, int itemCount, int pa
|
|||||||
renderer.fillRect(barX, thumbY, barW, thumbH);
|
renderer.fillRect(barX, thumbY, barW, thumbH);
|
||||||
}
|
}
|
||||||
|
|
||||||
std::string sanitizeButtonLabel(std::string label) {
|
|
||||||
// Remove common directional prefixes/symbols (e.g. "<< Home", unsupported icon glyphs).
|
|
||||||
while (!label.empty() && !std::isalnum(static_cast<unsigned char>(label[0]))) {
|
|
||||||
label.erase(0, 1);
|
|
||||||
}
|
|
||||||
// Trim any extra left spaces.
|
|
||||||
while (!label.empty() && label[0] == ' ') {
|
|
||||||
label.erase(0, 1);
|
|
||||||
}
|
|
||||||
return label;
|
|
||||||
}
|
|
||||||
|
|
||||||
} // namespace
|
} // namespace
|
||||||
int coverWidth = 0;
|
int coverWidth = 0;
|
||||||
|
|
||||||
@@ -412,11 +399,11 @@ void RoundedRaffTheme::drawButtonHints(GfxRenderer& renderer, const char* btn1,
|
|||||||
const bool backDisabled = (btn1 == nullptr || btn1[0] == '\0');
|
const bool backDisabled = (btn1 == nullptr || btn1[0] == '\0');
|
||||||
const int leftGroupX = sidePadding;
|
const int leftGroupX = sidePadding;
|
||||||
const int rightGroupX = leftGroupX + groupWidth + groupGap;
|
const int rightGroupX = leftGroupX + groupWidth + groupGap;
|
||||||
const std::string backLabel = backDisabled ? "" : sanitizeButtonLabel(std::string(btn1));
|
const std::string backLabel = backDisabled ? "" : std::string(btn1);
|
||||||
// Callers should provide the button labels. If a label is not specified, it should render empty.
|
// Callers should provide the button labels. If a label is not specified, it should render empty.
|
||||||
const std::string selectText = (btn2 && btn2[0] != '\0') ? sanitizeButtonLabel(std::string(btn2)) : "";
|
const std::string selectText = (btn2 && btn2[0] != '\0') ? std::string(btn2) : "";
|
||||||
const std::string upText = (btn3 && btn3[0] != '\0') ? sanitizeButtonLabel(std::string(btn3)) : "";
|
const std::string upText = (btn3 && btn3[0] != '\0') ? std::string(btn3) : "";
|
||||||
const std::string downText = (btn4 && btn4[0] != '\0') ? sanitizeButtonLabel(std::string(btn4)) : "";
|
const std::string downText = (btn4 && btn4[0] != '\0') ? std::string(btn4) : "";
|
||||||
|
|
||||||
// Ensure button hints always "win" visually even if other elements accidentally render into this area.
|
// Ensure button hints always "win" visually even if other elements accidentally render into this area.
|
||||||
renderer.fillRect(leftGroupX, hintY, groupWidth, hintHeight, false);
|
renderer.fillRect(leftGroupX, hintY, groupWidth, hintHeight, false);
|
||||||
|
|||||||
Reference in New Issue
Block a user