mirror of
https://github.com/hrydgard/ppsspp.git
synced 2026-10-14 15:00:30 +02:00
Fix more centering and sizing bugs
This commit is contained in:
1 parent
d54fb5097a
commit
c634e73885
5 files changed
+26
-7
No files matched your search
@@ -160,7 +160,7 @@ void PopupScreen::CreateViews() {
|
||||
10, y, 10, NONE, vCentering);
|
||||
} else {
|
||||
anchorParams = new AnchorLayoutParams(popupWidth, ySize,
|
||||
dc.GetLayoutBounds().centerX(), y, NONE, NONE, vCentering | Centering::Horizontal);
|
||||
(dc.GetLayoutBounds().w - RootMargins().horiz()) * 0.5, y, NONE, NONE, vCentering | Centering::Horizontal);
|
||||
}
|
||||
|
||||
box_ = new LinearLayout(ORIENT_VERTICAL, anchorParams);
|
||||
|
||||
@@ -43,7 +43,7 @@ public:
|
||||
notificationLevel_ = noticeLevel;
|
||||
notificationString_ = str;
|
||||
}
|
||||
virtual UI::Margins RootMargins() const { return UI::Margins(24); }
|
||||
virtual UI::Margins RootMargins() const { return UI::Margins(12, 24); }
|
||||
|
||||
protected:
|
||||
virtual bool FillVertical() const { return false; }
|
||||
|
||||
+18
-2
@@ -386,7 +386,7 @@ void StickyChoice::FocusChanged(int focusFlags) {
|
||||
Item::Item(LayoutParams *layoutParams) : InertView(layoutParams) {
|
||||
if (!layoutParams) {
|
||||
layoutParams_->width = FILL_PARENT;
|
||||
layoutParams_->height = ITEM_HEIGHT;
|
||||
layoutParams_->height = WRAP_CONTENT;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -545,6 +545,22 @@ InfoItem::InfoItem(std::string_view text, std::string_view rightText, LayoutPara
|
||||
// We set the colors later once we have a UIContext.
|
||||
}
|
||||
|
||||
void InfoItem::GetContentDimensionsBySpec(const UIContext &dc, MeasureSpec horiz, MeasureSpec vert, float &w, float &h) const {
|
||||
float w1, h1, w2, h2;
|
||||
dc.MeasureText(dc.GetTheme().uiFont, 1.0f, 1.0f, text_, &w1, &h1, 0);
|
||||
|
||||
if (horiz.type == MeasureSpecType::AT_MOST) {
|
||||
float availableWidth = horiz.size - w1 - 24;
|
||||
dc.MeasureTextRect(dc.GetTheme().uiFont, 1.0f, 1.0f, rightText_, availableWidth, &w2, &h2, FLAG_WRAP_TEXT);
|
||||
} else {
|
||||
dc.MeasureText(dc.GetTheme().uiFont, 1.0f, 1.0f, rightText_, &w2, &h2, 0);
|
||||
}
|
||||
|
||||
// TODO: Make this more exact.
|
||||
w = 24 + w1 + w2;
|
||||
h = std::max(std::max(h1, h2), ITEM_HEIGHT);
|
||||
}
|
||||
|
||||
void InfoItem::Draw(UIContext &dc) {
|
||||
Item::Draw(dc);
|
||||
|
||||
@@ -573,7 +589,7 @@ std::string InfoItem::DescribeText() const {
|
||||
ItemHeader::ItemHeader(std::string_view text, LayoutParams *layoutParams)
|
||||
: Item(layoutParams), text_(text) {
|
||||
layoutParams_->width = FILL_PARENT;
|
||||
layoutParams_->height = 40;
|
||||
layoutParams_->height = 44;
|
||||
}
|
||||
|
||||
void ItemHeader::Draw(UIContext &dc) {
|
||||
|
||||
@@ -834,6 +834,8 @@ public:
|
||||
void SetRightText(std::string_view text) {
|
||||
rightText_ = text;
|
||||
}
|
||||
protected:
|
||||
void GetContentDimensionsBySpec(const UIContext &dc, MeasureSpec horiz, MeasureSpec vert, float &w, float &h) const;
|
||||
|
||||
private:
|
||||
std::string text_;
|
||||
|
||||
@@ -77,12 +77,13 @@ void SystemInfoScreen::CreateTabs() {
|
||||
|
||||
auto si = GetI18NCategory(I18NCat::SYSINFO);
|
||||
|
||||
AddTab("Device Info", si->T("Device Info"), [this](UI::LinearLayout *parent) {
|
||||
CreateDeviceInfoTab(parent);
|
||||
});
|
||||
AddTab("Storage", si->T("Storage"), [this](UI::LinearLayout *parent) {
|
||||
CreateStorageTab(parent);
|
||||
});
|
||||
|
||||
AddTab("Device Info", si->T("Device Info"), [this](UI::LinearLayout *parent) {
|
||||
CreateDeviceInfoTab(parent);
|
||||
});
|
||||
AddTab("DevSystemInfoBuildConfig", si->T("Build Config"), [this](UI::LinearLayout *parent) {
|
||||
CreateBuildConfigTab(parent);
|
||||
});
|
||||
|
||||
Reference in new issue
Block a user