summaryrefslogtreecommitdiff
path: root/plugins/MirandaG15/src/CConfig.h
blob: ccc426dc2280ba5acc252cc4c76244a61716688f (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
#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 SESSION_SENDRETURN         10
#define NOTIFY_PROTO_STATUS        11
#define SESSION_SHOWTYPING         12
#define SESSION_SENDTYPING         13
#define SESSION_SCROLL_MAXIMIZED   14
#define SESSION_REPLY_MAXIMIZED    15
#define MAXIMIZED_TITLE            16
#define MAXIMIZED_LABELS           17
#define CLIST_USEGROUPS            18
#define CLIST_USEIGNORE            19
#define NOTIFY_PROTO_SIGNON        20
#define NOTIFY_PROTO_SIGNOFF       21
#define CLIST_SHOWPROTO            22
#define SESSION_SYMBOLS            23
#define CLIST_COUNTERS             24
#define CLIST_DRAWLINES            25
#define CLIST_POSITION             26
#define CONTROL_BACKLIGHTS         27
#define HOOK_VOLUMEWHEEL           28
#define NOTIFY_SKIP_MESSAGES       29
#define NOTIFY_SKIP_STATUS         30
#define NOTIFY_SKIP_SIGNON         31
#define NOTIFY_SKIP_SIGNOFF        32
#define SESSION_TIMESTAMPS         33
#define NOTIFY_TIMESTAMPS          34		  
#define TIMESTAMP_SECONDS          35
#define NOTIFY_IRC_MESSAGES        36
#define NOTIFY_IRC_USERS           37
#define NOTIFY_IRC_EMOTES          38
#define NOTIFY_IRC_NOTICES         39
#define NOTIFY_IRC_CHANNEL         40
#define NOTIFY_IRC_STATUS          41
#define CLIST_COLUMNS              42
#define TRANSITIONS                43
#define NOTIFY_NICKCUTOFF          44
#define NOTIFY_SHOWPROTO           45
#define NOTIFY_NO_SKIP_REPLY       46
#define CLIST_SELECTION            47
#define NOTIFY_CHANNELCUTOFF       48
#define SCREENSAVER_LOCK           49
#define SESSION_CLOSE              50
#define SKIP_DRIVER_ERROR          52

#define BOOL_SETTINGS              53

// 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_PTR CALLBACK AppearanceDlgProc(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM lParam);
	static INT_PTR CALLBACK ChatDlgProc(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM lParam);
	static INT_PTR CALLBACK NotificationsDlgProc(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM lParam);
	static INT_PTR 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