mirror of
https://github.com/hrydgard/ppsspp.git
synced 2024-11-24 05:49:58 +00:00
Fix layout issues in AbstractChoiceWithValueDisplay. Remove title text from post shaders to fit.
This commit is contained in:
parent
d97035fffc
commit
23ba0d0515
@ -849,7 +849,10 @@ void AbstractChoiceWithValueDisplay::Draw(UIContext &dc) {
|
|||||||
dc.SetFontStyle(dc.theme->uiFont);
|
dc.SetFontStyle(dc.theme->uiFont);
|
||||||
|
|
||||||
const std::string valueText = ValueText();
|
const std::string valueText = ValueText();
|
||||||
// Assume we want at least 20% of the size for the label, at a minimum.
|
|
||||||
|
// If there is a label, assume we want at least 20% of the size for it, at a minimum.
|
||||||
|
|
||||||
|
if (!text_.empty()) {
|
||||||
float availWidth = (bounds_.w - paddingX * 2) * 0.8f;
|
float availWidth = (bounds_.w - paddingX * 2) * 0.8f;
|
||||||
float scale = CalculateValueScale(dc, valueText, availWidth);
|
float scale = CalculateValueScale(dc, valueText, availWidth);
|
||||||
|
|
||||||
@ -863,6 +866,13 @@ void AbstractChoiceWithValueDisplay::Draw(UIContext &dc) {
|
|||||||
Bounds valueBounds(bounds_.x2() - textPadding_.right, bounds_.y, w, bounds_.h);
|
Bounds valueBounds(bounds_.x2() - textPadding_.right, bounds_.y, w, bounds_.h);
|
||||||
dc.DrawTextRect(valueText.c_str(), valueBounds, style.fgColor, ALIGN_RIGHT | ALIGN_VCENTER | FLAG_WRAP_TEXT);
|
dc.DrawTextRect(valueText.c_str(), valueBounds, style.fgColor, ALIGN_RIGHT | ALIGN_VCENTER | FLAG_WRAP_TEXT);
|
||||||
dc.SetFontScale(1.0f, 1.0f);
|
dc.SetFontScale(1.0f, 1.0f);
|
||||||
|
} else {
|
||||||
|
Choice::Draw(dc);
|
||||||
|
float scale = CalculateValueScale(dc, valueText, bounds_.w);
|
||||||
|
dc.SetFontScale(scale, scale);
|
||||||
|
dc.DrawTextRect(valueText.c_str(), bounds_.Expand(-paddingX, 0.0f), style.fgColor, ALIGN_LEFT | ALIGN_VCENTER | FLAG_WRAP_TEXT);
|
||||||
|
dc.SetFontScale(1.0f, 1.0f);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
float AbstractChoiceWithValueDisplay::CalculateValueScale(const UIContext &dc, const std::string &valueText, float availWidth) const {
|
float AbstractChoiceWithValueDisplay::CalculateValueScale(const UIContext &dc, const std::string &valueText, float availWidth) const {
|
||||||
|
@ -483,7 +483,7 @@ void Choice::Draw(UIContext &dc) {
|
|||||||
|
|
||||||
if (image_.isValid() && text_.empty()) {
|
if (image_.isValid() && text_.empty()) {
|
||||||
dc.Draw()->DrawImageRotated(image_, bounds_.centerX(), bounds_.centerY(), imgScale_, imgRot_, style.fgColor, imgFlipH_);
|
dc.Draw()->DrawImageRotated(image_, bounds_.centerX(), bounds_.centerY(), imgScale_, imgRot_, style.fgColor, imgFlipH_);
|
||||||
} else {
|
} else if (!text_.empty()) {
|
||||||
dc.SetFontStyle(dc.theme->uiFont);
|
dc.SetFontStyle(dc.theme->uiFont);
|
||||||
|
|
||||||
int paddingX = 12;
|
int paddingX = 12;
|
||||||
|
@ -287,7 +287,8 @@ void DisplayLayoutScreen::CreateViews() {
|
|||||||
for (int i = 0; i < (int)g_Config.vPostShaderNames.size() + 1 && i < ARRAY_SIZE(shaderNames_); ++i) {
|
for (int i = 0; i < (int)g_Config.vPostShaderNames.size() + 1 && i < ARRAY_SIZE(shaderNames_); ++i) {
|
||||||
// Vector element pointer get invalidated on resize, cache name to have always a valid reference in the rendering thread
|
// Vector element pointer get invalidated on resize, cache name to have always a valid reference in the rendering thread
|
||||||
shaderNames_[i] = i == g_Config.vPostShaderNames.size() ? "Off" : g_Config.vPostShaderNames[i];
|
shaderNames_[i] = i == g_Config.vPostShaderNames.size() ? "Off" : g_Config.vPostShaderNames[i];
|
||||||
postProcChoice_ = rightColumn->Add(new ChoiceWithValueDisplay(&shaderNames_[i], StringFromFormat("%s #%d", gr->T("Postprocessing Shader"), i + 1), &PostShaderTranslateName));
|
rightColumn->Add(new ItemHeader(StringFromFormat("%s #%d", gr->T("Postprocessing Shader"), i + 1)));
|
||||||
|
postProcChoice_ = rightColumn->Add(new ChoiceWithValueDisplay(&shaderNames_[i], "", &PostShaderTranslateName));
|
||||||
postProcChoice_->OnClick.Add([=](EventParams &e) {
|
postProcChoice_->OnClick.Add([=](EventParams &e) {
|
||||||
auto gr = GetI18NCategory("Graphics");
|
auto gr = GetI18NCategory("Graphics");
|
||||||
auto procScreen = new PostProcScreen(gr->T("Postprocessing Shader"), i, false);
|
auto procScreen = new PostProcScreen(gr->T("Postprocessing Shader"), i, false);
|
||||||
|
Loading…
Reference in New Issue
Block a user