From f6f131ab125696780a30993c56ff825a1d339ef5 Mon Sep 17 00:00:00 2001 From: George Hazan Date: Sun, 15 Jul 2018 11:09:25 +0300 Subject: fixes #1495 (WebView: radioboxes behaviour) --- plugins/WebView/res/webview.rc | 9 +- plugins/WebView/src/version.h | 2 +- plugins/WebView/src/webview.cpp | 2 +- plugins/WebView/src/webview_opts.cpp | 169 +++++++++++++++++------------------ 4 files changed, 89 insertions(+), 93 deletions(-) (limited to 'plugins/WebView') diff --git a/plugins/WebView/res/webview.rc b/plugins/WebView/res/webview.rc index f79a6263b8..a4fea01b4e 100644 --- a/plugins/WebView/res/webview.rc +++ b/plugins/WebView/res/webview.rc @@ -304,14 +304,15 @@ BEGIN GROUPBOX "Colors",IDC_STATIC,8,60,270,60,WS_GROUP CONTROL "Use custom colors",IDC_POP_USECUSTCOLORS,"Button", BS_AUTORADIOBUTTON,18,70,111,13 - LTEXT "Background",IDC_STATIC,223,65,50,8,SS_CENTERIMAGE - LTEXT "Text",IDC_STATIC,147,65,50,8,SS_CENTERIMAGE - CONTROL "",IDC_POP_BGCOLOUR,"ColourPicker",WS_TABSTOP,223,75,35,11 - CONTROL "",IDC_POP_TEXTCOLOUR,"ColourPicker",WS_TABSTOP,147,75,35,11 CONTROL "Use Windows colors",IDC_POP_USEWINCOLORS,"Button", BS_AUTORADIOBUTTON,18,85,121,13 CONTROL "Use same colors as data window", IDC_POP_USESAMECOLORS,"Button", BS_AUTORADIOBUTTON,18,100,161,13 + + LTEXT "Background",IDC_STATIC,223,65,50,8,SS_CENTERIMAGE + LTEXT "Text",IDC_STATIC,147,65,50,8,SS_CENTERIMAGE + CONTROL "",IDC_POP_BGCOLOUR,"ColourPicker",WS_TABSTOP,223,75,35,11 + CONTROL "",IDC_POP_TEXTCOLOUR,"ColourPicker",WS_TABSTOP,147,75,35,11 //// GROUPBOX "Left click action",IDC_STATIC,8,125,120,54,WS_GROUP diff --git a/plugins/WebView/src/version.h b/plugins/WebView/src/version.h index 3b5eaf7336..c2030de835 100644 --- a/plugins/WebView/src/version.h +++ b/plugins/WebView/src/version.h @@ -1,7 +1,7 @@ #define __MAJOR_VERSION 0 #define __MINOR_VERSION 1 #define __RELEASE_NUM 3 -#define __BUILD_NUM 1 +#define __BUILD_NUM 2 #include diff --git a/plugins/WebView/src/webview.cpp b/plugins/WebView/src/webview.cpp index 7ec393d3fc..d00e473a66 100644 --- a/plugins/WebView/src/webview.cpp +++ b/plugins/WebView/src/webview.cpp @@ -301,7 +301,7 @@ static int OptInitialise(WPARAM wParam, LPARAM) // if popup service exists if ((ServiceExists(MS_POPUP_ADDPOPUPT))) { odp.pszTemplate = MAKEINTRESOURCEA(IDD_POPUP); - odp.szGroup.w = LPGENW("Popups"); + odp.szGroup.a = LPGEN("Popups"); odp.pfnDlgProc = DlgPopUpOpts; g_plugin.addOptions(wParam, &odp); } diff --git a/plugins/WebView/src/webview_opts.cpp b/plugins/WebView/src/webview_opts.cpp index 81095011ee..3573ead3c2 100644 --- a/plugins/WebView/src/webview_opts.cpp +++ b/plugins/WebView/src/webview_opts.cpp @@ -1,23 +1,23 @@ /* -* A plugin for Miranda IM which displays web page text in a window Copyright -* (C) 2005 Vincent Joyce. -* +* A plugin for Miranda IM which displays web page text in a window +* Copyright (C) 2005 Vincent Joyce. +* * Miranda IM: the free icq client for MS Windows Copyright (C) 2000-2 * Richard Hughes, Roland Rabien & Tristan Van de Vreede -* +* * 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 +* 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 +* 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. +* 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" @@ -101,38 +101,37 @@ INT_PTR CALLBACK DlgPopUpOpts(HWND hdlg, UINT msg, WPARAM wParam, LPARAM lParam) switch (msg) { case WM_INITDIALOG: TranslateDialogDefault(hdlg); - { - delay = db_get_dw(NULL, MODULENAME, POP_DELAY_KEY, 0); - - // setting popup delay option - _itoa(delay, str, 10); - SetDlgItemTextA(hdlg, IDC_DELAY, str); - - BGColour = db_get_dw(NULL, MODULENAME, POP_BG_CLR_KEY, Def_color_bg); - TextColour = db_get_dw(NULL, MODULENAME, POP_TXT_CLR_KEY, Def_color_txt); - - // Colours. First step is configuring the colours. - SendDlgItemMessage(hdlg, IDC_POP_BGCOLOUR, CPM_SETCOLOUR, 0, BGColour); - SendDlgItemMessage(hdlg, IDC_POP_TEXTCOLOUR, CPM_SETCOLOUR, 0, TextColour); - // Second step is disabling them if we want to use default Windows - // ones. - CheckDlgButton(hdlg, IDC_POP_USEWINCOLORS, db_get_b(NULL, MODULENAME, POP_USEWINCLRS_KEY, 0) ? BST_CHECKED : BST_UNCHECKED); - CheckDlgButton(hdlg, IDC_POP_USESAMECOLORS, db_get_b(NULL, MODULENAME, POP_USESAMECLRS_KEY, 1) ? BST_CHECKED : BST_UNCHECKED); - CheckDlgButton(hdlg, IDC_POP_USECUSTCOLORS, db_get_b(NULL, MODULENAME, POP_USECUSTCLRS_KEY, 0) ? BST_CHECKED : BST_UNCHECKED); - - if (IsDlgButtonChecked(hdlg, IDC_POP_USEWINCOLORS) || IsDlgButtonChecked(hdlg, IDC_POP_USESAMECOLORS)) { - EnableWindow(GetDlgItem(hdlg, IDC_POP_BGCOLOUR), 0); - EnableWindow(GetDlgItem(hdlg, IDC_POP_TEXTCOLOUR), 0); - } - CheckDlgButton(hdlg, IDC_LCLK_WINDOW, db_get_b(NULL, MODULENAME, LCLK_WINDOW_KEY, 0) ? BST_CHECKED : BST_UNCHECKED); - CheckDlgButton(hdlg, IDC_LCLK_WEB_PGE, db_get_b(NULL, MODULENAME, LCLK_WEB_PGE_KEY, 0) ? BST_CHECKED : BST_UNCHECKED); - CheckDlgButton(hdlg, IDC_LCLK_DISMISS, db_get_b(NULL, MODULENAME, LCLK_DISMISS_KEY, 1) ? BST_CHECKED : BST_UNCHECKED); + delay = db_get_dw(NULL, MODULENAME, POP_DELAY_KEY, 0); + + // setting popup delay option + _itoa(delay, str, 10); + SetDlgItemTextA(hdlg, IDC_DELAY, str); - CheckDlgButton(hdlg, IDC_RCLK_WINDOW, db_get_b(NULL, MODULENAME, RCLK_WINDOW_KEY, 0) ? BST_CHECKED : BST_UNCHECKED); - CheckDlgButton(hdlg, IDC_RCLK_WEB_PGE, db_get_b(NULL, MODULENAME, RCLK_WEB_PGE_KEY, 1) ? BST_CHECKED : BST_UNCHECKED); - CheckDlgButton(hdlg, IDC_RCLK_DISMISS, db_get_b(NULL, MODULENAME, RCLK_DISMISS_KEY, 0) ? BST_CHECKED : BST_UNCHECKED); + BGColour = db_get_dw(NULL, MODULENAME, POP_BG_CLR_KEY, Def_color_bg); + TextColour = db_get_dw(NULL, MODULENAME, POP_TXT_CLR_KEY, Def_color_txt); + + // Colours. First step is configuring the colours. + SendDlgItemMessage(hdlg, IDC_POP_BGCOLOUR, CPM_SETCOLOUR, 0, BGColour); + SendDlgItemMessage(hdlg, IDC_POP_TEXTCOLOUR, CPM_SETCOLOUR, 0, TextColour); + // Second step is disabling them if we want to use default Windows + // ones. + CheckDlgButton(hdlg, IDC_POP_USEWINCOLORS, db_get_b(NULL, MODULENAME, POP_USEWINCLRS_KEY, 0) ? BST_CHECKED : BST_UNCHECKED); + CheckDlgButton(hdlg, IDC_POP_USESAMECOLORS, db_get_b(NULL, MODULENAME, POP_USESAMECLRS_KEY, 1) ? BST_CHECKED : BST_UNCHECKED); + CheckDlgButton(hdlg, IDC_POP_USECUSTCOLORS, db_get_b(NULL, MODULENAME, POP_USECUSTCLRS_KEY, 0) ? BST_CHECKED : BST_UNCHECKED); + + if (IsDlgButtonChecked(hdlg, IDC_POP_USEWINCOLORS) || IsDlgButtonChecked(hdlg, IDC_POP_USESAMECOLORS)) { + EnableWindow(GetDlgItem(hdlg, IDC_POP_BGCOLOUR), 0); + EnableWindow(GetDlgItem(hdlg, IDC_POP_TEXTCOLOUR), 0); } + + CheckDlgButton(hdlg, IDC_LCLK_WINDOW, db_get_b(NULL, MODULENAME, LCLK_WINDOW_KEY, 0) ? BST_CHECKED : BST_UNCHECKED); + CheckDlgButton(hdlg, IDC_LCLK_WEB_PGE, db_get_b(NULL, MODULENAME, LCLK_WEB_PGE_KEY, 0) ? BST_CHECKED : BST_UNCHECKED); + CheckDlgButton(hdlg, IDC_LCLK_DISMISS, db_get_b(NULL, MODULENAME, LCLK_DISMISS_KEY, 1) ? BST_CHECKED : BST_UNCHECKED); + + CheckDlgButton(hdlg, IDC_RCLK_WINDOW, db_get_b(NULL, MODULENAME, RCLK_WINDOW_KEY, 0) ? BST_CHECKED : BST_UNCHECKED); + CheckDlgButton(hdlg, IDC_RCLK_WEB_PGE, db_get_b(NULL, MODULENAME, RCLK_WEB_PGE_KEY, 1) ? BST_CHECKED : BST_UNCHECKED); + CheckDlgButton(hdlg, IDC_RCLK_DISMISS, db_get_b(NULL, MODULENAME, RCLK_DISMISS_KEY, 0) ? BST_CHECKED : BST_UNCHECKED); return TRUE; case WM_COMMAND: @@ -187,70 +186,66 @@ INT_PTR CALLBACK DlgPopUpOpts(HWND hdlg, UINT msg, WPARAM wParam, LPARAM lParam) break; case IDC_PREVIEW: - { - wchar_t str3[512]; - POPUPDATAT ppd = { 0 }; + wchar_t str3[512]; + POPUPDATAT ppd = { 0 }; - GetDlgItemText(hdlg, IDC_DELAY, str3, _countof(str3)); + GetDlgItemText(hdlg, IDC_DELAY, str3, _countof(str3)); - if (IsDlgButtonChecked(hdlg, IDC_POP_USECUSTCOLORS)) { - BGColour = (SendDlgItemMessage(hdlg, IDC_POP_BGCOLOUR, CPM_GETCOLOUR, 0, 0)); - TextColour = (SendDlgItemMessage(hdlg, IDC_POP_TEXTCOLOUR, CPM_GETCOLOUR, 0, 0)); - } - if (IsDlgButtonChecked(hdlg, IDC_POP_USEWINCOLORS)) { - BGColour = GetSysColor(COLOR_BTNFACE); - TextColour = GetSysColor(COLOR_WINDOWTEXT); - } - if (IsDlgButtonChecked(hdlg, IDC_POP_USESAMECOLORS)) { - BGColour = BackgoundClr; - TextColour = TextClr; - } - ppd.lchContact = NULL; - mir_wstrcpy(ppd.lptzContactName, _A2W(MODULENAME)); - ppd.lchIcon = LoadIcon(g_plugin.getInst(), MAKEINTRESOURCE(IDI_SITE)); - mir_wstrcpy(ppd.lptzText, TranslateT("This is a preview popup.")); - ppd.colorBack = BGColour; - ppd.colorText = TextColour; - ppd.PluginWindowProc = nullptr; - ppd.iSeconds = _wtol(str3); - // display popups - PUAddPopupT(&ppd); + if (IsDlgButtonChecked(hdlg, IDC_POP_USECUSTCOLORS)) { + BGColour = (SendDlgItemMessage(hdlg, IDC_POP_BGCOLOUR, CPM_GETCOLOUR, 0, 0)); + TextColour = (SendDlgItemMessage(hdlg, IDC_POP_TEXTCOLOUR, CPM_GETCOLOUR, 0, 0)); + } + if (IsDlgButtonChecked(hdlg, IDC_POP_USEWINCOLORS)) { + BGColour = GetSysColor(COLOR_BTNFACE); + TextColour = GetSysColor(COLOR_WINDOWTEXT); } + if (IsDlgButtonChecked(hdlg, IDC_POP_USESAMECOLORS)) { + BGColour = BackgoundClr; + TextColour = TextClr; + } + ppd.lchContact = NULL; + mir_wstrcpy(ppd.lptzContactName, _A2W(MODULENAME)); + ppd.lchIcon = LoadIcon(g_plugin.getInst(), MAKEINTRESOURCE(IDI_SITE)); + mir_wstrcpy(ppd.lptzText, TranslateT("This is a preview popup.")); + ppd.colorBack = BGColour; + ppd.colorText = TextColour; + ppd.PluginWindowProc = nullptr; + ppd.iSeconds = _wtol(str3); + // display popups + PUAddPopupT(&ppd); } break; case WM_NOTIFY: // Here we have pressed either the OK or the APPLY button. switch (((LPNMHDR)lParam)->code) { case PSN_APPLY: - { - int popupdelayval = 0; - wchar_t str2[512]; - GetDlgItemText(hdlg, IDC_DELAY, str2, _countof(str2)); + int popupdelayval = 0; + wchar_t str2[512]; + GetDlgItemText(hdlg, IDC_DELAY, str2, _countof(str2)); - popupdelayval = _wtol(str2); - db_set_dw(NULL, MODULENAME, POP_DELAY_KEY, popupdelayval); + popupdelayval = _wtol(str2); + db_set_dw(NULL, MODULENAME, POP_DELAY_KEY, popupdelayval); - db_set_b(NULL, MODULENAME, LCLK_WINDOW_KEY, (BYTE)IsDlgButtonChecked(hdlg, IDC_LCLK_WINDOW)); - db_set_b(NULL, MODULENAME, LCLK_WEB_PGE_KEY, (BYTE)IsDlgButtonChecked(hdlg, IDC_LCLK_WEB_PGE)); - db_set_b(NULL, MODULENAME, LCLK_DISMISS_KEY, (BYTE)IsDlgButtonChecked(hdlg, IDC_LCLK_DISMISS)); + db_set_b(NULL, MODULENAME, LCLK_WINDOW_KEY, (BYTE)IsDlgButtonChecked(hdlg, IDC_LCLK_WINDOW)); + db_set_b(NULL, MODULENAME, LCLK_WEB_PGE_KEY, (BYTE)IsDlgButtonChecked(hdlg, IDC_LCLK_WEB_PGE)); + db_set_b(NULL, MODULENAME, LCLK_DISMISS_KEY, (BYTE)IsDlgButtonChecked(hdlg, IDC_LCLK_DISMISS)); - db_set_b(NULL, MODULENAME, RCLK_WINDOW_KEY, (BYTE)IsDlgButtonChecked(hdlg, IDC_RCLK_WINDOW)); - db_set_b(NULL, MODULENAME, RCLK_WEB_PGE_KEY, (BYTE)IsDlgButtonChecked(hdlg, IDC_RCLK_WEB_PGE)); - db_set_b(NULL, MODULENAME, RCLK_DISMISS_KEY, (BYTE)IsDlgButtonChecked(hdlg, IDC_RCLK_DISMISS)); + db_set_b(NULL, MODULENAME, RCLK_WINDOW_KEY, (BYTE)IsDlgButtonChecked(hdlg, IDC_RCLK_WINDOW)); + db_set_b(NULL, MODULENAME, RCLK_WEB_PGE_KEY, (BYTE)IsDlgButtonChecked(hdlg, IDC_RCLK_WEB_PGE)); + db_set_b(NULL, MODULENAME, RCLK_DISMISS_KEY, (BYTE)IsDlgButtonChecked(hdlg, IDC_RCLK_DISMISS)); - db_set_b(NULL, MODULENAME, POP_USECUSTCLRS_KEY, (BYTE)IsDlgButtonChecked(hdlg, IDC_POP_USECUSTCOLORS)); - db_set_b(NULL, MODULENAME, POP_USEWINCLRS_KEY, (BYTE)IsDlgButtonChecked(hdlg, IDC_POP_USEWINCOLORS)); - db_set_b(NULL, MODULENAME, POP_USESAMECLRS_KEY, (BYTE)IsDlgButtonChecked(hdlg, IDC_POP_USESAMECOLORS)); + db_set_b(NULL, MODULENAME, POP_USECUSTCLRS_KEY, (BYTE)IsDlgButtonChecked(hdlg, IDC_POP_USECUSTCOLORS)); + db_set_b(NULL, MODULENAME, POP_USEWINCLRS_KEY, (BYTE)IsDlgButtonChecked(hdlg, IDC_POP_USEWINCOLORS)); + db_set_b(NULL, MODULENAME, POP_USESAMECLRS_KEY, (BYTE)IsDlgButtonChecked(hdlg, IDC_POP_USESAMECOLORS)); - BGColour = (SendDlgItemMessage(hdlg, IDC_POP_BGCOLOUR, CPM_GETCOLOUR, 0, 0)); - TextColour = (SendDlgItemMessage(hdlg, IDC_POP_TEXTCOLOUR, CPM_GETCOLOUR, 0, 0)); + BGColour = (SendDlgItemMessage(hdlg, IDC_POP_BGCOLOUR, CPM_GETCOLOUR, 0, 0)); + TextColour = (SendDlgItemMessage(hdlg, IDC_POP_TEXTCOLOUR, CPM_GETCOLOUR, 0, 0)); - db_set_dw(NULL, MODULENAME, POP_BG_CLR_KEY, BGColour); - db_set_dw(NULL, MODULENAME, POP_TXT_CLR_KEY, TextColour); + db_set_dw(NULL, MODULENAME, POP_BG_CLR_KEY, BGColour); + db_set_dw(NULL, MODULENAME, POP_TXT_CLR_KEY, TextColour); - test = 0; - return TRUE; - } + test = 0; + return TRUE; } break; } -- cgit v1.2.3