[NEW_FEATURE] Automatic Backup System (in progress).

git-svn-id: svn://svn.tuxfamily.org/svnroot/notepadplus/repository/trunk@1225 f5eea248-9336-0410-98b8-ebc06183d4e3
This commit is contained in:
Don Ho 2014-04-22 18:16:32 +00:00
parent 1a73826357
commit 162de3ff6c
5 changed files with 26 additions and 15 deletions

View File

@ -719,6 +719,7 @@
</RecentFilesHistory>
<Backup title="備份">
<Item id="6309" name="記憶此次開啟文件"/>
<Item id="6801" name="備份"/>
<Item id="6315" name="否"/>
<Item id="6316" name="簡易"/>
@ -762,7 +763,6 @@
<MISC title="其他">
<Item id="6307" name="啟動"/>
<Item id="6308" name="縮小到系統框"/>
<Item id="6309" name="記憶此次開啟文件"/>
<Item id="6312" name="自動檢視開啟文件狀態"/>
<Item id="6313" name="自動更新檔案"/>
<Item id="6314" name="備份"/>

View File

@ -714,6 +714,8 @@
</RecentFilesHistory>
<Backup title="Backup">
<Item id="6309" name="Remember current session for next launch"/>
<Item id="6801" name="Backup"/>
<Item id="6315" name="None"/>
<Item id="6316" name="Simple backup"/>
@ -759,7 +761,6 @@
<MISC title="MISC.">
<Item id="6307" name="Enable"/>
<Item id="6308" name="Minimize to system tray"/>
<Item id="6309" name="Remember current session for next launch"/>
<Item id="6312" name="File Status Auto-Detection"/>
<Item id="6313" name="Update silently"/>
<Item id="6318" name="Clickable Link Settings"/>

View File

@ -733,6 +733,7 @@
</RecentFilesHistory>
<Backup title="Sauvegarde">
<Item id="6309" name="Mémoriser la session actuelle"/>
<Item id="6315" name="Aucune"/>
<Item id="6316" name="Simple"/>
<Item id="6317" name="Détaillée"/>
@ -779,7 +780,6 @@
<Item id="6117" name="Activer la liste de MRU"/>
<Item id="6307" name="Détection automatique"/>
<Item id="6308" name="Réduire dans la barre de notifications"/>
<Item id="6309" name="Mémoriser la session actuelle"/>
<Item id="6312" name="Autodétection de létat des fichiers"/>
<Item id="6313" name="Mise à jour sans alerte"/>
<Item id="6314" name="Backup"/>

View File

@ -288,6 +288,12 @@ IDD_PREFERENCE_BACKUP_BOX DIALOGEX 0, 0, 455, 185
STYLE DS_SETFONT | DS_FIXEDSYS | DS_CONTROL | WS_CHILD
FONT 8, "MS Shell Dlg", 0, 0, 0x1
BEGIN
GROUPBOX "Session snapshot and periodic backup",IDC_BACKUPDIR_RESTORESESSION_GRP_STATIC,79,1,289,59,BS_CENTER
CONTROL "Remember current session for next launch",IDC_CHECK_REMEMBERSESSION,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,90,10,270,10
CONTROL "Enable session snapshot and periodic backup",IDC_BACKUPDIR_RESTORESESSION_CHECK,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,90,25,270,10
EDITTEXT IDC_BACKUPDIR_RESTORESESSION_EDIT,164,40,21,14,ES_NUMBER
RTEXT "Backup in every",IDD_BACKUPDIR_RESTORESESSION_STATIC1,82,42,78,8
LTEXT "seconds",IDD_BACKUPDIR_RESTORESESSION_STATIC2,190,42,66,8
GROUPBOX "Backup on save",IDC_BACKUPDIR_GRP_STATIC,79,69,289,110,BS_CENTER
CONTROL "None",IDC_RADIO_BKNONE,"Button",BS_AUTORADIOBUTTON | WS_GROUP,104,80,87,10
CONTROL "Simple backup",IDC_RADIO_BKSIMPLE,"Button",BS_AUTORADIOBUTTON,104,94,111,10
@ -297,12 +303,6 @@ BEGIN
RTEXT "Directory :",IDD_BACKUPDIR_STATIC,99,146,40,8
EDITTEXT IDC_BACKUPDIR_EDIT,146,144,179,14,ES_AUTOHSCROLL
PUSHBUTTON "...",IDD_BACKUPDIR_BROWSE_BUTTON,332,144,16,14
GROUPBOX "Session snapshot and periodic backup",IDC_BACKUPDIR_RESTORESESSION_GRP_STATIC,79,1,289,59,BS_CENTER
CONTROL "Remember current session for next launch",IDC_CHECK_REMEMBERSESSION,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,90,10,270,10
CONTROL "Enable session snapshot and periodic backup",IDC_BACKUPDIR_RESTORESESSION_CHECK,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,90,25,270,10
EDITTEXT IDC_BACKUPDIR_RESTORESESSION_EDIT,164,40,21,14,ES_NUMBER
RTEXT "Backup in every",IDD_BACKUPDIR_RESTORESESSION_STATIC1,82,42,78,8
LTEXT "seconds",IDD_BACKUPDIR_RESTORESESSION_STATIC2,190,42,66,8
END
IDD_PREFERENCE_AUTOCOMPLETION_BOX DIALOGEX 0, 0, 455, 185

