From 43200c01490450d13185d80c5a1fa9307ddd3552 Mon Sep 17 00:00:00 2001 From: Katayama Hirofumi MZ Date: Fri, 2 Aug 2024 11:55:07 +0900 Subject: [PATCH] Fix #262 --- EGA | 2 +- HISTORY-ID.txt | 1 + HISTORY-ITA.txt | 1 + HISTORY-JPN.txt | 1 + HISTORY-KOR.txt | 1 + HISTORY-PTB.txt | 1 + HISTORY.txt | 1 + src/MEgaDlg.hpp | 14 ++++++++++++-- src/RisohEditor.cpp | 16 +++------------- 9 files changed, 22 insertions(+), 16 deletions(-) diff --git a/EGA b/EGA index 04855ff6..da2d117c 160000 --- a/EGA +++ b/EGA @@ -1 +1 @@ -Subproject commit 04855ff6d91f123ed029bdaafc5e714157768964 +Subproject commit da2d117ccb599ca1c8348874178ca73aaf7bd4ef diff --git a/HISTORY-ID.txt b/HISTORY-ID.txt index b3a49a4e..bdc44da3 100644 --- a/HISTORY-ID.txt +++ b/HISTORY-ID.txt @@ -319,3 +319,4 @@ - Separated x86 and x64 settings. - Fixed misinterpretation of open filter index. - v.5.8.5 (2024-XX-YY) + - Improved EGA console usability. diff --git a/HISTORY-ITA.txt b/HISTORY-ITA.txt index d1861dcc..e7aab5bc 100644 --- a/HISTORY-ITA.txt +++ b/HISTORY-ITA.txt @@ -319,3 +319,4 @@ - Impostazioni x86 e x64 separate. - Risolta errata interpretazione apertura indice filtro. - v.5.8.5 (DD.MM.2024) + - Improved EGA console usability. diff --git a/HISTORY-JPN.txt b/HISTORY-JPN.txt index 7b34c180..031b1175 100644 --- a/HISTORY-JPN.txt +++ b/HISTORY-JPN.txt @@ -663,3 +663,4 @@ - x86とx64の設定を分離。 - 「開く」フィルターの解釈間違いを修正。 - v.5.8.5 (2024-XX-YY) + - Improved EGA console usability. diff --git a/HISTORY-KOR.txt b/HISTORY-KOR.txt index 4d454059..702fa4cb 100644 --- a/HISTORY-KOR.txt +++ b/HISTORY-KOR.txt @@ -320,3 +320,4 @@ - x86 및 x64 설정을 분리합니다. - 열린 필터 인덱스의 잘못된 해석을 수정했습니다. - v.5.8.5 (2024-XX-YY) + - Improved EGA console usability. diff --git a/HISTORY-PTB.txt b/HISTORY-PTB.txt index 97c7e754..fcb88835 100644 --- a/HISTORY-PTB.txt +++ b/HISTORY-PTB.txt @@ -319,3 +319,4 @@ - Separated x86 and x64 settings. - Fixed misinterpretation of open filter index. - v.5.8.5 (2024-XX-YY) + - Improved EGA console usability. diff --git a/HISTORY.txt b/HISTORY.txt index 27f7748e..ec54f919 100644 --- a/HISTORY.txt +++ b/HISTORY.txt @@ -319,3 +319,4 @@ - Separated x86 and x64 settings. - Fixed misinterpretation of open filter index. - v.5.8.5 (2024-XX-YY) + - Improved EGA console usability. diff --git a/src/MEgaDlg.hpp b/src/MEgaDlg.hpp index 4acb5c9f..d6b2eadb 100644 --- a/src/MEgaDlg.hpp +++ b/src/MEgaDlg.hpp @@ -29,19 +29,26 @@ using namespace EGA; class MEgaDlg; static HWND s_hwndEga = NULL; static BOOL s_bEnter = FALSE; +extern HWND g_hMainWnd; static bool EGA_dialog_input(char *buf, size_t buflen) { + if (buf == NULL && buflen == 0) + { + SendMessageW(s_hwndEga, WM_COMMAND, IDCONTINUE, 0); + return true; + } + while (!s_bEnter || !::IsWindowVisible(s_hwndEga)) { Sleep(100); } s_bEnter = FALSE; - WCHAR szTextW[260]; + WCHAR szTextW[512]; GetDlgItemTextW(s_hwndEga, edt2, szTextW, ARRAYSIZE(szTextW)); - char szTextA[260]; + char szTextA[512]; WideCharToMultiByte(CP_UTF8, 0, szTextW, -1, szTextA, ARRAYSIZE(szTextA), NULL, NULL); StringCchCopyA(buf, buflen, szTextA); @@ -198,6 +205,9 @@ class MEgaDlg : public MDialogBase s_bEnter = FALSE; ::ShowWindow(hwnd, SW_HIDE); break; + case IDCONTINUE: + SendMessageW(g_hMainWnd, WM_COMMAND, ID_REFRESHALL, 0); + break; case psh1: OnPsh1(hwnd); break; diff --git a/src/RisohEditor.cpp b/src/RisohEditor.cpp index 3a7d22d5..4c4f8ea8 100644 --- a/src/RisohEditor.cpp +++ b/src/RisohEditor.cpp @@ -85,7 +85,7 @@ void DoSetFileModified(BOOL bModified) s_bModified = bModified; } -static HWND s_hMainWnd = NULL; +HWND g_hMainWnd = NULL; static INT s_ret = 0; enum IMPORT_RESULT @@ -10417,7 +10417,7 @@ void MMainWnd::OnDestroy(HWND hwnd) DestroyWindow(m_splitter1); DestroyWindow(m_splitter2); - s_hMainWnd = NULL; + g_hMainWnd = NULL; // post WM_QUIT message to quit the application PostQuitMessage(0); @@ -14494,7 +14494,7 @@ BOOL MMainWnd::OnCreate(HWND hwnd, LPCREATESTRUCT lpCreateStruct) m_id_list_dlg.m_hMainWnd = hwnd; // set the main window to the ID list window - s_hMainWnd = hwnd; + g_hMainWnd = hwnd; m_nShowMode = SHOW_CODEONLY; DoLoadLangInfo(); // load the language information @@ -16488,8 +16488,6 @@ EGA::arg_t MMainWnd::RES_delete(const EGA::args_t& args) SelectTV(NULL, FALSE); } - PostMessageW(s_hMainWnd, WM_COMMAND, ID_REFRESHALL, 0); - return make_arg(ret); } @@ -16545,8 +16543,6 @@ EGA::arg_t MMainWnd::RES_clone_by_name(const EGA::args_t& args) if (!found.empty()) DoSetFileModified(TRUE); - PostMessageW(s_hMainWnd, WM_COMMAND, ID_REFRESHALL, 0); - return make_arg(!found.empty()); } @@ -16648,8 +16644,6 @@ EGA::arg_t MMainWnd::RES_clone_by_lang(const EGA::args_t& args) if (!found2.empty()) DoSetFileModified(TRUE); - PostMessageW(s_hMainWnd, WM_COMMAND, ID_REFRESHALL, 0); - return make_arg(!found2.empty()); } @@ -16705,7 +16699,6 @@ EGA::arg_t MMainWnd::RES_set_binary(const EGA::args_t& args) ret = 1; DoSetFileModified(TRUE); - PostMessageW(s_hMainWnd, WM_COMMAND, ID_REFRESHALL, 0); return make_arg(ret); } @@ -16799,7 +16792,6 @@ EGA::arg_t MMainWnd::RES_set_text(EGA::arg_t arg0, EGA::arg_t arg1, EGA::arg_t a --g_bNoGuiMode; DoSetFileModified(TRUE); - PostMessageW(s_hMainWnd, WM_COMMAND, ID_REFRESHALL, 0); return make_arg(ret); } @@ -16966,7 +16958,6 @@ EGA::arg_t MMainWnd::RES_str_set(EGA::arg_t arg0, EGA::arg_t arg1, EGA::arg_t ar } DoSetFileModified(TRUE); - PostMessageW(s_hMainWnd, WM_COMMAND, ID_REFRESHALL, 0); return make_arg(1); // success } @@ -17015,7 +17006,6 @@ EGA::arg_t MMainWnd::RES_unload_resh(const EGA::args_t& args) UnloadResourceH(m_hwnd); DoSetFileModified(TRUE); - PostMessageW(s_hMainWnd, WM_COMMAND, ID_REFRESHALL, 0); return make_arg(1); }