mirror of
https://github.com/notepad-plus-plus/notepad-plus-plus.git
synced 2025-07-22 05:14:41 +02:00
[BUG_FIXED] Fix systemtray close crash bug.
[CHANGE_BEHAVIOUR] Change systemtray feature behaviour. git-svn-id: svn://svn.tuxfamily.org/svnroot/notepadplus/repository/trunk@560 f5eea248-9336-0410-98b8-ebc06183d4e3
This commit is contained in:
parent
1e41a66293
commit
bdbb2711e1
@ -393,7 +393,7 @@ void Notepad_plus::destroy()
|
|||||||
bool Notepad_plus::saveGUIParams()
|
bool Notepad_plus::saveGUIParams()
|
||||||
{
|
{
|
||||||
NppGUI & nppGUI = (NppGUI &)(NppParameters::getInstance())->getNppGUI();
|
NppGUI & nppGUI = (NppGUI &)(NppParameters::getInstance())->getNppGUI();
|
||||||
nppGUI._statusBarShow = _statusBar.isVisible();
|
//nppGUI._statusBarShow = _statusBar.isVisible();
|
||||||
nppGUI._toolbarShow = _rebarTop.getIDVisible(REBAR_BAR_TOOLBAR);
|
nppGUI._toolbarShow = _rebarTop.getIDVisible(REBAR_BAR_TOOLBAR);
|
||||||
nppGUI._toolBarStatus = _toolBar.getState();
|
nppGUI._toolBarStatus = _toolBar.getState();
|
||||||
|
|
||||||
@ -9204,70 +9204,65 @@ LRESULT Notepad_plus::runProc(HWND hwnd, UINT Message, WPARAM wParam, LPARAM lPa
|
|||||||
case WM_QUERYENDSESSION:
|
case WM_QUERYENDSESSION:
|
||||||
case WM_CLOSE:
|
case WM_CLOSE:
|
||||||
{
|
{
|
||||||
if (!_isPrelaunch)
|
if (_isPrelaunch)
|
||||||
{
|
|
||||||
_pTrayIco->doTrayIcon(REMOVE);
|
|
||||||
}
|
|
||||||
|
|
||||||
const NppGUI & nppgui = pNppParam->getNppGUI();
|
|
||||||
Session currentSession;
|
|
||||||
if (nppgui._rememberLastSession)
|
|
||||||
{
|
|
||||||
getCurrentOpenedFiles(currentSession);
|
|
||||||
//Lock the recent file list so it isnt populated with opened files
|
|
||||||
//Causing them to show on restart even though they are loaded by session
|
|
||||||
_lastRecentFileList.setLock(true); //only lock when the session is remembered
|
|
||||||
}
|
|
||||||
bool allClosed = fileCloseAll(); //try closing files before doing anything else
|
|
||||||
|
|
||||||
if (nppgui._rememberLastSession)
|
|
||||||
{
|
|
||||||
_lastRecentFileList.setLock(false); //only lock when the session is remembered
|
|
||||||
}
|
|
||||||
|
|
||||||
if (!allClosed)
|
|
||||||
{
|
|
||||||
//User cancelled the shutdown
|
|
||||||
return FALSE;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (_beforeSpecialView.isFullScreen) //closing, return to windowed mode
|
|
||||||
fullScreenToggle();
|
|
||||||
if (_beforeSpecialView.isPostIt) //closing, return to windowed mode
|
|
||||||
postItToggle();
|
|
||||||
|
|
||||||
if (_configStyleDlg.isCreated() && ::IsWindowVisible(_configStyleDlg.getHSelf()))
|
|
||||||
_configStyleDlg.restoreGlobalOverrideValues();
|
|
||||||
|
|
||||||
SCNotification scnN;
|
|
||||||
scnN.nmhdr.code = NPPN_SHUTDOWN;
|
|
||||||
scnN.nmhdr.hwndFrom = _hSelf;
|
|
||||||
scnN.nmhdr.idFrom = 0;
|
|
||||||
_pluginsManager.notify(&scnN);
|
|
||||||
|
|
||||||
saveFindHistory();
|
|
||||||
|
|
||||||
_lastRecentFileList.saveLRFL();
|
|
||||||
saveScintillaParams(SCIV_PRIMARY);
|
|
||||||
saveScintillaParams(SCIV_SECOND);
|
|
||||||
saveGUIParams();
|
|
||||||
saveUserDefineLangs();
|
|
||||||
saveShortcuts();
|
|
||||||
if (nppgui._rememberLastSession && _rememberThisSession)
|
|
||||||
saveSession(currentSession);
|
|
||||||
|
|
||||||
|
|
||||||
if (!_isPrelaunch)
|
|
||||||
{
|
|
||||||
//Sends WM_DESTROY, Notepad++ will end
|
|
||||||
::DestroyWindow(hwnd);
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
{
|
||||||
SendMessage(_hSelf, WM_SYSCOMMAND, SC_MINIMIZE, 0);
|
SendMessage(_hSelf, WM_SYSCOMMAND, SC_MINIMIZE, 0);
|
||||||
}
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
if (_pTrayIco)
|
||||||
|
_pTrayIco->doTrayIcon(REMOVE);
|
||||||
|
|
||||||
|
const NppGUI & nppgui = pNppParam->getNppGUI();
|
||||||
|
Session currentSession;
|
||||||
|
if (nppgui._rememberLastSession)
|
||||||
|
{
|
||||||
|
getCurrentOpenedFiles(currentSession);
|
||||||
|
//Lock the recent file list so it isnt populated with opened files
|
||||||
|
//Causing them to show on restart even though they are loaded by session
|
||||||
|
_lastRecentFileList.setLock(true); //only lock when the session is remembered
|
||||||
|
}
|
||||||
|
bool allClosed = fileCloseAll(); //try closing files before doing anything else
|
||||||
|
|
||||||
|
if (nppgui._rememberLastSession)
|
||||||
|
{
|
||||||
|
_lastRecentFileList.setLock(false); //only lock when the session is remembered
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!allClosed)
|
||||||
|
{
|
||||||
|
//User cancelled the shutdown
|
||||||
|
return FALSE;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (_beforeSpecialView.isFullScreen) //closing, return to windowed mode
|
||||||
|
fullScreenToggle();
|
||||||
|
if (_beforeSpecialView.isPostIt) //closing, return to windowed mode
|
||||||
|
postItToggle();
|
||||||
|
|
||||||
|
if (_configStyleDlg.isCreated() && ::IsWindowVisible(_configStyleDlg.getHSelf()))
|
||||||
|
_configStyleDlg.restoreGlobalOverrideValues();
|
||||||
|
|
||||||
|
SCNotification scnN;
|
||||||
|
scnN.nmhdr.code = NPPN_SHUTDOWN;
|
||||||
|
scnN.nmhdr.hwndFrom = _hSelf;
|
||||||
|
scnN.nmhdr.idFrom = 0;
|
||||||
|
_pluginsManager.notify(&scnN);
|
||||||
|
|
||||||
|
saveFindHistory();
|
||||||
|
|
||||||
|
_lastRecentFileList.saveLRFL();
|
||||||
|
saveScintillaParams(SCIV_PRIMARY);
|
||||||
|
saveScintillaParams(SCIV_SECOND);
|
||||||
|
saveGUIParams();
|
||||||
|
saveUserDefineLangs();
|
||||||
|
saveShortcuts();
|
||||||
|
if (nppgui._rememberLastSession && _rememberThisSession)
|
||||||
|
saveSession(currentSession);
|
||||||
|
|
||||||
|
//Sends WM_DESTROY, Notepad++ will end
|
||||||
|
::DestroyWindow(hwnd);
|
||||||
|
}
|
||||||
return TRUE;
|
return TRUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -9282,7 +9277,7 @@ LRESULT Notepad_plus::runProc(HWND hwnd, UINT Message, WPARAM wParam, LPARAM lPa
|
|||||||
case WM_SYSCOMMAND:
|
case WM_SYSCOMMAND:
|
||||||
{
|
{
|
||||||
NppGUI & nppgui = (NppGUI &)(pNppParam->getNppGUI());
|
NppGUI & nppgui = (NppGUI &)(pNppParam->getNppGUI());
|
||||||
if ((nppgui._isMinimizedToTray) && (wParam == SC_MINIMIZE))
|
if ((nppgui._isMinimizedToTray || _isPrelaunch) && (wParam == SC_MINIMIZE))
|
||||||
{
|
{
|
||||||
if (!_pTrayIco)
|
if (!_pTrayIco)
|
||||||
_pTrayIco = new trayIconControler(_hSelf, IDI_M30ICON, IDC_MINIMIZED_TRAY, ::LoadIcon(_hInst, MAKEINTRESOURCE(IDI_M30ICON)), TEXT(""));
|
_pTrayIco = new trayIconControler(_hSelf, IDI_M30ICON, IDC_MINIMIZED_TRAY, ::LoadIcon(_hInst, MAKEINTRESOURCE(IDI_M30ICON)), TEXT(""));
|
||||||
|
@ -311,9 +311,9 @@
|
|||||||
|
|
||||||
#define IDM_POPUP (IDM + 3050)
|
#define IDM_POPUP (IDM + 3050)
|
||||||
#define IDM_POPUP_FILE_ACTIVATE_OR_NEW (IDM_POPUP + 1)
|
#define IDM_POPUP_FILE_ACTIVATE_OR_NEW (IDM_POPUP + 1)
|
||||||
#define IDM_POPUP_FILE_NEW (IDM_POPUP + 2)
|
#define IDM_POPUP_FILE_NEW (IDM_POPUP + 2)
|
||||||
#define IDM_POPUP_FILE_NEW_AND_PASTE (IDM_POPUP + 3)
|
#define IDM_POPUP_FILE_NEW_AND_PASTE (IDM_POPUP + 3)
|
||||||
#define IDM_POPUP_FILE_OPEN (IDM_POPUP + 4)
|
#define IDM_POPUP_FILE_OPEN (IDM_POPUP + 4)
|
||||||
#define IDM_POPUP_CLOSE (IDM_POPUP + 5)
|
#define IDM_POPUP_CLOSE (IDM_POPUP + 5)
|
||||||
|
|
||||||
#endif //MENUCMDID_H
|
#endif //MENUCMDID_H
|
||||||
|
@ -164,6 +164,7 @@ notepad++ [--help] [-multiInst] [-noPlugins] [-lLanguage] [-nLineNumber] [-cColu
|
|||||||
-systemtray : Launch Notepad++ directly in system tray\r\
|
-systemtray : Launch Notepad++ directly in system tray\r\
|
||||||
fullFilePathName : file name to open (absolute or relative path name)\r\
|
fullFilePathName : file name to open (absolute or relative path name)\r\
|
||||||
");
|
");
|
||||||
|
|
||||||
void doException(Notepad_plus & notepad_plus_plus);
|
void doException(Notepad_plus & notepad_plus_plus);
|
||||||
|
|
||||||
int WINAPI WinMain(HINSTANCE hInstance, HINSTANCE, LPSTR, int)
|
int WINAPI WinMain(HINSTANCE hInstance, HINSTANCE, LPSTR, int)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user