Skip to content

Commit 375bb66

Browse files
committed
TypeView: ask the user if they want to update
This was the original behavior. It didn't work because the WM_NOTIFY was sent to the main window instead of the TypeView windows. WM_NOTIFY messages do not auto-propagate.
1 parent 45f2138 commit 375bb66

File tree

2 files changed

+11
-14
lines changed

2 files changed

+11
-14
lines changed

src/HexEdit/HexEdit.c

+11-2
Original file line numberDiff line numberDiff line change
@@ -897,8 +897,17 @@ LRESULT HexEdit_OnNotify(MAINWND *mainWnd, HWND hwnd, UINT idCtrl, NMHDR *hdr)
897897

898898
if (hdr->code == FCN_FILECHANGE)
899899
{
900-
InitTypeLibrary();
901-
UpdateTypeView();
900+
NMFILECHANGE *nmfc = (NMFILECHANGE *)hdr;
901+
TCHAR szMessage[MAX_PATH + 100];
902+
wsprintf(szMessage, TEXT("%s\r\n\r\nThis file has changed outside of the TypeView editor.\r\nDo you want to reload the changes?"), nmfc->pszFile);
903+
904+
UINT ret = MessageBox(hwnd, szMessage, TEXT("HexEdit"), MB_ICONQUESTION | MB_YESNO);
905+
906+
if (ret == IDYES)
907+
{
908+
InitTypeLibrary();
909+
UpdateTypeView();
910+
}
902911
return 0;
903912
}
904913

src/TypeView/TypeViewWnd.cpp

-12
Original file line numberDiff line numberDiff line change
@@ -601,18 +601,6 @@ LRESULT CALLBACK TypeViewCommandHandler(HWND hwnd, UINT msg, WPARAM wParam, LPAR
601601
NMGRIDVIEW *nmgv = (NMGRIDVIEW *)lParam;
602602
NMFILECHANGE *nmfc = (NMFILECHANGE *)lParam;
603603

604-
if(nmfc->hdr.code == FCN_FILECHANGE)
605-
{
606-
TCHAR szMessage[MAX_PATH+100];
607-
wsprintf(szMessage, TEXT("%s\r\n\r\nThis file has changed outside of the TypeView editor.\r\nDo you want to reload the changes?"), nmfc->pszFile);
608-
609-
UINT ret = MessageBox(hwnd, szMessage, TEXT("HexEdit"), MB_ICONQUESTION|MB_YESNO);
610-
611-
if(ret == IDYES)
612-
UpdateTypeView();
613-
return 0;
614-
}
615-
616604
//
617605
if(nmgv->hdr.code == GVN_CANINSERT || nmgv->hdr.code == GVN_CANDELETE)
618606
{

0 commit comments

Comments
 (0)