Add "No to All" and "Yes to All" options in Save dialog
It allows users, while closing files, to reply Yes or No only for once in Save dialog for the all rest of modified files. Close #5835 , close #4385, close #4392pull/5875/head
parent
bfd8cd0702
commit
3f7956dc1b
|
@ -981,6 +981,14 @@
|
||||||
<Item id="1718" name="延伸(\n, \r, \t, \0, \x...)"/>
|
<Item id="1718" name="延伸(\n, \r, \t, \0, \x...)"/>
|
||||||
<Item id="1720" name="「.」包含換行"/>
|
<Item id="1720" name="「.」包含換行"/>
|
||||||
</FindInFinder>
|
</FindInFinder>
|
||||||
|
<DoSaveOrNot title="儲存檔案">
|
||||||
|
<Item id="1761" name="您要儲存「$STR_REPLACE$」嗎?"/>
|
||||||
|
<Item id="6" name="好吧"/>
|
||||||
|
<Item id="7" name="不要啦"/>
|
||||||
|
<Item id="2" name="取消"/>
|
||||||
|
<Item id="4" name="全部存檔"/>
|
||||||
|
<Item id="5" name="全部棄存"/>
|
||||||
|
</DoSaveOrNot>
|
||||||
</Dialog>
|
</Dialog>
|
||||||
<MessageBox>
|
<MessageBox>
|
||||||
<ContextMenuXmlEditWarning title="編輯快顯功能表" message="編輯 contextMenu.xml 可以變更 Notepad++ 之快顯功能表。
|
<ContextMenuXmlEditWarning title="編輯快顯功能表" message="編輯 contextMenu.xml 可以變更 Notepad++ 之快顯功能表。
|
||||||
|
@ -1006,7 +1014,6 @@
|
||||||
<SortingError title="排序錯誤" message="第 $INT_REPLACE$ 行無法執行數字排序。"/>
|
<SortingError title="排序錯誤" message="第 $INT_REPLACE$ 行無法執行數字排序。"/>
|
||||||
<ColumnModeTip title="多欄選取提示" message="請使用「ALT + 滑鼠選擇」或「Alt + Shift + 方向鍵」以切換到多欄選取。"/>
|
<ColumnModeTip title="多欄選取提示" message="請使用「ALT + 滑鼠選擇」或「Alt + Shift + 方向鍵」以切換到多欄選取。"/>
|
||||||
<BufferInvalidWarning title="儲存失敗" message="緩衝區無效。"/>
|
<BufferInvalidWarning title="儲存失敗" message="緩衝區無效。"/>
|
||||||
<DoSaveOrNot title="儲存檔案" message="您要儲存「$STR_REPLACE$」嗎?"/>
|
|
||||||
<DoCloseOrNot title="保留文件" message="檔案「$STR_REPLACE$」已不存在。
|
<DoCloseOrNot title="保留文件" message="檔案「$STR_REPLACE$」已不存在。
|
||||||
您在 Notepad++ 中保存這個文件嗎?"/>
|
您在 Notepad++ 中保存這個文件嗎?"/>
|
||||||
<DoDeleteOrNot title="刪除檔案" message="您確定要刪除並關閉「$STR_REPLACE$」嗎?"/>
|
<DoDeleteOrNot title="刪除檔案" message="您確定要刪除並關閉「$STR_REPLACE$」嗎?"/>
|
||||||
|
|
|
@ -981,6 +981,14 @@
|
||||||
<Item id="1718" name="E&xtended (\n, \r, \t, \0, \x...)"/>
|
<Item id="1718" name="E&xtended (\n, \r, \t, \0, \x...)"/>
|
||||||
<Item id="1720" name="&. matches newline"/>
|
<Item id="1720" name="&. matches newline"/>
|
||||||
</FindInFinder>
|
</FindInFinder>
|
||||||
|
<DoSaveOrNot title="Save">
|
||||||
|
<Item id="1761" name="Save file "$STR_REPLACE$" ?"/>
|
||||||
|
<Item id="6" name="Yes"/>
|
||||||
|
<Item id="7" name="No"/>
|
||||||
|
<Item id="2" name="Cancel"/>
|
||||||
|
<Item id="4" name="Yes to all"/>
|
||||||
|
<Item id="5" name="No to all"/>
|
||||||
|
</DoSaveOrNot>
|
||||||
</Dialog>
|
</Dialog>
|
||||||
<MessageBox> <!-- $INT_REPLACE$ is a place holder, don't translate it -->
|
<MessageBox> <!-- $INT_REPLACE$ is a place holder, don't translate it -->
|
||||||
<ContextMenuXmlEditWarning title="Editing contextMenu" message="Editing contextMenu.xml allows you to modify your Notepad++ popup context menu.
|
<ContextMenuXmlEditWarning title="Editing contextMenu" message="Editing contextMenu.xml allows you to modify your Notepad++ popup context menu.
|
||||||
|
@ -1013,7 +1021,6 @@ you have to enable "Open all files of folder instead of launching Folder as
|
||||||
<SortingError title="Sorting Error" message="Unable to perform numeric sorting due to line $INT_REPLACE$."/>
|
<SortingError title="Sorting Error" message="Unable to perform numeric sorting due to line $INT_REPLACE$."/>
|
||||||
<ColumnModeTip title="Column Mode Tip" message="Please use "ALT+Mouse Selection" or "Alt+Shift+Arrow key" to switch to column mode."/>
|
<ColumnModeTip title="Column Mode Tip" message="Please use "ALT+Mouse Selection" or "Alt+Shift+Arrow key" to switch to column mode."/>
|
||||||
<BufferInvalidWarning title="Save failed" message="Cannot save: Buffer is invalid."/>
|
<BufferInvalidWarning title="Save failed" message="Cannot save: Buffer is invalid."/>
|
||||||
<DoSaveOrNot title="Save" message="Save file "$STR_REPLACE$" ?"/>
|
|
||||||
<DoCloseOrNot title="Keep non existing file" message="The file "$STR_REPLACE$" doesn't exist anymore.
|
<DoCloseOrNot title="Keep non existing file" message="The file "$STR_REPLACE$" doesn't exist anymore.
|
||||||
Keep this file in editor?"/>
|
Keep this file in editor?"/>
|
||||||
<DoDeleteOrNot title="Delete file" message="The file "$STR_REPLACE$"
|
<DoDeleteOrNot title="Delete file" message="The file "$STR_REPLACE$"
|
||||||
|
|
|
@ -966,6 +966,14 @@
|
||||||
<Item id="1718" name="Mode étendu (\n, \r, \t, \0, \x...)"/>
|
<Item id="1718" name="Mode étendu (\n, \r, \t, \0, \x...)"/>
|
||||||
<Item id="1720" name="&. comprend ligne nouvelle"/>
|
<Item id="1720" name="&. comprend ligne nouvelle"/>
|
||||||
</FindInFinder>
|
</FindInFinder>
|
||||||
|
<DoSaveOrNot title="Saugggvegarder">
|
||||||
|
<Item id="1761" name="Sauvegarder le fichier "$STR_REPLACE$" ?"/>
|
||||||
|
<Item id="6" name="Oui"/>
|
||||||
|
<Item id="7" name="Non"/>
|
||||||
|
<Item id="2" name="Annuler"/>
|
||||||
|
<Item id="4" name="Oui pour tout"/>
|
||||||
|
<Item id="5" name="Non pour tout"/>
|
||||||
|
</DoSaveOrNot>
|
||||||
</Dialog>
|
</Dialog>
|
||||||
<MessageBox>
|
<MessageBox>
|
||||||
<CannotMoveDoc title="Déplacement vers une nouvelle instance Notepad++" message="Le document est en cours d'utilisation, le sauvegarder puis réessayer."/>
|
<CannotMoveDoc title="Déplacement vers une nouvelle instance Notepad++" message="Le document est en cours d'utilisation, le sauvegarder puis réessayer."/>
|
||||||
|
@ -986,7 +994,6 @@
|
||||||
vous devez activer "Open all files of folder instead of launching Folder as Workspace on folder dropping" in "Default Directory" section of Preferences dialog to make this operation work."/>
|
vous devez activer "Open all files of folder instead of launching Folder as Workspace on folder dropping" in "Default Directory" section of Preferences dialog to make this operation work."/>
|
||||||
<SortingError title="Erreur de tri" message="Impossible d'effectuer le tri numérique à cause de la ligne $INT_REPLACE$."/>
|
<SortingError title="Erreur de tri" message="Impossible d'effectuer le tri numérique à cause de la ligne $INT_REPLACE$."/>
|
||||||
<BufferInvalidWarning title="Échec de sauvegarde" message="Cannot save: Buffer is invalid."/>
|
<BufferInvalidWarning title="Échec de sauvegarde" message="Cannot save: Buffer is invalid."/>
|
||||||
<DoSaveOrNot title="Sauvegarder" message="Sauvegarder le fichier "$STR_REPLACE$" ?"/>
|
|
||||||
<DoCloseOrNot title="Conserver un fichier non existant" message="Le fichier "$STR_REPLACE$" n'existe plus.
|
<DoCloseOrNot title="Conserver un fichier non existant" message="Le fichier "$STR_REPLACE$" n'existe plus.
|
||||||
Conserver ce fichier dans l'éditeur ?"/>
|
Conserver ce fichier dans l'éditeur ?"/>
|
||||||
<DoDeleteOrNot title="Supprimer fichier" message="Le fichier "$STR_REPLACE$"
|
<DoDeleteOrNot title="Supprimer fichier" message="Le fichier "$STR_REPLACE$"
|
||||||
|
|
|
@ -1862,15 +1862,15 @@ void Notepad_plus::filePrint(bool showDialog)
|
||||||
printer.doPrint();
|
printer.doPrint();
|
||||||
}
|
}
|
||||||
|
|
||||||
int Notepad_plus::doSaveOrNot(const TCHAR *fn)
|
int Notepad_plus::doSaveOrNot(const TCHAR* fn, bool isMulti)
|
||||||
{
|
{
|
||||||
return _nativeLangSpeaker.messageBox("DoSaveOrNot",
|
DoSaveOrNotBox doSaveOrNotBox;
|
||||||
_pPublicInterface->getHSelf(),
|
doSaveOrNotBox.init(_pPublicInterface->getHinst(), _pPublicInterface->getHSelf(), fn, isMulti);
|
||||||
TEXT("Save file \"$STR_REPLACE$\" ?"),
|
doSaveOrNotBox.doDialog(_nativeLangSpeaker.isRTL());
|
||||||
TEXT("Save"),
|
int buttonID = doSaveOrNotBox.getClickedButtonId();
|
||||||
MB_YESNOCANCEL | MB_ICONQUESTION | MB_APPLMODAL,
|
doSaveOrNotBox.destroy();
|
||||||
0, // not used
|
|
||||||
fn);
|
return buttonID;
|
||||||
}
|
}
|
||||||
|
|
||||||
int Notepad_plus::doReloadOrNot(const TCHAR *fn, bool dirty)
|
int Notepad_plus::doReloadOrNot(const TCHAR *fn, bool dirty)
|
||||||
|
|
|
@ -441,7 +441,7 @@ private:
|
||||||
void performPostReload(int whichOne);
|
void performPostReload(int whichOne);
|
||||||
//END: Document management
|
//END: Document management
|
||||||
|
|
||||||
int doSaveOrNot(const TCHAR *fn);
|
int doSaveOrNot(const TCHAR *fn, bool isMulti = false);
|
||||||
int doReloadOrNot(const TCHAR *fn, bool dirty);
|
int doReloadOrNot(const TCHAR *fn, bool dirty);
|
||||||
int doCloseOrNot(const TCHAR *fn);
|
int doCloseOrNot(const TCHAR *fn);
|
||||||
int doDeleteOrNot(const TCHAR *fn);
|
int doDeleteOrNot(const TCHAR *fn);
|
||||||
|
|
|
@ -1029,10 +1029,22 @@ CAPTION "Debug Info"
|
||||||
FONT 8, TEXT("MS Shell Dlg"), 0, 0, 0x1
|
FONT 8, TEXT("MS Shell Dlg"), 0, 0, 0x1
|
||||||
BEGIN
|
BEGIN
|
||||||
EDITTEXT IDC_DEBUGINFO_EDIT,31,20,220,96,ES_MULTILINE | ES_AUTOVSCROLL | ES_READONLY | NOT WS_BORDER | WS_VSCROLL
|
EDITTEXT IDC_DEBUGINFO_EDIT,31,20,220,96,ES_MULTILINE | ES_AUTOVSCROLL | ES_READONLY | NOT WS_BORDER | WS_VSCROLL
|
||||||
LTEXT "Copy debug info into clipboard",IDC_DEBUGINFO_COPYLINK,31,120,126,8
|
LTEXT "Copy debug info into clipboard",IDC_DEBUGINFO_COPYLINK,31,120,126,8
|
||||||
DEFPUSHBUTTON "OK",IDOK,106,160,50,14,BS_FLAT
|
DEFPUSHBUTTON "OK",IDOK,106,160,50,14,BS_FLAT
|
||||||
END
|
END
|
||||||
|
|
||||||
|
IDD_DOSAVEORNOTBOX DIALOGEX 0, 0, 350, 115
|
||||||
|
STYLE DS_SETFONT | DS_MODALFRAME | DS_FIXEDSYS | WS_POPUP | WS_CAPTION | WS_SYSMENU | WS_MAXIMIZEBOX | WS_THICKFRAME
|
||||||
|
CAPTION "Save"
|
||||||
|
FONT 8, TEXT("MS Shell Dlg"), 0, 0, 0x1
|
||||||
|
BEGIN
|
||||||
|
LTEXT "",IDC_DOSAVEORNOTTEX,30,30,126,126
|
||||||
|
DEFPUSHBUTTON "Yes",IDYES,50,85,50,14,BS_FLAT
|
||||||
|
PUSHBUTTON "No",IDNO,105,85,50,14,BS_FLAT
|
||||||
|
PUSHBUTTON "Cancel",IDCANCEL,160,85,50,14,BS_FLAT
|
||||||
|
PUSHBUTTON "Yes to all",IDRETRY,215,85,60,14,BS_FLAT
|
||||||
|
PUSHBUTTON "No to all",IDIGNORE,280,85,60,14,BS_FLAT
|
||||||
|
END
|
||||||
|
|
||||||
IDD_GOLINE DIALOGEX 26, 41, 261, 88
|
IDD_GOLINE DIALOGEX 26, 41, 261, 88
|
||||||
STYLE DS_SETFONT | DS_FIXEDSYS | WS_POPUP | WS_CAPTION | WS_SYSMENU
|
STYLE DS_SETFONT | DS_FIXEDSYS | WS_POPUP | WS_CAPTION | WS_SYSMENU
|
||||||
|
|
|
@ -871,7 +871,6 @@ bool Notepad_plus::fileClose(BufferID id, int curView)
|
||||||
}
|
}
|
||||||
else if (buf->isDirty())
|
else if (buf->isDirty())
|
||||||
{
|
{
|
||||||
|
|
||||||
res = doSaveOrNot(fileNamePath);
|
res = doSaveOrNot(fileNamePath);
|
||||||
if (res == IDYES)
|
if (res == IDYES)
|
||||||
{
|
{
|
||||||
|
@ -899,10 +898,13 @@ bool Notepad_plus::fileClose(BufferID id, int curView)
|
||||||
|
|
||||||
bool Notepad_plus::fileCloseAll(bool doDeleteBackup, bool isSnapshotMode)
|
bool Notepad_plus::fileCloseAll(bool doDeleteBackup, bool isSnapshotMode)
|
||||||
{
|
{
|
||||||
|
bool noSaveToAll = false;
|
||||||
|
bool saveToAll = false;
|
||||||
|
|
||||||
//closes all documents, makes the current view the only one visible
|
//closes all documents, makes the current view the only one visible
|
||||||
|
|
||||||
//first check if we need to save any file
|
//first check if we need to save any file
|
||||||
for (size_t i = 0; i < _mainDocTab.nbItem(); ++i)
|
for (size_t i = 0; i < _mainDocTab.nbItem() && !noSaveToAll; ++i)
|
||||||
{
|
{
|
||||||
BufferID id = _mainDocTab.getBufferByIndex(i);
|
BufferID id = _mainDocTab.getBufferByIndex(i);
|
||||||
Buffer * buf = MainFileManager->getBufferByID(id);
|
Buffer * buf = MainFileManager->getBufferByID(id);
|
||||||
|
@ -929,7 +931,6 @@ bool Notepad_plus::fileCloseAll(bool doDeleteBackup, bool isSnapshotMode)
|
||||||
0, // not used
|
0, // not used
|
||||||
buf->getFullPathName());
|
buf->getFullPathName());
|
||||||
|
|
||||||
//int res = doSaveOrNot(buf->getFullPathName());
|
|
||||||
if (res == IDYES)
|
if (res == IDYES)
|
||||||
{
|
{
|
||||||
if (!fileSave(id))
|
if (!fileSave(id))
|
||||||
|
@ -947,7 +948,16 @@ bool Notepad_plus::fileCloseAll(bool doDeleteBackup, bool isSnapshotMode)
|
||||||
if (!activateBuffer(id, SUB_VIEW))
|
if (!activateBuffer(id, SUB_VIEW))
|
||||||
switchEditViewTo(MAIN_VIEW);
|
switchEditViewTo(MAIN_VIEW);
|
||||||
|
|
||||||
int res = doSaveOrNot(buf->getFullPathName());
|
int res = -1;
|
||||||
|
if (saveToAll)
|
||||||
|
{
|
||||||
|
res = IDYES;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
res = doSaveOrNot(buf->getFullPathName(), true);
|
||||||
|
}
|
||||||
|
|
||||||
if (res == IDYES)
|
if (res == IDYES)
|
||||||
{
|
{
|
||||||
if (!fileSave(id))
|
if (!fileSave(id))
|
||||||
|
@ -957,10 +967,22 @@ bool Notepad_plus::fileCloseAll(bool doDeleteBackup, bool isSnapshotMode)
|
||||||
{
|
{
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
else if (res == IDIGNORE)
|
||||||
|
{
|
||||||
|
noSaveToAll = true;
|
||||||
|
}
|
||||||
|
else if (res == IDRETRY)
|
||||||
|
{
|
||||||
|
if (!fileSave(id))
|
||||||
|
return false; // Abort entire procedure.
|
||||||
|
|
||||||
|
saveToAll = true;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
for (size_t i = 0; i < _subDocTab.nbItem(); ++i)
|
|
||||||
|
for (size_t i = 0; i < _subDocTab.nbItem() && !noSaveToAll; ++i)
|
||||||
{
|
{
|
||||||
BufferID id = _subDocTab.getBufferByIndex(i);
|
BufferID id = _subDocTab.getBufferByIndex(i);
|
||||||
Buffer * buf = MainFileManager->getBufferByID(id);
|
Buffer * buf = MainFileManager->getBufferByID(id);
|
||||||
|
@ -1002,7 +1024,16 @@ bool Notepad_plus::fileCloseAll(bool doDeleteBackup, bool isSnapshotMode)
|
||||||
activateBuffer(id, SUB_VIEW);
|
activateBuffer(id, SUB_VIEW);
|
||||||
switchEditViewTo(SUB_VIEW);
|
switchEditViewTo(SUB_VIEW);
|
||||||
|
|
||||||
int res = doSaveOrNot(buf->getFullPathName());
|
int res = -1;
|
||||||
|
if (saveToAll)
|
||||||
|
{
|
||||||
|
res = IDYES;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
res = doSaveOrNot(buf->getFullPathName(), true);
|
||||||
|
}
|
||||||
|
|
||||||
if (res == IDYES)
|
if (res == IDYES)
|
||||||
{
|
{
|
||||||
if (!fileSave(id))
|
if (!fileSave(id))
|
||||||
|
@ -1013,6 +1044,17 @@ bool Notepad_plus::fileCloseAll(bool doDeleteBackup, bool isSnapshotMode)
|
||||||
return false;
|
return false;
|
||||||
//otherwise continue (IDNO)
|
//otherwise continue (IDNO)
|
||||||
}
|
}
|
||||||
|
else if (res == IDIGNORE)
|
||||||
|
{
|
||||||
|
noSaveToAll = true;
|
||||||
|
}
|
||||||
|
else if (res == IDRETRY)
|
||||||
|
{
|
||||||
|
if (!fileSave(id))
|
||||||
|
return false; // Abort entire procedure.
|
||||||
|
|
||||||
|
saveToAll = true;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1042,16 +1084,19 @@ bool Notepad_plus::fileCloseAllGiven(const std::vector<int> &krvecBufferIndexes)
|
||||||
// First check if we need to save any file.
|
// First check if we need to save any file.
|
||||||
|
|
||||||
std::vector<int>::const_iterator itIndexesEnd = krvecBufferIndexes.end();
|
std::vector<int>::const_iterator itIndexesEnd = krvecBufferIndexes.end();
|
||||||
|
bool noSaveToAll = false;
|
||||||
|
bool saveToAll = false;
|
||||||
|
|
||||||
for (std::vector<int>::const_iterator itIndex = krvecBufferIndexes.begin(); itIndex != itIndexesEnd; ++itIndex)
|
for (std::vector<int>::const_iterator itIndex = krvecBufferIndexes.begin(); itIndex != itIndexesEnd; ++itIndex)
|
||||||
{
|
{
|
||||||
BufferID id = _pDocTab->getBufferByIndex(*itIndex);
|
BufferID id = _pDocTab->getBufferByIndex(*itIndex);
|
||||||
Buffer * buf = MainFileManager->getBufferByID(id);
|
Buffer * buf = MainFileManager->getBufferByID(id);
|
||||||
|
|
||||||
if (buf->isUntitled() && buf->docLength() == 0)
|
if (buf->isUntitled() && buf->docLength() == 0)
|
||||||
{
|
{
|
||||||
// Do nothing.
|
// Do nothing.
|
||||||
}
|
}
|
||||||
else if (buf->isDirty())
|
else if (buf->isDirty() && !noSaveToAll)
|
||||||
{
|
{
|
||||||
if (_activeView == MAIN_VIEW)
|
if (_activeView == MAIN_VIEW)
|
||||||
{
|
{
|
||||||
|
@ -1065,7 +1110,16 @@ bool Notepad_plus::fileCloseAllGiven(const std::vector<int> &krvecBufferIndexes)
|
||||||
switchEditViewTo(SUB_VIEW);
|
switchEditViewTo(SUB_VIEW);
|
||||||
}
|
}
|
||||||
|
|
||||||
int res = doSaveOrNot(buf->getFullPathName());
|
int res = -1;
|
||||||
|
if (saveToAll)
|
||||||
|
{
|
||||||
|
res = IDYES;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
res = doSaveOrNot(buf->getFullPathName(), true);
|
||||||
|
}
|
||||||
|
|
||||||
if (res == IDYES)
|
if (res == IDYES)
|
||||||
{
|
{
|
||||||
if (!fileSave(id))
|
if (!fileSave(id))
|
||||||
|
@ -1073,7 +1127,18 @@ bool Notepad_plus::fileCloseAllGiven(const std::vector<int> &krvecBufferIndexes)
|
||||||
}
|
}
|
||||||
else if (res == IDCANCEL)
|
else if (res == IDCANCEL)
|
||||||
{
|
{
|
||||||
return false;
|
return false;
|
||||||
|
}
|
||||||
|
else if (res == IDIGNORE)
|
||||||
|
{
|
||||||
|
noSaveToAll = true;
|
||||||
|
}
|
||||||
|
else if (res == IDRETRY)
|
||||||
|
{
|
||||||
|
if (!fileSave(id))
|
||||||
|
return false; // Abort entire procedure.
|
||||||
|
|
||||||
|
saveToAll = true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1135,10 +1200,13 @@ bool Notepad_plus::fileCloseAllButCurrent()
|
||||||
BufferID current = _pEditView->getCurrentBufferID();
|
BufferID current = _pEditView->getCurrentBufferID();
|
||||||
int active = _pDocTab->getCurrentTabIndex();
|
int active = _pDocTab->getCurrentTabIndex();
|
||||||
const int activeViewID = currentView();
|
const int activeViewID = currentView();
|
||||||
|
bool noSaveToAll = false;
|
||||||
|
bool saveToAll = false;
|
||||||
|
|
||||||
//closes all documents, makes the current view the only one visible
|
//closes all documents, makes the current view the only one visible
|
||||||
|
|
||||||
//first check if we need to save any file
|
//first check if we need to save any file
|
||||||
for (size_t i = 0; i < _mainDocTab.nbItem(); ++i)
|
for (size_t i = 0; i < _mainDocTab.nbItem() && !noSaveToAll; ++i)
|
||||||
{
|
{
|
||||||
BufferID id = _mainDocTab.getBufferByIndex(i);
|
BufferID id = _mainDocTab.getBufferByIndex(i);
|
||||||
if (id == current)
|
if (id == current)
|
||||||
|
@ -1154,7 +1222,16 @@ bool Notepad_plus::fileCloseAllButCurrent()
|
||||||
if (!activateBuffer(id, SUB_VIEW))
|
if (!activateBuffer(id, SUB_VIEW))
|
||||||
switchEditViewTo(MAIN_VIEW);
|
switchEditViewTo(MAIN_VIEW);
|
||||||
|
|
||||||
int res = doSaveOrNot(buf->getFullPathName());
|
int res = -1;
|
||||||
|
if (saveToAll)
|
||||||
|
{
|
||||||
|
res = IDYES;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
res = doSaveOrNot(buf->getFullPathName(), true);
|
||||||
|
}
|
||||||
|
|
||||||
if (res == IDYES)
|
if (res == IDYES)
|
||||||
{
|
{
|
||||||
if (!fileSave(id))
|
if (!fileSave(id))
|
||||||
|
@ -1162,11 +1239,22 @@ bool Notepad_plus::fileCloseAllButCurrent()
|
||||||
}
|
}
|
||||||
else if (res == IDCANCEL)
|
else if (res == IDCANCEL)
|
||||||
{
|
{
|
||||||
return false;
|
return false;
|
||||||
|
}
|
||||||
|
else if (res == IDIGNORE)
|
||||||
|
{
|
||||||
|
noSaveToAll = true;
|
||||||
|
}
|
||||||
|
else if (res == IDRETRY)
|
||||||
|
{
|
||||||
|
if (!fileSave(id))
|
||||||
|
return false; // Abort entire procedure.
|
||||||
|
|
||||||
|
saveToAll = true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
for (size_t i = 0; i < _subDocTab.nbItem(); ++i)
|
for (size_t i = 0; i < _subDocTab.nbItem() && !noSaveToAll; ++i)
|
||||||
{
|
{
|
||||||
BufferID id = _subDocTab.getBufferByIndex(i);
|
BufferID id = _subDocTab.getBufferByIndex(i);
|
||||||
Buffer * buf = MainFileManager->getBufferByID(id);
|
Buffer * buf = MainFileManager->getBufferByID(id);
|
||||||
|
@ -1181,7 +1269,16 @@ bool Notepad_plus::fileCloseAllButCurrent()
|
||||||
activateBuffer(id, SUB_VIEW);
|
activateBuffer(id, SUB_VIEW);
|
||||||
switchEditViewTo(SUB_VIEW);
|
switchEditViewTo(SUB_VIEW);
|
||||||
|
|
||||||
int res = doSaveOrNot(buf->getFullPathName());
|
int res = -1;
|
||||||
|
if (saveToAll)
|
||||||
|
{
|
||||||
|
res = IDYES;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
res = doSaveOrNot(buf->getFullPathName(), true);
|
||||||
|
}
|
||||||
|
|
||||||
if (res == IDYES)
|
if (res == IDYES)
|
||||||
{
|
{
|
||||||
if (!fileSave(id))
|
if (!fileSave(id))
|
||||||
|
@ -1189,7 +1286,18 @@ bool Notepad_plus::fileCloseAllButCurrent()
|
||||||
}
|
}
|
||||||
else if (res == IDCANCEL)
|
else if (res == IDCANCEL)
|
||||||
{
|
{
|
||||||
return false;
|
return false;
|
||||||
|
}
|
||||||
|
else if (res == IDIGNORE)
|
||||||
|
{
|
||||||
|
noSaveToAll = true;
|
||||||
|
}
|
||||||
|
else if (res == IDRETRY)
|
||||||
|
{
|
||||||
|
if (!fileSave(id))
|
||||||
|
return false; // Abort entire procedure.
|
||||||
|
|
||||||
|
saveToAll = true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -32,6 +32,7 @@
|
||||||
|
|
||||||
#include "AboutDlg.h"
|
#include "AboutDlg.h"
|
||||||
#include "Parameters.h"
|
#include "Parameters.h"
|
||||||
|
#include "localization.h"
|
||||||
|
|
||||||
INT_PTR CALLBACK AboutDlg::run_dlgProc(UINT message, WPARAM wParam, LPARAM lParam)
|
INT_PTR CALLBACK AboutDlg::run_dlgProc(UINT message, WPARAM wParam, LPARAM lParam)
|
||||||
{
|
{
|
||||||
|
@ -225,3 +226,95 @@ void DebugInfoDlg::doDialog()
|
||||||
goToCenter();
|
goToCenter();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void DoSaveOrNotBox::doDialog(bool isRTL)
|
||||||
|
{
|
||||||
|
|
||||||
|
if (isRTL)
|
||||||
|
{
|
||||||
|
DLGTEMPLATE *pMyDlgTemplate = NULL;
|
||||||
|
HGLOBAL hMyDlgTemplate = makeRTLResource(IDD_DOSAVEORNOTBOX, &pMyDlgTemplate);
|
||||||
|
::DialogBoxIndirectParam(_hInst, pMyDlgTemplate, _hParent, dlgProc, reinterpret_cast<LPARAM>(this));
|
||||||
|
::GlobalFree(hMyDlgTemplate);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
::DialogBoxParam(_hInst, MAKEINTRESOURCE(IDD_DOSAVEORNOTBOX), _hParent, dlgProc, reinterpret_cast<LPARAM>(this));
|
||||||
|
}
|
||||||
|
|
||||||
|
void DoSaveOrNotBox::changeLang()
|
||||||
|
{
|
||||||
|
generic_string msg;
|
||||||
|
generic_string defaultMessage = TEXT("Save file \"$STR_REPLACE$\" ?");
|
||||||
|
NativeLangSpeaker* nativeLangSpeaker = NppParameters::getInstance()->getNativeLangSpeaker();
|
||||||
|
|
||||||
|
if (nativeLangSpeaker->changeDlgLang(_hSelf, "DoSaveOrNot"))
|
||||||
|
{
|
||||||
|
const unsigned char len = 255;
|
||||||
|
TCHAR text[len];
|
||||||
|
::GetDlgItemText(_hSelf, IDC_DOSAVEORNOTTEX, text, len);
|
||||||
|
msg = text;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (msg.empty())
|
||||||
|
msg = defaultMessage;
|
||||||
|
|
||||||
|
msg = stringReplace(msg, TEXT("$STR_REPLACE$"), _fn);
|
||||||
|
::SetDlgItemText(_hSelf, IDC_DOSAVEORNOTTEX, msg.c_str());
|
||||||
|
}
|
||||||
|
|
||||||
|
INT_PTR CALLBACK DoSaveOrNotBox::run_dlgProc(UINT message, WPARAM wParam, LPARAM /*lParam*/)
|
||||||
|
{
|
||||||
|
switch (message)
|
||||||
|
{
|
||||||
|
case WM_INITDIALOG :
|
||||||
|
{
|
||||||
|
changeLang();
|
||||||
|
::EnableWindow(::GetDlgItem(_hSelf, IDRETRY), _isMulti);
|
||||||
|
::EnableWindow(::GetDlgItem(_hSelf, IDIGNORE), _isMulti);
|
||||||
|
goToCenter();
|
||||||
|
return TRUE;
|
||||||
|
}
|
||||||
|
|
||||||
|
case WM_COMMAND:
|
||||||
|
{
|
||||||
|
switch (LOWORD(wParam))
|
||||||
|
{
|
||||||
|
case IDCANCEL:
|
||||||
|
{
|
||||||
|
::EndDialog(_hSelf, -1);
|
||||||
|
clickedButtonId = IDCANCEL;
|
||||||
|
return TRUE;
|
||||||
|
}
|
||||||
|
|
||||||
|
case IDYES:
|
||||||
|
{
|
||||||
|
::EndDialog(_hSelf, 0);
|
||||||
|
clickedButtonId = IDYES;
|
||||||
|
return TRUE;
|
||||||
|
}
|
||||||
|
|
||||||
|
case IDNO:
|
||||||
|
{
|
||||||
|
::EndDialog(_hSelf, 0);
|
||||||
|
clickedButtonId = IDNO;
|
||||||
|
return TRUE;
|
||||||
|
}
|
||||||
|
|
||||||
|
case IDIGNORE:
|
||||||
|
{
|
||||||
|
::EndDialog(_hSelf, 0);
|
||||||
|
clickedButtonId = IDIGNORE;
|
||||||
|
return TRUE;
|
||||||
|
}
|
||||||
|
|
||||||
|
case IDRETRY:
|
||||||
|
{
|
||||||
|
::EndDialog(_hSelf, 0);
|
||||||
|
clickedButtonId = IDRETRY;
|
||||||
|
return TRUE;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
default:
|
||||||
|
return FALSE;
|
||||||
|
}
|
||||||
|
}
|
|
@ -96,3 +96,35 @@ private:
|
||||||
URLCtrl _copyToClipboardLink;
|
URLCtrl _copyToClipboardLink;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
class DoSaveOrNotBox : public StaticDialog
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
DoSaveOrNotBox() : StaticDialog() {};
|
||||||
|
|
||||||
|
void init(HINSTANCE hInst, HWND parent, const TCHAR* fn, bool isMulti) {
|
||||||
|
Window::init(hInst, parent);
|
||||||
|
if (fn)
|
||||||
|
_fn = fn;
|
||||||
|
|
||||||
|
_isMulti = isMulti;
|
||||||
|
};
|
||||||
|
|
||||||
|
void doDialog(bool isRTL = false);
|
||||||
|
|
||||||
|
virtual void destroy() {
|
||||||
|
};
|
||||||
|
|
||||||
|
int getClickedButtonId() const {
|
||||||
|
return clickedButtonId;
|
||||||
|
};
|
||||||
|
|
||||||
|
void changeLang();
|
||||||
|
|
||||||
|
protected:
|
||||||
|
virtual INT_PTR CALLBACK run_dlgProc(UINT message, WPARAM wParam, LPARAM lParam);
|
||||||
|
|
||||||
|
private:
|
||||||
|
int clickedButtonId = -1;
|
||||||
|
generic_string _fn;
|
||||||
|
bool _isMulti = false;
|
||||||
|
};
|
||||||
|
|
|
@ -36,7 +36,6 @@
|
||||||
IDD_SHORTCUTMAPPER_DLG DIALOGEX 0, 0, 450, 355
|
IDD_SHORTCUTMAPPER_DLG DIALOGEX 0, 0, 450, 355
|
||||||
STYLE DS_SETFONT | DS_MODALFRAME | DS_FIXEDSYS | WS_POPUP | WS_CAPTION |
|
STYLE DS_SETFONT | DS_MODALFRAME | DS_FIXEDSYS | WS_POPUP | WS_CAPTION |
|
||||||
WS_SYSMENU | WS_MAXIMIZEBOX | WS_THICKFRAME
|
WS_SYSMENU | WS_MAXIMIZEBOX | WS_THICKFRAME
|
||||||
//EXSTYLE WS_EX_TOOLWINDOW
|
|
||||||
CAPTION "Shortcut mapper"
|
CAPTION "Shortcut mapper"
|
||||||
FONT 8, TEXT("MS Shell Dlg"), 400, 0, 0x1
|
FONT 8, TEXT("MS Shell Dlg"), 400, 0, 0x1
|
||||||
BEGIN
|
BEGIN
|
||||||
|
|
|
@ -304,6 +304,9 @@
|
||||||
#define IDC_DEBUGINFO_EDIT 1751
|
#define IDC_DEBUGINFO_EDIT 1751
|
||||||
#define IDC_DEBUGINFO_COPYLINK 1752
|
#define IDC_DEBUGINFO_COPYLINK 1752
|
||||||
|
|
||||||
|
#define IDD_DOSAVEORNOTBOX 1760
|
||||||
|
#define IDC_DOSAVEORNOTTEX 1761
|
||||||
|
|
||||||
//#define IDD_USER_DEFINE_BOX 1800
|
//#define IDD_USER_DEFINE_BOX 1800
|
||||||
//#define IDD_RUN_DLG 1900
|
//#define IDD_RUN_DLG 1900
|
||||||
//#define IDD_MD5FROMFILES_DLG 1920
|
//#define IDD_MD5FROMFILES_DLG 1920
|
||||||
|
|
Loading…
Reference in New Issue