mirror of
https://github.com/hrydgard/ppsspp.git
synced 2026-10-01 14:58:14 +00:00
AnchorLayout: Allow centering separately for horizontal and vertical
This commit is contained in:
1 parent
0453fb5449
commit
9de8e75709
16 files changed
+71
-61
No files matched your search
@@ -132,11 +132,11 @@ void PopupScreen::CreateViews() {
|
||||
if (!alignTop_) {
|
||||
// Standard centering etc.
|
||||
anchorParams = new AnchorLayoutParams(PopupWidth(), FillVertical() ? yres - 30 : WRAP_CONTENT,
|
||||
dc.GetBounds().centerX(), dc.GetBounds().centerY() + offsetY_, NONE, NONE, true);
|
||||
dc.GetBounds().centerX(), dc.GetBounds().centerY() + offsetY_, NONE, NONE, Centering::Both);
|
||||
} else {
|
||||
// Top-aligned, for dialogs where we need to pop a keyboard below.
|
||||
anchorParams = new AnchorLayoutParams(PopupWidth(), FillVertical() ? yres - 30 : WRAP_CONTENT,
|
||||
NONE, 0, NONE, NONE, false);
|
||||
NONE, 0, NONE, NONE, Centering::None);
|
||||
}
|
||||
|
||||
box_ = new LinearLayout(ORIENT_VERTICAL, anchorParams);
|
||||
@@ -250,7 +250,7 @@ void PopupContextMenuScreen::CreatePopupContents(UI::ViewGroup *parent) {
|
||||
|
||||
// Hacky: Override the position to look like a popup menu.
|
||||
AnchorLayoutParams *ap = (AnchorLayoutParams *)parent->GetLayoutParams();
|
||||
ap->center = false;
|
||||
ap->centering = Centering::None;
|
||||
ap->left = sourceView_->GetBounds().x;
|
||||
ap->top = sourceView_->GetBounds().y2();
|
||||
}
|
||||
|
||||
@@ -805,10 +805,12 @@ void AnchorLayout::MeasureViews(const UIContext &dc, MeasureSpec horiz, MeasureS
|
||||
width = params->width;
|
||||
height = params->height;
|
||||
|
||||
if (!params->center) {
|
||||
if (!(params->centering & Centering::Horizontal)) {
|
||||
if (params->left > NONE && params->right > NONE) {
|
||||
width = measuredWidth_ - params->left - params->right;
|
||||
}
|
||||
}
|
||||
if (!(params->centering & Centering::Vertical)) {
|
||||
if (params->top > NONE && params->bottom > NONE) {
|
||||
height = measuredHeight_ - params->top - params->bottom;
|
||||
}
|
||||
@@ -839,22 +841,22 @@ static void ApplyAnchorLayoutParams(float measuredWidth, float measuredHeight, c
|
||||
if (vBounds->h > container.h) vBounds->h = container.h;
|
||||
|
||||
float left = 0, top = 0, right = 0, bottom = 0;
|
||||
bool center = false;
|
||||
Centering centering = Centering::None;
|
||||
if (params) {
|
||||
left = params->left;
|
||||
top = params->top;
|
||||
right = params->right;
|
||||
bottom = params->bottom;
|
||||
center = params->center;
|
||||
centering = params->centering;
|
||||
}
|
||||
|
||||
if (left > NONE) {
|
||||
vBounds->x = container.x + left;
|
||||
if (center)
|
||||
if (centering & Centering::Horizontal)
|
||||
vBounds->x -= vBounds->w * 0.5f;
|
||||
} else if (right > NONE) {
|
||||
vBounds->x = container.x2() - right - vBounds->w;
|
||||
if (center) {
|
||||
if (centering & Centering::Horizontal) {
|
||||
vBounds->x += vBounds->w * 0.5f;
|
||||
}
|
||||
} else {
|
||||
@@ -864,11 +866,11 @@ static void ApplyAnchorLayoutParams(float measuredWidth, float measuredHeight, c
|
||||
|
||||
if (top > NONE) {
|
||||
vBounds->y = container.y + top;
|
||||
if (center)
|
||||
if (centering & Centering::Vertical)
|
||||
vBounds->y -= vBounds->h * 0.5f;
|
||||
} else if (bottom > NONE) {
|
||||
vBounds->y = container.y2() - bottom - vBounds->h;
|
||||
if (center)
|
||||
if (centering & Centering::Vertical)
|
||||
vBounds->y += vBounds->h * 0.5f;
|
||||
} else {
|
||||
// Both top and bottom are NONE. Center.
|
||||
|
||||
+15
-7
@@ -109,22 +109,30 @@ public:
|
||||
|
||||
const float NONE = -FLT_MAX;
|
||||
|
||||
enum class Centering {
|
||||
None = 0,
|
||||
Vertical = 1,
|
||||
Horizontal = 2,
|
||||
Both = 3, // 1 | 2
|
||||
};
|
||||
ENUM_CLASS_BITOPS(Centering);
|
||||
|
||||
class AnchorLayoutParams : public LayoutParams {
|
||||
public:
|
||||
AnchorLayoutParams(Size w, Size h, float l, float t, float r, float b, bool c = false)
|
||||
: LayoutParams(w, h, LP_ANCHOR), left(l), top(t), right(r), bottom(b), center(c) {}
|
||||
AnchorLayoutParams(Size w, Size h, float l, float t, float r, float b, Centering c = Centering::None)
|
||||
: LayoutParams(w, h, LP_ANCHOR), left(l), top(t), right(r), bottom(b), centering(c) {}
|
||||
// There's a small hack here to make this behave more intuitively - AnchorLayout ordinarily ignores FILL_PARENT.
|
||||
AnchorLayoutParams(Size w, Size h, bool c = false)
|
||||
: LayoutParams(w, h, LP_ANCHOR), left(0), top(0), right(w == FILL_PARENT ? 0 : NONE), bottom(h == FILL_PARENT ? 0 : NONE), center(c) {
|
||||
AnchorLayoutParams(Size w, Size h, Centering c = Centering::None)
|
||||
: LayoutParams(w, h, LP_ANCHOR), left(0), top(0), right(w == FILL_PARENT ? 0 : NONE), bottom(h == FILL_PARENT ? 0 : NONE), centering(c) {
|
||||
}
|
||||
AnchorLayoutParams(float l, float t, float r, float b, bool c = false)
|
||||
: LayoutParams(WRAP_CONTENT, WRAP_CONTENT, LP_ANCHOR), left(l), top(t), right(r), bottom(b), center(c) {}
|
||||
AnchorLayoutParams(float l, float t, float r, float b, Centering c = Centering::None)
|
||||
: LayoutParams(WRAP_CONTENT, WRAP_CONTENT, LP_ANCHOR), left(l), top(t), right(r), bottom(b), centering(c) {}
|
||||
|
||||
// These are not bounds, but distances from the container edges.
|
||||
// Set to NONE to not attach this edge to the container.
|
||||
// If two opposite edges are NONE, centering will happen.
|
||||
float left, top, right, bottom;
|
||||
bool center; // If set, only two "sides" can be set, and they refer to the center, not the edge, of the view being layouted.
|
||||
Centering centering; // If set, only two "sides" can be set, and they refer to the center, not the edge, of the view being layouted.
|
||||
|
||||
static LayoutParamsType StaticType() {
|
||||
return LP_ANCHOR;
|
||||
|
||||
+6
-6
@@ -59,22 +59,22 @@ void ChatMenu::CreateSubviews(const Bounds &screenBounds) {
|
||||
switch (g_Config.iChatScreenPosition) {
|
||||
// the chat screen size is still static 280x240 need a dynamic size based on device resolution
|
||||
case 0:
|
||||
box_ = new LinearLayout(ORIENT_VERTICAL, new AnchorLayoutParams(width, WRAP_CONTENT, 280, NONE, NONE, 240, true));
|
||||
box_ = new LinearLayout(ORIENT_VERTICAL, new AnchorLayoutParams(width, WRAP_CONTENT, 280, NONE, NONE, 240, Centering::Both));
|
||||
break;
|
||||
case 1:
|
||||
box_ = new LinearLayout(ORIENT_VERTICAL, new AnchorLayoutParams(width, WRAP_CONTENT, screenBounds.centerX(), NONE, NONE, 240, true));
|
||||
box_ = new LinearLayout(ORIENT_VERTICAL, new AnchorLayoutParams(width, WRAP_CONTENT, screenBounds.centerX(), NONE, NONE, 240, Centering::Both));
|
||||
break;
|
||||
case 2:
|
||||
box_ = new LinearLayout(ORIENT_VERTICAL, new AnchorLayoutParams(width, WRAP_CONTENT, NONE, NONE, 280, 240, true));
|
||||
box_ = new LinearLayout(ORIENT_VERTICAL, new AnchorLayoutParams(width, WRAP_CONTENT, NONE, NONE, 280, 240, Centering::Both));
|
||||
break;
|
||||
case 3:
|
||||
box_ = new LinearLayout(ORIENT_VERTICAL, new AnchorLayoutParams(width, WRAP_CONTENT, 280, 240, NONE, NONE, true));
|
||||
box_ = new LinearLayout(ORIENT_VERTICAL, new AnchorLayoutParams(width, WRAP_CONTENT, 280, 240, NONE, NONE, Centering::Both));
|
||||
break;
|
||||
case 4:
|
||||
box_ = new LinearLayout(ORIENT_VERTICAL, new AnchorLayoutParams(width, WRAP_CONTENT, screenBounds.centerX(), 240, NONE, NONE, true));
|
||||
box_ = new LinearLayout(ORIENT_VERTICAL, new AnchorLayoutParams(width, WRAP_CONTENT, screenBounds.centerX(), 240, NONE, NONE, Centering::Both));
|
||||
break;
|
||||
case 5:
|
||||
box_ = new LinearLayout(ORIENT_VERTICAL, new AnchorLayoutParams(width, WRAP_CONTENT, NONE, 240, 280, NONE, true));
|
||||
box_ = new LinearLayout(ORIENT_VERTICAL, new AnchorLayoutParams(width, WRAP_CONTENT, NONE, 240, 280, NONE, Centering::Both));
|
||||
break;
|
||||
default:
|
||||
box_ = nullptr;
|
||||
|
||||
@@ -900,7 +900,7 @@ void VisualMappingScreen::CreateViews() {
|
||||
bounds.w -= leftColumnWidth + 10.0f;
|
||||
|
||||
AnchorLayout *rightColumn = new AnchorLayout(new LinearLayoutParams(bounds.w, FILL_PARENT, 1.0f));
|
||||
psp_ = rightColumn->Add(new MockPSP(new AnchorLayoutParams(bounds.centerX(), bounds.centerY(), NONE, NONE, true)));
|
||||
psp_ = rightColumn->Add(new MockPSP(new AnchorLayoutParams(bounds.centerX(), bounds.centerY(), NONE, NONE, Centering::Both)));
|
||||
psp_->ButtonClick.Handle(this, &VisualMappingScreen::OnMapButton);
|
||||
|
||||
root_->Add(leftColumn);
|
||||
|
||||
@@ -94,7 +94,7 @@ private:
|
||||
class ButtonPreview : public UI::View {
|
||||
public:
|
||||
ButtonPreview(ImageID bgImg, ImageID img, float rotationIcon, bool flipShape, float rotationShape, int x, int y)
|
||||
: View(new UI::AnchorLayoutParams(x, y, UI::NONE, UI::NONE, true)), bgImg_(bgImg), img_(img), rotI_(rotationIcon),
|
||||
: View(new UI::AnchorLayoutParams(x, y, UI::NONE, UI::NONE, UI::Centering::Both)), bgImg_(bgImg), img_(img), rotI_(rotationIcon),
|
||||
flipS_(flipShape), rotS_(rotationShape), x_(x), y_(y) {}
|
||||
|
||||
void Draw(UIContext &dc) override {
|
||||
|
||||
@@ -218,7 +218,7 @@ void DisplayLayoutScreen::CreateViews() {
|
||||
|
||||
LinearLayout *leftColumn;
|
||||
if (!portrait) {
|
||||
ScrollView *leftScrollView = new ScrollView(ORIENT_VERTICAL, new AnchorLayoutParams(420.0f, FILL_PARENT, 0.f, 0.f, NONE, 0.f, false));
|
||||
ScrollView *leftScrollView = new ScrollView(ORIENT_VERTICAL, new AnchorLayoutParams(420.0f, FILL_PARENT, 0.f, 0.f, NONE, 0.f));
|
||||
leftColumn = new LinearLayout(ORIENT_VERTICAL);
|
||||
leftColumn->padding.SetAll(8.0f);
|
||||
leftScrollView->Add(leftColumn);
|
||||
@@ -226,7 +226,7 @@ void DisplayLayoutScreen::CreateViews() {
|
||||
root_->Add(leftScrollView);
|
||||
}
|
||||
|
||||
ScrollView *rightScrollView = new ScrollView(ORIENT_VERTICAL, new AnchorLayoutParams(300.0f, FILL_PARENT, NONE, 0.f, 0.f, 0.f, false));
|
||||
ScrollView *rightScrollView = new ScrollView(ORIENT_VERTICAL, new AnchorLayoutParams(300.0f, FILL_PARENT, NONE, 0.f, 0.f, 0.f));
|
||||
LinearLayout *rightColumn = new LinearLayout(ORIENT_VERTICAL);
|
||||
rightColumn->padding.SetAll(8.0f);
|
||||
rightScrollView->Add(rightColumn);
|
||||
@@ -239,7 +239,7 @@ void DisplayLayoutScreen::CreateViews() {
|
||||
rightColumn->Add(bottomControls);
|
||||
leftColumn = rightColumn;
|
||||
} else {
|
||||
bottomControls = new LinearLayout(ORIENT_HORIZONTAL, new AnchorLayoutParams(NONE, NONE, NONE, 10.0f, false));
|
||||
bottomControls = new LinearLayout(ORIENT_HORIZONTAL, new AnchorLayoutParams(NONE, NONE, NONE, 10.0f));
|
||||
root_->Add(bottomControls);
|
||||
}
|
||||
|
||||
|
||||
+13
-13
@@ -1226,15 +1226,15 @@ protected:
|
||||
static UI::AnchorLayoutParams *AnchorInCorner(const Bounds &bounds, int corner, float xOffset, float yOffset) {
|
||||
using namespace UI;
|
||||
switch ((ScreenEdgePosition)g_Config.iChatButtonPosition) {
|
||||
case ScreenEdgePosition::BOTTOM_LEFT: return new AnchorLayoutParams(WRAP_CONTENT, WRAP_CONTENT, xOffset, NONE, NONE, yOffset, true);
|
||||
case ScreenEdgePosition::BOTTOM_CENTER: return new AnchorLayoutParams(WRAP_CONTENT, WRAP_CONTENT, bounds.centerX(), NONE, NONE, yOffset, true);
|
||||
case ScreenEdgePosition::BOTTOM_RIGHT: return new AnchorLayoutParams(WRAP_CONTENT, WRAP_CONTENT, NONE, NONE, xOffset, yOffset, true);
|
||||
case ScreenEdgePosition::TOP_LEFT: return new AnchorLayoutParams(WRAP_CONTENT, WRAP_CONTENT, xOffset, yOffset, NONE, NONE, true);
|
||||
case ScreenEdgePosition::TOP_CENTER: return new AnchorLayoutParams(WRAP_CONTENT, WRAP_CONTENT, bounds.centerX(), yOffset, NONE, NONE, true);
|
||||
case ScreenEdgePosition::TOP_RIGHT: return new AnchorLayoutParams(WRAP_CONTENT, WRAP_CONTENT, NONE, yOffset, xOffset, NONE, true);
|
||||
case ScreenEdgePosition::CENTER_LEFT: return new AnchorLayoutParams(WRAP_CONTENT, WRAP_CONTENT, xOffset, bounds.centerY(), NONE, NONE, true);
|
||||
case ScreenEdgePosition::CENTER_RIGHT: return new AnchorLayoutParams(WRAP_CONTENT, WRAP_CONTENT, NONE, bounds.centerY(), xOffset, NONE, true);
|
||||
default: return new AnchorLayoutParams(WRAP_CONTENT, WRAP_CONTENT, xOffset, NONE, NONE, yOffset, true);
|
||||
case ScreenEdgePosition::BOTTOM_LEFT: return new AnchorLayoutParams(WRAP_CONTENT, WRAP_CONTENT, xOffset, NONE, NONE, yOffset, Centering::Both);
|
||||
case ScreenEdgePosition::BOTTOM_CENTER: return new AnchorLayoutParams(WRAP_CONTENT, WRAP_CONTENT, bounds.centerX(), NONE, NONE, yOffset, Centering::Both);
|
||||
case ScreenEdgePosition::BOTTOM_RIGHT: return new AnchorLayoutParams(WRAP_CONTENT, WRAP_CONTENT, NONE, NONE, xOffset, yOffset, Centering::Both);
|
||||
case ScreenEdgePosition::TOP_LEFT: return new AnchorLayoutParams(WRAP_CONTENT, WRAP_CONTENT, xOffset, yOffset, NONE, NONE, Centering::Both);
|
||||
case ScreenEdgePosition::TOP_CENTER: return new AnchorLayoutParams(WRAP_CONTENT, WRAP_CONTENT, bounds.centerX(), yOffset, NONE, NONE, Centering::Both);
|
||||
case ScreenEdgePosition::TOP_RIGHT: return new AnchorLayoutParams(WRAP_CONTENT, WRAP_CONTENT, NONE, yOffset, xOffset, NONE, Centering::Both);
|
||||
case ScreenEdgePosition::CENTER_LEFT: return new AnchorLayoutParams(WRAP_CONTENT, WRAP_CONTENT, xOffset, bounds.centerY(), NONE, NONE, Centering::Both);
|
||||
case ScreenEdgePosition::CENTER_RIGHT: return new AnchorLayoutParams(WRAP_CONTENT, WRAP_CONTENT, NONE, bounds.centerY(), xOffset, NONE, Centering::Both);
|
||||
default: return new AnchorLayoutParams(WRAP_CONTENT, WRAP_CONTENT, xOffset, NONE, NONE, yOffset, Centering::Both);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1260,7 +1260,7 @@ void EmuScreen::CreateViews() {
|
||||
root_->Add(new Button(dev->T("DevMenu")))->OnClick.Handle(this, &EmuScreen::OnDevTools);
|
||||
}
|
||||
|
||||
LinearLayout *buttons = new LinearLayout(Orientation::ORIENT_HORIZONTAL, new AnchorLayoutParams(bounds.centerX(), NONE, NONE, 60, true));
|
||||
LinearLayout *buttons = new LinearLayout(Orientation::ORIENT_HORIZONTAL, new AnchorLayoutParams(bounds.centerX(), NONE, NONE, 60, Centering::Both));
|
||||
buttons->SetSpacing(20.0f);
|
||||
root_->Add(buttons);
|
||||
|
||||
@@ -1288,7 +1288,7 @@ void EmuScreen::CreateViews() {
|
||||
});
|
||||
backButton_->SetVisibility(V_GONE);
|
||||
|
||||
cardboardDisableButton_ = root_->Add(new Button(sc->T("Cardboard VR OFF"), new AnchorLayoutParams(bounds.centerX(), NONE, NONE, 30, true)));
|
||||
cardboardDisableButton_ = root_->Add(new Button(sc->T("Cardboard VR OFF"), new AnchorLayoutParams(bounds.centerX(), NONE, NONE, 30, Centering::Both)));
|
||||
DeviceOrientation orientation = GetDeviceOrientation();
|
||||
cardboardDisableButton_->OnClick.Add([deviceOrientation](UI::EventParams &) {
|
||||
DisplayLayoutConfig &config = g_Config.GetDisplayLayoutConfig(deviceOrientation);
|
||||
@@ -1311,7 +1311,7 @@ void EmuScreen::CreateViews() {
|
||||
chatMenu_->SetVisibility(UI::V_GONE);
|
||||
}
|
||||
|
||||
saveStatePreview_ = new AsyncImageFileView(Path(), IS_FIXED, new AnchorLayoutParams(bounds.centerX(), 100, NONE, NONE, true));
|
||||
saveStatePreview_ = new AsyncImageFileView(Path(), IS_FIXED, new AnchorLayoutParams(bounds.centerX(), 100, NONE, NONE, Centering::Both));
|
||||
saveStatePreview_->SetFixedSize(160, 90);
|
||||
saveStatePreview_->SetColor(0x90FFFFFF);
|
||||
saveStatePreview_->SetVisibility(V_GONE);
|
||||
@@ -1327,7 +1327,7 @@ void EmuScreen::CreateViews() {
|
||||
ImageID("I_TRIANGLE"),
|
||||
};
|
||||
|
||||
Spinner *loadingSpinner = root_->Add(new Spinner(symbols, ARRAY_SIZE(symbols), new AnchorLayoutParams(NONE, NONE, 45, 45, true)));
|
||||
Spinner *loadingSpinner = root_->Add(new Spinner(symbols, ARRAY_SIZE(symbols), new AnchorLayoutParams(NONE, NONE, 45, 45, Centering::Both)));
|
||||
loadingSpinner_ = loadingSpinner;
|
||||
|
||||
loadingBG->SetTag("LoadingBG");
|
||||
|
||||
@@ -301,7 +301,7 @@ void GPUDriverTestScreen::CreateViews() {
|
||||
AnchorLayout *anchor = new AnchorLayout();
|
||||
root_ = anchor;
|
||||
|
||||
tabHolder_ = new TabHolder(ORIENT_HORIZONTAL, 30.0f, TabHolderFlags::Default, nullptr, new AnchorLayoutParams(FILL_PARENT, FILL_PARENT, false));
|
||||
tabHolder_ = new TabHolder(ORIENT_HORIZONTAL, 30.0f, TabHolderFlags::Default, nullptr, new AnchorLayoutParams(FILL_PARENT, FILL_PARENT, Centering::None));
|
||||
anchor->Add(tabHolder_);
|
||||
tabHolder_->AddTab("Discard", ImageID::invalid(), new LinearLayout(ORIENT_VERTICAL));
|
||||
tabHolder_->AddTab("Shader", ImageID::invalid(), new LinearLayout(ORIENT_VERTICAL));
|
||||
|
||||
+2
-2
@@ -888,7 +888,7 @@ UI::ViewGroup *CreatePadLayout(const TouchControlConfig &config, float xres, flo
|
||||
float y;
|
||||
};
|
||||
auto buttonLayoutParams = [=](const ConfigTouchPos &touch, ButtonOffset off = { 0, 0 }) {
|
||||
return new AnchorLayoutParams(touch.x * xres + off.x, touch.y * yres + off.y, NONE, NONE, true);
|
||||
return new AnchorLayoutParams(touch.x * xres + off.x, touch.y * yres + off.y, NONE, NONE, Centering::Both);
|
||||
};
|
||||
|
||||
// Space between the PSP buttons (traingle, circle, square and cross)
|
||||
@@ -937,7 +937,7 @@ UI::ViewGroup *CreatePadLayout(const TouchControlConfig &config, float xres, flo
|
||||
};
|
||||
|
||||
if (showPauseButton) {
|
||||
root->Add(new BoolButton(pause, "Pause button", roundImage, ImageID("I_ROUND"), ImageID("I_ARROW"), 1.0f, new AnchorLayoutParams(halfW, 20, NONE, NONE, true)))->SetAngle(90);
|
||||
root->Add(new BoolButton(pause, "Pause button", roundImage, ImageID("I_ROUND"), ImageID("I_ARROW"), 1.0f, new AnchorLayoutParams(halfW, 20, NONE, NONE, Centering::Both)))->SetAngle(90);
|
||||
}
|
||||
|
||||
// touchActionButtonCenter.show will always be true, since that's the default.
|
||||
|
||||
+4
-4
@@ -1135,11 +1135,11 @@ UI::ViewGroup *MainScreen::CreateLogoView(bool portrait, UI::LayoutParams *layou
|
||||
using namespace UI;
|
||||
AnchorLayout *logos = new AnchorLayout(layoutParams);
|
||||
if (System_GetPropertyBool(SYSPROP_APP_GOLD)) {
|
||||
logos->Add(new ImageView(ImageID("I_ICON_GOLD"), "", IS_DEFAULT, new AnchorLayoutParams(64, 64, 0, 0, NONE, NONE, false)));
|
||||
logos->Add(new ImageView(ImageID("I_ICON_GOLD"), "", IS_DEFAULT, new AnchorLayoutParams(64, 64, 0, 0, NONE, NONE)));
|
||||
} else {
|
||||
logos->Add(new ImageView(ImageID("I_ICON"), "", IS_DEFAULT, new AnchorLayoutParams(64, 64, 0, 0, NONE, NONE, false)));
|
||||
logos->Add(new ImageView(ImageID("I_ICON"), "", IS_DEFAULT, new AnchorLayoutParams(64, 64, 0, 0, NONE, NONE)));
|
||||
}
|
||||
logos->Add(new ImageView(ImageID("I_LOGO"), "PPSSPP", IS_DEFAULT, new AnchorLayoutParams(180, 64, 68, 2, NONE, NONE, false)));
|
||||
logos->Add(new ImageView(ImageID("I_LOGO"), "PPSSPP", IS_DEFAULT, new AnchorLayoutParams(180, 64, 68, 2, NONE, NONE)));
|
||||
|
||||
std::string versionString = PPSSPP_GIT_VERSION;
|
||||
// Strip the 'v' from the displayed version, and shorten the commit hash.
|
||||
@@ -1325,7 +1325,7 @@ void MainScreen::CreateViews() {
|
||||
#if !defined(MOBILE_DEVICE)
|
||||
auto gr = GetI18NCategory(I18NCat::GRAPHICS);
|
||||
ImageID icon(g_Config.UseFullScreen() ? "I_RESTORE" : "I_FULLSCREEN");
|
||||
fullscreenButton_ = logo->Add(new Button(gr->T("FullScreen", "Full Screen"), icon, new AnchorLayoutParams(48, 48, NONE, 0, 0, NONE, false)));
|
||||
fullscreenButton_ = logo->Add(new Button(gr->T("FullScreen", "Full Screen"), icon, new AnchorLayoutParams(48, 48, NONE, 0, 0, NONE, Centering::None)));
|
||||
fullscreenButton_->SetIgnoreText(true);
|
||||
fullscreenButton_->OnClick.Handle(this, &MainScreen::OnFullScreenToggle);
|
||||
#endif
|
||||
|
||||
+2
-2
@@ -83,9 +83,9 @@ void SettingInfoMessage::Show(std::string_view text, const UI::View *refView) {
|
||||
const UI::AnchorLayoutParams *lp = GetLayoutParams()->As<UI::AnchorLayoutParams>();
|
||||
if (lp) {
|
||||
if (cutOffY_ != -1.0f && b.y >= cutOffY_) {
|
||||
ReplaceLayoutParams(new UI::AnchorLayoutParams(lp->width, lp->height, lp->left, 80.0f, lp->right, lp->bottom, lp->center));
|
||||
ReplaceLayoutParams(new UI::AnchorLayoutParams(lp->width, lp->height, lp->left, 80.0f, lp->right, lp->bottom, lp->centering));
|
||||
} else {
|
||||
ReplaceLayoutParams(new UI::AnchorLayoutParams(lp->width, lp->height, lp->left, g_display.dp_yres - 80.0f - 40.0f, lp->right, lp->bottom, lp->center));
|
||||
ReplaceLayoutParams(new UI::AnchorLayoutParams(lp->width, lp->height, lp->left, g_display.dp_yres - 80.0f - 40.0f, lp->right, lp->bottom, lp->centering));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -67,7 +67,7 @@ void UITabbedBaseDialogScreen::CreateViews() {
|
||||
if (flags_ & TabDialogFlags::VerticalShowIcons) {
|
||||
tabHolderFlags |= TabHolderFlags::VerticalShowIcons;
|
||||
}
|
||||
tabHolder_ = new TabHolder(ORIENT_VERTICAL, 300, tabHolderFlags, filterNotice_, new AnchorLayoutParams(10, 0, 10, 0, false));
|
||||
tabHolder_ = new TabHolder(ORIENT_VERTICAL, 300, tabHolderFlags, filterNotice_, new AnchorLayoutParams(10, 0, 10, 0));
|
||||
CreateExtraButtons(tabHolder_->Container(), 10);
|
||||
tabHolder_->AddBack(this);
|
||||
root_->Add(tabHolder_);
|
||||
|
||||
@@ -44,7 +44,7 @@ void TiltAnalogSettingsScreen::CreateCalibrationView(UI::ViewGroup *parent, UI::
|
||||
switch (g_Config.iTiltInputType) {
|
||||
case TILT_DPAD:
|
||||
{
|
||||
parent->Add(new PSPDpad(ImageID("I_DIR_LINE"), "D-pad", ImageID("I_DIR_LINE"), ImageID("I_ARROW"), 1.5f, 1.3f, new AnchorLayoutParams(NONE, NONE, NONE, NONE, true)));
|
||||
parent->Add(new PSPDpad(ImageID("I_DIR_LINE"), "D-pad", ImageID("I_DIR_LINE"), ImageID("I_ARROW"), 1.5f, 1.3f, new AnchorLayoutParams(NONE, NONE, NONE, NONE, Centering::Both)));
|
||||
break;
|
||||
}
|
||||
case TILT_ACTION_BUTTON:
|
||||
@@ -52,10 +52,10 @@ void TiltAnalogSettingsScreen::CreateCalibrationView(UI::ViewGroup *parent, UI::
|
||||
AnchorLayout *rightSide = new AnchorLayout(layoutParams);
|
||||
parent->Add(rightSide);
|
||||
|
||||
PSPButton *circle = new PSPButton(CTRL_CIRCLE, "Circle button", ImageID("I_ROUND_LINE"), ImageID("I_ROUND"), ImageID("I_CIRCLE"), 1.5f, new AnchorLayoutParams(NONE, NONE, 100.0f, NONE, true));
|
||||
PSPButton *cross = new PSPButton(CTRL_CROSS, "Cross button", ImageID("I_ROUND_LINE"), ImageID("I_ROUND"), ImageID("I_CROSS"), 1.5f, new AnchorLayoutParams(NONE, NONE, NONE, 100.0f, true));
|
||||
PSPButton *triangle = new PSPButton(CTRL_TRIANGLE, "Triangle button", ImageID("I_ROUND_LINE"), ImageID("I_ROUND"), ImageID("I_TRIANGLE"), 1.5f, new AnchorLayoutParams(NONE, 100.0f, NONE, NONE, true));
|
||||
PSPButton *square = new PSPButton(CTRL_SQUARE, "Square button", ImageID("I_ROUND_LINE"), ImageID("I_ROUND"), ImageID("I_SQUARE"), 1.5f, new AnchorLayoutParams(100.0f, NONE, NONE, NONE, true));
|
||||
PSPButton *circle = new PSPButton(CTRL_CIRCLE, "Circle button", ImageID("I_ROUND_LINE"), ImageID("I_ROUND"), ImageID("I_CIRCLE"), 1.5f, new AnchorLayoutParams(NONE, NONE, 100.0f, NONE, Centering::Both));
|
||||
PSPButton *cross = new PSPButton(CTRL_CROSS, "Cross button", ImageID("I_ROUND_LINE"), ImageID("I_ROUND"), ImageID("I_CROSS"), 1.5f, new AnchorLayoutParams(NONE, NONE, NONE, 100.0f, Centering::Both));
|
||||
PSPButton *triangle = new PSPButton(CTRL_TRIANGLE, "Triangle button", ImageID("I_ROUND_LINE"), ImageID("I_ROUND"), ImageID("I_TRIANGLE"), 1.5f, new AnchorLayoutParams(NONE, 100.0f, NONE, NONE, Centering::Both));
|
||||
PSPButton *square = new PSPButton(CTRL_SQUARE, "Square button", ImageID("I_ROUND_LINE"), ImageID("I_ROUND"), ImageID("I_SQUARE"), 1.5f, new AnchorLayoutParams(100.0f, NONE, NONE, NONE, Centering::Both));
|
||||
rightSide->Add(circle);
|
||||
rightSide->Add(cross);
|
||||
rightSide->Add(triangle);
|
||||
@@ -67,8 +67,8 @@ void TiltAnalogSettingsScreen::CreateCalibrationView(UI::ViewGroup *parent, UI::
|
||||
AnchorLayout *rightSide = new AnchorLayout(layoutParams);
|
||||
parent->Add(rightSide);
|
||||
|
||||
PSPButton *lTrigger = new PSPButton(CTRL_LTRIGGER, "Left shoulder button", ImageID("I_SHOULDER_LINE"), ImageID("I_SHOULDER"), ImageID("I_L"), 1.5f, new AnchorLayoutParams(100.0f, NONE, NONE, NONE, true));
|
||||
PSPButton *rTrigger = new PSPButton(CTRL_RTRIGGER, "Right shoulder button", ImageID("I_SHOULDER_LINE"), ImageID("I_SHOULDER"), ImageID("I_R"), 1.5f, new AnchorLayoutParams(NONE, NONE, 100.0f, NONE, true));
|
||||
PSPButton *lTrigger = new PSPButton(CTRL_LTRIGGER, "Left shoulder button", ImageID("I_SHOULDER_LINE"), ImageID("I_SHOULDER"), ImageID("I_L"), 1.5f, new AnchorLayoutParams(100.0f, NONE, NONE, NONE, Centering::Both));
|
||||
PSPButton *rTrigger = new PSPButton(CTRL_RTRIGGER, "Right shoulder button", ImageID("I_SHOULDER_LINE"), ImageID("I_SHOULDER"), ImageID("I_R"), 1.5f, new AnchorLayoutParams(NONE, NONE, 100.0f, NONE, Centering::Both));
|
||||
rTrigger->FlipImageH(true);
|
||||
rightSide->Add(lTrigger);
|
||||
rightSide->Add(rTrigger);
|
||||
|
||||
@@ -44,7 +44,7 @@ static u32 GetButtonColor() {
|
||||
class DragDropButton : public MultiTouchButton {
|
||||
public:
|
||||
DragDropButton(ConfigTouchPos &pos, const char *key, ImageID bgImg, ImageID img, const Bounds &screenBounds)
|
||||
: MultiTouchButton(key, bgImg, bgImg, img, pos.scale, new UI::AnchorLayoutParams(pos.x * screenBounds.w, pos.y * screenBounds.h, UI::NONE, UI::NONE, true)),
|
||||
: MultiTouchButton(key, bgImg, bgImg, img, pos.scale, new UI::AnchorLayoutParams(pos.x * screenBounds.w, pos.y * screenBounds.h, UI::NONE, UI::NONE, UI::Centering::Both)),
|
||||
x_(pos.x), y_(pos.y), theScale_(pos.scale), screenBounds_(screenBounds) {
|
||||
scale_ = theScale_;
|
||||
}
|
||||
@@ -412,7 +412,7 @@ bool ControlLayoutView::Touch(const TouchInput &touch) {
|
||||
}
|
||||
|
||||
newPos = ClampTo(newPos, validRange);
|
||||
pickedControl_->ReplaceLayoutParams(new AnchorLayoutParams(newPos.x, newPos.y, NONE, NONE, true));
|
||||
pickedControl_->ReplaceLayoutParams(new AnchorLayoutParams(newPos.x, newPos.y, NONE, NONE, Centering::Both));
|
||||
} else if (mode_ == 1) {
|
||||
// Resize. Vertical = scaling, horizontal = spacing;
|
||||
// Up should be bigger so let's negate in that direction
|
||||
|
||||
@@ -155,7 +155,7 @@ void RightAnalogMappingScreen::CreateViews() {
|
||||
root_ = new AnchorLayout(new LayoutParams(FILL_PARENT, FILL_PARENT));
|
||||
Choice *back = new Choice(di->T("Back"), ImageID("I_NAVIGATE_BACK"), new AnchorLayoutParams(leftColumnWidth - 10, WRAP_CONTENT, 10, NONE, NONE, 10));
|
||||
root_->Add(back)->OnClick.Handle<UIScreen>(this, &UIScreen::OnBack);
|
||||
TabHolder *tabHolder = new TabHolder(ORIENT_VERTICAL, leftColumnWidth, TabHolderFlags::Default, nullptr, new AnchorLayoutParams(10, 0, 10, 0, false));
|
||||
TabHolder *tabHolder = new TabHolder(ORIENT_VERTICAL, leftColumnWidth, TabHolderFlags::Default, nullptr, new AnchorLayoutParams(10, 0, 10, 0, Centering::None));
|
||||
root_->Add(tabHolder);
|
||||
ScrollView *rightPanel = new ScrollView(ORIENT_VERTICAL);
|
||||
tabHolder->AddTab(co->T("Binds"), ImageID::invalid(), rightPanel);
|
||||
|
||||
Reference in new issue
Block a user