Skip to content

Commit f808df5

Browse files
authored
change default font to Segoe UI (#1323)
1 parent 85842ea commit f808df5

15 files changed

Lines changed: 314 additions & 264 deletions

src/RA_Resource.h

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -154,6 +154,7 @@
154154
#define IDC_RA_ADD_REGION 1249
155155
#define IDC_RA_REMOVE_REGION 1250
156156
#define IDC_RA_VIEW_DETAIL 1251
157+
#define IDC_RA_LBL_VALUE 1252
157158

158159

159160
#define IDD_RA_MEMORY 1501
@@ -226,7 +227,7 @@
226227
#ifndef APSTUDIO_READONLY_SYMBOLS
227228
#define _APS_NEXT_RESOURCE_VALUE 122
228229
#define _APS_NEXT_COMMAND_VALUE 40001
229-
#define _APS_NEXT_CONTROL_VALUE 1252
230+
#define _APS_NEXT_CONTROL_VALUE 1253
230231
#define _APS_NEXT_SYMED_VALUE 101
231232
#endif
232233
#endif

src/RA_Shared.rc

Lines changed: 214 additions & 213 deletions
Large diffs are not rendered by default.

src/ui/win32/AssetEditorDialog.cpp

Lines changed: 21 additions & 34 deletions
Original file line numberDiff line numberDiff line change
@@ -32,23 +32,14 @@ namespace ui {
3232
namespace win32 {
3333

3434
static constexpr int COLUMN_WIDTH_ID = 30;
35-
static constexpr int COLUMN_WIDTH_FLAG = 78;
36-
static constexpr int COLUMN_WIDTH_TYPE = 42;
37-
static constexpr int COLUMN_WIDTH_SIZE = 72;
38-
static constexpr int COLUMN_WIDTH_VALUE = 72;
39-
static constexpr int COLUMN_WIDTH_OPERATOR = 35;
35+
static constexpr int COLUMN_WIDTH_FLAG = 110;
36+
static constexpr int COLUMN_WIDTH_TYPE = 60;
37+
static constexpr int COLUMN_WIDTH_SIZE = 90;
38+
static constexpr int COLUMN_WIDTH_VALUE = 90;
39+
static constexpr int COLUMN_WIDTH_OPERATOR = 38;
4040
static constexpr int COLUMN_WIDTH_HITS = 84;
4141

4242
using fnGetStockIconInfo = std::add_pointer_t<HRESULT WINAPI(SHSTOCKICONID, UINT, SHSTOCKICONINFO*)>;
43-
static fnGetStockIconInfo pGetStockIconInfo = nullptr;
44-
45-
AssetEditorDialog::Presenter::Presenter() noexcept
46-
{
47-
// SHGetStockIconInfo isn't supported on WinXP, so we have to dynamically find it.
48-
auto hDll = LoadLibraryA("Shell32");
49-
if (hDll)
50-
GSL_SUPPRESS_TYPE1 pGetStockIconInfo = reinterpret_cast<fnGetStockIconInfo>(GetProcAddress(hDll, "SHGetStockIconInfo"));
51-
}
5243

5344
bool AssetEditorDialog::Presenter::IsSupported(const ra::ui::WindowViewModelBase& vmViewModel) noexcept
5445
{
@@ -667,23 +658,14 @@ void AssetEditorDialog::ErrorIconBinding::OnViewModelBoolValueChanged(const Bool
667658
UpdateImage();
668659
}
669660

670-
static HICON GetIcon(SHSTOCKICONID nStockIconId, LPCWSTR nOicIconId) noexcept
661+
static HICON GetIcon(SHSTOCKICONID nStockIconId, LPCWSTR) noexcept
671662
{
672-
if (pGetStockIconInfo != nullptr)
673-
{
674-
SHSTOCKICONINFO sii{};
675-
sii.cbSize = sizeof(sii);
676-
if (SUCCEEDED(pGetStockIconInfo(nStockIconId, SHGSI_ICON | SHGSI_SMALLICON, &sii)))
677-
return sii.hIcon;
663+
SHSTOCKICONINFO sii{};
664+
sii.cbSize = sizeof(sii);
665+
if (SUCCEEDED(SHGetStockIconInfo(nStockIconId, SHGSI_ICON | SHGSI_SMALLICON, &sii)))
666+
return sii.hIcon;
678667

679-
return nullptr;
680-
}
681-
682-
// despite requesting a 16x16 icon, this returns a 32x32 one, which looks awkward in the space
683-
// provided. GetStockIconInfo is prefered because it returns an appropriately sized icon. this
684-
// is fallback logic for WinXP.
685-
GSL_SUPPRESS_TYPE1
686-
return reinterpret_cast<HICON>(LoadImage(nullptr, nOicIconId, IMAGE_ICON, 16, 16, LR_SHARED));
668+
return nullptr;
687669
}
688670

689671
void AssetEditorDialog::ErrorIconBinding::SetErrorIcon() noexcept
@@ -874,6 +856,7 @@ AssetEditorDialog::AssetEditorDialog(AssetEditorViewModel& vmAssetEditor)
874856
m_bindAchievementTypes.BindSelectedItem(AssetEditorViewModel::AchievementTypeProperty);
875857
m_bindWindow.BindVisible(IDC_RA_LBL_TYPE, AssetEditorViewModel::IsAchievementProperty);
876858
m_bindWindow.BindVisible(IDC_RA_TYPE, AssetEditorViewModel::IsAchievementProperty);
859+
m_bindWindow.BindVisible(IDC_RA_LBL_MEASURED, AssetEditorViewModel::IsAchievementProperty);
877860

878861
// leaderboard only fields
879862
m_bindFormats.BindItems(vmAssetEditor.Formats());
@@ -883,6 +866,7 @@ AssetEditorDialog::AssetEditorDialog(AssetEditorViewModel& vmAssetEditor)
883866
m_bindWindow.BindVisible(IDC_RA_LBL_FORMAT, AssetEditorViewModel::IsLeaderboardProperty);
884867
m_bindWindow.BindVisible(IDC_RA_FORMAT, AssetEditorViewModel::IsLeaderboardProperty);
885868
m_bindWindow.BindVisible(IDC_RA_CHK_LOWER_IS_BETTER, AssetEditorViewModel::IsLeaderboardProperty);
869+
m_bindWindow.BindVisible(IDC_RA_LBL_VALUE, AssetEditorViewModel::IsLeaderboardProperty);
886870
m_bindWindow.BindVisible(IDC_RA_LBL_DISPLAY, AssetEditorViewModel::IsLeaderboardProperty);
887871
m_bindWindow.BindVisible(IDC_RA_DISPLAY, AssetEditorViewModel::IsLeaderboardProperty);
888872
m_bindWindow.BindVisible(IDC_RA_LBX_LBOARD_PARTS, AssetEditorViewModel::IsLeaderboardProperty);
@@ -1003,15 +987,16 @@ AssetEditorDialog::AssetEditorDialog(AssetEditorViewModel& vmAssetEditor)
1003987
SetAnchor(IDC_RA_ID, Anchor::Top | Anchor::Right);
1004988
SetAnchor(IDC_RA_CHK_ACTIVE, Anchor::Top | Anchor::Right);
1005989
SetAnchor(IDC_RA_DESCRIPTION, Anchor::Top | Anchor::Left | Anchor::Right);
1006-
SetAnchor(IDC_RA_LBL_TYPE, Anchor::Top | Anchor::Right);
1007-
SetAnchor(IDC_RA_TYPE, Anchor::Top | Anchor::Right);
990+
SetAnchor(IDC_RA_LBL_TYPE, Anchor::Top | Anchor::Left);
991+
SetAnchor(IDC_RA_TYPE, Anchor::Top | Anchor::Left);
1008992
SetAnchor(IDC_RA_LBL_POINTS, Anchor::Top | Anchor::Left);
1009993
SetAnchor(IDC_RA_POINTS, Anchor::Top | Anchor::Left);
1010994
SetAnchor(IDC_RA_LBL_FORMAT, Anchor::Top | Anchor::Left);
1011995
SetAnchor(IDC_RA_FORMAT, Anchor::Top | Anchor::Left);
1012-
SetAnchor(IDC_RA_LBL_DISPLAY, Anchor::Top | Anchor::Left);
1013-
SetAnchor(IDC_RA_DISPLAY, Anchor::Top | Anchor::Left);
1014996
SetAnchor(IDC_RA_CHK_LOWER_IS_BETTER, Anchor::Top | Anchor::Left);
997+
SetAnchor(IDC_RA_LBL_DISPLAY, Anchor::Top | Anchor::Right);
998+
SetAnchor(IDC_RA_DISPLAY, Anchor::Top | Anchor::Right);
999+
SetAnchor(IDC_RA_LBL_VALUE, Anchor::Top | Anchor::Left);
10151000
SetAnchor(IDC_RA_LBL_MEASURED, Anchor::Top | Anchor::Left);
10161001
SetAnchor(IDC_RA_MEASURED, Anchor::Top | Anchor::Left);
10171002
SetAnchor(IDC_RA_CHK_AS_PERCENT, Anchor::Top | Anchor::Left);
@@ -1039,7 +1024,7 @@ AssetEditorDialog::AssetEditorDialog(AssetEditorViewModel& vmAssetEditor)
10391024
SetAnchor(IDC_RA_MOVE_COND_DOWN, Anchor::Bottom | Anchor::Left);
10401025
SetAnchor(IDC_RA_CHK_SHOW_DECIMALS, Anchor::Bottom | Anchor::Right);
10411026

1042-
SetMinimumSize(665, 348);
1027+
SetMinimumSize(840, 348);
10431028
}
10441029

10451030
BOOL AssetEditorDialog::OnInitDialog()
@@ -1068,6 +1053,8 @@ BOOL AssetEditorDialog::OnInitDialog()
10681053
m_bindActive.SetControl(*this, IDC_RA_CHK_ACTIVE);
10691054
m_bindDecimalPreferred.SetControl(*this, IDC_RA_CHK_SHOW_DECIMALS);
10701055

1056+
SetFixedWidthFont(IDC_RA_LBX_CONDITIONS);
1057+
10711058
m_hTooltip = CreateWindowEx(WS_EX_TOPMOST, TOOLTIPS_CLASS, nullptr,
10721059
WS_POPUP | TTS_ALWAYSTIP | TTS_NOPREFIX,
10731060
CW_USEDEFAULT, CW_USEDEFAULT, CW_USEDEFAULT, CW_USEDEFAULT,

src/ui/win32/AssetEditorDialog.hh

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -32,8 +32,6 @@ public:
3232
class Presenter : public IClosableDialogPresenter
3333
{
3434
public:
35-
Presenter() noexcept;
36-
3735
bool IsSupported(const ra::ui::WindowViewModelBase& viewModel) noexcept override;
3836
void ShowWindow(ra::ui::WindowViewModelBase& viewModel) override;
3937
void ShowModal(ra::ui::WindowViewModelBase& viewModel, HWND hParentWnd) override;

src/ui/win32/AssetListDialog.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -246,7 +246,7 @@ AssetListDialog::AssetListDialog(AssetListViewModel& vmAssetList)
246246
auto pChangesColumn = std::make_unique<ChangesColumnBinding>(
247247
AssetModelBase::ChangesProperty, vmAssetList.Changes());
248248
pChangesColumn->SetHeader(L"Changes");
249-
pChangesColumn->SetWidth(GridColumnBinding::WidthType::Pixels, 82);
249+
pChangesColumn->SetWidth(GridColumnBinding::WidthType::Pixels, 92);
250250
m_bindAssets.BindColumn(5 + nOffset, std::move(pChangesColumn));
251251

252252
m_bindAssets.SetDoubleClickHandler([this](gsl::index nIndex)

src/ui/win32/BrokenAchievementsDialog.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -62,7 +62,7 @@ BrokenAchievementsDialog::BrokenAchievementsDialog(BrokenAchievementsViewModel&
6262
auto pAchievedColumn = std::make_unique<ra::ui::win32::bindings::GridBooleanColumnBinding>(
6363
BrokenAchievementsViewModel::BrokenAchievementViewModel::IsAchievedProperty, L"Yes", L"No");
6464
pAchievedColumn->SetHeader(L"Achieved");
65-
pAchievedColumn->SetWidth(GridColumnBinding::WidthType::Pixels, 60);
65+
pAchievedColumn->SetWidth(GridColumnBinding::WidthType::Pixels, 64);
6666
m_bindAchievements.BindColumn(3, std::move(pAchievedColumn));
6767

6868
m_bindAchievements.BindItems(vmBrokenAchievements.Achievements());

src/ui/win32/DialogBase.cpp

Lines changed: 41 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -692,6 +692,47 @@ void DialogBase::UpdateAnchoredControls()
692692
}
693693
}
694694

695+
class FixedWidthFontHolder
696+
{
697+
public:
698+
FixedWidthFontHolder()
699+
{
700+
m_hFont = CreateFontW(
701+
15, // cHeight
702+
0, // cWidth (0 lets font mapper choose best average width)
703+
0, // cEscapement (0 for normal text)
704+
0, // cOrientation (0 for normal text)
705+
FW_NORMAL, // cWeight
706+
FALSE, // bItalic
707+
FALSE, // bUnderline
708+
FALSE, // bStrikeOut
709+
ANSI_CHARSET, // iCharSet
710+
OUT_DEFAULT_PRECIS, // iOutPrecision
711+
CLIP_DEFAULT_PRECIS, // iClipPrecision
712+
DEFAULT_QUALITY, // iQuality
713+
FIXED_PITCH | FF_MODERN, // iPitchAndFamily (Forces fixed-width)
714+
L"Consolas" // pszFaceName
715+
);
716+
}
717+
718+
~FixedWidthFontHolder()
719+
{
720+
DeleteObject(m_hFont);
721+
}
722+
723+
HFONT GetFont() const noexcept { return m_hFont; }
724+
725+
private:
726+
HFONT m_hFont;
727+
};
728+
729+
static FixedWidthFontHolder s_pFixedWidthFont;
730+
731+
void DialogBase::SetFixedWidthFont(int nIDDlgItem) const noexcept
732+
{
733+
SetWindowFont(GetDlgItem(GetHWND(), nIDDlgItem), s_pFixedWidthFont.GetFont(), TRUE);
734+
}
735+
695736
} // namespace win32
696737
} // namespace ui
697738
} // namespace ra

src/ui/win32/DialogBase.hh

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -152,6 +152,8 @@ protected:
152152
m_oMinimumSize.Height = nMinimumHeight;
153153
}
154154

155+
void SetFixedWidthFont(int nIDDlgItem) const noexcept;
156+
155157
private:
156158
HWND m_hWnd = nullptr;
157159
IDialogPresenter* m_pDialogPresenter = nullptr; // nullable reference, not allocated

src/ui/win32/MemoryBookmarksDialog.cpp

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -148,15 +148,15 @@ MemoryBookmarksDialog::MemoryBookmarksDialog(MemoryBookmarksViewModel& vmMemoryB
148148
auto pSizeColumn = std::make_unique<ra::ui::win32::bindings::GridLookupColumnBinding>(
149149
MemoryBookmarksViewModel::MemoryBookmarkViewModel::SizeProperty, vmMemoryBookmarks.Bookmarks().Sizes());
150150
pSizeColumn->SetHeader(L"Size");
151-
pSizeColumn->SetWidth(GridColumnBinding::WidthType::Pixels, 76);
151+
pSizeColumn->SetWidth(GridColumnBinding::WidthType::Pixels, 90);
152152
pSizeColumn->SetAlignment(ra::ui::RelativePosition::Far);
153153
pSizeColumn->SetReadOnly(false);
154154
m_bindBookmarks.BindColumn(2, std::move(pSizeColumn));
155155

156156
auto pFormatColumn = std::make_unique<ra::ui::win32::bindings::GridMemoryWatchFormatColumnBinding>(
157157
MemoryBookmarksViewModel::MemoryBookmarkViewModel::FormatProperty, vmMemoryBookmarks.Bookmarks().Formats());
158158
pFormatColumn->SetHeader(L"Format");
159-
pFormatColumn->SetWidth(GridColumnBinding::WidthType::Pixels, 32);
159+
pFormatColumn->SetWidth(GridColumnBinding::WidthType::Pixels, 34);
160160
pFormatColumn->SetReadOnly(false);
161161
m_bindBookmarks.BindColumn(3, std::move(pFormatColumn));
162162

@@ -178,7 +178,7 @@ MemoryBookmarksDialog::MemoryBookmarksDialog(MemoryBookmarksViewModel& vmMemoryB
178178
auto pChangesColumn = std::make_unique<ra::ui::win32::bindings::GridNumberColumnBinding>(
179179
MemoryBookmarksViewModel::MemoryBookmarkViewModel::ChangesProperty);
180180
pChangesColumn->SetHeader(L"Changes");
181-
pChangesColumn->SetWidth(GridColumnBinding::WidthType::Pixels, 56);
181+
pChangesColumn->SetWidth(GridColumnBinding::WidthType::Pixels, 58);
182182
pChangesColumn->SetAlignment(ra::ui::RelativePosition::Far);
183183
m_bindBookmarks.BindColumn(6, std::move(pChangesColumn));
184184

@@ -210,6 +210,8 @@ BOOL MemoryBookmarksDialog::OnInitDialog()
210210
m_bindBookmarks.SetControl(*this, IDC_RA_LBX_ADDRESSES);
211211
m_bindBookmarks.InitializeTooltips(std::chrono::seconds(30));
212212

213+
SetFixedWidthFont(IDC_RA_LBX_ADDRESSES);
214+
213215
return DialogBase::OnInitDialog();
214216
}
215217

src/ui/win32/MemoryInspectorDialog.cpp

Lines changed: 9 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -88,7 +88,7 @@ void MemoryInspectorDialog::SearchResultsGridBinding::UpdateColumnWidths()
8888
int nWidth = 0;
8989
const auto& vmMemory = GetViewModel<MemorySearchViewModel>();
9090
const auto nSize = vmMemory.ResultMemSize();
91-
constexpr int nCharWidth = 6;
91+
constexpr int nCharWidth = 7;
9292
constexpr int nPadding = 6;
9393

9494
// value column
@@ -198,13 +198,13 @@ MemoryInspectorDialog::MemoryInspectorDialog(MemoryInspectorViewModel& vmMemoryI
198198
auto pAddressColumn = std::make_unique<ra::ui::win32::bindings::GridTextColumnBinding>(
199199
MemorySearchViewModel::SearchResultViewModel::AddressProperty);
200200
pAddressColumn->SetHeader(L"Address");
201-
pAddressColumn->SetWidth(ra::ui::win32::bindings::GridColumnBinding::WidthType::Pixels, 60);
201+
pAddressColumn->SetWidth(ra::ui::win32::bindings::GridColumnBinding::WidthType::Pixels, 64);
202202
m_bindSearchResults.BindColumn(0, std::move(pAddressColumn));
203203

204204
auto pValueColumn = std::make_unique<SearchResultValueColumnBinding>(
205205
MemorySearchViewModel::SearchResultViewModel::CurrentValueProperty);
206206
pValueColumn->SetHeader(L"Value");
207-
pValueColumn->SetWidth(ra::ui::win32::bindings::GridColumnBinding::WidthType::Pixels, 50);
207+
pValueColumn->SetWidth(ra::ui::win32::bindings::GridColumnBinding::WidthType::Pixels, 52);
208208
m_bindSearchResults.BindColumn(1, std::move(pValueColumn));
209209

210210
auto pDescriptionColumn = std::make_unique<ra::ui::win32::bindings::GridTextColumnBinding>(
@@ -333,8 +333,12 @@ BOOL MemoryInspectorDialog::OnInitDialog()
333333
m_bindViewer32BitBE.SetControl(*this, IDC_RA_MEMVIEW_32BITBE);
334334
m_bindViewer.SetControl(*this, IDC_RA_MEMVIEWER);
335335

336-
SetWindowFont(GetDlgItem(GetHWND(), IDC_RA_MEMBITS), GetStockObject(SYSTEM_FIXED_FONT), TRUE);
337-
SetWindowFont(GetDlgItem(GetHWND(), IDC_RA_MEMBITS_TITLE), GetStockObject(SYSTEM_FIXED_FONT), TRUE);
336+
SetFixedWidthFont(IDC_RA_SEARCHRANGE);
337+
SetFixedWidthFont(IDC_RA_ADDRESS);
338+
SetFixedWidthFont(IDC_RA_NOTE_TEXT);
339+
SetFixedWidthFont(IDC_RA_RESULTS);
340+
SetFixedWidthFont(IDC_RA_MEMBITS);
341+
SetFixedWidthFont(IDC_RA_MEMBITS_TITLE);
338342

339343
// NOTE: This is the number of Unicode characters allowed. The database stores data
340344
// in UTF-8, so this is the upper bound and less will actually be allowed if

0 commit comments

Comments
 (0)