From e8b76a28eca6354751eb7b39c91b19ef42da28b1 Mon Sep 17 00:00:00 2001 From: Don Ho Date: Sun, 13 Apr 2014 20:56:20 +0000 Subject: [PATCH] [NEW_FEATURE] Snapshot feature. git-svn-id: svn://svn.tuxfamily.org/svnroot/notepadplus/repository/trunk@1221 f5eea248-9336-0410-98b8-ebc06183d4e3 --- PowerEditor/src/NppBigSwitch.cpp | 7 +++++ .../src/ScitillaComponent/FindReplaceDlg.cpp | 9 +++--- .../WinControls/Preference/preferenceDlg.cpp | 29 +++++++++++++++++++ PowerEditor/src/resource.h | 2 +- 4 files changed, 42 insertions(+), 5 deletions(-) diff --git a/PowerEditor/src/NppBigSwitch.cpp b/PowerEditor/src/NppBigSwitch.cpp index 72d794842..13dc24f6a 100644 --- a/PowerEditor/src/NppBigSwitch.cpp +++ b/PowerEditor/src/NppBigSwitch.cpp @@ -1050,6 +1050,13 @@ LRESULT Notepad_plus::process(HWND hwnd, UINT Message, WPARAM wParam, LPARAM lPa return (LRESULT)_scintillaCtrls4Plugins.getScintillaEditViewFrom((HWND)lParam); } + case NPPM_INTERNAL_ENABLESNAPSHOT: + { + launchDocumentBackupTask(); + return TRUE; + } + + case NPPM_DESTROYSCINTILLAHANDLE : { return _scintillaCtrls4Plugins.destroyScintilla((HWND)lParam); diff --git a/PowerEditor/src/ScitillaComponent/FindReplaceDlg.cpp b/PowerEditor/src/ScitillaComponent/FindReplaceDlg.cpp index 42170dd65..b383734c9 100644 --- a/PowerEditor/src/ScitillaComponent/FindReplaceDlg.cpp +++ b/PowerEditor/src/ScitillaComponent/FindReplaceDlg.cpp @@ -2732,10 +2732,11 @@ BOOL CALLBACK FindIncrementDlg::run_dlgProc(UINT message, WPARAM wParam, LPARAM) _pFRDlg->processFindNext(str2Search.c_str(), &fo, &findStatus); setFindStatus(findStatus); } - return TRUE; - case EN_KILLFOCUS : - case EN_SETFOCUS : - break; + return TRUE; + + case EN_KILLFOCUS : + case EN_SETFOCUS : + break; } } return TRUE; diff --git a/PowerEditor/src/WinControls/Preference/preferenceDlg.cpp b/PowerEditor/src/WinControls/Preference/preferenceDlg.cpp index 3eb379a97..cdaf82134 100644 --- a/PowerEditor/src/WinControls/Preference/preferenceDlg.cpp +++ b/PowerEditor/src/WinControls/Preference/preferenceDlg.cpp @@ -2216,6 +2216,15 @@ BOOL CALLBACK BackupDlg::run_dlgProc(UINT Message, WPARAM wParam, LPARAM) case IDC_BACKUPDIR_RESTORESESSION_EDIT: { + + const int stringSize = 16; + TCHAR str[stringSize]; + + ::GetDlgItemText(_hSelf, IDC_BACKUPDIR_RESTORESESSION_EDIT, str, stringSize); + + if (lstrcmp(str, TEXT("")) == 0) + return TRUE; + nppGUI._snapshotBackupTiming = ::GetDlgItemInt(_hSelf, IDC_BACKUPDIR_RESTORESESSION_EDIT, NULL, FALSE) * 1000; if (!nppGUI._snapshotBackupTiming) { @@ -2226,6 +2235,25 @@ BOOL CALLBACK BackupDlg::run_dlgProc(UINT Message, WPARAM wParam, LPARAM) } } } + else if (HIWORD(wParam) == EN_KILLFOCUS) + { + switch (LOWORD(wParam)) + { + case IDC_BACKUPDIR_RESTORESESSION_EDIT: + { + //printStr(TEXT("")); + const int stringSize = 16; + TCHAR str[stringSize]; + + ::GetDlgItemText(_hSelf, IDC_BACKUPDIR_RESTORESESSION_EDIT, str, stringSize); + + if (lstrcmp(str, TEXT("")) == 0) + { + ::SetDlgItemInt(_hSelf, IDC_BACKUPDIR_RESTORESESSION_EDIT, nppGUI._snapshotBackupTiming/1000, FALSE); + } + } + } + } switch (wParam) { @@ -2237,6 +2265,7 @@ BOOL CALLBACK BackupDlg::run_dlgProc(UINT Message, WPARAM wParam, LPARAM) if (nppGUI._isSnapshotMode) { // Launch thread + ::SendMessage(::GetParent(_hParent), NPPM_INTERNAL_ENABLESNAPSHOT, 0, 0); } return TRUE; } diff --git a/PowerEditor/src/resource.h b/PowerEditor/src/resource.h index eb7ea1e1e..7dfeaf8b9 100644 --- a/PowerEditor/src/resource.h +++ b/PowerEditor/src/resource.h @@ -394,7 +394,7 @@ #define NPPM_INTERNAL_RECENTFILELIST_UPDATE (NOTEPADPLUS_USER_INTERNAL + 35) #define NPPM_INTERNAL_RECENTFILELIST_SWITCH (NOTEPADPLUS_USER_INTERNAL + 36) #define NPPM_INTERNAL_GETSCINTEDTVIEW (NOTEPADPLUS_USER_INTERNAL + 37) - //#define NPPM_INTERNAL_SETDOCMAPCHECK (NOTEPADPLUS_USER_INTERNAL + 38) + #define NPPM_INTERNAL_ENABLESNAPSHOT (NOTEPADPLUS_USER_INTERNAL + 38) //wParam: 0 //lParam: document new index