no need to save current file (doc changed) for open new (empty) np3 window

This commit is contained in:
rkotten 2024-05-21 11:40:34 +02:00
parent 0578281ee5
commit 6835a69555
3 changed files with 7 additions and 6 deletions

View File

@ -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' };

View File

@ -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);

View File

@ -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);
}
@ -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;
@ -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();
}
}