Skip to content

Commit

Permalink
Fix #258
Browse files Browse the repository at this point in the history
  • Loading branch information
katahiromz committed Aug 2, 2024
1 parent 43200c0 commit a06ad0e
Show file tree
Hide file tree
Showing 3 changed files with 45 additions and 11 deletions.
15 changes: 10 additions & 5 deletions src/MEgaDlg.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -30,12 +30,15 @@ class MEgaDlg;
static HWND s_hwndEga = NULL;
static BOOL s_bEnter = FALSE;
extern HWND g_hMainWnd;
extern MIdOrString g_RES_select_type;
extern MIdOrString g_RES_select_name;
extern WORD g_RES_select_lang;

static bool EGA_dialog_input(char *buf, size_t buflen)
{
if (buf == NULL && buflen == 0)
{
SendMessageW(s_hwndEga, WM_COMMAND, IDCONTINUE, 0);
SendMessageW(g_hMainWnd, WM_COMMAND, ID_EGAFINISH, 0);
return true;
}

Expand Down Expand Up @@ -128,7 +131,9 @@ class MEgaDlg : public MDialogBase
if (filename && filename[0])
{
WideCharToMultiByte(CP_ACP, 0, filename, -1, szFileName, _countof(szFileName), NULL, NULL);
s_bEnter = TRUE;
g_RES_select_type = (WORD)0;
g_RES_select_name = (WORD)0;
g_RES_select_lang = BAD_LANG;
EGA_file_input(szFileName);
}
}
Expand Down Expand Up @@ -187,6 +192,9 @@ class MEgaDlg : public MDialogBase

void OnOK(HWND hwnd)
{
g_RES_select_type = (WORD)0;
g_RES_select_name = (WORD)0;
g_RES_select_lang = BAD_LANG;
s_bEnter = TRUE;
}

Expand All @@ -205,9 +213,6 @@ 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;
Expand Down
38 changes: 33 additions & 5 deletions src/RisohEditor.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -96,6 +96,10 @@ enum IMPORT_RESULT
NOT_IMPORTABLE
};

MIdOrString g_RES_select_type = (WORD)0;
MIdOrString g_RES_select_name = (WORD)0;
WORD g_RES_select_lang = BAD_LANG;

WORD GetMachineOfBinary(LPCWSTR pszExeFile)
{
WORD wMachine = IMAGE_FILE_MACHINE_UNKNOWN;
Expand Down Expand Up @@ -11977,6 +11981,32 @@ void MMainWnd::OnCommand(HWND hwnd, int id, HWND hwndCtl, UINT codeNotify)
case ID_OPENHISTORYPTB:
OnOpenLocalFile(hwnd, L"HISTORY-PTB.txt");
break;
case ID_EGAFINISH:
{
BOOL bModifiedOld = s_bModified;
DoRefreshTV(hwnd);
DoRefreshIDList(hwnd);
s_bModified = bModifiedOld;
}
if (!g_RES_select_type.is_zero() ||
!g_RES_select_name.is_zero() ||
g_RES_select_lang != BAD_LANG)
{
EntrySet found;
g_res.search(found, ET_LANG, g_RES_select_type, g_RES_select_name, g_RES_select_lang);

for (auto e : found)
{
SelectTV(e, FALSE);
break;
}

g_RES_select_type = (WORD)0;
g_RES_select_name = (WORD)0;
g_RES_select_lang = BAD_LANG;
}
PostUpdateLangArrow(hwnd);
break;
default:
bUpdateStatus = FALSE;
break;
Expand Down Expand Up @@ -16989,11 +17019,9 @@ EGA::arg_t MMainWnd::RES_select(const EGA::args_t& args)

if (found.size())
{
for (auto e : found)
{
SelectTV(e, FALSE);
break;
}
g_RES_select_type = type;
g_RES_select_name = name;
g_RES_select_lang = lang;
}

return make_arg<AstInt>(!found.empty());
Expand Down
3 changes: 2 additions & 1 deletion src/resource.h
Original file line number Diff line number Diff line change
Expand Up @@ -525,6 +525,7 @@
#define ID_OPENHISTORYID 276
#define ID_OPENREADMEPTB 277
#define ID_OPENHISTORYPTB 278
#define ID_EGAFINISH 279

#define MSGID_HELLO 101
#define MSGID_SAMPLE 102
Expand All @@ -535,7 +536,7 @@
#ifndef APSTUDIO_READONLY_SYMBOLS
#define _APS_NO_MFC 1
#define _APS_NEXT_RESOURCE_VALUE 108
#define _APS_NEXT_COMMAND_VALUE 279
#define _APS_NEXT_COMMAND_VALUE 280
#define _APS_NEXT_CONTROL_VALUE 1002
#define _APS_NEXT_SYMED_VALUE 300
#endif
Expand Down

0 comments on commit a06ad0e

Please sign in to comment.