summaryrefslogtreecommitdiff
path: root/plugins/!NotAdopted/MirandaG15/src/CConfig.h
blob: a0c6d43c820479c2fb962ce5c5b6df115164ce4c (plain)
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
#ifndef _CCONFIG_H_
#define _CCONFIG_H_

// Tabs
#define TAB_OPTIONS 0
#define TAB_NOTIFICATIONS 1
#define TAB_CHAT 2
#define TAB_CLIST 3

// Fonts
#define FONT_LOG 0
#define FONT_SESSION 1
#define FONT_CLIST 2
#define FONT_TITLE 3
#define FONT_NOTIFICATION 4

#define FONT_SETTINGS 5

// Bool settings
#define CLIST_HIDEOFFLINE 0
#define NOTIFY_MESSAGES 1
#define NOTIFY_SIGNON 2
#define NOTIFY_SIGNOFF 3
#define NOTIFY_STATUS 4
#define SESSION_LOADDB 5
#define SHOW_LABELS 6
#define SESSION_MARKREAD 7
#define NOTIFY_CONTACTS 8
#define NOTIFY_FILE 9
#define NOTIFY_URL 10
#define SESSION_SENDRETURN 11
#define NOTIFY_PROTO_STATUS 12
#define SESSION_SHOWTYPING 13
#define SESSION_SENDTYPING 14
#define SESSION_SCROLL_MAXIMIZED 15
#define SESSION_REPLY_MAXIMIZED 16
#define MAXIMIZED_TITLE 17
#define MAXIMIZED_LABELS 18
#define CLIST_USEGROUPS 19
#define CLIST_USEIGNORE 20
#define NOTIFY_PROTO_SIGNON 21
#define NOTIFY_PROTO_SIGNOFF 22
#define CLIST_SHOWPROTO 23
#define SESSION_SYMBOLS 24
#define CLIST_COUNTERS 24
#define CLIST_DRAWLINES 25
#define CLIST_POSITION 26
#define CONTROL_BACKLIGHTS 28
#define HOOK_VOLUMEWHEEL 29
#define NOTIFY_SKIP_MESSAGES 30
#define NOTIFY_SKIP_STATUS 31
#define NOTIFY_SKIP_SIGNON 32
#define NOTIFY_SKIP_SIGNOFF 33
#define SESSION_TIMESTAMPS 34
#define NOTIFY_TIMESTAMPS 35
#define TIMESTAMP_SECONDS 36
#define NOTIFY_IRC_MESSAGES 37
#define NOTIFY_IRC_USERS 38
#define NOTIFY_IRC_EMOTES 39
#define NOTIFY_IRC_NOTICES 40
#define NOTIFY_IRC_CHANNEL 41
#define NOTIFY_IRC_STATUS 42
#define CLIST_COLUMNS 43
#define TRANSITIONS 44
#define NOTIFY_NICKCUTOFF 45
#define NOTIFY_SHOWPROTO 46
#define NOTIFY_NO_SKIP_REPLY 47
#define CLIST_SELECTION 48
#define NOTIFY_CHANNELCUTOFF 49
#define SCREENSAVER_LOCK 50
#define SESSION_CLOSE 52
#define SKIP_DRIVER_ERROR 53

#define BOOL_SETTINGS 54

// Int Settings
#define SESSION_LOGSIZE 0
#define NOTIFY_LOGSIZE 1
#define NOTIFY_DURATION 2
#define NOTIFY_TITLE 3
#define SESSION_AUTOSCROLL 4
#define CLIST_GA 5
#define NOTIFY_NICKCUTOFF_OFFSET 6
#define DEVICE 7
#define NOTIFY_CHANNELCUTOFF_OFFSET 8
#define SESSION_CLOSETIMER 9

#define INT_SETTINGS 10

// Enums
#define CLIST_GA_NONE 0
#define CLIST_GA_EXPAND 1
#define CLIST_GA_COLLAPSE 2

#define NOTIFY_TITLE_HIDE 0
#define NOTIFY_TITLE_INFO 1
#define NOTIFY_TITLE_NAME 2

#define SESSION_AUTOSCROLL_NONE 0
#define SESSION_AUTOSCROLL_FIRST 1
#define SESSION_AUTOSCROLL_LAST 2

struct CProtoFilter
{
	tstring strName;
	bool bNotificationFilter;
	bool bContactlistFilter;

	bool bTempNotificationFilter;
	bool bTempContactlistFilter;
};

class CConfig
{
public:
	static void Initialize();
	static void Shutdown();

	static void LoadSettings();
	static void SaveSettings();
	
	// InitDialogHook Callback
	static int InitOptionsDialog(WPARAM wParam, LPARAM lParam);
	// OnConnectionChanged
	static void OnConnectionChanged();

	// Dialog WndProc
	static int CALLBACK AppearanceDlgProc(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM lParam);
	static int CALLBACK ChatDlgProc(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM lParam);
	static int CALLBACK NotificationsDlgProc(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM lParam);
	static int CALLBACK ContactlistDlgProc(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM lParam);

	static bool GetBoolSetting(int iSetting);
	static int GetIntSetting(int iSetting);
	static bool GetProtocolNotificationFilter(tstring strProtocol);
	static bool GetProtocolContactlistFilter(tstring strProtocol);

	static LOGFONT &GetFont(int iFont);
	static int GetFontHeight(int iFont);
private:
	static int GetSampleField(int iFont);
	static void ClearTree(HWND hTree);
	static void FillTree(HWND hTree,bool bCList=false);
	static void FillDeviceBox(HWND hBox);
	
	static HWND hDeviceBox;
	static vector<CProtoFilter*> m_ProtoList;
	
	static HANDLE m_hSampleFont[FONT_SETTINGS];
	static TEXTMETRIC m_tmFontInfo[FONT_SETTINGS];
	static LOGFONT m_logfont[FONT_SETTINGS];
	static LOGFONT m_templogfont[FONT_SETTINGS];

	static void LoadFontSettings(int iFont);
	static void SaveFontSettings(int iFont);

	static void UpdateFontSettings(int iFont);

	static bool m_abBoolSettings[BOOL_SETTINGS];
	static int m_aiIntSettings[INT_SETTINGS];
	static bool m_bInitializingDialog;
	static HANDLE m_hOptionsInitHook;
	
};

#endif