Skip to content

Commit

Permalink
improve
Browse files Browse the repository at this point in the history
  • Loading branch information
katahiromz committed Jan 13, 2024
1 parent ad6c261 commit 71702c8
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 19 deletions.
32 changes: 14 additions & 18 deletions GUI.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -5572,6 +5572,14 @@ BOOL __fastcall XgFindLocalFile(LPWSTR pszPath, UINT cchPath, LPCWSTR pszFileNam
return PathFileExistsW(pszPath);
}

// ローカルファイルを開く。
void __fastcall XgOpenLocalFile(HWND hwnd, LPCWSTR pszFileName) noexcept
{
WCHAR szPath[MAX_PATH];
if (XgFindLocalFile(szPath, _countof(szPath), pszFileName))
ShellExecuteW(hwnd, nullptr, szPath, nullptr, nullptr, SW_SHOWNORMAL);
}

// マス位置からキャンバス座標を取得する。
void __fastcall XgCellToCanvas(RECT& rc, XG_Pos cell)
{
Expand Down Expand Up @@ -7039,20 +7047,12 @@ void __fastcall MainWnd_OnCommand(HWND hwnd, int id, HWND hwndCtl, UINT /*codeNo
bUpdateImage = TRUE;
break;
case ID_OPENPATTXT:
{
// PAT.txtを開く。
WCHAR szPath[MAX_PATH];
if (XgFindLocalFile(szPath, _countof(szPath), L"PAT.txt"))
ShellExecuteW(hwnd, nullptr, szPath, nullptr, nullptr, SW_SHOWNORMAL);
}
// PAT.txtを開く。
XgOpenLocalFile(hwnd, L"PAT.txt");
break;
case ID_OPENTHEMETXT:
{
// THEME.txtを開く。
WCHAR szPath[MAX_PATH];
if (XgFindLocalFile(szPath, _countof(szPath), L"THEME.txt"))
ShellExecuteW(hwnd, nullptr, szPath, nullptr, nullptr, SW_SHOWNORMAL);
}
// THEME.txtを開く。
XgOpenLocalFile(hwnd, L"THEME.txt");
break;
case ID_CLEARUNDOBUFFER:
// Undoバッファをクリアする。
Expand All @@ -7066,12 +7066,8 @@ void __fastcall MainWnd_OnCommand(HWND hwnd, int id, HWND hwndCtl, UINT /*codeNo
ShellExecuteW(hwnd, nullptr, L"https://katahiromz.web.fc2.com/xword/dict", nullptr, nullptr, SW_SHOWNORMAL);
break;
case ID_OPENPOLICYTXT:
{
// POLICY.txtを開く。
WCHAR szPath[MAX_PATH];
if (XgFindLocalFile(szPath, _countof(szPath), L"POLICY.txt"))
ShellExecuteW(hwnd, nullptr, szPath, nullptr, nullptr, SW_SHOWNORMAL);
}
// POLICY.txtを開く。
XgOpenLocalFile(hwnd, L"POLICY.txt");
break;

case ID_RECENT_00:
Expand Down
2 changes: 1 addition & 1 deletion res/Manifest_1.manifest
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<assembly xmlns="urn:schemas-microsoft-com:asm.v1" manifestVersion="1.0">
<assemblyIdentity name="XWordGiver" processorArchitecture="*" version="1.0.0.0" type="win32"/>
<assemblyIdentity name="XWordGiver" processorArchitecture="*" version="1.0.0.0" type="win32" />
<description>XWordGiver</description>
<dependency>
<dependentAssembly>
Expand Down

0 comments on commit 71702c8

Please sign in to comment.