diff options
author | George Hazan <ghazan@miranda.im> | 2020-08-04 18:54:48 +0300 |
---|---|---|
committer | George Hazan <ghazan@miranda.im> | 2020-08-04 18:54:48 +0300 |
commit | b334ced17b8a0493ca2070a0065b1954f5a82abe (patch) | |
tree | 86051ac64d7871e9c386974098c43cc3c1695b3e /plugins/DbChecker/src | |
parent | db31374dcce6b858d553452aa1829687ef5071fd (diff) |
unused code removed
Diffstat (limited to 'plugins/DbChecker/src')
-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 |
12 files changed, 27 insertions, 372 deletions
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); |