diff options
author | George Hazan <ghazan@miranda.im> | 2018-11-12 20:12:53 +0300 |
---|---|---|
committer | George Hazan <ghazan@miranda.im> | 2018-11-12 20:12:53 +0300 |
commit | 488214ac8af0c4aeb1a5c1d8fd48368daaf4c4c7 (patch) | |
tree | 96b0db981b4f5054f24d484902b597ba7da1c1a5 /plugins/IEHistory/src | |
parent | 9b35784c5042984fbb60785f0a4a41a64af545f6 (diff) |
end of ME_OPT_INITIALISE related zoo in another plugins
Diffstat (limited to 'plugins/IEHistory/src')
-rw-r--r-- | plugins/IEHistory/src/IEHistory.cpp | 2 | ||||
-rw-r--r-- | plugins/IEHistory/src/dlgHandlers.cpp | 155 | ||||
-rw-r--r-- | plugins/IEHistory/src/dlgHandlers.h | 3 | ||||
-rw-r--r-- | plugins/IEHistory/src/events.cpp | 48 | ||||
-rw-r--r-- | plugins/IEHistory/src/events.h | 33 | ||||
-rw-r--r-- | plugins/IEHistory/src/services.h | 3 | ||||
-rw-r--r-- | plugins/IEHistory/src/stdafx.h | 1 |
7 files changed, 88 insertions, 157 deletions
diff --git a/plugins/IEHistory/src/IEHistory.cpp b/plugins/IEHistory/src/IEHistory.cpp index 63652e826d..f8e5a290ee 100644 --- a/plugins/IEHistory/src/IEHistory.cpp +++ b/plugins/IEHistory/src/IEHistory.cpp @@ -86,7 +86,7 @@ int CMPlugin::Load() mi.name.w = LPGENW("&System History"); Menu_AddMainMenuItem(&mi); - HookEvents(); + HookEvent(ME_OPT_INITIALISE, OnOptionsInitialize); return 0; } diff --git a/plugins/IEHistory/src/dlgHandlers.cpp b/plugins/IEHistory/src/dlgHandlers.cpp index f5db4c4597..6e5b146434 100644 --- a/plugins/IEHistory/src/dlgHandlers.cpp +++ b/plugins/IEHistory/src/dlgHandlers.cpp @@ -483,76 +483,6 @@ INT_PTR CALLBACK HistoryDlgProc(HWND hWnd, UINT msg, WPARAM wParam, LPARAM lPara return 0;
}
-INT_PTR CALLBACK OptionsDlgProc(HWND hWnd, UINT msg, WPARAM wParam, LPARAM lParam)
-{
- switch (msg) {
- case WM_INITDIALOG:
- TranslateDialogDefault(hWnd);
- {
- int count = db_get_dw(NULL, MODULENAME, "EventsToLoad", 0);
- EnableWindow(GetDlgItem(hWnd, IDC_EVENTS_COUNT), count > 0);
- EnableWindow(GetDlgItem(hWnd, IDC_SHOW_LAST_FIRST), count > 0);
-
- CheckDlgButton(hWnd, IDC_LOAD_ALL, count <= 0 ? BST_CHECKED : BST_UNCHECKED);
- CheckDlgButton(hWnd, IDC_LOAD_NUMBER, count > 0 ? BST_CHECKED : BST_UNCHECKED);
- CheckDlgButton(hWnd, IDC_ENABLE_RTL, db_get_b(NULL, MODULENAME, "EnableRTL", 0) ? BST_CHECKED : BST_UNCHECKED);
- CheckDlgButton(hWnd, IDC_SHOW_LAST_FIRST, db_get_b(NULL, MODULENAME, "ShowLastPageFirst", 0) ? BST_CHECKED : BST_UNCHECKED);
- CheckDlgButton(hWnd, IDC_LOAD_BACKGROUND, db_get_b(NULL, MODULENAME, "UseWorkerThread", 0) ? BST_CHECKED : BST_UNCHECKED);
-
- wchar_t buffer[40];
- _itow_s(count, buffer, 10);
- SetDlgItemText(hWnd, IDC_EVENTS_COUNT, buffer);
- }
- break;
-
- case WM_COMMAND:
- switch (LOWORD(wParam)) {
- case IDC_LOAD_ALL:
- EnableWindow(GetDlgItem(hWnd, IDC_EVENTS_COUNT), FALSE);
- EnableWindow(GetDlgItem(hWnd, IDC_SHOW_LAST_FIRST), FALSE);
- SendMessage(GetParent(hWnd), PSM_CHANGED, 0, 0);
- break;
-
- case IDC_LOAD_NUMBER:
- EnableWindow(GetDlgItem(hWnd, IDC_EVENTS_COUNT), TRUE);
- EnableWindow(GetDlgItem(hWnd, IDC_SHOW_LAST_FIRST), TRUE);
- SendMessage(GetParent(hWnd), PSM_CHANGED, 0, 0);
- break;
-
- case IDC_ENABLE_RTL:
- case IDC_SHOW_LAST_FIRST:
- case IDC_EVENTS_COUNT:
- case IDC_LOAD_BACKGROUND:
- SendMessage(GetParent(hWnd), PSM_CHANGED, 0, 0);
- break;
- }
- break;
-
- case WM_NOTIFY:
- switch (((LPNMHDR)lParam)->idFrom) {
- case 0:
- switch (((LPNMHDR)lParam)->code) {
- case PSN_APPLY:
- long count;
- if (IsDlgButtonChecked(hWnd, IDC_LOAD_ALL))
- count = 0;
- else {
- wchar_t buffer[1024];
- GetDlgItemText(hWnd, IDC_EVENTS_COUNT, buffer, _countof(buffer));
- count = _wtol(buffer);
- count = (count < 0) ? 0 : count;
- }
- db_set_b(NULL, MODULENAME, "ShowLastPageFirst", IsDlgButtonChecked(hWnd, IDC_SHOW_LAST_FIRST));
- db_set_b(NULL, MODULENAME, "EnableRTL", IsDlgButtonChecked(hWnd, IDC_ENABLE_RTL));
- db_set_b(NULL, MODULENAME, "UseWorkerThread", IsDlgButtonChecked(hWnd, IDC_LOAD_BACKGROUND));
- db_set_dw(NULL, MODULENAME, "EventsToLoad", count);
- }
- }
- break;
- }
- return 0;
-}
-
INT_PTR CALLBACK SearchDlgProc(HWND hWnd, UINT msg, WPARAM wParam, LPARAM lParam)
{
SearchWindowData *data = (SearchWindowData *)GetWindowLongPtr(hWnd, DWLP_USER);
@@ -671,3 +601,88 @@ INT_PTR CALLBACK SearchDlgProc(HWND hWnd, UINT msg, WPARAM wParam, LPARAM lParam }
return 0;
}
+
+/////////////////////////////////////////////////////////////////////////////////////////
+// options
+
+static INT_PTR CALLBACK OptionsDlgProc(HWND hWnd, UINT msg, WPARAM wParam, LPARAM lParam)
+{
+ switch (msg) {
+ case WM_INITDIALOG:
+ TranslateDialogDefault(hWnd);
+ {
+ int count = db_get_dw(NULL, MODULENAME, "EventsToLoad", 0);
+ EnableWindow(GetDlgItem(hWnd, IDC_EVENTS_COUNT), count > 0);
+ EnableWindow(GetDlgItem(hWnd, IDC_SHOW_LAST_FIRST), count > 0);
+
+ CheckDlgButton(hWnd, IDC_LOAD_ALL, count <= 0 ? BST_CHECKED : BST_UNCHECKED);
+ CheckDlgButton(hWnd, IDC_LOAD_NUMBER, count > 0 ? BST_CHECKED : BST_UNCHECKED);
+ CheckDlgButton(hWnd, IDC_ENABLE_RTL, db_get_b(NULL, MODULENAME, "EnableRTL", 0) ? BST_CHECKED : BST_UNCHECKED);
+ CheckDlgButton(hWnd, IDC_SHOW_LAST_FIRST, db_get_b(NULL, MODULENAME, "ShowLastPageFirst", 0) ? BST_CHECKED : BST_UNCHECKED);
+ CheckDlgButton(hWnd, IDC_LOAD_BACKGROUND, db_get_b(NULL, MODULENAME, "UseWorkerThread", 0) ? BST_CHECKED : BST_UNCHECKED);
+
+ wchar_t buffer[40];
+ _itow_s(count, buffer, 10);
+ SetDlgItemText(hWnd, IDC_EVENTS_COUNT, buffer);
+ }
+ break;
+
+ case WM_COMMAND:
+ switch (LOWORD(wParam)) {
+ case IDC_LOAD_ALL:
+ EnableWindow(GetDlgItem(hWnd, IDC_EVENTS_COUNT), FALSE);
+ EnableWindow(GetDlgItem(hWnd, IDC_SHOW_LAST_FIRST), FALSE);
+ SendMessage(GetParent(hWnd), PSM_CHANGED, 0, 0);
+ break;
+
+ case IDC_LOAD_NUMBER:
+ EnableWindow(GetDlgItem(hWnd, IDC_EVENTS_COUNT), TRUE);
+ EnableWindow(GetDlgItem(hWnd, IDC_SHOW_LAST_FIRST), TRUE);
+ SendMessage(GetParent(hWnd), PSM_CHANGED, 0, 0);
+ break;
+
+ case IDC_ENABLE_RTL:
+ case IDC_SHOW_LAST_FIRST:
+ case IDC_EVENTS_COUNT:
+ case IDC_LOAD_BACKGROUND:
+ SendMessage(GetParent(hWnd), PSM_CHANGED, 0, 0);
+ break;
+ }
+ break;
+
+ case WM_NOTIFY:
+ switch (((LPNMHDR)lParam)->idFrom) {
+ case 0:
+ switch (((LPNMHDR)lParam)->code) {
+ case PSN_APPLY:
+ long count;
+ if (IsDlgButtonChecked(hWnd, IDC_LOAD_ALL))
+ count = 0;
+ else {
+ wchar_t buffer[1024];
+ GetDlgItemText(hWnd, IDC_EVENTS_COUNT, buffer, _countof(buffer));
+ count = _wtol(buffer);
+ count = (count < 0) ? 0 : count;
+ }
+ db_set_b(NULL, MODULENAME, "ShowLastPageFirst", IsDlgButtonChecked(hWnd, IDC_SHOW_LAST_FIRST));
+ db_set_b(NULL, MODULENAME, "EnableRTL", IsDlgButtonChecked(hWnd, IDC_ENABLE_RTL));
+ db_set_b(NULL, MODULENAME, "UseWorkerThread", IsDlgButtonChecked(hWnd, IDC_LOAD_BACKGROUND));
+ db_set_dw(NULL, MODULENAME, "EventsToLoad", count);
+ }
+ }
+ break;
+ }
+ return 0;
+}
+
+int OnOptionsInitialize(WPARAM wParam, LPARAM)
+{
+ OPTIONSDIALOGPAGE odp = {};
+ odp.position = 100000000;
+ odp.szTitle.w = LPGENW("History");
+ odp.pfnDlgProc = OptionsDlgProc;
+ odp.pszTemplate = MAKEINTRESOURCEA(IDD_OPT_HISTORY);
+ odp.flags = ODPF_BOLDGROUPS | ODPF_UNICODE;
+ g_plugin.addOptions(wParam, &odp);
+ return 0;
+}
diff --git a/plugins/IEHistory/src/dlgHandlers.h b/plugins/IEHistory/src/dlgHandlers.h index 01d39a1351..03db94dd6e 100644 --- a/plugins/IEHistory/src/dlgHandlers.h +++ b/plugins/IEHistory/src/dlgHandlers.h @@ -21,8 +21,6 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. #ifndef M_HISTORY_DLG_HANDLERS_H #define M_HISTORY_DLG_HANDLERS_H -#include "stdafx.h" - #define LOAD_IN_BACKGROUND 0x00000001 struct HistoryWindowData{ @@ -44,7 +42,6 @@ struct SearchWindowData{ }; INT_PTR CALLBACK HistoryDlgProc(HWND hWnd, UINT msg, WPARAM wParam, LPARAM lParam); -INT_PTR CALLBACK OptionsDlgProc(HWND hWnd, UINT msg, WPARAM wParam, LPARAM lParam); INT_PTR CALLBACK SearchDlgProc(HWND hWnd, UINT msg, WPARAM wParam, LPARAM lParam); #endif //M_HISTORY_DLG_HANDLERS_H diff --git a/plugins/IEHistory/src/events.cpp b/plugins/IEHistory/src/events.cpp deleted file mode 100644 index 30b80dbf23..0000000000 --- a/plugins/IEHistory/src/events.cpp +++ /dev/null @@ -1,48 +0,0 @@ -/* -IEView history viewer plugin for Miranda IM - -Copyright © 2005-2006 Cristian Libotean - -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" -#include "events.h" - -HANDLE hOptionsInitialize; - -int HookEvents() -{ - hOptionsInitialize = HookEvent(ME_OPT_INITIALISE, OnOptionsInitialize); - return 0; -} - -int UnhookEvents() -{ - UnhookEvent(hOptionsInitialize); - return 0; -} - -int OnOptionsInitialize(WPARAM wParam, LPARAM) -{ - OPTIONSDIALOGPAGE odp = {}; - odp.position = 100000000; - odp.szTitle.w = LPGENW("History"); - odp.pfnDlgProc = OptionsDlgProc; - odp.pszTemplate = MAKEINTRESOURCEA(IDD_OPT_HISTORY); - odp.flags = ODPF_BOLDGROUPS | ODPF_UNICODE; - g_plugin.addOptions(wParam, &odp); - return 0; -} diff --git a/plugins/IEHistory/src/events.h b/plugins/IEHistory/src/events.h deleted file mode 100644 index abfa66ac42..0000000000 --- a/plugins/IEHistory/src/events.h +++ /dev/null @@ -1,33 +0,0 @@ -/* -IEView history viewer plugin for Miranda IM - -Copyright © 2005-2006 Cristian Libotean - -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. -*/ - -#ifndef M_HISTORY_HOOKED_EVENTS_H -#define M_HISTORY_HOOKED_EVENTS_H - -#include "stdafx.h" - -extern HANDLE hOptionsInitialize; - -int HookEvents(); -int UnhookEvents(); - -int OnOptionsInitialize(WPARAM wParam, LPARAM lParam); - -#endif //M_HISTORY_HOOKED_EVENTS_H diff --git a/plugins/IEHistory/src/services.h b/plugins/IEHistory/src/services.h index c1048ce9fc..a1b7dfb50d 100644 --- a/plugins/IEHistory/src/services.h +++ b/plugins/IEHistory/src/services.h @@ -21,11 +21,12 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. #ifndef M_IEHISTORY_PROVIDED_SERVICES_H #define M_IEHISTORY_PROVIDED_SERVICES_H -#include "stdafx.h" #include "dlgHandlers.h" int InitServices(); +int OnOptionsInitialize(WPARAM, LPARAM); + INT_PTR ShowContactHistoryService(WPARAM wParam, LPARAM lParam); #endif //M_IEHISTORY_PROVIDED_SERVICES_H diff --git a/plugins/IEHistory/src/stdafx.h b/plugins/IEHistory/src/stdafx.h index f073c987a4..3d182815ff 100644 --- a/plugins/IEHistory/src/stdafx.h +++ b/plugins/IEHistory/src/stdafx.h @@ -53,7 +53,6 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. #include "version.h" #include "utils.h" -#include "events.h" #include "dlgHandlers.h" #define _strcat strcat_s |