Skip to content

Commit 1ca3fdc

Browse files
committed
reduce binary size 9
1 parent 95194b8 commit 1ca3fdc

File tree

4 files changed

+33
-35
lines changed

4 files changed

+33
-35
lines changed

GUI.cpp

Lines changed: 0 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -5522,36 +5522,6 @@ void __fastcall XgMakeItNumCro(HWND hwnd)
55225522
XgUpdateImage(hwnd);
55235523
}
55245524

5525-
// ローカルファイルを見つける。
5526-
BOOL __fastcall XgFindLocalFile(LPWSTR pszPath, UINT cchPath, LPCWSTR pszFileName) noexcept
5527-
{
5528-
GetModuleFileNameW(nullptr, pszPath, MAX_PATH);
5529-
PathRemoveFileSpecW(pszPath);
5530-
PathAppendW(pszPath, pszFileName);
5531-
if (!PathFileExistsW(pszPath))
5532-
{
5533-
PathRemoveFileSpecW(pszPath);
5534-
PathRemoveFileSpecW(pszPath);
5535-
PathAppendW(pszPath, pszFileName);
5536-
if (!PathFileExistsW(pszPath))
5537-
{
5538-
PathRemoveFileSpecW(pszPath);
5539-
PathRemoveFileSpecW(pszPath);
5540-
PathAppendW(pszPath, pszFileName);
5541-
}
5542-
}
5543-
5544-
return PathFileExistsW(pszPath);
5545-
}
5546-
5547-
// ローカルファイルを開く。
5548-
void __fastcall XgOpenLocalFile(HWND hwnd, LPCWSTR pszFileName) noexcept
5549-
{
5550-
WCHAR szPath[MAX_PATH];
5551-
if (XgFindLocalFile(szPath, _countof(szPath), pszFileName))
5552-
ShellExecuteW(hwnd, nullptr, szPath, nullptr, nullptr, SW_SHOWNORMAL);
5553-
}
5554-
55555525
// マス位置からキャンバス座標を取得する。
55565526
void __fastcall XgCellToCanvas(RECT& rc, XG_Pos cell)
55575527
{

GUI.hpp

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -25,10 +25,6 @@ extern BOOL xg_bShowClues;
2525
// UIフォントの論理オブジェクトを取得する。
2626
LOGFONTW *XgGetUIFont(void);
2727

28-
// ローカルファイルを見つける。
29-
BOOL __fastcall XgFindLocalFile(LPWSTR pszPath, UINT cchPath, LPCWSTR pszFileName) noexcept;
30-
// ローカルファイルを開く。
31-
void __fastcall XgOpenLocalFile(HWND hwnd, LPCWSTR pszFileName) noexcept;
3228
// 「黒マスルールの説明.txt」を開く。
3329
void __fastcall XgOpenRulesTxt(HWND hwnd);
3430

Utils.cpp

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1445,3 +1445,25 @@ BOOL ComboBox_RealSetText(HWND hwndCombo, LPCWSTR pszText) noexcept
14451445
}
14461446
return ComboBox_SetCurSel(hwndCombo, iItem);
14471447
}
1448+
1449+
// ローカルファイルを見つける。
1450+
BOOL XgFindLocalFile(LPWSTR pszPath, UINT cchPath, LPCWSTR pszFileName)
1451+
{
1452+
GetModuleFileNameW(nullptr, pszPath, MAX_PATH);
1453+
PathRemoveFileSpecW(pszPath);
1454+
PathAppendW(pszPath, pszFileName);
1455+
if (!PathFileExistsW(pszPath))
1456+
{
1457+
PathRemoveFileSpecW(pszPath);
1458+
PathRemoveFileSpecW(pszPath);
1459+
PathAppendW(pszPath, pszFileName);
1460+
if (!PathFileExistsW(pszPath))
1461+
{
1462+
PathRemoveFileSpecW(pszPath);
1463+
PathRemoveFileSpecW(pszPath);
1464+
PathAppendW(pszPath, pszFileName);
1465+
}
1466+
}
1467+
1468+
return PathFileExistsW(pszPath);
1469+
}

Utils.hpp

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -132,12 +132,22 @@ char XgToHex(char code) noexcept;
132132
// 24BPPビットマップを作成。
133133
HBITMAP XgCreate24BppBitmap(HDC hDC, LONG width, LONG height) noexcept;
134134

135+
// パック形式のDIBを作成する。
135136
BOOL PackedDIB_CreateFromHandle(std::vector<BYTE>& vecData, HBITMAP hbm);
136137

137138
//////////////////////////////////////////////////////////////////////////////
138-
// パスを作る。
139139

140+
// パスを作る。
140141
BOOL XgMakePathW(LPCWSTR pszPath);
142+
// ローカルファイルを見つける。
143+
BOOL XgFindLocalFile(LPWSTR pszPath, UINT cchPath, LPCWSTR pszFileName);
144+
// ローカルファイルを開く。
145+
inline void XgOpenLocalFile(HWND hwnd, LPCWSTR pszFileName)
146+
{
147+
WCHAR szPath[MAX_PATH];
148+
if (XgFindLocalFile(szPath, _countof(szPath), pszFileName))
149+
ShellExecuteW(hwnd, nullptr, szPath, nullptr, nullptr, SW_SHOWNORMAL);
150+
}
141151

142152
//////////////////////////////////////////////////////////////////////////////
143153

0 commit comments

Comments
 (0)