Skip to content

Commit

Permalink
no need to save current file (doc changed) for open new (empty) np3 w…
Browse files Browse the repository at this point in the history
…indow
  • Loading branch information
RaiKoHoff committed May 21, 2024
1 parent 0578281 commit 6835a69
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 6 deletions.
4 changes: 2 additions & 2 deletions src/Dialogs.c
Original file line number Diff line number Diff line change
Expand Up @@ -4826,9 +4826,9 @@ void RestorePrevScreenPos(HWND hwnd)
//
// DialogNewWindow()
//
void DialogNewWindow(HWND hwnd, bool bSaveOnRunTools, const HPATHL hFilePath, WININFO* wi)
void DialogNewWindow(HWND hwnd, bool bSaveBeforeOpen, const HPATHL hFilePath, WININFO* wi)
{
if (bSaveOnRunTools && !FileSave(FSF_Ask)) {
if (bSaveBeforeOpen && !FileSave(FSF_Ask)) {
return;
}
WCHAR wch[80] = { L'\0' };
Expand Down
2 changes: 1 addition & 1 deletion src/Dialogs.h
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,7 @@ WINDOWPLACEMENT WindowPlacementFromInfo(HWND hwnd, const WININFO* pWinInfo, SCRE
void SnapToWinInfoPos(HWND hwnd, const WININFO winInfo, SCREEN_MODE mode, UINT nCmdShow);
void RestorePrevScreenPos(HWND hwnd);

void DialogNewWindow(HWND hwnd, bool bSaveOnRunTools, const HPATHL hFilePath, WININFO* wi);
void DialogNewWindow(HWND hwnd, bool bSaveBeforeOpen, const HPATHL hFilePath, WININFO* wi);
void DialogFileBrowse(HWND hwnd);
void DialogGrepWin(HWND hwnd, LPCWSTR searchPattern);
void DialogAdminExe(HWND hwnd,bool);
Expand Down
7 changes: 4 additions & 3 deletions src/Notepad3.c
Original file line number Diff line number Diff line change
Expand Up @@ -3684,8 +3684,9 @@ static LRESULT _OnDropOneFile(HWND hwnd, HPATHL hFilePath, WININFO* wi)
}
else if (Path_IsExistingFile(hFilePath)) {
//~ ignore Flags.bReuseWindow
bool const sameFile = (Path_StrgComparePath(hFilePath, Paths.CurrentFile, Paths.ModuleDirectory) == 0);
if (IsKeyDown(VK_CONTROL) || wi) {
DialogNewWindow(hwnd, Settings.SaveBeforeRunningTools, hFilePath, wi);
DialogNewWindow(hwnd, sameFile, hFilePath, wi);
} else {
FileLoad(hFilePath, fLoadFlags, 0, 0);
}
Expand Down Expand Up @@ -4840,7 +4841,7 @@ LRESULT MsgCommand(HWND hwnd, UINT umsg, WPARAM wParam, LPARAM lParam)
case IDM_FILE_NEWWINDOW2: {
SaveAllSettings(false);
HPATHL hpth = (iLoWParam == IDM_FILE_NEWWINDOW2) ? Paths.CurrentFile : NULL;
DialogNewWindow(hwnd, Settings.SaveBeforeRunningTools, hpth, NULL);
DialogNewWindow(hwnd, (hpth != NULL), hpth, NULL);
}
break;

Expand Down Expand Up @@ -12117,7 +12118,7 @@ bool FileSave(FileSaveFlags fSaveFlags)
LONG const answer = InfoBoxLng(typ, L"ReloadExSavedCfg", IDS_MUI_RELOADSETTINGS, tch);
if (IsYesOkay(answer)) {
///~SaveAllSettings(true); ~ already saved (CurrentFile)
DialogNewWindow(Globals.hwndMain, false, Paths.CurrentFile, NULL);
DialogNewWindow(Globals.hwndMain, true, Paths.CurrentFile, NULL);
CloseApplication();
}
}
Expand Down

0 comments on commit 6835a69

Please sign in to comment.