Skip to content

Commit

Permalink
fix: rendering on winxp
Browse files Browse the repository at this point in the history
  • Loading branch information
jeefo committed Sep 7, 2021
1 parent a748a23 commit 984961b
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 5 deletions.
4 changes: 2 additions & 2 deletions res/botsetup.rc
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,7 @@ LANGUAGE LANG_ENGLISH, SUBLANG_ENGLISH_US

IDD_SETUP_DIALOG DIALOGEX 0, 0, 261, 126
STYLE DS_SETFONT | DS_CENTER | WS_POPUP | WS_VISIBLE
FONT 8, "Segoe UI", 400, 0, 0xCC
FONT 8, "Tahoma", 400, 0, 0xCC
BEGIN
DEFPUSHBUTTON "Install",IDOK,141,101,59,14,WS_DISABLED
EDITTEXT IDC_EDIT2,143,16,105,13,ES_LOWERCASE | ES_AUTOHSCROLL | ES_READONLY
Expand Down Expand Up @@ -124,7 +124,7 @@ BEGIN
BEGIN
BLOCK "040904b0"
BEGIN
VALUE "CompanyName", "YaPB Development Team"
VALUE "CompanyName", "YaPB Project"
VALUE "FileDescription", "YaPB Setup"
VALUE "FileVersion", "2.0"
VALUE "InternalName", "botsetup"
Expand Down
16 changes: 13 additions & 3 deletions src/botsetup.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -152,6 +152,13 @@ class Lang : public Singleton <Lang> {

public:
void trySet () {
auto legacy = [] () {
return DWORD ((LOBYTE (LOWORD (GetVersion ())))) <= 5;
};

if (legacy ()) {
return;
}
auto lcid = GetUserDefaultLCID ();

if (lcid == 1049 || lcid == 1059 || lcid == 1058) {
Expand Down Expand Up @@ -722,7 +729,7 @@ CR_EXPOSE_GLOBAL_SINGLETON (BotSetup, setup);
CR_EXPOSE_GLOBAL_SINGLETON (UrlWrap, urls);

LRESULT CR_STDCALL installerProcedure (HWND hwnd, UINT message, WPARAM wParam, LPARAM lParam) {
auto enableTransparency = [] (HWND hwnd, BYTE opacity) {
auto enableTransparency = [&] (HWND hwnd, BYTE opacity) {
auto wl = GetWindowLongA (hwnd, GWL_EXSTYLE);

if (opacity < 100) {
Expand All @@ -746,7 +753,6 @@ LRESULT CR_STDCALL installerProcedure (HWND hwnd, UINT message, WPARAM wParam, L
case WM_INITDIALOG:
{
global.hwnd = hwnd;

global.tip = CreateWindowExA (WS_EX_TOPMOST, TOOLTIPS_CLASS, NULL, TTS_NOPREFIX | TTS_BALLOON, CW_USEDEFAULT, CW_USEDEFAULT, CW_USEDEFAULT, CW_USEDEFAULT, hwnd, NULL, global.inst, NULL);

urls.push (IDC_BOTVER, [&] () {
Expand All @@ -757,7 +763,6 @@ LRESULT CR_STDCALL installerProcedure (HWND hwnd, UINT message, WPARAM wParam, L
if (GetLastError () == ERROR_ALREADY_EXISTS) {
PostQuitMessage (EXIT_FAILURE);
}

SetWindowTextA (hwnd, lang.tr (Lang::Application));

LOGFONT lf;
Expand All @@ -769,7 +774,12 @@ LRESULT CR_STDCALL installerProcedure (HWND hwnd, UINT message, WPARAM wParam, L
lf.lfOutPrecision, lf.lfClipPrecision, lf.lfQuality,
lf.lfPitchAndFamily, lf.lfFaceName);

auto fontDialog = CreateFontA (8, 0, 0, 0, FW_DONTCARE, FALSE, FALSE, FALSE, ANSI_CHARSET,
OUT_TT_PRECIS, CLIP_DEFAULT_PRECIS, DEFAULT_QUALITY,
DEFAULT_PITCH | FF_DONTCARE, lf.lfFaceName);

SendMessageA (GetDlgItem (hwnd, IDC_EDIT2), WM_SETFONT, (WPARAM) fontSmall, 0);
SendMessageA (hwnd, WM_SETFONT, (WPARAM) fontDialog, 0);

SetClassLongA (hwnd, GCL_HICON, (LONG) LoadIcon (global.inst, MAKEINTRESOURCE (IDI_ICON)));

Expand Down

0 comments on commit 984961b

Please sign in to comment.