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
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
|
/////////////////////////////////////////////////////////////////////////////////////////
// Miranda NG: the free IM client for Microsoft* Windows*
//
// Copyright (c) 2012-18 Miranda NG team,
// Copyright (c) 2000-09 Miranda ICQ/IM project,
// all portions of this codebase are copyrighted to the people
// listed in contributors.txt.
//
// 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.
//
// part of tabSRMM messaging plugin for Miranda.
//
// (C) 2005-2010 by silvercircle _at_ gmail _dot_ com and contributors
//
// The dialog to customize per container options
#include "stdafx.h"
static void MY_CheckDlgButton(HWND hWnd, UINT id, int iCheck)
{
CheckDlgButton(hWnd, id, iCheck ? BST_CHECKED : BST_UNCHECKED);
}
static void ReloadGlobalContainerSettings(bool fForceReconfig)
{
for (TContainerData *p = pFirstContainer; p; p = p->pNext) {
if (!p->settings->fPrivate) {
Utils::SettingsToContainer(p);
if (fForceReconfig)
SendMessage(p->m_hwnd, DM_CONFIGURECONTAINER, 0, 0);
else
SendMessage(p->m_hwnd, WM_SIZE, 0, 1);
BroadCastContainer(p, DM_SETINFOPANEL, 0, 0);
}
}
}
/**
* Apply a container setting
*
* @param pContainer ContainerWindowData *: the container
* @param flags DWORD: the flag values to set or clear
* @param mode int: bit #0 set/clear, any bit from 16-31 indicates that dwFlagsEx should be affected
* @param fForceResize
*/
void TSAPI ApplyContainerSetting(TContainerData *pContainer, DWORD flags, UINT mode, bool fForceResize)
{
bool isEx = (mode & 0xffff0000) ? true : false;
bool set = (mode & 0x01) ? true : false;
if (!pContainer->settings->fPrivate) {
if (!isEx)
pContainer->dwFlags = (set ? pContainer->dwFlags | flags : pContainer->dwFlags & ~flags);
else
pContainer->dwFlagsEx = (set ? pContainer->dwFlagsEx | flags : pContainer->dwFlagsEx & ~flags);
Utils::ContainerToSettings(pContainer);
if (flags & CNT_INFOPANEL)
BroadCastContainer(pContainer, DM_SETINFOPANEL, 0, 0);
if (flags & CNT_SIDEBAR) {
for (TContainerData *p = pFirstContainer; p; p = p->pNext)
if (!p->settings->fPrivate)
SendMessage(p->m_hwnd, WM_COMMAND, IDC_TOGGLESIDEBAR, 0);
}
else ReloadGlobalContainerSettings(fForceResize);
}
else {
if (!isEx)
pContainer->dwFlags = (set ? pContainer->dwFlags | flags : pContainer->dwFlags & ~flags);
else
pContainer->dwFlagsEx = (set ? pContainer->dwFlagsEx | flags : pContainer->dwFlagsEx & ~flags);
Utils::ContainerToSettings(pContainer);
if (flags & CNT_SIDEBAR)
SendMessage(pContainer->m_hwnd, WM_COMMAND, IDC_TOGGLESIDEBAR, 0);
else
SendMessage(pContainer->m_hwnd, DM_CONFIGURECONTAINER, 0, 0);
if (flags & CNT_INFOPANEL)
BroadCastContainer(pContainer, DM_SETINFOPANEL, 0, 0);
}
if (fForceResize)
SendMessage(pContainer->m_hwnd, WM_SIZE, 0, 1);
BroadCastContainer(pContainer, WM_CBD_UPDATED, 0, 0);
}
struct
{
const wchar_t *szTitle, *szDesc;
UINT uIds[10];
}
static o_pages[] =
{
{ LPGENW("General options"), nullptr, IDC_O_NOTABS, IDC_O_STICKY, IDC_VERTICALMAX, IDC_AUTOSPLITTER, IDC_O_AUTOHIDE, IDC_AUTOCLOSETABTIME, IDC_AUTOCLOSETABSPIN, IDC_O_AUTOHIDESECONDS, 0, 0 },
{ LPGENW("Window layout"), nullptr, IDC_CNTNOSTATUSBAR, IDC_HIDEMENUBAR, IDC_UIDSTATUSBAR, IDC_HIDETOOLBAR, IDC_INFOPANEL, IDC_BOTTOMTOOLBAR, 0, 0, 0, 0 },
{ LPGENW("Tabs and switch bar"), LPGENW("Choose your options for the tabbed user interface. Not all options can be applied to open windows. You may need to close and re-open them."), IDC_TABMODE, IDC_O_TABMODE, IDC_O_SBARLAYOUT, IDC_SBARLAYOUT, IDC_FLASHICON, IDC_FLASHLABEL, IDC_SINGLEROWTAB, IDC_BUTTONTABS, IDC_CLOSEBUTTONONTABS, 0 },
{ LPGENW("Notifications"), LPGENW("Select, when you want to see event notifications (popups) for this window. The settings apply to all tabs within this window."), IDC_O_DONTREPORT, IDC_DONTREPORTUNFOCUSED2, IDC_DONTREPORTFOCUSED2, IDC_ALWAYSPOPUPSINACTIVE, IDC_O_EXPLAINGLOBALNOTIFY, 0, 0, 0, 0, 0 },
{ LPGENW("Flashing"), nullptr, IDC_O_FLASHDEFAULT, IDC_O_FLASHALWAYS, IDC_O_FLASHNEVER, 0, 0, 0, 0, 0, 0, 0 },
{ LPGENW("Title bar"), nullptr, IDC_O_HIDETITLE, IDC_TITLEFORMAT, IDC_O_TITLEBARFORMAT, IDC_O_HELP_TITLEFORMAT, 0, 0, 0, 0, 0, 0 },
{ LPGENW("Window size and theme"), LPGENW("You can select a private theme (.tabsrmm file) for this container which will then override the default message log theme. You will have to close and re-open all message windows after changing this option."), IDC_THEME, IDC_SELECTTHEME, IDC_USEGLOBALSIZE, IDC_SAVESIZEASGLOBAL, IDC_LABEL_PRIVATETHEME, IDC_TSLABEL_EXPLAINTHEME, 0, 0, 0, 0 },
{ LPGENW("Transparency"), LPGENW("This feature may be unavailable when using a container skin."), IDC_TRANSPARENCY, IDC_TRANSPARENCY_ACTIVE, IDC_TRANSPARENCY_INACTIVE, IDC_TSLABEL_ACTIVE, IDC_TSLABEL_INACTIVE, 0, 0, 0, 0, 0 },
{ LPGENW("Contact avatars"), nullptr, IDC_O_STATIC_AVATAR, IDC_O_STATIC_OWNAVATAR, IDC_AVATARMODE, IDC_OWNAVATARMODE, IDC_AVATARSONTASKBAR, 0, 0, 0, 0, 0 },
{ LPGENW("Sound notifications"), nullptr, IDC_O_ENABLESOUNDS, IDC_O_SOUNDSMINIMIZED, IDC_O_SOUNDSUNFOCUSED, IDC_O_SOUNDSINACTIVE, IDC_O_SOUNDSFOCUSED, 0, 0, 0, 0, 0 },
};
static void ShowPage(HWND hwndDlg, int iPage, BOOL fShow)
{
if (iPage < 0 || iPage >= _countof(o_pages))
return;
for (int i = 0; i < _countof(o_pages[0].uIds) && o_pages[iPage].uIds[i] != 0; i++)
Utils::showDlgControl(hwndDlg, o_pages[iPage].uIds[i], fShow ? SW_SHOW : SW_HIDE);
if (fShow) {
SetDlgItemText(hwndDlg, IDC_TITLEBOX, TranslateW(o_pages[iPage].szTitle));
if (o_pages[iPage].szDesc != nullptr)
SetDlgItemText(hwndDlg, IDC_DESC, TranslateW(o_pages[iPage].szDesc));
else
SetDlgItemText(hwndDlg, IDC_DESC, L"");
}
Utils::showDlgControl(hwndDlg, IDC_O_EXPLAINGLOBALNOTIFY, (iPage == 3 && nen_options.bWindowCheck) ? SW_SHOW : SW_HIDE);
if (iPage == 8 && !IsWinVer7Plus())
Utils::showDlgControl(hwndDlg, IDC_AVATARSONTASKBAR, SW_HIDE);
}
INT_PTR CALLBACK DlgProcContainerOptions(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lParam)
{
HWND hwndTree = GetDlgItem(hwndDlg, IDC_SECTIONTREE);
TContainerData *pContainer = (TContainerData*)GetWindowLongPtr(hwndDlg, GWLP_USERDATA);
switch (msg) {
case WM_INITDIALOG:
TranslateDialogDefault(hwndDlg);
{
TVINSERTSTRUCT tvis = {};
int nr_layouts = 0;
const TSideBarLayout *sblayouts = CSideBar::getLayouts(nr_layouts);
SetWindowLongPtr(hwndDlg, GWLP_USERDATA, (LONG_PTR)lParam);
pContainer = (TContainerData*)lParam;
pContainer->hWndOptions = hwndDlg;
SetWindowText(hwndDlg, TranslateT("Container options"));
wchar_t szNewTitle[128];
mir_snwprintf(szNewTitle, L"%s", !mir_wstrcmp(pContainer->m_wszName, L"default") ? TranslateT("Default container") : pContainer->m_wszName);
SetDlgItemText(hwndDlg, IDC_HEADERBAR, szNewTitle);
Utils::enableDlgControl(hwndDlg, IDC_O_HIDETITLE, !CSkin::m_frameSkins);
CheckDlgButton(hwndDlg, IDC_CNTPRIVATE, pContainer->settings->fPrivate ? BST_CHECKED : BST_UNCHECKED);
SendDlgItemMessage(hwndDlg, IDC_TABMODE, CB_INSERTSTRING, -1, (LPARAM)TranslateT("Tabs at the top"));
SendDlgItemMessage(hwndDlg, IDC_TABMODE, CB_INSERTSTRING, -1, (LPARAM)TranslateT("Tabs at the bottom"));
SendDlgItemMessage(hwndDlg, IDC_TABMODE, CB_INSERTSTRING, -1, (LPARAM)TranslateT("Switch bar on the left side"));
SendDlgItemMessage(hwndDlg, IDC_TABMODE, CB_INSERTSTRING, -1, (LPARAM)TranslateT("Switch bar on the right side"));
SendDlgItemMessage(hwndDlg, IDC_AVATARMODE, CB_INSERTSTRING, -1, (LPARAM)TranslateT("Globally on"));
SendDlgItemMessage(hwndDlg, IDC_AVATARMODE, CB_INSERTSTRING, -1, (LPARAM)TranslateT("On, if present"));
SendDlgItemMessage(hwndDlg, IDC_AVATARMODE, CB_INSERTSTRING, -1, (LPARAM)TranslateT("Globally OFF"));
SendDlgItemMessage(hwndDlg, IDC_AVATARMODE, CB_INSERTSTRING, -1, (LPARAM)TranslateT("On, if present, always in bottom display"));
SendDlgItemMessage(hwndDlg, IDC_OWNAVATARMODE, CB_INSERTSTRING, -1, (LPARAM)TranslateT("On, if present"));
SendDlgItemMessage(hwndDlg, IDC_OWNAVATARMODE, CB_INSERTSTRING, -1, (LPARAM)TranslateT("Don't show them"));
for (int i = 0; i < nr_layouts; i++)
SendDlgItemMessage(hwndDlg, IDC_SBARLAYOUT, CB_INSERTSTRING, -1, (LPARAM)TranslateW(sblayouts[i].szName));
/* bits 24 - 31 of dwFlagsEx hold the side bar layout id */
SendDlgItemMessage(hwndDlg, IDC_SBARLAYOUT, CB_SETCURSEL, (WPARAM)((pContainer->settings->dwFlagsEx & 0xff000000) >> 24), 0);
SendMessage(hwndDlg, DM_SC_INITDIALOG, 0, (LPARAM)pContainer->settings);
SendDlgItemMessage(hwndDlg, IDC_TITLEFORMAT, EM_LIMITTEXT, TITLE_FORMATLEN - 1, 0);
SetDlgItemText(hwndDlg, IDC_TITLEFORMAT, pContainer->settings->szTitleFormat);
SetDlgItemText(hwndDlg, IDC_THEME, pContainer->szRelThemeFile);
for (int i = 0; i < _countof(o_pages); i++) {
tvis.hParent = nullptr;
tvis.hInsertAfter = TVI_LAST;
tvis.item.mask = TVIF_TEXT | TVIF_PARAM;
tvis.item.pszText = TranslateW(o_pages[i].szTitle);
tvis.item.lParam = i;
HTREEITEM hItem = TreeView_InsertItem(hwndTree, &tvis);
if (i == 0)
SendMessage(hwndTree, TVM_SELECTITEM, TVGN_CARET, (LPARAM)hItem);
ShowPage(hwndDlg, i, FALSE);
}
Window_SetSkinIcon_IcoLib(hwndDlg, SKINICON_EVENT_MESSAGE);
ShowPage(hwndDlg, 0, TRUE);
SetFocus(hwndTree);
Utils::enableDlgControl(hwndDlg, IDC_APPLY, false);
HFONT hFont = (HFONT)SendDlgItemMessage(hwndDlg, IDC_DESC, WM_GETFONT, 0, 0);
LOGFONT lf = { 0 };
GetObject(hFont, sizeof(lf), &lf);
lf.lfHeight = (int)(lf.lfHeight * 1.2);
hFont = CreateFontIndirect(&lf);
SendDlgItemMessage(hwndDlg, IDC_TITLEBOX, WM_SETFONT, (WPARAM)hFont, TRUE);
if (pContainer->isCloned && pContainer->hContactFrom != 0) {
Utils::showDlgControl(hwndDlg, IDC_CNTPRIVATE, SW_HIDE);
Utils::showDlgControl(hwndDlg, IDC_O_CNTPRIVATE, SW_HIDE);
}
}
return FALSE;
case WM_NOTIFY:
if (wParam == IDC_SECTIONTREE && ((LPNMHDR)lParam)->code == TVN_SELCHANGED) {
NMTREEVIEW *pmtv = (NMTREEVIEW *)lParam;
ShowPage(hwndDlg, pmtv->itemOld.lParam, 0);
ShowPage(hwndDlg, pmtv->itemNew.lParam, 1);
}
break;
case WM_HSCROLL:
if ((HWND)lParam == GetDlgItem(hwndDlg, IDC_TRANSPARENCY_ACTIVE) || (HWND)lParam == GetDlgItem(hwndDlg, IDC_TRANSPARENCY_INACTIVE))
Utils::enableDlgControl(hwndDlg, IDC_APPLY, true);
break;
case WM_COMMAND:
switch (LOWORD(wParam)) {
case IDC_CNTPRIVATE:
if (IsDlgButtonChecked(hwndDlg, IDC_CNTPRIVATE)) {
Utils::ReadPrivateContainerSettings(pContainer, true);
pContainer->settings->fPrivate = true;
}
else {
if (pContainer->settings != &PluginConfig.globalContainerSettings) {
char szCname[40];
mir_snprintf(szCname, "%s%d", CNT_BASEKEYNAME, pContainer->iContainerIndex);
Utils::WriteContainerSettingsToDB(0, pContainer->settings, szCname);
mir_free(pContainer->settings);
}
pContainer->settings = &PluginConfig.globalContainerSettings;
pContainer->settings->fPrivate = false;
}
SendMessage(hwndDlg, DM_SC_INITDIALOG, 0, (LPARAM)pContainer->settings);
goto do_apply;
case IDC_TRANSPARENCY:
{
bool isTrans = IsDlgButtonChecked(hwndDlg, IDC_TRANSPARENCY) != 0;
Utils::enableDlgControl(hwndDlg, IDC_TRANSPARENCY_ACTIVE, isTrans);
Utils::enableDlgControl(hwndDlg, IDC_TRANSPARENCY_INACTIVE, isTrans);
}
goto do_apply;
case IDC_SECTIONTREE:
case IDC_DESC:
return 0;
case IDC_SAVESIZEASGLOBAL:
{
WINDOWPLACEMENT wp = { 0 };
wp.length = sizeof(wp);
if (GetWindowPlacement(pContainer->m_hwnd, &wp)) {
db_set_dw(0, SRMSGMOD_T, "splitx", wp.rcNormalPosition.left);
db_set_dw(0, SRMSGMOD_T, "splity", wp.rcNormalPosition.top);
db_set_dw(0, SRMSGMOD_T, "splitwidth", wp.rcNormalPosition.right - wp.rcNormalPosition.left);
db_set_dw(0, SRMSGMOD_T, "splitheight", wp.rcNormalPosition.bottom - wp.rcNormalPosition.top);
}
break;
}
case IDC_O_ENABLESOUNDS:
SendMessage(hwndDlg, DM_SC_CONFIG, 0, 0);
break;
case IDC_TITLEFORMAT:
if (HIWORD(wParam) != EN_CHANGE || (HWND)lParam != GetFocus())
return TRUE;
goto do_apply;
case IDC_SELECTTHEME:
{
const wchar_t *szFileName = GetThemeFileName(0);
if (PathFileExists(szFileName)) {
SetDlgItemText(hwndDlg, IDC_THEME, szFileName);
goto do_apply;
}
break;
}
case IDC_O_HELP_TITLEFORMAT:
Utils_OpenUrl("https://wiki.miranda-ng.org/index.php?title=Plugin:TabSRMM/en/Title_bar_formatting");
break;
case IDOK:
case IDC_APPLY:
SendMessage(hwndDlg, DM_SC_BUILDLIST, 0, (LPARAM)pContainer->settings);
pContainer->settings->dwTransparency = MAKELONG((WORD)SendDlgItemMessage(hwndDlg, IDC_TRANSPARENCY_ACTIVE, TBM_GETPOS, 0, 0),
(WORD)SendDlgItemMessage(hwndDlg, IDC_TRANSPARENCY_INACTIVE, TBM_GETPOS, 0, 0));
pContainer->settings->avatarMode = (WORD)SendDlgItemMessage(hwndDlg, IDC_AVATARMODE, CB_GETCURSEL, 0, 0);
pContainer->settings->ownAvatarMode = (WORD)SendDlgItemMessage(hwndDlg, IDC_OWNAVATARMODE, CB_GETCURSEL, 0, 0);
GetDlgItemText(hwndDlg, IDC_TITLEFORMAT, pContainer->settings->szTitleFormat, TITLE_FORMATLEN);
pContainer->settings->szTitleFormat[TITLE_FORMATLEN - 1] = 0;
pContainer->szRelThemeFile[0] = pContainer->szAbsThemeFile[0] = 0;
if (GetWindowTextLength(GetDlgItem(hwndDlg, IDC_THEME)) > 0) {
wchar_t szFinalThemeFile[MAX_PATH], szFilename[MAX_PATH];
GetDlgItemText(hwndDlg, IDC_THEME, szFilename, _countof(szFilename));
szFilename[MAX_PATH - 1] = 0;
PathToAbsoluteW(szFilename, szFinalThemeFile, M.getDataPath());
if (mir_wstrcmp(szFilename, pContainer->szRelThemeFile))
pContainer->fPrivateThemeChanged = TRUE;
if (PathFileExists(szFinalThemeFile))
wcsncpy_s(pContainer->szRelThemeFile, szFilename, _TRUNCATE);
else
pContainer->szRelThemeFile[0] = 0;
}
else {
pContainer->szRelThemeFile[0] = 0;
pContainer->fPrivateThemeChanged = TRUE;
}
Utils::SettingsToContainer(pContainer);
if (BST_UNCHECKED == IsDlgButtonChecked(hwndDlg, IDC_CNTPRIVATE)) {
ReloadGlobalContainerSettings(true);
Utils::WriteContainerSettingsToDB(0, &PluginConfig.globalContainerSettings, nullptr);
}
else {
char *szSetting = "CNTW_";
Utils::SaveContainerSettings(pContainer, szSetting);
}
SendMessage(pContainer->m_hwnd, DM_CONFIGURECONTAINER, 0, 0);
BroadCastContainer(pContainer, DM_SETINFOPANEL, 0, 0);
ShowWindow(pContainer->m_hwnd, SW_HIDE);
{
RECT rc;
GetWindowRect(pContainer->m_hwnd, &rc);
SetWindowPos(pContainer->m_hwnd, nullptr, rc.left, rc.top, (rc.right - rc.left) - 1, (rc.bottom - rc.top) - 1, SWP_NOZORDER | SWP_DRAWFRAME | SWP_FRAMECHANGED);
SetWindowPos(pContainer->m_hwnd, nullptr, rc.left, rc.top, (rc.right - rc.left), (rc.bottom - rc.top), SWP_NOZORDER | SWP_DRAWFRAME | SWP_SHOWWINDOW);
}
if (LOWORD(wParam) == IDOK)
DestroyWindow(hwndDlg);
else
Utils::enableDlgControl(hwndDlg, IDC_APPLY, false);
break;
case IDCANCEL:
DestroyWindow(hwndDlg);
return TRUE;
default:
do_apply: Utils::enableDlgControl(hwndDlg, IDC_APPLY, true);
break;
}
break;
case DM_SC_INITDIALOG:
{
TContainerSettings* cs = (TContainerSettings *)lParam;
DWORD dwFlags = cs->dwFlags;
DWORD dwTransparency = cs->dwTransparency;
DWORD dwFlagsEx = cs->dwFlagsEx;
BOOL fAllowTrans = FALSE;
if (PluginConfig.m_WinVerMajor >= 6)
fAllowTrans = TRUE;
else
fAllowTrans = (!CSkin::m_skinEnabled);
MY_CheckDlgButton(hwndDlg, IDC_O_HIDETITLE, dwFlags & CNT_NOTITLE);
MY_CheckDlgButton(hwndDlg, IDC_O_DONTREPORT, dwFlags & CNT_DONTREPORT);
MY_CheckDlgButton(hwndDlg, IDC_O_NOTABS, dwFlags & CNT_HIDETABS);
MY_CheckDlgButton(hwndDlg, IDC_O_STICKY, dwFlags & CNT_STICKY);
MY_CheckDlgButton(hwndDlg, IDC_O_FLASHNEVER, dwFlags & CNT_NOFLASH);
MY_CheckDlgButton(hwndDlg, IDC_O_FLASHALWAYS, dwFlags & CNT_FLASHALWAYS);
MY_CheckDlgButton(hwndDlg, IDC_O_FLASHDEFAULT, !((dwFlags & CNT_NOFLASH) || (dwFlags & CNT_FLASHALWAYS)));
MY_CheckDlgButton(hwndDlg, IDC_TRANSPARENCY, dwFlags & CNT_TRANSPARENCY);
MY_CheckDlgButton(hwndDlg, IDC_DONTREPORTUNFOCUSED2, dwFlags & CNT_DONTREPORTUNFOCUSED);
MY_CheckDlgButton(hwndDlg, IDC_DONTREPORTFOCUSED2, dwFlags & CNT_DONTREPORTFOCUSED);
MY_CheckDlgButton(hwndDlg, IDC_ALWAYSPOPUPSINACTIVE, dwFlags & CNT_ALWAYSREPORTINACTIVE);
MY_CheckDlgButton(hwndDlg, IDC_CNTNOSTATUSBAR, dwFlags & CNT_NOSTATUSBAR);
MY_CheckDlgButton(hwndDlg, IDC_HIDEMENUBAR, dwFlags & CNT_NOMENUBAR);
MY_CheckDlgButton(hwndDlg, IDC_HIDETOOLBAR, dwFlags & CNT_HIDETOOLBAR);
MY_CheckDlgButton(hwndDlg, IDC_BOTTOMTOOLBAR, dwFlags & CNT_BOTTOMTOOLBAR);
MY_CheckDlgButton(hwndDlg, IDC_UIDSTATUSBAR, dwFlags & CNT_UINSTATUSBAR);
MY_CheckDlgButton(hwndDlg, IDC_VERTICALMAX, dwFlags & CNT_VERTICALMAX);
MY_CheckDlgButton(hwndDlg, IDC_AUTOSPLITTER, dwFlags & CNT_AUTOSPLITTER);
MY_CheckDlgButton(hwndDlg, IDC_AVATARSONTASKBAR, dwFlags & CNT_AVATARSONTASKBAR);
MY_CheckDlgButton(hwndDlg, IDC_INFOPANEL, dwFlags & CNT_INFOPANEL);
MY_CheckDlgButton(hwndDlg, IDC_USEGLOBALSIZE, dwFlags & CNT_GLOBALSIZE);
MY_CheckDlgButton(hwndDlg, IDC_FLASHICON, dwFlagsEx & TCF_FLASHICON);
MY_CheckDlgButton(hwndDlg, IDC_FLASHLABEL, dwFlagsEx & TCF_FLASHLABEL);
MY_CheckDlgButton(hwndDlg, IDC_CLOSEBUTTONONTABS, dwFlagsEx & TCF_CLOSEBUTTON);
MY_CheckDlgButton(hwndDlg, IDC_SINGLEROWTAB, dwFlagsEx & TCF_SINGLEROWTABCONTROL);
MY_CheckDlgButton(hwndDlg, IDC_BUTTONTABS, dwFlagsEx & TCF_FLAT);
MY_CheckDlgButton(hwndDlg, IDC_O_ENABLESOUNDS, !(dwFlags & CNT_NOSOUND));
MY_CheckDlgButton(hwndDlg, IDC_O_SOUNDSMINIMIZED, dwFlagsEx & CNT_EX_SOUNDS_MINIMIZED);
MY_CheckDlgButton(hwndDlg, IDC_O_SOUNDSUNFOCUSED, dwFlagsEx & CNT_EX_SOUNDS_UNFOCUSED);
MY_CheckDlgButton(hwndDlg, IDC_O_SOUNDSINACTIVE, dwFlagsEx & CNT_EX_SOUNDS_INACTIVETABS);
MY_CheckDlgButton(hwndDlg, IDC_O_SOUNDSFOCUSED, dwFlagsEx & CNT_EX_SOUNDS_FOCUSED);
SendMessage(hwndDlg, DM_SC_CONFIG, 0, 0);
if (!(dwFlagsEx & (TCF_SBARLEFT | TCF_SBARRIGHT)))
SendDlgItemMessage(hwndDlg, IDC_TABMODE, CB_SETCURSEL, dwFlags & CNT_TABSBOTTOM ? 1 : 0, 0);
else
SendDlgItemMessage(hwndDlg, IDC_TABMODE, CB_SETCURSEL, dwFlagsEx & TCF_SBARLEFT ? 2 : 3, 0);
if (LOBYTE(LOWORD(GetVersion())) >= 5 && fAllowTrans)
CheckDlgButton(hwndDlg, IDC_TRANSPARENCY, dwFlags & CNT_TRANSPARENCY ? BST_CHECKED : BST_UNCHECKED);
else
CheckDlgButton(hwndDlg, IDC_TRANSPARENCY, BST_UNCHECKED);
Utils::enableDlgControl(hwndDlg, IDC_TRANSPARENCY, PluginConfig.m_WinVerMajor >= 5 && fAllowTrans);
bool isTrans = IsDlgButtonChecked(hwndDlg, IDC_TRANSPARENCY) != 0;
Utils::enableDlgControl(hwndDlg, IDC_TRANSPARENCY_ACTIVE, isTrans);
Utils::enableDlgControl(hwndDlg, IDC_TRANSPARENCY_INACTIVE, isTrans);
SendDlgItemMessage(hwndDlg, IDC_TRANSPARENCY_ACTIVE, TBM_SETRANGE, 0, (LPARAM)MAKELONG(50, 255));
SendDlgItemMessage(hwndDlg, IDC_TRANSPARENCY_INACTIVE, TBM_SETRANGE, 0, (LPARAM)MAKELONG(50, 255));
SendDlgItemMessage(hwndDlg, IDC_TRANSPARENCY_ACTIVE, TBM_SETPOS, TRUE, (LPARAM)LOWORD(dwTransparency));
SendDlgItemMessage(hwndDlg, IDC_TRANSPARENCY_INACTIVE, TBM_SETPOS, TRUE, (LPARAM)HIWORD(dwTransparency));
Utils::enableDlgControl(hwndDlg, IDC_O_DONTREPORT, !nen_options.bWindowCheck);
Utils::enableDlgControl(hwndDlg, IDC_DONTREPORTUNFOCUSED2, !nen_options.bWindowCheck);
Utils::enableDlgControl(hwndDlg, IDC_DONTREPORTFOCUSED2, !nen_options.bWindowCheck);
Utils::enableDlgControl(hwndDlg, IDC_ALWAYSPOPUPSINACTIVE, !nen_options.bWindowCheck);
SendDlgItemMessage(hwndDlg, IDC_AVATARMODE, CB_SETCURSEL, (WPARAM)cs->avatarMode, 0);
SendDlgItemMessage(hwndDlg, IDC_OWNAVATARMODE, CB_SETCURSEL, (WPARAM)cs->ownAvatarMode, 0);
Utils::showDlgControl(hwndDlg, IDC_O_EXPLAINGLOBALNOTIFY, nen_options.bWindowCheck ? SW_SHOW : SW_HIDE);
SendDlgItemMessage(hwndDlg, IDC_AUTOCLOSETABSPIN, UDM_SETRANGE, 0, MAKELONG(1000, 0));
SendDlgItemMessage(hwndDlg, IDC_AUTOCLOSETABSPIN, UDM_SETPOS, 0, (LPARAM)cs->autoCloseSeconds);
}
break;
case DM_SC_CONFIG:
{
bool bEnable = IsDlgButtonChecked(hwndDlg, IDC_O_ENABLESOUNDS) != 0;
Utils::enableDlgControl(hwndDlg, IDC_O_SOUNDSINACTIVE, bEnable);
Utils::enableDlgControl(hwndDlg, IDC_O_SOUNDSUNFOCUSED, bEnable);
Utils::enableDlgControl(hwndDlg, IDC_O_SOUNDSMINIMIZED, bEnable);
Utils::enableDlgControl(hwndDlg, IDC_O_SOUNDSFOCUSED, bEnable);
}
return 0;
case DM_SC_BUILDLIST:
{
DWORD dwNewFlags = 0, dwNewFlagsEx = 0;
TContainerSettings* cs = (TContainerSettings *)lParam;
dwNewFlags = (IsDlgButtonChecked(hwndDlg, IDC_O_HIDETITLE) ? CNT_NOTITLE : 0) |
(IsDlgButtonChecked(hwndDlg, IDC_O_DONTREPORT) ? CNT_DONTREPORT : 0) |
(IsDlgButtonChecked(hwndDlg, IDC_O_NOTABS) ? CNT_HIDETABS : 0) |
(IsDlgButtonChecked(hwndDlg, IDC_O_STICKY) ? CNT_STICKY : 0) |
(IsDlgButtonChecked(hwndDlg, IDC_O_FLASHALWAYS) ? CNT_FLASHALWAYS : 0) |
(IsDlgButtonChecked(hwndDlg, IDC_O_FLASHNEVER) ? CNT_NOFLASH : 0) |
(IsDlgButtonChecked(hwndDlg, IDC_TRANSPARENCY) ? CNT_TRANSPARENCY : 0) |
(IsDlgButtonChecked(hwndDlg, IDC_DONTREPORTUNFOCUSED2) ? CNT_DONTREPORTUNFOCUSED : 0) |
(IsDlgButtonChecked(hwndDlg, IDC_DONTREPORTFOCUSED2) ? CNT_DONTREPORTFOCUSED : 0) |
(IsDlgButtonChecked(hwndDlg, IDC_ALWAYSPOPUPSINACTIVE) ? CNT_ALWAYSREPORTINACTIVE : 0) |
(IsDlgButtonChecked(hwndDlg, IDC_CNTNOSTATUSBAR) ? CNT_NOSTATUSBAR : 0) |
(IsDlgButtonChecked(hwndDlg, IDC_HIDEMENUBAR) ? CNT_NOMENUBAR : 0) |
(IsDlgButtonChecked(hwndDlg, IDC_HIDETOOLBAR) ? CNT_HIDETOOLBAR : 0) |
(IsDlgButtonChecked(hwndDlg, IDC_BOTTOMTOOLBAR) ? CNT_BOTTOMTOOLBAR : 0) |
(IsDlgButtonChecked(hwndDlg, IDC_UIDSTATUSBAR) ? CNT_UINSTATUSBAR : 0) |
(IsDlgButtonChecked(hwndDlg, IDC_USEGLOBALSIZE) ? CNT_GLOBALSIZE : 0) |
(IsDlgButtonChecked(hwndDlg, IDC_INFOPANEL) ? CNT_INFOPANEL : 0) |
(IsDlgButtonChecked(hwndDlg, IDC_O_ENABLESOUNDS) ? 0 : CNT_NOSOUND) |
(IsDlgButtonChecked(hwndDlg, IDC_AVATARSONTASKBAR) ? CNT_AVATARSONTASKBAR : 0) |
(IsDlgButtonChecked(hwndDlg, IDC_VERTICALMAX) ? CNT_VERTICALMAX : 0) |
(IsDlgButtonChecked(hwndDlg, IDC_AUTOSPLITTER) ? CNT_AUTOSPLITTER : 0) |
(CNT_NEWCONTAINERFLAGS);
LRESULT iTabMode = SendDlgItemMessage(hwndDlg, IDC_TABMODE, CB_GETCURSEL, 0, 0);
LRESULT iTabLayout = SendDlgItemMessage(hwndDlg, IDC_SBARLAYOUT, CB_GETCURSEL, 0, 0);
dwNewFlagsEx = 0;
if (iTabMode < 2)
dwNewFlags = ((iTabMode == 1) ? (dwNewFlags | CNT_TABSBOTTOM) : (dwNewFlags & ~CNT_TABSBOTTOM));
else {
dwNewFlags &= ~CNT_TABSBOTTOM;
dwNewFlagsEx = iTabMode == 2 ? TCF_SBARLEFT : TCF_SBARRIGHT;
}
dwNewFlagsEx |= ((IsDlgButtonChecked(hwndDlg, IDC_FLASHICON) ? TCF_FLASHICON : 0) |
(IsDlgButtonChecked(hwndDlg, IDC_FLASHLABEL) ? TCF_FLASHLABEL : 0) |
(IsDlgButtonChecked(hwndDlg, IDC_BUTTONTABS) ? TCF_FLAT : 0) |
(IsDlgButtonChecked(hwndDlg, IDC_CLOSEBUTTONONTABS) ? TCF_CLOSEBUTTON : 0) |
(IsDlgButtonChecked(hwndDlg, IDC_SINGLEROWTAB) ? TCF_SINGLEROWTABCONTROL : 0) |
(IsDlgButtonChecked(hwndDlg, IDC_O_SOUNDSMINIMIZED) ? CNT_EX_SOUNDS_MINIMIZED : 0) |
(IsDlgButtonChecked(hwndDlg, IDC_O_SOUNDSUNFOCUSED) ? CNT_EX_SOUNDS_UNFOCUSED : 0) |
(IsDlgButtonChecked(hwndDlg, IDC_O_SOUNDSFOCUSED) ? CNT_EX_SOUNDS_FOCUSED : 0) |
(IsDlgButtonChecked(hwndDlg, IDC_O_SOUNDSINACTIVE) ? CNT_EX_SOUNDS_INACTIVETABS : 0)
);
/* bits 24 - 31 of dwFlagsEx hold the sidebar layout id */
dwNewFlagsEx |= ((int)((iTabLayout << 24) & 0xff000000));
if (IsDlgButtonChecked(hwndDlg, IDC_O_FLASHDEFAULT))
dwNewFlags &= ~(CNT_FLASHALWAYS | CNT_NOFLASH);
cs->dwFlags = dwNewFlags;
cs->dwFlagsEx = dwNewFlagsEx;
cs->autoCloseSeconds = (WORD)SendDlgItemMessage(hwndDlg, IDC_AUTOCLOSETABSPIN, UDM_GETPOS, 0, 0);
}
break;
case WM_DESTROY:
Window_FreeIcon_IcoLib(hwndDlg);
pContainer->hWndOptions = nullptr;
SetWindowLongPtr(hwndDlg, GWLP_USERDATA, 0);
HFONT hFont = (HFONT)SendDlgItemMessage(hwndDlg, IDC_TITLEBOX, WM_GETFONT, 0, 0);
DeleteObject(hFont);
break;
}
return FALSE;
}
|