View File

@ -828,7 +828,6 @@ BOOL CALLBACK SettingsDlg::run_dlgProc(UINT Message, WPARAM wParam, LPARAM)
}
::SendDlgItemMessage(_hSelf, IDC_CHECK_MIN2SYSTRAY, BM_SETCHECK, nppGUI._isMinimizedToTray, 0);
::SendDlgItemMessage(_hSelf, IDC_CHECK_REMEMBERSESSION, BM_SETCHECK, nppGUI._rememberLastSession, 0);
::SendDlgItemMessage(_hSelf, IDC_CHECK_DETECTENCODING, BM_SETCHECK, nppGUI._detectEncoding, 0);
::SendDlgItemMessage(_hSelf, IDC_CHECK_AUTOUPDATE, BM_SETCHECK, nppGUI._autoUpdateOpt._doAutoUpdate, 0);
@ -959,9 +958,6 @@ BOOL CALLBACK SettingsDlg::run_dlgProc(UINT Message, WPARAM wParam, LPARAM)
nppGUI._isMinimizedToTray = isCheckedOrNot(wParam);
return TRUE;
case IDC_CHECK_REMEMBERSESSION:
nppGUI._rememberLastSession = isCheckedOrNot(wParam);
return TRUE;
case IDC_CHECK_DETECTENCODING:
nppGUI._detectEncoding = isCheckedOrNot(wParam);
return TRUE;
@ -2171,7 +2167,8 @@ BOOL CALLBACK BackupDlg::run_dlgProc(UINT Message, WPARAM wParam, LPARAM)
{
case WM_INITDIALOG :
{
bool snapshotCheck = nppGUI._isSnapshotMode;
::SendDlgItemMessage(_hSelf, IDC_CHECK_REMEMBERSESSION, BM_SETCHECK, nppGUI._rememberLastSession, 0);
bool snapshotCheck = nppGUI._rememberLastSession && nppGUI._isSnapshotMode;
::SendDlgItemMessage(_hSelf, IDC_BACKUPDIR_RESTORESESSION_CHECK, BM_SETCHECK, snapshotCheck?BST_CHECKED:BST_UNCHECKED, 0);
int periodicBackupInSec = nppGUI._snapshotBackupTiming/1000;
::SetDlgItemInt(_hSelf, IDC_BACKUPDIR_RESTORESESSION_EDIT, periodicBackupInSec, FALSE);
@ -2257,6 +2254,17 @@ BOOL CALLBACK BackupDlg::run_dlgProc(UINT Message, WPARAM wParam, LPARAM)
switch (wParam)
{
case IDC_CHECK_REMEMBERSESSION:
{
nppGUI._rememberLastSession = isCheckedOrNot(IDC_CHECK_REMEMBERSESSION);
if (!nppGUI._rememberLastSession)
{
::SendDlgItemMessage(_hSelf, IDC_BACKUPDIR_RESTORESESSION_CHECK, BM_SETCHECK, BST_UNCHECKED, 0);
::SendMessage(_hSelf, WM_COMMAND, IDC_BACKUPDIR_RESTORESESSION_CHECK, 0);
}
updateBackupGUI();
return TRUE;
}
case IDC_BACKUPDIR_RESTORESESSION_CHECK:
{
nppGUI._isSnapshotMode = BST_CHECKED == ::SendDlgItemMessage(_hSelf, IDC_BACKUPDIR_RESTORESESSION_CHECK, BM_GETCHECK, 0, 0);
@ -2315,7 +2323,9 @@ BOOL CALLBACK BackupDlg::run_dlgProc(UINT Message, WPARAM wParam, LPARAM)
void BackupDlg::updateBackupGUI()
{
bool isSnapshot = BST_CHECKED == ::SendDlgItemMessage(_hSelf, IDC_BACKUPDIR_RESTORESESSION_CHECK, BM_GETCHECK, 0, 0);
bool rememberSession = isCheckedOrNot(IDC_CHECK_REMEMBERSESSION);
bool isSnapshot = isCheckedOrNot(IDC_BACKUPDIR_RESTORESESSION_CHECK);
::EnableWindow(::GetDlgItem(_hSelf, IDC_BACKUPDIR_RESTORESESSION_CHECK), rememberSession);
::EnableWindow(::GetDlgItem(_hSelf, IDD_BACKUPDIR_RESTORESESSION_STATIC1), isSnapshot);
::EnableWindow(::GetDlgItem(_hSelf, IDC_BACKUPDIR_RESTORESESSION_EDIT), isSnapshot);
::EnableWindow(::GetDlgItem(_hSelf, IDD_BACKUPDIR_RESTORESESSION_STATIC2), isSnapshot);