Skip to content

Commit

Permalink
Reorganize the DisplayLayoutScreen again - flip left/right sides, mov…
Browse files Browse the repository at this point in the history
…e mode switch to bottom.
  • Loading branch information
hrydgard committed Dec 3, 2022
1 parent b938992 commit e46b036
Showing 1 changed file with 20 additions and 18 deletions.
38 changes: 20 additions & 18 deletions UI/DisplayLayoutScreen.cpp
Expand Up @@ -208,31 +208,31 @@ void DisplayLayoutScreen::CreateViews() {
rightScrollView->Add(rightColumn);
root_->Add(rightScrollView);

LinearLayout *bottomControls = new LinearLayout(ORIENT_HORIZONTAL, new AnchorLayoutParams(NONE, NONE, NONE, 10.0f, false));
root_->Add(bottomControls);

if (!IsVREnabled()) {
auto stretch = new CheckBox(&g_Config.bDisplayStretch, gr->T("Stretch"));
leftColumn->Add(stretch);
rightColumn->Add(stretch);

PopupSliderChoiceFloat *aspectRatio = new PopupSliderChoiceFloat(&g_Config.fDisplayAspectRatio, 0.5f, 2.0f, gr->T("Aspect Ratio"), screenManager());
leftColumn->Add(aspectRatio);
rightColumn->Add(aspectRatio);
aspectRatio->SetDisabledPtr(&g_Config.bDisplayStretch);
aspectRatio->SetHasDropShadow(false);
aspectRatio->SetLiveUpdate(true);

mode_ = new ChoiceStrip(ORIENT_VERTICAL);
mode_ = new ChoiceStrip(ORIENT_HORIZONTAL, new LinearLayoutParams(WRAP_CONTENT, WRAP_CONTENT));
mode_->AddChoice(di->T("Move"));
mode_->AddChoice(di->T("Resize"));
mode_->SetSelection(0, false);
leftColumn->Add(mode_);
bottomControls->Add(mode_);

static const char *displayRotation[] = { "Landscape", "Portrait", "Landscape Reversed", "Portrait Reversed" };
auto rotation = new PopupMultiChoice(&g_Config.iInternalScreenRotation, gr->T("Rotation"), displayRotation, 1, ARRAY_SIZE(displayRotation), co->GetName(), screenManager());
rotation->SetEnabledFunc([] {
return !g_Config.bSkipBufferEffects || g_Config.bSoftwareRendering;
});
leftColumn->Add(rotation);

leftColumn->Add(new Spacer(12.0f));
rightColumn->Add(rotation);

Choice *center = new Choice(di->T("Reset"));
center->OnClick.Add([&](UI::EventParams &) {
Expand All @@ -242,13 +242,19 @@ void DisplayLayoutScreen::CreateViews() {
g_Config.fDisplayOffsetY = 0.5f;
return UI::EVENT_DONE;
});
leftColumn->Add(center);
rightColumn->Add(center);

rightColumn->Add(new Spacer(12.0f));
}

Choice *back = new Choice(di->T("Back"), "", false);
back->OnClick.Handle<UIScreen>(this, &UIScreen::OnBack);
rightColumn->Add(back);

static const char *bufFilters[] = { "Linear", "Nearest", };
rightColumn->Add(new PopupMultiChoice(&g_Config.iBufFilter, gr->T("Screen Scaling Filter"), bufFilters, 1, ARRAY_SIZE(bufFilters), gr->GetName(), screenManager()));
leftColumn->Add(new PopupMultiChoice(&g_Config.iBufFilter, gr->T("Screen Scaling Filter"), bufFilters, 1, ARRAY_SIZE(bufFilters), gr->GetName(), screenManager()));

rightColumn->Add(new ItemHeader(gr->T("Postprocessing effect")));
leftColumn->Add(new ItemHeader(gr->T("Postprocessing effect")));

Draw::DrawContext *draw = screenManager()->getDrawContext();

Expand All @@ -262,8 +268,8 @@ void DisplayLayoutScreen::CreateViews() {
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
shaderNames_[i] = i == g_Config.vPostShaderNames.size() ? "Off" : g_Config.vPostShaderNames[i];
rightColumn->Add(new ItemHeader(StringFromFormat("%s #%d", gr->T("Postprocessing Shader"), i + 1)));
postProcChoice_ = rightColumn->Add(new ChoiceWithValueDisplay(&shaderNames_[i], "", &PostShaderTranslateName));
leftColumn->Add(new ItemHeader(StringFromFormat("%s #%d", gr->T("Postprocessing Shader"), i + 1)));
postProcChoice_ = leftColumn->Add(new ChoiceWithValueDisplay(&shaderNames_[i], "", &PostShaderTranslateName));
postProcChoice_->OnClick.Add([=](EventParams &e) {
auto gr = GetI18NCategory("Graphics");
auto procScreen = new PostProcScreen(gr->T("Postprocessing Shader"), i, false);
Expand Down Expand Up @@ -293,10 +299,10 @@ void DisplayLayoutScreen::CreateViews() {
auto &value = g_Config.mPostShaderSetting[StringFromFormat("%sSettingValue%d", shaderInfo->section.c_str(), i + 1)];
if (duplicated) {
auto sliderName = StringFromFormat("%s %s", ps->T(setting.name), ps->T("(duplicated setting, previous slider will be used)"));
PopupSliderChoiceFloat *settingValue = rightColumn->Add(new PopupSliderChoiceFloat(&value, setting.minValue, setting.maxValue, sliderName, setting.step, screenManager()));
PopupSliderChoiceFloat *settingValue = leftColumn->Add(new PopupSliderChoiceFloat(&value, setting.minValue, setting.maxValue, sliderName, setting.step, screenManager()));
settingValue->SetEnabled(false);
} else {
PopupSliderChoiceFloat *settingValue = rightColumn->Add(new PopupSliderChoiceFloat(&value, setting.minValue, setting.maxValue, ps->T(setting.name), setting.step, screenManager()));
PopupSliderChoiceFloat *settingValue = leftColumn->Add(new PopupSliderChoiceFloat(&value, setting.minValue, setting.maxValue, ps->T(setting.name), setting.step, screenManager()));
settingValue->SetLiveUpdate(true);
settingValue->SetHasDropShadow(false);
settingValue->SetEnabledFunc([=] {
Expand All @@ -308,9 +314,5 @@ void DisplayLayoutScreen::CreateViews() {
}
}

Choice *back = new Choice(di->T("Back"), "", false);
back->OnClick.Handle<UIScreen>(this, &UIScreen::OnBack);
rightColumn->Add(back);

root_->Add(new DisplayLayoutBackground(mode_, new AnchorLayoutParams(FILL_PARENT, FILL_PARENT, 0.0f, 0.0f, 0.0f, 0.0f)));
}

0 comments on commit e46b036

Please sign in to comment.