diff --git a/Common/UI/View.cpp b/Common/UI/View.cpp index 587db038ab..3b447574c7 100644 --- a/Common/UI/View.cpp +++ b/Common/UI/View.cpp @@ -25,18 +25,18 @@ static constexpr Size ITEM_HEIGHT = 64.f; static constexpr float MIN_TEXT_SCALE = 0.8f; static constexpr float MAX_ITEM_SIZE = 65535.0f; -void MeasureBySpec(Size sz, float contentWidth, MeasureSpec spec, float *measured) { +void MeasureBySpec(Size sz, float contentDim, MeasureSpec spec, float *measured) { if (sz == WRAP_CONTENT) { if (spec.type == UNSPECIFIED) - *measured = contentWidth; + *measured = contentDim; else if (spec.type == AT_MOST) - *measured = contentWidth < spec.size ? contentWidth : spec.size; + *measured = contentDim < spec.size ? contentDim : spec.size; else if (spec.type == EXACTLY) *measured = spec.size; } else if (sz == FILL_PARENT) { // UNSPECIFIED may have a minimum size of the parent. Let's use it to fill. if (spec.type == UNSPECIFIED) - *measured = std::max(spec.size, contentWidth); + *measured = std::max(spec.size, contentDim); else *measured = spec.size; } else if (spec.type == EXACTLY || (spec.type == AT_MOST && *measured > spec.size)) { @@ -46,7 +46,7 @@ void MeasureBySpec(Size sz, float contentWidth, MeasureSpec spec, float *measure } } -void ApplyBoundBySpec(float &bound, MeasureSpec spec) { +static void ApplyBoundBySpec(float &bound, MeasureSpec spec) { switch (spec.type) { case AT_MOST: bound = bound < spec.size ? bound : spec.size; @@ -122,9 +122,8 @@ void View::Measure(const UIContext &dc, MeasureSpec horiz, MeasureSpec vert) { MeasureBySpec(layoutParams_->height, contentH, vert, &measuredHeight_); } -// Default values - void View::GetContentDimensions(const UIContext &dc, float &w, float &h) const { + // Default values w = 10.0f; h = 10.0f; } diff --git a/Core/Config.cpp b/Core/Config.cpp index da1c279033..e322f6dbcf 100644 --- a/Core/Config.cpp +++ b/Core/Config.cpp @@ -789,8 +789,8 @@ static const ConfigSetting networkSettings[] = { ConfigSetting("UPnPUseOriginalPort", &g_Config.bUPnPUseOriginalPort, false, CfgFlag::PER_GAME), ConfigSetting("EnableNetworkChat", &g_Config.bEnableNetworkChat, false, CfgFlag::PER_GAME), - ConfigSetting("ChatButtonPosition",&g_Config.iChatButtonPosition,BOTTOM_LEFT, CfgFlag::PER_GAME), - ConfigSetting("ChatScreenPosition",&g_Config.iChatScreenPosition,BOTTOM_LEFT, CfgFlag::PER_GAME), + ConfigSetting("ChatButtonPosition", &g_Config.iChatButtonPosition, (int)ScreenEdgePosition::BOTTOM_LEFT, CfgFlag::PER_GAME), + ConfigSetting("ChatScreenPosition", &g_Config.iChatScreenPosition, (int)ScreenEdgePosition::BOTTOM_LEFT, CfgFlag::PER_GAME), ConfigSetting("EnableQuickChat", &g_Config.bEnableQuickChat, true, CfgFlag::PER_GAME), ConfigSetting("QuickChat1", &g_Config.sQuickChat0, "Quick Chat 1", CfgFlag::PER_GAME), ConfigSetting("QuickChat2", &g_Config.sQuickChat1, "Quick Chat 2", CfgFlag::PER_GAME), diff --git a/Core/Config.h b/Core/Config.h index aabc73fd02..d6af7aeffb 100644 --- a/Core/Config.h +++ b/Core/Config.h @@ -29,7 +29,7 @@ extern const char *PPSSPP_GIT_VERSION; -enum ChatPositions { +enum class ScreenEdgePosition { BOTTOM_LEFT = 0, BOTTOM_CENTER = 1, BOTOM_RIGHT = 2, diff --git a/UI/EmuScreen.cpp b/UI/EmuScreen.cpp index aeeea0be4c..8e87463697 100644 --- a/UI/EmuScreen.cpp +++ b/UI/EmuScreen.cpp @@ -894,15 +894,15 @@ protected: // TODO: Shouldn't actually need bounds for this, Anchor can center too. static UI::AnchorLayoutParams *AnchorInCorner(const Bounds &bounds, int corner, float xOffset, float yOffset) { using namespace UI; - switch (g_Config.iChatButtonPosition) { - case 0: return new AnchorLayoutParams(WRAP_CONTENT, WRAP_CONTENT, xOffset, NONE, NONE, yOffset, true); - case 1: return new AnchorLayoutParams(WRAP_CONTENT, WRAP_CONTENT, bounds.centerX(), NONE, NONE, yOffset, true); - case 2: return new AnchorLayoutParams(WRAP_CONTENT, WRAP_CONTENT, NONE, NONE, xOffset, yOffset, true); - case 3: return new AnchorLayoutParams(WRAP_CONTENT, WRAP_CONTENT, xOffset, yOffset, NONE, NONE, true); - case 4: return new AnchorLayoutParams(WRAP_CONTENT, WRAP_CONTENT, bounds.centerX(), yOffset, NONE, NONE, true); - case 5: return new AnchorLayoutParams(WRAP_CONTENT, WRAP_CONTENT, NONE, yOffset, xOffset, NONE, true); - case 6: return new AnchorLayoutParams(WRAP_CONTENT, WRAP_CONTENT, xOffset, bounds.centerY(), NONE, NONE, true); - case 7: return new AnchorLayoutParams(WRAP_CONTENT, WRAP_CONTENT, NONE, bounds.centerY(), xOffset, NONE, true); + 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::BOTOM_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); } }