project64/Source/Project64/UserInterface/About.cpp

97 lines
3.8 KiB
C++
Raw Normal View History

2022-09-21 05:16:07 +00:00
#include "stdafx.h"
2020-11-11 10:29:13 +00:00
#include <Project64\UserInterface\About.h>
CAboutDlg::CAboutDlg(CProjectSupport & Support) :
m_Support(Support)
{
}
2021-01-19 05:58:59 +00:00
LRESULT CAboutDlg::OnInitDialog(UINT /*uMsg*/, WPARAM /*wParam*/, LPARAM /*lParam*/, BOOL & /*bHandled*/)
2020-11-11 10:29:13 +00:00
{
m_Logo.SubclassWindow(GetDlgItem(IDC_BMP_LOGO));
m_Logo.SetBitmap(MAKEINTRESOURCE(IDB_ABOUT_LOGO));
stdstr AboutMsg;
if (m_Support.Validated() && strlen(m_Support.Name()) > 0)
{
AboutMsg += stdstr_f("Thank you %s for the support!\n\n", m_Support.Name());
}
AboutMsg += "Project64 is a completely free and open-source emulator for the Nintendo 64 and 64DD written in C++.\n\nCapable of playing your favorite N64 games on your PC with high-definition graphics, excellent compatibility, save states, built - in cheat codes, and more!";
2020-11-11 10:29:13 +00:00
CDC hDC = GetDC();
float DPIScale = hDC.GetDeviceCaps(LOGPIXELSX) / 96.0f;
2022-09-21 05:16:07 +00:00
LOGFONT lf = {0};
2020-11-11 10:29:13 +00:00
CFontHandle(GetDlgItem(IDC_VERSION).GetFont()).GetLogFont(&lf);
lf.lfHeight = (int)(16 * DPIScale);
m_TextFont.CreateFontIndirect(&lf);
lf.lfHeight = (int)(18 * DPIScale);
lf.lfWeight += 200;
m_BoldFont.CreateFontIndirect(&lf);
SetWindowDetais(IDC_VERSION, IDC_BMP_LOGO, stdstr_f("Version: %s", VER_FILE_VERSION_STR).ToUTF16().c_str(), m_BoldFont);
SetWindowDetais(IDC_ABOUT_PROJECT, IDC_VERSION, AboutMsg.ToUTF16().c_str(), m_TextFont);
SetWindowDetais(IDC_THANKS_CORE, IDC_ABOUT_PROJECT, L"Special thanks to previous core members:", m_BoldFont);
2020-11-11 10:29:13 +00:00
SetWindowDetais(IDC_CORE_THANK_LIST, IDC_THANKS_CORE, L"Jabo, Smiff, Gent", m_TextFont);
SetWindowDetais(IDC_THANKYOU, IDC_CORE_THANK_LIST, L"Thanks also goes to:", m_BoldFont);
SetWindowDetais(IDC_THANKYOU_LIST, IDC_THANKYOU, L"Jahra!n, Witten, RadeonUser, Azimer, Shygoo, Frank, LuigiBlood, theboy181, Gonetz, BlueToonYoshi, Kimbjo, Melchior, retroben, AIO, and krom", m_TextFont);
2020-11-11 10:29:13 +00:00
return TRUE;
}
2022-09-21 05:16:07 +00:00
void CAboutDlg::SetWindowDetais(int nIDDlgItem, int nAboveIDDlgItem, const wchar_t * Text, const HFONT & font)
2020-11-11 10:29:13 +00:00
{
CWindow Wnd = GetDlgItem(nIDDlgItem);
Wnd.SetWindowText(Text);
Wnd.SetFont(font);
CDC hDC = GetDC();
float DPIScale = hDC.GetDeviceCaps(LOGPIXELSX) / 96.0f;
hDC.SelectFont(font);
CRect rcWin;
Wnd.GetWindowRect(&rcWin);
2021-04-12 11:35:39 +00:00
::MapWindowPoints(nullptr, m_hWnd, (LPPOINT)&rcWin, 2);
2020-11-11 10:29:13 +00:00
if (hDC.DrawText(Text, -1, &rcWin, DT_LEFT | DT_CALCRECT | DT_WORDBREAK | DT_NOCLIP) > 0)
{
2021-04-12 11:35:39 +00:00
Wnd.SetWindowPos(nullptr, 0, 0, rcWin.Width(), rcWin.Height(), SWP_NOACTIVATE | SWP_NOMOVE | SWP_NOOWNERZORDER);
2020-11-11 10:29:13 +00:00
}
2022-09-21 05:16:07 +00:00
2020-11-11 10:29:13 +00:00
CWindow AboveWnd = GetDlgItem(nAboveIDDlgItem);
AboveWnd.GetWindowRect(&rcWin);
2021-04-12 11:35:39 +00:00
::MapWindowPoints(nullptr, m_hWnd, (LPPOINT)&rcWin, 2);
2021-01-19 05:58:59 +00:00
LONG Top = rcWin.bottom + (LONG)(8 * DPIScale);
2020-11-11 10:29:13 +00:00
Wnd.GetWindowRect(&rcWin);
2021-04-12 11:35:39 +00:00
::MapWindowPoints(nullptr, m_hWnd, (LPPOINT)&rcWin, 2);
Wnd.SetWindowPos(nullptr, rcWin.left, Top, 0, 0, SWP_NOACTIVATE | SWP_NOSIZE | SWP_NOOWNERZORDER);
2020-11-11 10:29:13 +00:00
}
2022-09-21 05:16:07 +00:00
LRESULT CAboutDlg::OnColorStatic(UINT /*uMsg*/, WPARAM wParam, LPARAM /*lParam*/, BOOL & /*bHandled*/)
2020-11-11 10:29:13 +00:00
{
HDC hdcStatic = (HDC)wParam;
SetTextColor(hdcStatic, RGB(0, 0, 0));
SetBkMode(hdcStatic, TRANSPARENT);
return (LONG)(LRESULT)((HBRUSH)GetStockObject(NULL_BRUSH));
}
2022-09-21 05:16:07 +00:00
LRESULT CAboutDlg::OnEraseBackground(UINT /*uMsg*/, WPARAM wParam, LPARAM /*lParam*/, BOOL & /*bHandled*/)
2020-11-11 10:29:13 +00:00
{
static HPEN outline = CreatePen(PS_SOLID, 1, 0x00FFFFFF);
static HBRUSH fill = CreateSolidBrush(0x00FFFFFF);
SelectObject((HDC)wParam, outline);
SelectObject((HDC)wParam, fill);
RECT rect;
GetClientRect(&rect);
Rectangle((HDC)wParam, rect.left, rect.top, rect.right, rect.bottom);
return TRUE;
}
2021-01-19 05:58:59 +00:00
LRESULT CAboutDlg::OnOkCmd(WORD /*wNotifyCode*/, WORD /*wID*/, HWND /*hWndCtl*/, BOOL & /*bHandled*/)
2020-11-11 10:29:13 +00:00
{
EndDialog(0);
return TRUE;
}