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
|
#include "win.h"
#include "options.h"
Options options;
void EnableTitleBar() {
if(!pluginwind) return;
bool visible = IsWindowVisible(pluginwind) ? true : false;
SetWindowLong(pluginwind, GWL_STYLE, (options.show_titlebar ? STYLE_TITLE : STYLE_NOTITLE) | (visible ? WS_VISIBLE : 0));
SetWindowPos(pluginwind, 0, 0, 0, 0, 0, SWP_NOZORDER | SWP_NOMOVE | SWP_NOSIZE | SWP_NOACTIVATE | SWP_FRAMECHANGED);
}
void ResetTabIcons() {
PostMessage(pluginwind, WM_RESETTABICONS, 0, 0);
}
static BOOL CALLBACK DlgProcOpts(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lParam) {
switch ( msg ) {
case WM_INITDIALOG: {
TranslateDialogDefault( hwndDlg );
CheckDlgButton(hwndDlg, IDC_CHK_TITLE, options.show_titlebar ? FALSE : TRUE);
CheckDlgButton(hwndDlg, IDC_CHK_TABICON, options.tab_icon ? TRUE : FALSE);
CheckDlgButton(hwndDlg, IDC_CHK_ONTOP, options.ontop ? TRUE : FALSE);
return TRUE;
}
case WM_COMMAND:
if(HIWORD(wParam) == BN_CLICKED) {
SendMessage(GetParent(hwndDlg), PSM_CHANGED, 0, 0);
}
return TRUE;
case WM_NOTIFY:
if (((LPNMHDR)lParam)->code == (unsigned)PSN_APPLY ) {
options.show_titlebar = IsDlgButtonChecked(hwndDlg, IDC_CHK_TITLE) ? false : true;
DBWriteContactSettingByte(0, MODULE, "EnableTitle", options.show_titlebar ? 1 : 0);
EnableTitleBar();
options.tab_icon = IsDlgButtonChecked(hwndDlg, IDC_CHK_TABICON) ? true : false;
DBWriteContactSettingByte(0, MODULE, "TabIcon", options.tab_icon ? 1 : 0);
ResetTabIcons();
options.ontop = IsDlgButtonChecked(hwndDlg, IDC_CHK_ONTOP) ? true : false;
DBWriteContactSettingByte(0, MODULE, "OnTop", options.ontop ? 1 : 0);
FixWindowStyle();
}
return TRUE;
}
return FALSE;
}
int OptInit(WPARAM wParam,LPARAM lParam)
{
OPTIONSDIALOGPAGE odp = { 0 };
odp.cbSize = sizeof(odp);
odp.position = -790000000;
odp.hInstance = hInst;
odp.pszTemplate = MAKEINTRESOURCEA(IDD_OPT1);
odp.pszTitle = Translate("Messaging Tabs");
odp.pszGroup = Translate("Events");
odp.flags = ODPF_BOLDGROUPS;
odp.nIDBottomSimpleControl = 0;
odp.pfnDlgProc = DlgProcOpts;
CallService( MS_OPT_ADDPAGE, wParam,( LPARAM )&odp );
return 0;
}
void InitOptions() {
options.show_titlebar = (DBGetContactSettingByte(0, MODULE, "EnableTitle", 1) == 1);
options.tab_icon = (DBGetContactSettingByte(0, MODULE, "TabIcon", 0) == 1);
options.ontop = (DBGetContactSettingByte(0, MODULE, "OnTop", 0) == 1);
HookEvent(ME_OPT_INITIALISE, OptInit);
}
|