<ClCompile Include="..\..\src\cmd-action\cmd-tunnel.cpp" />\r
<ClCompile Include="..\..\src\action\movement-execution.cpp" />\r
<ClCompile Include="..\..\src\main-win\graphics-win.cpp" />\r
+ <ClCompile Include="..\..\src\main-win\main-win-utils.cpp" />\r
<ClCompile Include="..\..\src\store\cmd-store.cpp" />\r
<ClCompile Include="..\..\src\cmd-io\cmd-floor.cpp" />\r
<ClCompile Include="..\..\src\cmd-io\cmd-lore.cpp" />\r
<ClInclude Include="..\..\src\main-win\graphics-win.h" />\r
<ClInclude Include="..\..\src\main-win\string-win.h" />\r
<ClInclude Include="..\..\src\player-status\player-hand-types.h" />\r
+ <ClInclude Include="..\..\src\main-win\main-win-utils.h" />\r
<ClInclude Include="..\..\src\store\cmd-store.h" />\r
<ClInclude Include="..\..\src\cmd-io\cmd-floor.h" />\r
<ClInclude Include="..\..\src\cmd-io\cmd-lore.h" />\r
<Error Condition="!Exists('..\packages\Microsoft.NetFramework.Analyzers.3.0.0\build\Microsoft.NetFramework.Analyzers.props')" Text="$([System.String]::Format('$(ErrorText)', '..\packages\Microsoft.NetFramework.Analyzers.3.0.0\build\Microsoft.NetFramework.Analyzers.props'))" />\r
<Error Condition="!Exists('..\packages\Microsoft.CodeAnalysis.FxCopAnalyzers.3.0.0\build\Microsoft.CodeAnalysis.FxCopAnalyzers.props')" Text="$([System.String]::Format('$(ErrorText)', '..\packages\Microsoft.CodeAnalysis.FxCopAnalyzers.3.0.0\build\Microsoft.CodeAnalysis.FxCopAnalyzers.props'))" />\r
</Target>\r
-</Project>
\ No newline at end of file
+</Project>\r
<ClCompile Include="..\..\src\hpmp\hp-mp-regenerator.cpp">\r
<Filter>hpmp</Filter>\r
</ClCompile>\r
+ <ClCompile Include="..\..\src\main-win\main-win-utils.cpp">\r
+ <Filter>main-win</Filter>\r
+ </ClCompile>\r
</ItemGroup>\r
<ItemGroup>\r
<ClInclude Include="..\..\src\combat\shoot.h">\r
<ClInclude Include="..\..\src\store\store-key-processor.h">\r
<Filter>store</Filter>\r
</ClInclude>\r
- <ClInclude Include="..\..\src\main-win\string-win.h">\r
+ <ClInclude Include="..\..\src\main-win\main-win-utils.h">\r
<Filter>main-win</Filter>\r
</ClInclude>\r
<ClInclude Include="..\..\src\main-win\graphics-win.h">\r
<ItemGroup>\r
<ResourceCompile Include="..\..\src\angband.rc" />\r
</ItemGroup>\r
-</Project>
\ No newline at end of file
+</Project>\r
main-win/main-win-music.cpp main-win/main-win-music.h \
main-win/main-win-sound.cpp main-win/main-win-sound.h \
main-win/main-win-tokenizer.cpp main-win/main-win-tokenizer.h \
+ main-win/main-win-utils.cpp main-win/main-win-utils.h \
main-win/main-win-windows.h \
- main-win/string-win.h wall.bmp \
+ wall.bmp \
stdafx.cpp stdafx.h
EXTRA_DIST = \
* @brief Windows版固有実装(メインエントリポイント含む)
* @date 2018/03/16
* @author Hengband Team
- * @todo main関数を含むファイルの割に長過ぎる。main-win-utils.cなどといった形で分割したい
* @details
*
* <h3>概要</h3>
#ifdef WINDOWS
-#include "cmd-io/cmd-process-screen.h"
#include "cmd-io/cmd-save.h"
#include "cmd-visual/cmd-draw.h"
#include "core/game-play.h"
#include "main-win/main-win-menuitem.h"
#include "main-win/main-win-music.h"
#include "main-win/main-win-sound.h"
-#include "main-win/string-win.h"
+#include "main-win/main-win-utils.h"
#include "main/angband-initializer.h"
#include "main/sound-of-music.h"
#include "monster-floor/monster-lite.h"
#include "save/save.h"
-#include "system/angband-version.h"
#include "system/angband.h"
#include "system/player-type-definition.h"
#include "system/system-variables.h"
break;
}
case IDM_DUMP_SCREEN_HTML: {
- OPENFILENAMEW ofnw;
- std::vector<WCHAR> buf(MAIN_WIN_MAX_PATH + 1);
- memset(&ofnw, 0, sizeof(ofnw));
- ofnw.lStructSize = sizeof(ofnw);
- ofnw.hwndOwner = data[0].w;
- ofnw.lpstrFilter = L"HTML Files (*.html)\0*.html\0";
- ofnw.nFilterIndex = 1;
- ofnw.lpstrFile = &buf[0];
- ofnw.nMaxFile = MAIN_WIN_MAX_PATH;
- ofnw.lpstrDefExt = L"html";
- ofnw.lpstrInitialDir = NULL;
- ofnw.lpstrTitle = _(L"HTMLでスクリーンダンプを保存", L"Save screen dump as HTML.");
- ofnw.Flags = OFN_HIDEREADONLY | OFN_OVERWRITEPROMPT;
-
- if (GetSaveFileNameW(&ofnw)) {
- do_cmd_save_screen_html_aux(to_multibyte(&buf[0]).c_str(), 0);
- }
-
+ save_screen_as_html(data[0].w);
break;
}
}
}
/*!
- * @todo WNDCLASSに影響があるのでplayer_type*の追加は保留
+ * @brief メインウインドウ用ウインドウプロシージャ
*/
LRESULT PASCAL AngbandWndProc(HWND hWnd, UINT uMsg, WPARAM wParam, LPARAM lParam)
{
}
/*!
- * @todo WNDCLASSに影響があるのでplayer_type*の追加は保留
+ * @brief サブウインドウ用ウインドウプロシージャ
*/
LRESULT PASCAL AngbandListProc(HWND hWnd, UINT uMsg, WPARAM wParam, LPARAM lParam)
{
}
/*!
- * @todo よく見るとhMutexはちゃんと使われていない……?
- * @brief (Windows固有)変愚蛮怒が起動済かどうかのチェック
- */
-static bool is_already_running(void)
-{
- HANDLE hMutex;
- hMutex = CreateMutex(NULL, TRUE, VERSION_NAME);
- if (GetLastError() == ERROR_ALREADY_EXISTS) {
- return TRUE;
- }
-
- return FALSE;
-}
-
-/*!
* @brief (Windows固有)Windowsアプリケーションとしてのエントリポイント
*/
int WINAPI WinMain(_In_ HINSTANCE hInst, _In_opt_ HINSTANCE hPrevInst, _In_ LPSTR lpCmdLine, [[maybe_unused]] _In_ int nCmdShow)
--- /dev/null
+/*!
+ * @file main-win-utils.cpp
+ * @brief Windows版固有実装(ユーティリティー)
+ */
+
+#include "main-win/main-win-utils.h"
+#include "cmd-io/cmd-process-screen.h"
+#include "locale/language-switcher.h"
+#include "main-win/main-win-define.h"
+#include "system/angband-version.h"
+
+/*!
+ * @brief (Windows固有)変愚蛮怒が起動済かどうかのチェック
+ * @details
+ * 特定の名前のミューテックスオブジェクトの所有権取得を試みる。
+ * 取得できない場合は他に変愚蛮怒のプロセスが起動しているとみなす。
+ * 取得したミューテックスのハンドルは明示的な解放は行わず、プロセス終了時にOSが解放する。
+ * @retval true 他に変愚蛮怒のプロセスが起動している
+ * @retval false 他に変愚蛮怒のプロセスは起動していない
+ */
+bool is_already_running(void)
+{
+ [[maybe_unused]] HANDLE hMutex = CreateMutex(NULL, TRUE, VERSION_NAME);
+ if (GetLastError() == ERROR_ALREADY_EXISTS) {
+ return true;
+ }
+
+ return false;
+}
+
+/*!
+ * @brief (Windows固有)画面をHTMLファイルに保存する
+ * @details
+ * ファイル保存ダイアログを表示し、指定のファイルに画面内容を保存する。
+ * @param hWnd ダイアログの親にするウインドウのハンドル
+ */
+void save_screen_as_html(HWND hWnd)
+{
+ std::vector<WCHAR> buf(MAIN_WIN_MAX_PATH + 1);
+ OPENFILENAMEW ofnw;
+
+ memset(&ofnw, 0, sizeof(ofnw));
+ ofnw.lStructSize = sizeof(ofnw);
+ ofnw.hwndOwner = hWnd;
+ ofnw.lpstrFilter = L"HTML Files (*.html)\0*.html\0";
+ ofnw.nFilterIndex = 1;
+ ofnw.lpstrFile = &buf[0];
+ ofnw.nMaxFile = MAIN_WIN_MAX_PATH;
+ ofnw.lpstrDefExt = L"html";
+ ofnw.lpstrInitialDir = NULL;
+ ofnw.lpstrTitle = _(L"HTMLでスクリーンダンプを保存", L"Save screen dump as HTML.");
+ ofnw.Flags = OFN_HIDEREADONLY | OFN_OVERWRITEPROMPT;
+
+ if (GetSaveFileNameW(&ofnw)) {
+ do_cmd_save_screen_html_aux(to_multibyte(&buf[0]).c_str(), 0);
+ }
+}
#pragma once
/*!
- * @file string-win.h
- * @brief Windows版固有実装(文字列)ヘッダ
+ * @file main-win-utils.h
+ * @brief Windows版固有実装(ユーティリティー)ヘッダ
*/
#include "term/z-virt.h"
#include <windows.h>
/*!
- * @brief 文字列をワイド文字列へ変換するクラス
+ * @brief マルチバイト文字列をワイド文字列へ変換するクラス
*/
class to_wchar {
public:
}
}
};
+
+bool is_already_running(void);
+void save_screen_as_html(HWND hWnd);