1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
|
#include "stdafx.h"
Options options;
int OptShowPage = 0;
#undef MODULENAME
#define MODULENAME "PopUp"
void LoadOptions()
{
return;
}
static int OptionsInitialize(WPARAM wParam, LPARAM lParam);
void InitOptions()
{
HookEvent(ME_OPT_INITIALISE, OptionsInitialize);
}
INT_PTR CALLBACK OptionsDlgProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam);
static int OptionsInitialize(WPARAM wParam, LPARAM)
{
OPTIONSDIALOGPAGE odp = { 0 };
odp.position = 100000000;
odp.pszTemplate = MAKEINTRESOURCEA(IDD_OPTIONS);
odp.szTitle.w = LPGENW("Newstory");
// odp.pszGroup = Translate("PopUps");
//odp.position = 910000000;
odp.flags = ODPF_BOLDGROUPS | ODPF_UNICODE;
odp.pfnDlgProc = OptionsDlgProc;
g_plugin.addOptions(wParam, &odp);
return 0;
}
static void ThemeDialogBackground(HWND hwnd) {
//if (IsWinVerXPPlus())
{
static HMODULE hThemeAPI = NULL;
if (!hThemeAPI) hThemeAPI = GetModuleHandle(_T("uxtheme"));
if (hThemeAPI) {
HRESULT(STDAPICALLTYPE *MyEnableThemeDialogTexture)(HWND, DWORD) = (HRESULT(STDAPICALLTYPE*)(HWND, DWORD))GetProcAddress(hThemeAPI, "EnableThemeDialogTexture");
if (MyEnableThemeDialogTexture)
MyEnableThemeDialogTexture(hwnd, 0x00000002 | 0x00000004); //0x00000002|0x00000004=ETDT_ENABLETAB
}
}
}
INT_PTR CALLBACK OptionsDlgProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam)
{
switch (msg)
{
case WM_INITDIALOG:
{
TranslateDialogDefault(hwnd);
TCITEM tci;
RECT rc;
tci.mask = TCIF_PARAM | TCIF_TEXT;
tci.lParam = (LPARAM)CreateDialog(g_plugin.getInst(), MAKEINTRESOURCE(IDD_OPT_PASSWORDS), GetDlgItem(hwnd, IDC_TAB), OptPasswordsDlgProc);
tci.pszText = TranslateT("Passwords (not ready yet)");
if (tci.lParam) TabCtrl_InsertItem(GetDlgItem(hwnd, IDC_TAB), 0, &tci);
GetClientRect(GetDlgItem(hwnd, IDC_TAB), &rc);
TabCtrl_AdjustRect(GetDlgItem(hwnd, IDC_TAB), FALSE, &rc);
ThemeDialogBackground((HWND)tci.lParam);
MoveWindow((HWND)tci.lParam, rc.left, rc.top, rc.right - rc.left, rc.bottom - rc.top, TRUE);
ShowWindow((HWND)tci.lParam, (OptShowPage == 2) ? SW_SHOW : SW_HIDE);
tci.mask = TCIF_PARAM | TCIF_TEXT;
tci.lParam = (LPARAM)CreateDialog(g_plugin.getInst(), MAKEINTRESOURCE(IDD_OPT_TEMPLATES), GetDlgItem(hwnd, IDC_TAB), OptTemplatesDlgProc);
tci.pszText = TranslateT("Templates");
if (tci.lParam) TabCtrl_InsertItem(GetDlgItem(hwnd, IDC_TAB), 0, &tci);
GetClientRect(GetDlgItem(hwnd, IDC_TAB), &rc);
TabCtrl_AdjustRect(GetDlgItem(hwnd, IDC_TAB), FALSE, &rc);
ThemeDialogBackground((HWND)tci.lParam);
MoveWindow((HWND)tci.lParam, rc.left, rc.top, rc.right - rc.left, rc.bottom - rc.top, TRUE);
ShowWindow((HWND)tci.lParam, (OptShowPage == 1) ? SW_SHOW : SW_HIDE);
tci.mask = TCIF_PARAM | TCIF_TEXT;
tci.lParam = (LPARAM)CreateDialog(g_plugin.getInst(), MAKEINTRESOURCE(IDD_OPT_GENERAL), GetDlgItem(hwnd, IDC_TAB), 0);
tci.pszText = TranslateT("General");
if (tci.lParam) TabCtrl_InsertItem(GetDlgItem(hwnd, IDC_TAB), 0, &tci);
GetClientRect(GetDlgItem(hwnd, IDC_TAB), &rc);
TabCtrl_AdjustRect(GetDlgItem(hwnd, IDC_TAB), FALSE, &rc);
ThemeDialogBackground((HWND)tci.lParam);
MoveWindow((HWND)tci.lParam, rc.left, rc.top, rc.right - rc.left, rc.bottom - rc.top, TRUE);
ShowWindow((HWND)tci.lParam, (OptShowPage == 0) ? SW_SHOW : SW_HIDE);
TabCtrl_SetCurSel(GetDlgItem(hwnd, IDC_TAB), OptShowPage);
OptShowPage = 0;
return FALSE;
}
case PSM_CHANGED:
{
SendMessage(GetParent(hwnd), PSM_CHANGED, 0, 0);
break;
}
case WM_DESTROY:
{
OptShowPage = 0;
break;
}
case WM_NOTIFY:
{
switch (((LPNMHDR)lParam)->idFrom)
{
case 0:
{
switch (((LPNMHDR)lParam)->code)
{
case PSN_RESET:
case PSN_APPLY:
{
TCITEM tci;
int i, count;
tci.mask = TCIF_PARAM;
count = TabCtrl_GetItemCount(GetDlgItem(hwnd, IDC_TAB));
for (i = 0; i < count; i++)
{
TabCtrl_GetItem(GetDlgItem(hwnd, IDC_TAB), i, &tci);
SendMessage((HWND)tci.lParam, WM_NOTIFY, wParam, lParam);
}
break;
}
}
break;
}
case IDC_TAB:
{
switch (((LPNMHDR)lParam)->code)
{
case TCN_SELCHANGING:
{
TCITEM tci;
tci.mask = TCIF_PARAM;
TabCtrl_GetItem(GetDlgItem(hwnd, IDC_TAB), TabCtrl_GetCurSel(GetDlgItem(hwnd, IDC_TAB)), &tci);
ShowWindow((HWND)tci.lParam, SW_HIDE);
break;
}
case TCN_SELCHANGE:
{
TCITEM tci;
tci.mask = TCIF_PARAM;
TabCtrl_GetItem(GetDlgItem(hwnd, IDC_TAB), TabCtrl_GetCurSel(GetDlgItem(hwnd, IDC_TAB)), &tci);
ShowWindow((HWND)tci.lParam, SW_SHOW);
break;
}
}
break;
}
}
break;
}
}
return FALSE;
}
|