diff options
Diffstat (limited to 'plugins/DbChecker')
-rw-r--r-- | plugins/DbChecker/dbchecker.vcxproj | 3 | ||||
-rw-r--r-- | plugins/DbChecker/dbchecker.vcxproj.filters | 9 | ||||
-rw-r--r-- | plugins/DbChecker/res/dbthdr.emf | bin | 2912 -> 0 bytes | |||
-rw-r--r-- | plugins/DbChecker/res/dbtool.emf | bin | 4380 -> 0 bytes | |||
-rw-r--r-- | plugins/DbChecker/res/resource.rc | 85 | ||||
-rw-r--r-- | plugins/DbChecker/src/cleaning.cpp | 59 | ||||
-rw-r--r-- | plugins/DbChecker/src/fileaccess.cpp | 67 | ||||
-rw-r--r-- | plugins/DbChecker/src/finished.cpp | 7 | ||||
-rw-r--r-- | plugins/DbChecker/src/main.cpp | 5 | ||||
-rw-r--r-- | plugins/DbChecker/src/openerror.cpp | 2 | ||||
-rw-r--r-- | plugins/DbChecker/src/progress.cpp | 46 | ||||
-rw-r--r-- | plugins/DbChecker/src/resource.h | 10 | ||||
-rw-r--r-- | plugins/DbChecker/src/selectdb.cpp | 18 | ||||
-rw-r--r-- | plugins/DbChecker/src/stdafx.h | 15 | ||||
-rw-r--r-- | plugins/DbChecker/src/welcome.cpp | 71 | ||||
-rw-r--r-- | plugins/DbChecker/src/wizard.cpp | 22 | ||||
-rw-r--r-- | plugins/DbChecker/src/worker.cpp | 77 |
17 files changed, 27 insertions, 469 deletions
diff --git a/plugins/DbChecker/dbchecker.vcxproj b/plugins/DbChecker/dbchecker.vcxproj index 07a3db537f..a36d7d32f0 100644 --- a/plugins/DbChecker/dbchecker.vcxproj +++ b/plugins/DbChecker/dbchecker.vcxproj @@ -19,8 +19,6 @@ </ProjectConfiguration> </ItemGroup> <ItemGroup> - <ClCompile Include="src\cleaning.cpp" /> - <ClCompile Include="src\fileaccess.cpp" /> <ClCompile Include="src\finished.cpp" /> <ClCompile Include="src\main.cpp" /> <ClCompile Include="src\openerror.cpp" /> @@ -29,7 +27,6 @@ <ClCompile Include="src\stdafx.cxx"> <PrecompiledHeader>Create</PrecompiledHeader> </ClCompile> - <ClCompile Include="src\welcome.cpp" /> <ClCompile Include="src\wizard.cpp" /> <ClCompile Include="src\worker.cpp" /> </ItemGroup> diff --git a/plugins/DbChecker/dbchecker.vcxproj.filters b/plugins/DbChecker/dbchecker.vcxproj.filters index f2f061898e..9d06c0c8ec 100644 --- a/plugins/DbChecker/dbchecker.vcxproj.filters +++ b/plugins/DbChecker/dbchecker.vcxproj.filters @@ -2,12 +2,6 @@ <Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003"> <Import Project="$(ProjectDir)..\..\build\vc.common\common.filters" /> <ItemGroup> - <ClCompile Include="src\cleaning.cpp"> - <Filter>Source Files</Filter> - </ClCompile> - <ClCompile Include="src\fileaccess.cpp"> - <Filter>Source Files</Filter> - </ClCompile> <ClCompile Include="src\finished.cpp"> <Filter>Source Files</Filter> </ClCompile> @@ -23,9 +17,6 @@ <ClCompile Include="src\selectdb.cpp"> <Filter>Source Files</Filter> </ClCompile> - <ClCompile Include="src\welcome.cpp"> - <Filter>Source Files</Filter> - </ClCompile> <ClCompile Include="src\wizard.cpp"> <Filter>Source Files</Filter> </ClCompile> diff --git a/plugins/DbChecker/res/dbthdr.emf b/plugins/DbChecker/res/dbthdr.emf Binary files differdeleted file mode 100644 index 554d11b5ea..0000000000 --- a/plugins/DbChecker/res/dbthdr.emf +++ /dev/null diff --git a/plugins/DbChecker/res/dbtool.emf b/plugins/DbChecker/res/dbtool.emf Binary files differdeleted file mode 100644 index abce0632ee..0000000000 --- a/plugins/DbChecker/res/dbtool.emf +++ /dev/null diff --git a/plugins/DbChecker/res/resource.rc b/plugins/DbChecker/res/resource.rc index cd5ae96b6f..83b87dc9e8 100644 --- a/plugins/DbChecker/res/resource.rc +++ b/plugins/DbChecker/res/resource.rc @@ -26,18 +26,6 @@ LANGUAGE LANG_NEUTRAL, SUBLANG_NEUTRAL // Dialog // -IDD_WELCOME DIALOGEX 0, 0, 262, 143 -STYLE DS_SETFONT | DS_FIXEDSYS | WS_CHILD | WS_DISABLED -FONT 8, "MS Shell Dlg", 0, 0, 0x1 -BEGIN - CONTROL "",IDC_WATERMARK,"Static",SS_ENHMETAFILE,0,0,63,143 - LTEXT "whiterect",IDC_STATIC,63,0,199,143 - LTEXT "Welcome to the Miranda Database Wizard",IDC_TITLE,77,12,178,24,0,WS_EX_TRANSPARENT - LTEXT "Using this Wizard you can compact your Miranda profile database to remove dead space created during normal usage, as well as repair a large number of issues that could affect the database.",IDC_STATIC,77,46,178,32,0,WS_EX_TRANSPARENT - LTEXT "To continue, click Next.",IDC_STATIC,77,85,178,8,0,WS_EX_TRANSPARENT - LTEXT "This program is licensed under the terms of the GNU General Public License.",IDC_STATIC,77,122,178,16,WS_DISABLED -END - IDD_WIZARD DIALOGEX 0, 0, 262, 174 STYLE DS_SETFONT | DS_MODALFRAME | DS_SETFOREGROUND | DS_3DLOOK | DS_FIXEDSYS | DS_CENTER | WS_MINIMIZEBOX | WS_CAPTION | WS_SYSMENU EXSTYLE WS_EX_CONTROLPARENT @@ -83,43 +71,6 @@ BEGIN LTEXT "",IDC_FILE,23,57,226,8,SS_NOPREFIX END -IDD_FILEACCESS DIALOGEX 0, 0, 262, 143 -STYLE DS_SETFONT | DS_3DLOOK | DS_FIXEDSYS | WS_CHILD -EXSTYLE WS_EX_CONTROLPARENT -FONT 8, "MS Shell Dlg", 0, 0, 0x1 -BEGIN - LTEXT "whiterect",IDC_STATIC,0,0,262,32 - LTEXT "File Access Options",IDC_STATIC,11,6,206,8,WS_BORDER - CONTROL "",IDC_HDRLOGO,"Static",SS_ENHMETAFILE,234,3,25,25 - LTEXT "You can select low level options to determine how the database is processed.",IDC_STATIC,20,14,197,16 - CONTROL "",IDC_STATIC,"Static",SS_ETCHEDHORZ,-1,32,264,1 - CONTROL "Create backup",IDC_BACKUP,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,23,69,226,10,WS_EX_CLIENTEDGE - LTEXT "Creates a backup copy of the database before any of the requested changes are made.",IDC_STBACKUP,37,80,212,16 - CONTROL "Aggressively find corruption",IDC_AGGRESSIVE,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,23,100,226,10,WS_EX_CLIENTEDGE - LTEXT "Scans the database for data that is not linked to any other data. This requires more disk space and more time, so is only required if you suspect corruption.",IDC_STATIC,37,111,212,24 - CONTROL "Check consistency only",IDC_CHECKONLY,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,23,38,226,10,WS_EX_CLIENTEDGE - LTEXT "Just checks that the database is valid, without writing anything to the disk.",IDC_STATIC,37,49,212,16 -END - -IDD_CLEANING DIALOGEX 0, 0, 262, 143 -STYLE DS_SETFONT | DS_3DLOOK | DS_FIXEDSYS | WS_CHILD -EXSTYLE WS_EX_CONTROLPARENT -FONT 8, "MS Shell Dlg", 0, 0, 0x1 -BEGIN - LTEXT "whiterect",IDC_STATIC,0,0,262,32 - LTEXT "Cleaning Options",IDC_STATIC,11,6,206,8,WS_BORDER - CONTROL "",IDC_HDRLOGO,"Static",SS_ENHMETAFILE,234,3,25,25 - LTEXT "You can choose to remove information from the database while it is being processed.",IDC_STATIC,20,14,197,16 - CONTROL "",IDC_STATIC,"Static",SS_ETCHEDHORZ,-1,32,264,1 - CONTROL "Erase all histories",IDC_ERASEHISTORY,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,23,38,226,10,WS_EX_CLIENTEDGE - LTEXT "Removes all the saved history for all contacts in the database.",IDC_STATIC,37,49,212,8 - CONTROL "Mark all events read",IDC_MARKREAD,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,23,62,226,10,WS_EX_CLIENTEDGE - LTEXT "Marks all the history events as read. This will rectify any problems with old messages always appearing in the message window log box.",IDC_STATIC,37,73,212,24 - CONTROL "Convert old Unicode messages to UTF8",IDC_CONVERTUTF, - "Button",BS_AUTOCHECKBOX | WS_TABSTOP,23,101,226,10,WS_EX_CLIENTEDGE - LTEXT "Converts history messages in pre-0.7 format (ANSI+UCS2) to the new UTF8 format supported by 0.7. Saves the database space in most cases (recommended).",IDC_STATIC,37,111,212,25 -END - IDD_PROGRESS DIALOGEX 0, 0, 262, 143 STYLE DS_SETFONT | DS_3DLOOK | DS_FIXEDSYS | WS_CHILD EXSTYLE WS_EX_CONTROLPARENT @@ -148,8 +99,6 @@ BEGIN "Button",BS_AUTOCHECKBOX | WS_TABSTOP,23,87,226,10,WS_EX_CLIENTEDGE LTEXT "Launches Miranda with the profile that was just worked on.",IDC_STATIC,37,98,212,16 LTEXT "",IDC_DBFILE,23,68,226,8,SS_NOPREFIX | WS_BORDER - RTEXT "Backup:",IDC_STBACKUP,23,76,30,8 - LTEXT "",IDC_BACKUPFILE,56,76,193,8,SS_NOPREFIX LTEXT "The processing of the database has been completed. Click Next to return to the start of the wizard to select another database to check, or click Finish to exit the wizard.",IDC_STATIC,23,38,226,24 END @@ -162,15 +111,6 @@ END #ifdef APSTUDIO_INVOKED GUIDELINES DESIGNINFO BEGIN - IDD_WELCOME, DIALOG - BEGIN - LEFTMARGIN, 5 - RIGHTMARGIN, 255 - VERTGUIDE, 77 - TOPMARGIN, 5 - BOTTOMMARGIN, 138 - END - IDD_WIZARD, DIALOG BEGIN LEFTMARGIN, 7 @@ -195,24 +135,6 @@ BEGIN BOTTOMMARGIN, 136 END - IDD_FILEACCESS, DIALOG - BEGIN - LEFTMARGIN, 23 - RIGHTMARGIN, 249 - VERTGUIDE, 37 - TOPMARGIN, 38 - BOTTOMMARGIN, 136 - END - - IDD_CLEANING, DIALOG - BEGIN - LEFTMARGIN, 23 - RIGHTMARGIN, 249 - VERTGUIDE, 37 - TOPMARGIN, 38 - BOTTOMMARGIN, 136 - END - IDD_PROGRESS, DIALOG BEGIN LEFTMARGIN, 20 @@ -232,13 +154,6 @@ BEGIN END #endif // APSTUDIO_INVOKED -///////////////////////////////////////////////////////////////////////////// -// -// EMF -// - -IDE_WATERMARK EMF "dbtool.emf" -IDE_HDRLOGO EMF "dbthdr.emf" ///////////////////////////////////////////////////////////////////////////// // diff --git a/plugins/DbChecker/src/cleaning.cpp b/plugins/DbChecker/src/cleaning.cpp deleted file mode 100644 index 3a2541d364..0000000000 --- a/plugins/DbChecker/src/cleaning.cpp +++ /dev/null @@ -1,59 +0,0 @@ -/* -Miranda Database Tool -Copyright (C) 2001-2005 Richard Hughes - -This program is free software; you can redistribute it and/or -modify it under the terms of the GNU General Public License -as published by the Free Software Foundation; either version 2 -of the License, or (at your option) any later version. - -This program is distributed in the hope that it will be useful, -but WITHOUT ANY WARRANTY; without even the implied warranty of -MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -GNU General Public License for more details. - -You should have received a copy of the GNU General Public License -along with this program; if not, write to the Free Software -Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. -*/ - -#include "stdafx.h" - -INT_PTR CALLBACK CleaningDlgProc(HWND hdlg, UINT message, WPARAM wParam, LPARAM lParam) -{ - INT_PTR bReturn; - if (DoMyControlProcessing(hdlg, message, wParam, lParam, &bReturn)) - return bReturn; - - switch (message) { - case WM_INITDIALOG: - CheckDlgButton(hdlg, IDC_ERASEHISTORY, opts.bEraseHistory ? BST_CHECKED : BST_UNCHECKED); - EnableWindow(GetDlgItem(hdlg, IDC_ERASEHISTORY), !opts.bAggressive); - CheckDlgButton(hdlg, IDC_MARKREAD, opts.bMarkRead ? BST_CHECKED : BST_UNCHECKED); - CheckDlgButton(hdlg, IDC_CONVERTUTF, opts.bConvertUtf ? BST_CHECKED : BST_UNCHECKED); - TranslateDialogDefault(hdlg); - return TRUE; - - case WZN_PAGECHANGING: - opts.bEraseHistory = IsDlgButtonChecked(hdlg, IDC_ERASEHISTORY) && !opts.bAggressive; - opts.bMarkRead = IsDlgButtonChecked(hdlg, IDC_MARKREAD); - opts.bConvertUtf = IsDlgButtonChecked(hdlg, IDC_CONVERTUTF); - break; - - case WM_COMMAND: - switch (LOWORD(wParam)) { - case IDC_BACK: - if (opts.bCheckOnly) - PostMessage(GetParent(hdlg), WZM_GOTOPAGE, IDD_SELECTDB, (LPARAM)SelectDbDlgProc); - else - PostMessage(GetParent(hdlg), WZM_GOTOPAGE, IDD_FILEACCESS, (LPARAM)FileAccessDlgProc); - break; - - case IDOK: - OpenDatabase(hdlg, IDD_PROGRESS); - break; - } - break; - } - return FALSE; -} diff --git a/plugins/DbChecker/src/fileaccess.cpp b/plugins/DbChecker/src/fileaccess.cpp deleted file mode 100644 index 2965dfc2d9..0000000000 --- a/plugins/DbChecker/src/fileaccess.cpp +++ /dev/null @@ -1,67 +0,0 @@ -/* -Miranda Database Tool -Copyright (C) 2001-2005 Richard Hughes - -This program is free software; you can redistribute it and/or -modify it under the terms of the GNU General Public License -as published by the Free Software Foundation; either version 2 -of the License, or (at your option) any later version. - -This program is distributed in the hope that it will be useful, -but WITHOUT ANY WARRANTY; without even the implied warranty of -MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -GNU General Public License for more details. - -You should have received a copy of the GNU General Public License -along with this program; if not, write to the Free Software -Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. -*/ - -#include "stdafx.h" - -INT_PTR CALLBACK FileAccessDlgProc(HWND hdlg, UINT message, WPARAM wParam, LPARAM lParam) -{ - INT_PTR bReturn; - if (DoMyControlProcessing(hdlg, message, wParam, lParam, &bReturn)) - return bReturn; - - switch (message) { - case WM_INITDIALOG: - if (bShortMode) - EnableWindow(GetDlgItem(GetParent(hdlg), IDC_BACK), FALSE); - CheckDlgButton(hdlg, IDC_CHECKONLY, opts.bCheckOnly ? BST_CHECKED : BST_UNCHECKED); - CheckDlgButton(hdlg, IDC_BACKUP, opts.bBackup ? BST_CHECKED : BST_UNCHECKED); - CheckDlgButton(hdlg, IDC_AGGRESSIVE, opts.bAggressive ? BST_CHECKED : BST_UNCHECKED); - SendMessage(hdlg, WM_COMMAND, MAKEWPARAM(IDC_CHECKONLY, BN_CLICKED), 0); - TranslateDialogDefault(hdlg); - return TRUE; - - case WZN_PAGECHANGING: - opts.bCheckOnly = IsDlgButtonChecked(hdlg, IDC_CHECKONLY); - opts.bAggressive = IsDlgButtonChecked(hdlg, IDC_AGGRESSIVE); - if (opts.bCheckOnly) opts.bBackup = 0; - else opts.bBackup = IsDlgButtonChecked(hdlg, IDC_BACKUP); - break; - - case WM_COMMAND: - switch (LOWORD(wParam)) { - case IDC_BACK: - PostMessage(GetParent(hdlg), WZM_GOTOPAGE, IDD_SELECTDB, (LPARAM)SelectDbDlgProc); - break; - - case IDOK: - if (opts.bCheckOnly) - OpenDatabase(hdlg, IDD_PROGRESS); - else - PostMessage(GetParent(hdlg), WZM_GOTOPAGE, IDD_CLEANING, (LPARAM)CleaningDlgProc); - break; - - case IDC_CHECKONLY: - EnableWindow(GetDlgItem(hdlg, IDC_BACKUP), BST_UNCHECKED == IsDlgButtonChecked(hdlg, IDC_CHECKONLY)); - EnableWindow(GetDlgItem(hdlg, IDC_STBACKUP), BST_UNCHECKED == IsDlgButtonChecked(hdlg, IDC_CHECKONLY)); - break; - } - break; - } - return FALSE; -} diff --git a/plugins/DbChecker/src/finished.cpp b/plugins/DbChecker/src/finished.cpp index e43fea8b45..cf5d75f896 100644 --- a/plugins/DbChecker/src/finished.cpp +++ b/plugins/DbChecker/src/finished.cpp @@ -32,12 +32,7 @@ INT_PTR CALLBACK FinishedDlgProc(HWND hdlg, UINT message, WPARAM wParam, LPARAM SetDlgItemText(GetParent(hdlg), IDCANCEL, TranslateT("&Finish")); SetWindowLongPtr(GetDlgItem(hdlg, IDC_DBFILE), GWL_STYLE, GetWindowLongPtr(GetDlgItem(hdlg, IDC_DBFILE), GWL_STYLE) | SS_PATHELLIPSIS); SetDlgItemText(hdlg, IDC_DBFILE, opts.filename); - if (opts.bBackup) { - ShowWindow(GetDlgItem(hdlg, IDC_STBACKUP), TRUE); - SetWindowLongPtr(GetDlgItem(hdlg, IDC_BACKUPFILE), GWL_STYLE, GetWindowLongPtr(GetDlgItem(hdlg, IDC_BACKUPFILE), GWL_STYLE) | SS_PATHELLIPSIS); - SetDlgItemText(hdlg, IDC_BACKUPFILE, opts.backupFilename); - } - else ShowWindow(GetDlgItem(hdlg, IDC_STBACKUP), FALSE); + TranslateDialogDefault(hdlg); return TRUE; diff --git a/plugins/DbChecker/src/main.cpp b/plugins/DbChecker/src/main.cpp index b4a06048a9..18ee5cc29b 100644 --- a/plugins/DbChecker/src/main.cpp +++ b/plugins/DbChecker/src/main.cpp @@ -20,7 +20,7 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. #include "stdafx.h" int hLangpack = 0; -bool bServiceMode, bLaunchMiranda, bShortMode, bAutoExit; +bool bServiceMode, bLaunchMiranda, bAutoExit; DbToolOptions opts = { 0 }; @@ -60,7 +60,7 @@ static HANDLE hService; // do not remove it! static INT_PTR ServiceMode(WPARAM, LPARAM) { - bLaunchMiranda = bShortMode = bAutoExit = false; + bLaunchMiranda = bAutoExit = false; bServiceMode = true; opts.db = db_get_current(); @@ -76,7 +76,6 @@ static INT_PTR ServiceMode(WPARAM, LPARAM) static INT_PTR CheckProfile(WPARAM wParam, LPARAM lParam) { - bShortMode = true; bLaunchMiranda = lParam != 0; bAutoExit = lParam == 2; bServiceMode = false; diff --git a/plugins/DbChecker/src/openerror.cpp b/plugins/DbChecker/src/openerror.cpp index 42a4d4e2eb..e5cf04c98a 100644 --- a/plugins/DbChecker/src/openerror.cpp +++ b/plugins/DbChecker/src/openerror.cpp @@ -45,7 +45,7 @@ INT_PTR CALLBACK OpenErrorDlgProc(HWND hdlg, UINT message, WPARAM wParam, LPARAM break; case IDOK: - OpenDatabase(hdlg, IDD_FILEACCESS); + OpenDatabase(hdlg); break; } break; diff --git a/plugins/DbChecker/src/progress.cpp b/plugins/DbChecker/src/progress.cpp index eb8cc08141..8475648bef 100644 --- a/plugins/DbChecker/src/progress.cpp +++ b/plugins/DbChecker/src/progress.cpp @@ -23,7 +23,6 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. void __cdecl WorkerThread(void *unused); static HWND hwndStatus, hdlgProgress, hwndBar; -static bool bShortModeDone; HANDLE hEventRun = nullptr, hEventAbort = nullptr; int errorCount; LRESULT wizardResult; @@ -80,16 +79,13 @@ INT_PTR CALLBACK ProgressDlgProc(HWND hdlg, UINT message, WPARAM wParam, LPARAM hdlgProgress = hdlg; hwndStatus = GetDlgItem(hdlg, IDC_STATUS); errorCount = 0; - bShortModeDone = false; hwndBar = GetDlgItem(hdlg, IDC_PROGRESS); SendMessage(hwndBar, PBM_SETRANGE, 0, MAKELPARAM(0, 1000)); { - HDC hdc; - HFONT hFont, hoFont; SIZE s; - hdc = GetDC(nullptr); - hFont = (HFONT)SendMessage(hdlg, WM_GETFONT, 0, 0); - hoFont = (HFONT)SelectObject(hdc, hFont); + HDC hdc = GetDC(nullptr); + HFONT hFont = (HFONT)SendMessage(hdlg, WM_GETFONT, 0, 0); + HFONT hoFont = (HFONT)SelectObject(hdc, hFont); GetTextExtentPoint32(hdc, L"x", 1, &s); SelectObject(hdc, hoFont); ReleaseDC(nullptr, hdc); @@ -154,43 +150,18 @@ INT_PTR CALLBACK ProgressDlgProc(HWND hdlg, UINT message, WPARAM wParam, LPARAM case WM_PROCESSINGDONE: SetProgressBar(1000); - if (bShortMode) { - EnableWindow(GetDlgItem(GetParent(hdlg), IDC_BACK), FALSE); - EnableWindow(GetDlgItem(GetParent(hdlg), IDOK), FALSE); - SetDlgItemText(GetParent(hdlg), IDCANCEL, TranslateT("&Finish")); - bShortModeDone = true; - if (bAutoExit) - PostMessage(GetParent(hdlg), WM_COMMAND, IDCANCEL, 0); - } - else { - AddToStatus(STATUS_SUCCESS, TranslateT("Click Next to continue")); - EnableWindow(GetDlgItem(GetParent(hdlg), IDOK), TRUE); - } + AddToStatus(STATUS_SUCCESS, TranslateT("Click Next to continue")); + EnableWindow(GetDlgItem(GetParent(hdlg), IDOK), TRUE); if (manualAbort == 1) EndDialog(GetParent(hdlg), 0); else if (manualAbort == 2) { - if (opts.bCheckOnly) - PostMessage(GetParent(hdlg), WZM_GOTOPAGE, IDD_FILEACCESS, (LPARAM)FileAccessDlgProc); - else { - PostMessage(GetParent(hdlg), WZM_GOTOPAGE, IDD_CLEANING, (LPARAM)CleaningDlgProc); - CloseHandle(opts.hOutFile); - opts.hOutFile = nullptr; - } + PostMessage(GetParent(hdlg), WZM_GOTOPAGE, IDD_PROGRESS, (LPARAM)ProgressDlgProc); break; } break; case WZN_CANCELCLICKED: - if (bShortModeDone) { - if (!errorCount) { - if (bLaunchMiranda) - Profile_SetDefault(opts.filename); - wizardResult = 1; - } - return TRUE; - } - ResetEvent(hEventRun); if (IsWindowEnabled(GetDlgItem(GetParent(hdlg), IDOK))) break; @@ -216,10 +187,7 @@ INT_PTR CALLBACK ProgressDlgProc(HWND hdlg, UINT message, WPARAM wParam, LPARAM break; } SetEvent(hEventRun); - if (opts.bCheckOnly) - PostMessage(GetParent(hdlg), WZM_GOTOPAGE, IDD_FILEACCESS, (LPARAM)FileAccessDlgProc); - else - PostMessage(GetParent(hdlg), WZM_GOTOPAGE, IDD_CLEANING, (LPARAM)CleaningDlgProc); + PostMessage(GetParent(hdlg), WZM_GOTOPAGE, IDD_PROGRESS, (LPARAM)ProgressDlgProc); break; case IDOK: diff --git a/plugins/DbChecker/src/resource.h b/plugins/DbChecker/src/resource.h index cdd4a8e9ea..b6ea208d3c 100644 --- a/plugins/DbChecker/src/resource.h +++ b/plugins/DbChecker/src/resource.h @@ -8,12 +8,9 @@ #define IDI_DBTOOL 102 #define IDE_HDRLOGO 103 #define IDI_PROFILEGREEN 104 -#define IDR_DEFAULT1 104 #define IDD_WELCOME 106 #define IDD_SELECTDB 107 #define IDD_OPENERROR 108 -#define IDD_FILEACCESS 109 -#define IDD_CLEANING 110 #define IDD_PROGRESS 111 #define IDD_FINISHED 112 #define IDI_BAD 113 @@ -25,19 +22,12 @@ #define IDC_OTHER 1005 #define IDC_ERRORTEXT 1006 #define IDC_INUSE 1007 -#define IDC_BACKUP 1008 -#define IDC_AGGRESSIVE 1009 -#define IDC_ERASEHISTORY 1010 -#define IDC_CHECKONLY 1010 -#define IDC_MARKREAD 1011 #define IDC_PROGRESS 1011 #define IDC_STATUS 1012 -#define IDC_STBACKUP 1013 #define IDC_LAUNCHMIRANDA 1015 #define IDC_DBFILE 1016 #define IDC_BACKUPFILE 1017 #define IDC_CHECK1 1018 -#define IDC_CONVERTUTF 1018 #define IDC_STATIC -1 // Next default values for new objects diff --git a/plugins/DbChecker/src/selectdb.cpp b/plugins/DbChecker/src/selectdb.cpp index d395c6b4c4..66df5f7480 100644 --- a/plugins/DbChecker/src/selectdb.cpp +++ b/plugins/DbChecker/src/selectdb.cpp @@ -28,7 +28,7 @@ static bool CheckBroken(const wchar_t *ptszFullPath) return dblink->grokHeader(ptszFullPath) != EGROKPRF_NOERROR; } -int OpenDatabase(HWND hdlg, INT iNextPage) +int OpenDatabase(HWND hdlg) { wchar_t tszMsg[1024]; int error = 0; @@ -60,12 +60,8 @@ int OpenDatabase(HWND hdlg, INT iNextPage) } // force check - if (error == EGROKPRF_OBSOLETE) { - opts.bAggressive = opts.bBackup = true; + if (error == EGROKPRF_OBSOLETE) PostMessage(GetParent(hdlg), WZM_GOTOPAGE, IDD_PROGRESS, (LPARAM)ProgressDlgProc); - } - else if (iNextPage == IDD_FILEACCESS) - PostMessage(GetParent(hdlg), WZM_GOTOPAGE, IDD_FILEACCESS, (LPARAM)FileAccessDlgProc); else PostMessage(GetParent(hdlg), WZM_GOTOPAGE, IDD_PROGRESS, (LPARAM)ProgressDlgProc); return true; @@ -235,12 +231,6 @@ INT_PTR CALLBACK SelectDbDlgProc(HWND hdlg, UINT message, WPARAM wParam, LPARAM opts.dbChecker->Destroy(); opts.dbChecker = nullptr; } - - if (bShortMode) - if (!OpenDatabase(hdlg, IDD_FILEACCESS)) { - EndDialog(GetParent(hdlg), 1); - return FALSE; - } return TRUE; case WZN_PAGECHANGING: @@ -290,12 +280,10 @@ INT_PTR CALLBACK SelectDbDlgProc(HWND hdlg, UINT message, WPARAM wParam, LPARAM break; case IDC_BACK: - if (!bShortMode) - PostMessage(GetParent(hdlg), WZM_GOTOPAGE, IDD_WELCOME, (LPARAM)WelcomeDlgProc); break; case IDOK: - OpenDatabase(hdlg, IDD_FILEACCESS); + OpenDatabase(hdlg); break; } break; diff --git a/plugins/DbChecker/src/stdafx.h b/plugins/DbChecker/src/stdafx.h index a12e3e2306..a646cf9e4c 100644 --- a/plugins/DbChecker/src/stdafx.h +++ b/plugins/DbChecker/src/stdafx.h @@ -43,15 +43,9 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. struct DbToolOptions { wchar_t filename[MAX_PATH]; - wchar_t workingFilename[MAX_PATH]; - wchar_t outputFilename[MAX_PATH]; - wchar_t backupFilename[MAX_PATH]; MDatabaseCommon *db; MIDatabaseChecker *dbChecker; - HANDLE hOutFile; DWORD error; - int bCheckOnly, bBackup, bAggressive; - int bEraseHistory, bMarkRead, bConvertUtf; }; struct CMPlugin : public PLUGIN<CMPlugin> @@ -66,20 +60,17 @@ extern DbToolOptions opts; extern HANDLE hEventRun, hEventAbort; extern int errorCount; extern LRESULT wizardResult; -extern bool bServiceMode, bLaunchMiranda, bShortMode, bAutoExit; +extern bool bServiceMode, bLaunchMiranda, bAutoExit; int DoMyControlProcessing(HWND hdlg, UINT message, WPARAM wParam, LPARAM lParam, INT_PTR *bReturn); +INT_PTR CALLBACK WizardDlgProc(HWND hdlg, UINT message, WPARAM wParam, LPARAM lParam); INT_PTR CALLBACK SelectDbDlgProc(HWND hdlg, UINT message, WPARAM wParam, LPARAM lParam); -INT_PTR CALLBACK CleaningDlgProc(HWND hdlg, UINT message, WPARAM wParam, LPARAM lParam); INT_PTR CALLBACK ProgressDlgProc(HWND hdlg, UINT message, WPARAM wParam, LPARAM lParam); -INT_PTR CALLBACK FileAccessDlgProc(HWND hdlg, UINT message, WPARAM wParam, LPARAM lParam); -INT_PTR CALLBACK WizardDlgProc(HWND hdlg, UINT message, WPARAM wParam, LPARAM lParam); INT_PTR CALLBACK FinishedDlgProc(HWND hdlg, UINT message, WPARAM wParam, LPARAM lParam); -INT_PTR CALLBACK WelcomeDlgProc(HWND hdlg, UINT message, WPARAM wParam, LPARAM lParam); INT_PTR CALLBACK OpenErrorDlgProc(HWND hdlg, UINT message, WPARAM wParam, LPARAM lParam); -int OpenDatabase(HWND hdlg, INT iNextPage); +int OpenDatabase(HWND hdlg); #define STATUS_CLASSMASK 0x0f void AddToStatus(int flags, const wchar_t* fmt, ...); diff --git a/plugins/DbChecker/src/welcome.cpp b/plugins/DbChecker/src/welcome.cpp deleted file mode 100644 index 55d279e403..0000000000 --- a/plugins/DbChecker/src/welcome.cpp +++ /dev/null @@ -1,71 +0,0 @@ -/* -Miranda Database Tool -Copyright (C) 2001-2005 Richard Hughes - -This program is free software; you can redistribute it and/or -modify it under the terms of the GNU General Public License -as published by the Free Software Foundation; either version 2 -of the License, or (at your option) any later version. - -This program is distributed in the hope that it will be useful, -but WITHOUT ANY WARRANTY; without even the implied warranty of -MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -GNU General Public License for more details. - -You should have received a copy of the GNU General Public License -along with this program; if not, write to the Free Software -Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. -*/ - -#include "stdafx.h" - -INT_PTR CALLBACK WelcomeDlgProc(HWND hdlg, UINT message, WPARAM wParam, LPARAM lParam) -{ - static HENHMETAFILE hEmfWatermark; - static HFONT hTitleFont; - - INT_PTR bReturn; - if (DoMyControlProcessing(hdlg, message, wParam, lParam, &bReturn)) - return bReturn; - - switch (message) { - case WM_INITDIALOG: - { - HRSRC hRsrcWatermark = FindResourceA(g_plugin.getInst(), MAKEINTRESOURCEA(IDE_WATERMARK), "EMF"); - HGLOBAL hGlobWatermark = LoadResource(g_plugin.getInst(), hRsrcWatermark); - hEmfWatermark = SetEnhMetaFileBits(SizeofResource(g_plugin.getInst(), hRsrcWatermark), (PBYTE)LockResource(hGlobWatermark)); - } - SendDlgItemMessage(hdlg, IDC_WATERMARK, STM_SETIMAGE, IMAGE_ENHMETAFILE, (LPARAM)hEmfWatermark); - { - NONCLIENTMETRICS ncm = { 0 }; - ncm.cbSize = sizeof(ncm); - SystemParametersInfo(SPI_GETNONCLIENTMETRICS, 0, &ncm, 0); - LOGFONT TitleLogFont = ncm.lfMessageFont; - TitleLogFont.lfWeight = FW_BOLD; - mir_wstrcpy(TitleLogFont.lfFaceName, TEXT("Verdana Bold")); - - HDC hdc = GetDC(nullptr); - INT FontSize = 12; - TitleLogFont.lfHeight = 0 - GetDeviceCaps(hdc, LOGPIXELSY) * FontSize / 72; - hTitleFont = CreateFontIndirect(&TitleLogFont); - ReleaseDC(nullptr, hdc); - } - SendDlgItemMessage(hdlg, IDC_TITLE, WM_SETFONT, (WPARAM)hTitleFont, 0); - EnableWindow(GetDlgItem(GetParent(hdlg), IDC_BACK), FALSE); - return FALSE; - - case WM_COMMAND: - switch (LOWORD(wParam)) { - case IDOK: - PostMessage(GetParent(hdlg), WZM_GOTOPAGE, IDD_SELECTDB, (LPARAM)SelectDbDlgProc); - break; - } - break; - - case WM_DESTROY: - DeleteEnhMetaFile(hEmfWatermark); - DeleteObject(hTitleFont); - break; - } - return FALSE; -} diff --git a/plugins/DbChecker/src/wizard.cpp b/plugins/DbChecker/src/wizard.cpp index c69633794b..2653f2f04b 100644 --- a/plugins/DbChecker/src/wizard.cpp +++ b/plugins/DbChecker/src/wizard.cpp @@ -37,7 +37,7 @@ static BOOL CALLBACK MyControlsEnumChildren(HWND hwnd, LPARAM) makeBold = 1; } else if (!mir_strcmp(szClass, "Button")) { - if (exstyle&WS_EX_CLIENTEDGE) + if (exstyle & WS_EX_CLIENTEDGE) makeBold = 1; } if (makeBold) { @@ -79,11 +79,10 @@ int DoMyControlProcessing(HWND hdlg, UINT message, WPARAM wParam, LPARAM lParam, *bReturn = (INT_PTR)GetStockObject(WHITE_BRUSH); return TRUE; } - else { - SetBkMode((HDC)wParam, TRANSPARENT); - *bReturn = (INT_PTR)GetStockObject(NULL_BRUSH); - return TRUE; - } + + SetBkMode((HDC)wParam, TRANSPARENT); + *bReturn = (INT_PTR)GetStockObject(NULL_BRUSH); + return TRUE; } break; } @@ -96,13 +95,11 @@ INT_PTR CALLBACK WizardDlgProc(HWND hdlg, UINT message, WPARAM wParam, LPARAM lP switch (message) { case WM_INITDIALOG: + TranslateDialogDefault(hdlg); SendMessage(hdlg, WM_SETICON, ICON_SMALL, (LPARAM)LoadIcon(g_plugin.getInst(), MAKEINTRESOURCE(IDI_DBTOOL))); hdlgPage = nullptr; - if (bShortMode) - SendMessage(hdlg, WZM_GOTOPAGE, IDD_SELECTDB, (LPARAM)SelectDbDlgProc); - else - SendMessage(hdlg, WZM_GOTOPAGE, IDD_WELCOME, (LPARAM)WelcomeDlgProc); - TranslateDialogDefault(hdlg); + + SendMessage(hdlg, WZM_GOTOPAGE, IDD_SELECTDB, (LPARAM)SelectDbDlgProc); return TRUE; case WZM_GOTOPAGE: @@ -139,9 +136,6 @@ INT_PTR CALLBACK WizardDlgProc(HWND hdlg, UINT message, WPARAM wParam, LPARAM lP opts.dbChecker = nullptr; } - if (opts.hOutFile) - CloseHandle(opts.hOutFile); - DestroyWindow(hdlgPage); if (hBoldFont != nullptr) { DeleteObject(hBoldFont); diff --git a/plugins/DbChecker/src/worker.cpp b/plugins/DbChecker/src/worker.cpp index ff5a076191..7911691107 100644 --- a/plugins/DbChecker/src/worker.cpp +++ b/plugins/DbChecker/src/worker.cpp @@ -21,55 +21,10 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. void ProcessingDone(void); -static void Finalize(time_t& ts) +static void Finalize() { opts.dbChecker->Destroy(); opts.dbChecker = nullptr; - - if (opts.hOutFile) { - CloseHandle(opts.hOutFile); - opts.hOutFile = nullptr; - } - - if (errorCount && !opts.bBackup && !opts.bCheckOnly) { - time_t dlg_ts = time(nullptr); - if (IDYES == MessageBox(nullptr, - TranslateT("Errors were encountered, however you selected not to backup the original database. It is strongly recommended that you do so in case important data was omitted. Do you wish to keep a backup of the original database?"), - TranslateT("Miranda Database Tool"), MB_YESNO)) - opts.bBackup = 1; - ts += time(nullptr) - dlg_ts; - } - - if (opts.bBackup) { - wchar_t dbPath[MAX_PATH], dbFile[MAX_PATH]; - mir_wstrcpy(dbPath, opts.filename); - wchar_t* str2 = wcsrchr(dbPath, '\\'); - if (str2 != nullptr) { - mir_wstrcpy(dbFile, str2 + 1); - *str2 = 0; - } - else { - mir_wstrcpy(dbFile, dbPath); - dbPath[0] = 0; - } - for (int i = 1;; i++) { - if (i == 1) - mir_snwprintf(opts.backupFilename, TranslateT("%s\\Backup of %s"), dbPath, dbFile); - else - mir_snwprintf(opts.backupFilename, TranslateT("%s\\Backup (%d) of %s"), dbPath, i, dbFile); - if (_waccess(opts.backupFilename, 0) == -1) break; - } - - if (!MoveFile(opts.filename, opts.backupFilename)) - AddToStatus(STATUS_WARNING, TranslateT("Unable to rename original file")); - } - else if (!opts.bCheckOnly) - if (!DeleteFile(opts.filename)) - AddToStatus(STATUS_WARNING, TranslateT("Unable to delete original file")); - - if (!opts.bCheckOnly) - if (!MoveFile(opts.outputFilename, opts.filename)) - AddToStatus(STATUS_WARNING, TranslateT("Unable to rename output file")); } void __cdecl WorkerThread(void *) @@ -79,39 +34,11 @@ void __cdecl WorkerThread(void *) AddToStatus(STATUS_MESSAGE, TranslateT("Database worker thread activated")); - mir_wstrcpy(opts.workingFilename, opts.filename); - - if (opts.bCheckOnly) { - mir_wstrcpy(opts.outputFilename, TranslateT("<check only>")); - opts.hOutFile = INVALID_HANDLE_VALUE; - } - else { - mir_wstrcpy(opts.outputFilename, opts.filename); - *wcsrchr(opts.outputFilename, '.') = 0; - mir_wstrcat(opts.outputFilename, TranslateT(" (Output).dat")); - opts.hOutFile = CreateFile(opts.outputFilename, GENERIC_WRITE, FILE_SHARE_READ, nullptr, CREATE_ALWAYS, FILE_FLAG_SEQUENTIAL_SCAN, nullptr); - if (opts.hOutFile == INVALID_HANDLE_VALUE) { - AddToStatus(STATUS_FATAL, TranslateT("Can't create output file (%u)"), GetLastError()); - ProcessingDone(); - return; - } - } - DWORD sp = 0; firstTime = 0; DBCHeckCallback callback; - callback.cbSize = sizeof(callback); - callback.spaceUsed = 1; - callback.spaceProcessed = 0; callback.pfnAddLogMessage = AddToStatus; - callback.hOutFile = opts.hOutFile; - callback.bCheckOnly = opts.bCheckOnly; - callback.bBackup = opts.bBackup; - callback.bAggressive = opts.bAggressive; - callback.bEraseHistory = opts.bEraseHistory; - callback.bMarkRead = opts.bMarkRead; - callback.bConvertUtf = opts.bConvertUtf; opts.dbChecker->Start(&callback); for (task = 0;;) { @@ -128,7 +55,7 @@ void __cdecl WorkerThread(void *) int ret = opts.dbChecker->CheckDb(task, firstTime); firstTime = 0; if (ret == ERROR_OUT_OF_PAPER) { - Finalize(ts); + Finalize(); AddToStatus(STATUS_MESSAGE, TranslateT("Elapsed time: %d sec"), time(nullptr) - ts); if (errorCount) AddToStatus(STATUS_SUCCESS, TranslateT("All tasks completed but with errors (%d)"), errorCount); |