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
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
|
/*
Copyright (C) 2010 Mataes
This is free software; you can redistribute it and/or
modify it under the terms of the GNU Library General Public
License as published by the Free Software Foundation; either
version 2 of the License, or (at your option) any later version.
This 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
Library General Public License for more details.
You should have received a copy of the GNU Library General Public
License along with this file; see the file license.txt. If
not, write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
Boston, MA 02111-1307, USA.
*/
#include "stdafx.h"
PlugOptions opts;
POPUP_OPTIONS PopupOptions = {0};
int GetUpdateMode()
{
int UpdateMode = db_get_b(NULL, MODNAME, DB_SETTING_UPDATE_MODE, -1);
// Check if there is url for custom mode
if (UpdateMode == UPDATE_MODE_CUSTOM) {
ptrT url(db_get_tsa(NULL, MODNAME, DB_SETTING_UPDATE_URL));
if (url == NULL || !_tcslen(url)) {
// No url for custom mode, reset that setting so it will be determined automatically
db_unset(NULL, MODNAME, DB_SETTING_UPDATE_MODE);
UpdateMode = -1;
}
}
if (UpdateMode < 0 || UpdateMode > UPDATE_MODE_MAX_VALUE) {
// Missing or unknown mode, determine correct from version of running core
char coreVersion[512];
CallService(MS_SYSTEM_GETVERSIONTEXT, (WPARAM)_countof(coreVersion), (LPARAM)coreVersion);
UpdateMode = (strstr(coreVersion, "alpha") == NULL) ? UPDATE_MODE_STABLE : UPDATE_MODE_TRUNK;
}
return UpdateMode;
}
TCHAR* GetDefaultUrl()
{
switch (GetUpdateMode()) {
case UPDATE_MODE_STABLE:
return mir_tstrdup(_T(DEFAULT_UPDATE_URL));
case UPDATE_MODE_TRUNK:
return mir_tstrdup(_T(DEFAULT_UPDATE_URL_TRUNK));
case UPDATE_MODE_TRUNK_SYMBOLS:
return mir_tstrdup(_T(DEFAULT_UPDATE_URL_TRUNK_SYMBOLS));
default:
return db_get_tsa(NULL, MODNAME, DB_SETTING_UPDATE_URL);
}
}
static INT_PTR CALLBACK UpdateNotifyOptsProc(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lParam)
{
switch (msg) {
case WM_INITDIALOG:
if (opts.bUpdateOnStartup) {
CheckDlgButton(hwndDlg, IDC_UPDATEONSTARTUP, BST_CHECKED);
EnableWindow(GetDlgItem(hwndDlg, IDC_ONLYONCEADAY), TRUE);
}
CheckDlgButton(hwndDlg, IDC_ONLYONCEADAY, opts.bOnlyOnceADay ? BST_CHECKED : BST_UNCHECKED);
if (opts.bUpdateOnPeriod) {
CheckDlgButton(hwndDlg, IDC_UPDATEONPERIOD, BST_CHECKED);
EnableWindow(GetDlgItem(hwndDlg, IDC_PERIOD), TRUE);
EnableWindow(GetDlgItem(hwndDlg, IDC_PERIODSPIN), TRUE);
EnableWindow(GetDlgItem(hwndDlg, IDC_PERIODMEASURE), TRUE);
}
CheckDlgButton(hwndDlg, IDC_SILENTMODE, opts.bSilentMode ? BST_CHECKED : BST_UNCHECKED);
if (db_get_b(NULL, MODNAME, DB_SETTING_NEED_RESTART, 0))
ShowWindow(GetDlgItem(hwndDlg, IDC_NEEDRESTARTLABEL), SW_SHOW);
SendDlgItemMessage(hwndDlg, IDC_PERIODSPIN, UDM_SETRANGE, 0, MAKELONG(99, 1));
SendDlgItemMessage(hwndDlg, IDC_PERIODSPIN, UDM_SETPOS, 0, (LPARAM)opts.Period);
if (ServiceExists(MS_AB_BACKUP)) {
EnableWindow(GetDlgItem(hwndDlg, IDC_BACKUP), TRUE);
SetDlgItemText(hwndDlg, IDC_BACKUP, LPGENT("Backup profile after update"));
if(opts.bBackup)
CheckDlgButton(hwndDlg, IDC_BACKUP, BST_CHECKED);
}
Edit_LimitText(GetDlgItem(hwndDlg, IDC_PERIOD), 2);
if (db_get_b(NULL, MODNAME, DB_SETTING_DONT_SWITCH_TO_STABLE, 0)) {
EnableWindow(GetDlgItem(hwndDlg, IDC_STABLE), FALSE);
// Reset setting if needed
int UpdateMode = db_get_b(NULL, MODNAME, DB_SETTING_UPDATE_MODE, UPDATE_MODE_STABLE);
if (UpdateMode == UPDATE_MODE_STABLE)
db_set_b(NULL, MODNAME, DB_SETTING_UPDATE_MODE, UPDATE_MODE_TRUNK);
SetDlgItemText(hwndDlg,IDC_STABLE,LPGENT("Stable version (incompatible with current development version)"));
}
TranslateDialogDefault(hwndDlg);
ComboBox_InsertString(GetDlgItem(hwndDlg, IDC_PERIODMEASURE), 0, TranslateT("hours"));
ComboBox_InsertString(GetDlgItem(hwndDlg, IDC_PERIODMEASURE), 1, TranslateT("days"));
ComboBox_SetCurSel(GetDlgItem(hwndDlg, IDC_PERIODMEASURE), opts.bPeriodMeasure);
switch (GetUpdateMode()) {
case UPDATE_MODE_STABLE:
SetDlgItemText(hwndDlg, IDC_CUSTOMURL, _T(DEFAULT_UPDATE_URL));
CheckDlgButton(hwndDlg, IDC_STABLE, BST_CHECKED);
break;
case UPDATE_MODE_TRUNK:
SetDlgItemText(hwndDlg, IDC_CUSTOMURL, _T(DEFAULT_UPDATE_URL_TRUNK));
CheckDlgButton(hwndDlg, IDC_TRUNK, BST_CHECKED);
break;
case UPDATE_MODE_TRUNK_SYMBOLS:
SetDlgItemText(hwndDlg, IDC_CUSTOMURL, _T(DEFAULT_UPDATE_URL_TRUNK_SYMBOLS));
CheckDlgButton(hwndDlg, IDC_TRUNK_SYMBOLS, BST_CHECKED);
break;
default:
CheckDlgButton(hwndDlg, IDC_CUSTOM, BST_CHECKED);
EnableWindow(GetDlgItem(hwndDlg, IDC_CUSTOMURL), TRUE);
ptrT url(db_get_tsa(NULL, MODNAME, DB_SETTING_UPDATE_URL));
if (url == NULL)
url = GetDefaultUrl();
SetDlgItemText(hwndDlg, IDC_CUSTOMURL, url);
}
return TRUE;
case WM_COMMAND:
switch (LOWORD(wParam)) {
case IDC_UPDATEONSTARTUP:
EnableWindow(GetDlgItem(hwndDlg, IDC_ONLYONCEADAY), IsDlgButtonChecked(hwndDlg, IDC_UPDATEONSTARTUP));
// fall through
case IDC_SILENTMODE:
case IDC_ONLYONCEADAY:
case IDC_BACKUP:
SendMessage(GetParent(hwndDlg), PSM_CHANGED, 0, 0);
break;
case IDC_UPDATEONPERIOD:
{
BOOL value = IsDlgButtonChecked(hwndDlg, IDC_UPDATEONPERIOD);
EnableWindow(GetDlgItem(hwndDlg, IDC_PERIOD), value);
EnableWindow(GetDlgItem(hwndDlg, IDC_PERIODSPIN), value);
EnableWindow(GetDlgItem(hwndDlg, IDC_PERIODMEASURE), value);
SendMessage(GetParent(hwndDlg), PSM_CHANGED, 0, 0);
}
break;
case IDC_TRUNK_SYMBOLS:
EnableWindow(GetDlgItem(hwndDlg, IDC_CUSTOMURL), FALSE);
SetDlgItemText(hwndDlg, IDC_CUSTOMURL, _T(DEFAULT_UPDATE_URL_TRUNK_SYMBOLS));
SendMessage(GetParent(hwndDlg), PSM_CHANGED, 0, 0);
break;
case IDC_TRUNK:
EnableWindow(GetDlgItem(hwndDlg, IDC_CUSTOMURL), FALSE);
SetDlgItemText(hwndDlg, IDC_CUSTOMURL, _T(DEFAULT_UPDATE_URL_TRUNK));
SendMessage(GetParent(hwndDlg), PSM_CHANGED, 0, 0);
break;
case IDC_STABLE:
EnableWindow(GetDlgItem(hwndDlg, IDC_CUSTOMURL), FALSE);
SetDlgItemText(hwndDlg, IDC_CUSTOMURL, _T(DEFAULT_UPDATE_URL));
SendMessage(GetParent(hwndDlg), PSM_CHANGED, 0, 0);
break;
case IDC_CUSTOM:
EnableWindow(GetDlgItem(hwndDlg, IDC_CUSTOMURL), TRUE);
{
ptrT url(db_get_tsa(NULL, MODNAME, DB_SETTING_UPDATE_URL));
if (url == NULL)
url = GetDefaultUrl();
SetDlgItemText(hwndDlg, IDC_CUSTOMURL, url);
}
SendMessage(GetParent(hwndDlg), PSM_CHANGED, 0, 0);
break;
case IDC_PERIOD:
case IDC_CUSTOMURL:
if ((HWND)lParam == GetFocus() && (HIWORD(wParam) == EN_CHANGE))
SendMessage(GetParent(hwndDlg), PSM_CHANGED, 0, 0);
break;
case IDC_PERIODMEASURE:
if (HIWORD(wParam) == CBN_SELCHANGE)
SendMessage(GetParent(hwndDlg), PSM_CHANGED, 0, 0);
break;
case IDC_LINK_HOTKEY:
{
OPENOPTIONSDIALOG ood = {0};
ood.cbSize = sizeof(ood);
ood.pszGroup = "Customize";
ood.pszPage = "Hotkeys";
Options_Open(&ood);
}
return true;
}
break;
case WM_NOTIFY:
{
NMHDR *hdr = (NMHDR *)lParam;
if (hdr && hdr->code == UDN_DELTAPOS)
SendMessage(GetParent(hwndDlg), PSM_CHANGED, 0, 0);
if (hdr && hdr->code == PSN_APPLY) {
db_set_b(NULL, MODNAME, "UpdateOnStartup", opts.bUpdateOnStartup = IsDlgButtonChecked(hwndDlg, IDC_UPDATEONSTARTUP));
db_set_b(NULL, MODNAME, "OnlyOnceADay", opts.bOnlyOnceADay = IsDlgButtonChecked(hwndDlg, IDC_ONLYONCEADAY));
db_set_b(NULL, MODNAME, "UpdateOnPeriod", opts.bUpdateOnPeriod = IsDlgButtonChecked(hwndDlg, IDC_UPDATEONPERIOD));
db_set_b(NULL, MODNAME, "PeriodMeasure", opts.bPeriodMeasure = ComboBox_GetCurSel(GetDlgItem(hwndDlg, IDC_PERIODMEASURE)));
db_set_b(NULL, MODNAME, "SilentMode", opts.bSilentMode = IsDlgButtonChecked(hwndDlg, IDC_SILENTMODE));
db_set_b(NULL, MODNAME, "Backup", opts.bBackup = IsDlgButtonChecked(hwndDlg, IDC_BACKUP));
TCHAR buffer[3] = {0};
Edit_GetText(GetDlgItem(hwndDlg, IDC_PERIOD), buffer, _countof(buffer));
db_set_dw(NULL, MODNAME, "Period", opts.Period = _ttoi(buffer));
mir_forkthread(InitTimer, (void*)1);
if ( IsDlgButtonChecked(hwndDlg, IDC_STABLE)) {
db_set_b(NULL, MODNAME, DB_SETTING_UPDATE_MODE, UPDATE_MODE_STABLE);
opts.bForceRedownload = 0;
db_unset(NULL, MODNAME, DB_SETTING_REDOWNLOAD);
}
else if ( IsDlgButtonChecked(hwndDlg, IDC_TRUNK)) {
db_set_b(NULL, MODNAME, DB_SETTING_UPDATE_MODE, UPDATE_MODE_TRUNK);
opts.bForceRedownload = 0;
db_unset(NULL, MODNAME, DB_SETTING_REDOWNLOAD);
}
else if ( IsDlgButtonChecked(hwndDlg, IDC_TRUNK_SYMBOLS)) {
// Only set ForceRedownload if the previous UpdateMode was different
// to redownload all plugin with pdb files
if (db_get_b(NULL, MODNAME, DB_SETTING_UPDATE_MODE, UPDATE_MODE_STABLE) != UPDATE_MODE_TRUNK_SYMBOLS) {
db_set_b(NULL, MODNAME, DB_SETTING_REDOWNLOAD, opts.bForceRedownload = 1);
db_set_b(NULL, MODNAME, DB_SETTING_UPDATE_MODE, UPDATE_MODE_TRUNK_SYMBOLS);
}
}
else {
TCHAR tszUrl[100];
GetDlgItemText(hwndDlg, IDC_CUSTOMURL, tszUrl, _countof(tszUrl));
db_set_ts(NULL, MODNAME, DB_SETTING_UPDATE_URL, tszUrl);
db_set_b(NULL, MODNAME, DB_SETTING_UPDATE_MODE, UPDATE_MODE_CUSTOM);
opts.bForceRedownload = 0;
db_unset(NULL, MODNAME, DB_SETTING_REDOWNLOAD);
}
}
}
}
return FALSE;
}
static INT_PTR CALLBACK DlgPopupOpts(HWND hdlg, UINT msg, WPARAM wParam, LPARAM lParam)
{
switch (msg) {
case WM_INITDIALOG:
TranslateDialogDefault(hdlg);
//Colors
if (PopupOptions.DefColors == byCOLOR_OWN) {
CheckDlgButton(hdlg, IDC_USEOWNCOLORS, BST_CHECKED);
}
else if (PopupOptions.DefColors == byCOLOR_WINDOWS) {
CheckDlgButton(hdlg, IDC_USEWINCOLORS, BST_CHECKED);
}
else if (PopupOptions.DefColors == byCOLOR_POPUP) {
CheckDlgButton(hdlg, IDC_USEPOPUPCOLORS, BST_CHECKED);
}
for (int i = 0; i < POPUPS; i++) {
SendDlgItemMessage(hdlg, (i+42071), CPM_SETCOLOUR, 0, PopupsList[i].colorBack);
SendDlgItemMessage(hdlg, (i+41071), CPM_SETCOLOUR, 0, PopupsList[i].colorText);
EnableWindow(GetDlgItem(hdlg, (i+42071)), (PopupOptions.DefColors == byCOLOR_OWN));
EnableWindow(GetDlgItem(hdlg, (i+41071)), (PopupOptions.DefColors == byCOLOR_OWN));
}
//Timeout
SendDlgItemMessage(hdlg, IDC_TIMEOUT_VALUE, EM_LIMITTEXT, 4, 0);
SendDlgItemMessage(hdlg, IDC_TIMEOUT_VALUE_SPIN, UDM_SETRANGE32, -1, 9999);
SetDlgItemInt(hdlg, IDC_TIMEOUT_VALUE, PopupOptions.Timeout, TRUE);
//Mouse actions
for (int i = 0; i < _countof(PopupActions); i++) {
SendDlgItemMessage(hdlg, IDC_LC, CB_SETITEMDATA, SendDlgItemMessage(hdlg, IDC_LC, CB_ADDSTRING, 0, (LPARAM)TranslateTS(PopupActions[i].Text)), PopupActions[i].Action);
SendDlgItemMessage(hdlg, IDC_RC, CB_SETITEMDATA, SendDlgItemMessage(hdlg, IDC_RC, CB_ADDSTRING, 0, (LPARAM)TranslateTS(PopupActions[i].Text)), PopupActions[i].Action);
}
SendDlgItemMessage(hdlg, IDC_LC, CB_SETCURSEL, PopupOptions.LeftClickAction, 0);
SendDlgItemMessage(hdlg, IDC_RC, CB_SETCURSEL, PopupOptions.RightClickAction, 0);
//Popups notified
for (int i = 0; i < POPUPS; i++) {
char str[20] = {0};
mir_snprintf(str, "Popups%d", i);
CheckDlgButton(hdlg, (i+40071), (db_get_b(NULL, MODNAME, str, DEFAULT_POPUP_ENABLED)) ? BST_CHECKED: BST_UNCHECKED);
}
return TRUE;
case WM_COMMAND:
{
WORD idCtrl = LOWORD(wParam), wNotifyCode = HIWORD(wParam);
if (wNotifyCode == CPN_COLOURCHANGED) {
if (idCtrl > 40070) {
//It's a color picker change. idCtrl is the control id.
COLORREF color = SendDlgItemMessage(hdlg, idCtrl, CPM_GETCOLOUR, 0, 0);
int ctlID = idCtrl;
if ((ctlID > 41070) && (ctlID < 42070)) //It's 41071 or above => Text color.
PopupsList[ctlID-41071].colorText = color;
else if (ctlID > 42070)//Background color.
PopupsList[ctlID-42071].colorBack = color;
SendMessage(GetParent(hdlg), PSM_CHANGED, 0, 0);
return TRUE;
}
if (idCtrl == IDC_LC)
PopupOptions.LeftClickAction = (BYTE)SendDlgItemMessage(hdlg, IDC_LC, CB_GETCURSEL, 0, 0);
else if (idCtrl == IDC_RC)
PopupOptions.RightClickAction = (BYTE)SendDlgItemMessage(hdlg, IDC_RC, CB_GETCURSEL, 0, 0);
SendMessage(GetParent(hdlg), PSM_CHANGED, 0, 0);
return TRUE;
}
switch(idCtrl) {
case IDC_USEOWNCOLORS:
if (wNotifyCode != BN_CLICKED)
break;
PopupOptions.DefColors = byCOLOR_OWN;
for (int i = 0; i < POPUPS; i++) {
EnableWindow(GetDlgItem(hdlg, (i+42071)), TRUE); //Background
EnableWindow(GetDlgItem(hdlg, (i+41071)), TRUE); //Text
}
SendMessage(GetParent(hdlg), PSM_CHANGED, 0, 0);
break;
case IDC_USEWINCOLORS:
if (wNotifyCode != BN_CLICKED)
break;
//Use Windows colors
PopupOptions.DefColors = byCOLOR_WINDOWS;
for (int i = 0; i < POPUPS; i++) {
EnableWindow(GetDlgItem(hdlg, (i+42071)), FALSE); //Background
EnableWindow(GetDlgItem(hdlg, (i+41071)), FALSE); //Text
}
SendMessage(GetParent(hdlg), PSM_CHANGED, 0, 0);
break;
case IDC_USEPOPUPCOLORS:
if (wNotifyCode != BN_CLICKED)
break;
//Use Popup colors
PopupOptions.DefColors = byCOLOR_POPUP;
for (int i = 0; i < POPUPS; i++) {
EnableWindow(GetDlgItem(hdlg, (i+42071)), FALSE); //Background
EnableWindow(GetDlgItem(hdlg, (i+41071)), FALSE); //Text
}
SendMessage(GetParent(hdlg), PSM_CHANGED, 0, 0);
break;
case IDC_PREVIEW:
{//Declarations and initializations
LPCTSTR Title = TranslateT("Plugin Updater");
LPCTSTR Text = TranslateT("Test");
for (int i = 0; i < POPUPS; i++) {
if (IsDlgButtonChecked(hdlg, i+40071))
ShowPopup(Title, Text, i);
}
}
break;
case IDC_TIMEOUT_VALUE:
case IDC_MSG_BOXES:
case IDC_ERRORS:
EnableWindow(GetDlgItem(hdlg, IDC_ERRORS_MSG), BST_UNCHECKED == IsDlgButtonChecked(hdlg, IDC_ERRORS));
if ((HIWORD(wParam) == BN_CLICKED || HIWORD(wParam) == EN_CHANGE) && (HWND)lParam == GetFocus())
SendMessage(GetParent(hdlg), PSM_CHANGED, 0, 0);
break;
case IDC_INFO_MESSAGES:
EnableWindow(GetDlgItem(hdlg, IDC_INFO_MESSAGES_MSG), BST_UNCHECKED == IsDlgButtonChecked(hdlg, IDC_INFO_MESSAGES));
if ((HIWORD(wParam) == BN_CLICKED || HIWORD(wParam) == EN_CHANGE) && (HWND)lParam == GetFocus())
SendMessage(GetParent(hdlg), PSM_CHANGED, 0, 0);
break;
case IDC_PROGR_DLG:
EnableWindow(GetDlgItem(hdlg, IDC_PROGR_DLG_MSG), BST_UNCHECKED == IsDlgButtonChecked(hdlg, IDC_PROGR_DLG));
if ((HIWORD(wParam) == BN_CLICKED || HIWORD(wParam) == EN_CHANGE) && (HWND)lParam == GetFocus())
SendMessage(GetParent(hdlg), PSM_CHANGED, 0, 0);
break;
case IDC_MSG_BOXES_MSG:
case IDC_ERRORS_MSG:
case IDC_INFO_MESSAGES_MSG:
case IDC_PROGR_DLG_MSG:
if ((HIWORD(wParam) == BN_CLICKED || HIWORD(wParam) == EN_CHANGE) && (HWND)lParam == GetFocus())
SendMessage(GetParent(hdlg), PSM_CHANGED, 0, 0);
break;
}
}
break;
case WM_NOTIFY:
switch (((LPNMHDR)lParam)->code) {
case PSN_RESET:
//Restore the options stored in memory.
LoadOptions();
InitPopupList();
return TRUE;
case PSN_APPLY:
{
//Text color
char szSetting[20] = {0};
DWORD ctlColor = 0;
for (int i = 0; i < POPUPS; i++) {
ctlColor = SendDlgItemMessage(hdlg, (i+42071), CPM_GETCOLOUR, 0, 0);
PopupsList[i].colorBack = ctlColor;
mir_snprintf(szSetting, "Popups%iBg", i);
db_set_dw(NULL, MODNAME, szSetting, ctlColor);
ctlColor = SendDlgItemMessage(hdlg, (i+41071), CPM_GETCOLOUR, 0, 0);
PopupsList[i].colorText = ctlColor;
mir_snprintf(szSetting, "Popups%iTx", i);
db_set_dw(NULL, MODNAME, szSetting, ctlColor);
}
//Colors
db_set_b(NULL, MODNAME, "DefColors", PopupOptions.DefColors);
//Timeout
PopupOptions.Timeout = GetDlgItemInt(hdlg, IDC_TIMEOUT_VALUE, 0, TRUE);
db_set_dw(NULL, MODNAME, "Timeout", PopupOptions.Timeout);
//Left mouse click
db_set_b(NULL, MODNAME, "LeftClickAction", PopupOptions.LeftClickAction);
//Right mouse click
db_set_b(NULL, MODNAME, "RightClickAction", PopupOptions.RightClickAction);
//Notified popups
for (int i = 0; i < POPUPS; i++) {
char str[20] = {0};
mir_snprintf(str, "Popups%d", i);
db_set_b(NULL, MODNAME, str, (BYTE)(IsDlgButtonChecked(hdlg, (i+40071))));
}
return TRUE;
} //case PSN_APPLY
} // switch code
break; //End WM_NOTIFY
} //switch message
return FALSE;
}
static int OptInit(WPARAM wParam, LPARAM)
{
OPTIONSDIALOGPAGE odp = { 0 };
odp.position = 100000000;
odp.hInstance = hInst;
odp.flags = ODPF_BOLDGROUPS | ODPF_TCHAR;
odp.pszTemplate = MAKEINTRESOURCEA(IDD_OPT_UPDATENOTIFY);
odp.ptszGroup = LPGENT("Services");
odp.ptszTitle = LPGENT("Plugin Updater");
odp.pfnDlgProc = UpdateNotifyOptsProc;
Options_AddPage(wParam, &odp);
if ( ServiceExists(MS_POPUP_ADDPOPUPT)) {
odp.pszTemplate = MAKEINTRESOURCEA(IDD_POPUP);
odp.ptszGroup = LPGENT("Popups");
odp.ptszTitle = LPGENT("Plugin Updater");
odp.pfnDlgProc = DlgPopupOpts;
Options_AddPage(wParam, &odp);
}
return 0;
}
void InitOptions()
{
HookEvent(ME_OPT_INITIALISE, OptInit);
}
|