From ef7127e9715147094e39e27edb0143aaecff695b Mon Sep 17 00:00:00 2001 From: George Hazan Date: Mon, 13 Aug 2018 11:51:22 +0300 Subject: Variables: - plugin's own hash implementation replaced with the core function; - unused header dbhelpers.h removed; - code cleaning --- plugins/Variables/src/options.cpp | 79 ++++++++++++++++++++------------------- 1 file changed, 40 insertions(+), 39 deletions(-) (limited to 'plugins/Variables/src/options.cpp') diff --git a/plugins/Variables/src/options.cpp b/plugins/Variables/src/options.cpp index 8cac54f7a7..ed4bf81e07 100644 --- a/plugins/Variables/src/options.cpp +++ b/plugins/Variables/src/options.cpp @@ -1,42 +1,42 @@ /* - Variables Plugin for Miranda-IM (www.miranda-im.org) - Copyright 2003-2006 P. Boon - - This program is mir_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 +Variables Plugin for Miranda-IM (www.miranda-im.org) +Copyright 2003-2006 P. Boon + +This program is mir_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" -static INT_PTR CALLBACK SetOptsDlgProc(HWND hwndDlg,UINT msg,WPARAM wParam,LPARAM lParam) +static INT_PTR CALLBACK SetOptsDlgProc(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lParam) { - switch( msg ) { + switch (msg) { case WM_INITDIALOG: TranslateDialogDefault(hwndDlg); - { - DBVARIANT dbv; - if (!db_get_ws( NULL, MODULENAME, SETTING_STARTUPTEXT, &dbv )) { - SetDlgItemText(hwndDlg, IDC_FORMATTEXT, dbv.pwszVal); - db_free(&dbv); - } + + DBVARIANT dbv; + if (!db_get_ws(NULL, MODULENAME, SETTING_STARTUPTEXT, &dbv)) { + SetDlgItemText(hwndDlg, IDC_FORMATTEXT, dbv.pwszVal); + db_free(&dbv); } + CheckDlgButton(hwndDlg, IDC_PARSEATSTARTUP, db_get_b(NULL, MODULENAME, SETTING_PARSEATSTARTUP, 0) ? BST_CHECKED : BST_UNCHECKED); CheckDlgButton(hwndDlg, IDC_STRIPCRLF, db_get_b(NULL, MODULENAME, SETTING_STRIPCRLF, 0) ? BST_CHECKED : BST_UNCHECKED); CheckDlgButton(hwndDlg, IDC_STRIPWS, db_get_b(NULL, MODULENAME, SETTING_STRIPWS, 0) ? BST_CHECKED : BST_UNCHECKED); CheckDlgButton(hwndDlg, IDC_STRIPALL, db_get_b(NULL, MODULENAME, SETTING_STRIPALL, 0) ? BST_CHECKED : BST_UNCHECKED); - EnableWindow(GetDlgItem(hwndDlg, IDC_STRIPCRLF), IsDlgButtonChecked(hwndDlg, IDC_STRIPALL)?FALSE:TRUE); - EnableWindow(GetDlgItem(hwndDlg, IDC_STRIPWS), IsDlgButtonChecked(hwndDlg, IDC_STRIPALL)?FALSE:TRUE); + EnableWindow(GetDlgItem(hwndDlg, IDC_STRIPCRLF), IsDlgButtonChecked(hwndDlg, IDC_STRIPALL) ? FALSE : TRUE); + EnableWindow(GetDlgItem(hwndDlg, IDC_STRIPWS), IsDlgButtonChecked(hwndDlg, IDC_STRIPALL) ? FALSE : TRUE); variables_skin_helpbutton(hwndDlg, IDC_SHOWHELP); break; @@ -48,13 +48,13 @@ static INT_PTR CALLBACK SetOptsDlgProc(HWND hwndDlg,UINT msg,WPARAM wParam,LPARA case IDC_STRIPWS: case IDC_STRIPALL: case IDC_FORMATTEXT: - SendMessage(GetParent(hwndDlg),PSM_CHANGED,0,0); + SendMessage(GetParent(hwndDlg), PSM_CHANGED, 0, 0); gParseOpts.bStripEOL = IsDlgButtonChecked(hwndDlg, IDC_STRIPCRLF); gParseOpts.bStripWS = IsDlgButtonChecked(hwndDlg, IDC_STRIPWS); gParseOpts.bStripAll = IsDlgButtonChecked(hwndDlg, IDC_STRIPALL); break; } - if (LOWORD(wParam) == IDC_FORMATTEXT && IsDlgButtonChecked( hwndDlg, IDC_AUTOPARSE )) + if (LOWORD(wParam) == IDC_FORMATTEXT && IsDlgButtonChecked(hwndDlg, IDC_AUTOPARSE)) SendMessage(hwndDlg, VARM_PARSE, 0, 0); } switch (LOWORD(wParam)) { @@ -64,19 +64,19 @@ static INT_PTR CALLBACK SetOptsDlgProc(HWND hwndDlg,UINT msg,WPARAM wParam,LPARA case IDC_AUTOPARSE: SendMessage(hwndDlg, VARM_PARSE, 0, 0); - if (IsDlgButtonChecked( hwndDlg, IDC_AUTOPARSE )) + if (IsDlgButtonChecked(hwndDlg, IDC_AUTOPARSE)) SetTimer(hwndDlg, IDT_PARSE, 1000, nullptr); else KillTimer(hwndDlg, IDT_PARSE); break; case IDC_SHOWHELP: - variables_showhelp(hwndDlg, IDC_FORMATTEXT, VHF_FULLDLG|VHF_SETLASTSUBJECT, nullptr, nullptr); + variables_showhelp(hwndDlg, IDC_FORMATTEXT, VHF_FULLDLG | VHF_SETLASTSUBJECT, nullptr, nullptr); break; case IDC_STRIPALL: - EnableWindow(GetDlgItem(hwndDlg, IDC_STRIPCRLF), IsDlgButtonChecked(hwndDlg, IDC_STRIPALL)?FALSE:TRUE); - EnableWindow(GetDlgItem(hwndDlg, IDC_STRIPWS), IsDlgButtonChecked(hwndDlg, IDC_STRIPALL)?FALSE:TRUE); + EnableWindow(GetDlgItem(hwndDlg, IDC_STRIPCRLF), IsDlgButtonChecked(hwndDlg, IDC_STRIPALL) ? FALSE : TRUE); + EnableWindow(GetDlgItem(hwndDlg, IDC_STRIPWS), IsDlgButtonChecked(hwndDlg, IDC_STRIPALL) ? FALSE : TRUE); break; } break; @@ -85,19 +85,19 @@ static INT_PTR CALLBACK SetOptsDlgProc(HWND hwndDlg,UINT msg,WPARAM wParam,LPARA if (((LPNMHDR)lParam)->code == PSN_APPLY) { int len = SendDlgItemMessage(hwndDlg, IDC_FORMATTEXT, WM_GETTEXTLENGTH, 0, 0); if (len >= 0) { - wchar_t *szFormatText = (wchar_t*)mir_calloc((len+1)* sizeof(wchar_t)); + wchar_t *szFormatText = (wchar_t*)mir_calloc((len + 1) * sizeof(wchar_t)); if (szFormatText == nullptr) break; - if (GetDlgItemText(hwndDlg, IDC_FORMATTEXT, szFormatText, len+1) != 0) + if (GetDlgItemText(hwndDlg, IDC_FORMATTEXT, szFormatText, len + 1) != 0) db_set_ws(NULL, MODULENAME, SETTING_STARTUPTEXT, szFormatText); mir_free(szFormatText); } - db_set_b(NULL, MODULENAME, SETTING_PARSEATSTARTUP, (BYTE)(IsDlgButtonChecked(hwndDlg, IDC_PARSEATSTARTUP)?1:0)); - db_set_b(NULL, MODULENAME, SETTING_STRIPCRLF, (BYTE)(IsDlgButtonChecked(hwndDlg, IDC_STRIPCRLF)?1:0)); - db_set_b(NULL, MODULENAME, SETTING_STRIPWS, (BYTE)(IsDlgButtonChecked(hwndDlg, IDC_STRIPWS)?1:0)); - db_set_b(NULL, MODULENAME, SETTING_STRIPALL, (BYTE)(IsDlgButtonChecked(hwndDlg, IDC_STRIPALL)?1:0)); + db_set_b(NULL, MODULENAME, SETTING_PARSEATSTARTUP, (BYTE)(IsDlgButtonChecked(hwndDlg, IDC_PARSEATSTARTUP) ? 1 : 0)); + db_set_b(NULL, MODULENAME, SETTING_STRIPCRLF, (BYTE)(IsDlgButtonChecked(hwndDlg, IDC_STRIPCRLF) ? 1 : 0)); + db_set_b(NULL, MODULENAME, SETTING_STRIPWS, (BYTE)(IsDlgButtonChecked(hwndDlg, IDC_STRIPWS) ? 1 : 0)); + db_set_b(NULL, MODULENAME, SETTING_STRIPALL, (BYTE)(IsDlgButtonChecked(hwndDlg, IDC_STRIPALL) ? 1 : 0)); } break; @@ -111,7 +111,8 @@ static INT_PTR CALLBACK SetOptsDlgProc(HWND hwndDlg,UINT msg,WPARAM wParam,LPARA mir_free(newString); } mir_free(string); - } } + } + } break; case WM_TIMER: -- cgit v1.2.3