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
|
/*
Miranda IM: the free IM client for Microsoft* Windows*
Copyright 2000-2008 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.
*/
#pragma once
#ifndef _CLC_H_
#define _CLC_H_
#include "modern_image_array.h"
#include "../m_api/m_xpTheme.h"
#include "modern_defsettings.h"
#include "modern_clist.h"
#define SETTING_TRAYICON_SINGLE 0
#define SETTING_TRAYICON_CYCLE 1
#define SETTING_TRAYICON_MULTI 2
#define NIIF_INTERN_UNICODE 0x00000100
#define SETTING_STATE_HIDDEN 0
#define SETTING_STATE_MINIMIZED 1
#define SETTING_STATE_NORMAL 2
#define SETTING_BRINGTOFRONT_DEFAULT 0
#define SETTING_AVATAR_OVERLAY_TYPE_NORMAL 0
#define SETTING_AVATAR_OVERLAY_TYPE_PROTOCOL 1
#define SETTING_AVATAR_OVERLAY_TYPE_CONTACT 2
#define HCONTACT_ISGROUP 0x80000000
#define HCONTACT_ISINFO 0xFFFF0000
#define MAXSTATUSMSGLEN 256
#define INTM_NAMECHANGED (WM_USER+10)
#define INTM_ICONCHANGED (WM_USER+11)
#define INTM_GROUPCHANGED (WM_USER+12)
#define INTM_GROUPSCHANGED (WM_USER+13)
#define INTM_CONTACTADDED (WM_USER+14)
#define INTM_CONTACTDELETED (WM_USER+15)
#define INTM_HIDDENCHANGED (WM_USER+16)
#define INTM_INVALIDATE (WM_USER+17)
#define INTM_APPARENTMODECHANGED (WM_USER+18)
#define INTM_SETINFOTIPHOVERTIME (WM_USER+19)
#define INTM_NOTONLISTCHANGED (WM_USER+20)
#define INTM_RELOADOPTIONS (WM_USER+21)
#define INTM_NAMEORDERCHANGED (WM_USER+22)
#define INTM_IDLECHANGED (WM_USER+23)
#define INTM_SCROLLBARCHANGED (WM_USER+24)
#define INTM_PROTOCHANGED (WM_USER+25)
#define INTM_STATUSMSGCHANGED (WM_USER+26)
#define INTM_STATUSCHANGED (WM_USER+27)
#define INTM_AVATARCHANGED (WM_USER+28)
#define INTM_TIMEZONECHANGED (WM_USER+29)
#define CLBF_TILEVTOROWHEIGHT 0x0100
#define TIMERID_RENAME 10
#define TIMERID_DRAGAUTOSCROLL 11
#define TIMERID_INFOTIP 13
#define TIMERID_REBUILDAFTER 14
#define TIMERID_DELAYEDRESORTCLC 15
#define TIMERID_SUBEXPAND 21
#define TIMERID_INVALIDATE 22
#define TIMERID_INVALIDATE_FULL 25
#define TIMERID_RECALCSCROLLBAR 26
#define TIMERID_FIRST TIMERID_RENAME
#define TIMERID_LAST TIMERID_RECALCSCROLLBAR
void clcSetDelayTimer( UINT_PTR uIDEvent, HWND hwnd, int nDelay = -1);
#define FONTID_CONTACTS 0
#define FONTID_INVIS 1
#define FONTID_OFFLINE 2
#define FONTID_NOTONLIST 3
#define FONTID_OPENGROUPS 4
#define FONTID_OPENGROUPCOUNTS 5
#define FONTID_DIVIDERS 6
#define FONTID_OFFINVIS 7
#define FONTID_SECONDLINE 8
#define FONTID_THIRDLINE 9
#define FONTID_AWAY 10
#define FONTID_DND 11
#define FONTID_NA 12
#define FONTID_OCCUPIED 13
#define FONTID_CHAT 14
#define FONTID_INVISIBLE 15
#define FONTID_PHONE 16
#define FONTID_LUNCH 17
#define FONTID_CONTACT_TIME 18
#define FONTID_CLOSEDGROUPS 19
#define FONTID_CLOSEDGROUPCOUNTS 20
#define FONTID_STATUSBAR_PROTONAME 21
#define FONTID_EVENTAREA 22
#define FONTID_VIEMODES 23
#define FONTID_MODERN_MAX 23
#define DROPTARGET_OUTSIDE 0
#define DROPTARGET_ONSELF 1
#define DROPTARGET_ONNOTHING 2
#define DROPTARGET_ONGROUP 3
#define DROPTARGET_ONCONTACT 4
#define DROPTARGET_INSERTION 5
#define DROPTARGET_ONMETACONTACT 6
#define DROPTARGET_ONSUBCONTACT 7
ClcGroup;
#define CONTACTF_ONLINE 1
#define CONTACTF_INVISTO 2
#define CONTACTF_VISTO 4
#define CONTACTF_NOTONLIST 8
#define CONTACTF_CHECKED 16
#define CONTACTF_IDLE 32
//#define CONTACTF_STATUSMSG 64
#define AVATAR_POS_DONT_HAVE -1
#define AVATAR_POS_ANIMATED -2
#define TEXT_PIECE_TYPE_TEXT 0
#define TEXT_PIECE_TYPE_SMILEY 1
#define DRAGSTAGE_NOTMOVED 0
#define DRAGSTAGE_ACTIVE 1
#define DRAGSTAGEM_STAGE 0x00FF
#define DRAGSTAGEF_MAYBERENAME 0x8000
#define DRAGSTAGEF_OUTSIDE 0x4000
#define DRAGSTAGEF_SKIPRENAME 0x2000
#define ITEM_AVATAR 0
#define ITEM_ICON 1
#define ITEM_TEXT 2
#define ITEM_EXTRA_ICONS 3
#define ITEM_CONTACT_TIME 4
#define NUM_ITEM_TYPE 5
#define TEXT_EMPTY -1
#define TEXT_STATUS 0
#define TEXT_NICKNAME 1
#define TEXT_STATUS_MESSAGE 2
#define TEXT_TEXT 3
#define TEXT_CONTACT_TIME 4
#define TEXT_LISTENING_TO 5
#define TEXT_TEXT_MAX_LENGTH 1024
typedef struct tagClcContactTextPiece
{
int type;
int len;
union
{
struct
{
int start_pos;
};
struct
{
HICON smiley;
int smiley_width;
int smiley_height;
};
};
} ClcContactTextPiece;
enum {
CIT_PAINT_END=0, //next items are invalids
CIT_AVATAR, // 1
CIT_ICON, // 2
CIT_TEXT, // 3 //the contact name or group name
CIT_SUBTEXT1, // 4 //the second line for contact or group counter for groups
CIT_SUBTEXT2, // 5
CIT_TIME, // 6
CIT_CHECKBOX, // 7
CIT_SELECTION, // 8
CIT_EXTRA=64 //use bit compare for extra icon, the mask &0x3F will return number of extra icon
};
struct tContactItems
{
BYTE itemType; //one of above CIT_ definitions
RECT itemRect;
};
struct ClcContact : public ClcContactBase
{
ClcContact *subcontacts;
BYTE SubAllocated;
BYTE SubExpanded;
BYTE isSubcontact;
// int status;
BOOL image_is_special;
int avatar_pos;
struct avatarCacheEntry *avatar_data;
SIZE avatar_size;
CSmileyString ssText;
// For hittest
int pos_indent;
RECT pos_check;
RECT pos_avatar;
RECT pos_icon;
RECT pos_label;
RECT pos_rename_rect;
RECT pos_contact_time;
RECT pos_extra[EXTRA_ICON_COUNT];
DWORD lastPaintCounter;
BYTE bContactRate;
// For extended layout
BYTE ext_nItemsNum;
BOOL ext_fItemsValid;
tContactItems ext_mpItemsDesc[EXTRA_ICON_COUNT+10]; //up to 10 items
};
struct ClcModernFontInfo {
HFONT hFont;
int fontHeight,changed;
COLORREF colour;
BYTE effect;
COLORREF effectColour1;
COLORREF effectColour2;
};
struct ClcData : public ClcDataBase
{
SortedList lCLCContactsCache;
BYTE HiLightMode;
BYTE doubleClickExpand;
int MetaIgnoreEmptyExtra;
BYTE expandMeta;
BYTE IsMetaContactsEnabled;
time_t last_tick_time;
BOOL force_in_dialog;
int subIndent;
int rightMargin;
HBITMAP hMenuBackground;
DWORD MenuBkColor, MenuBkHiColor, MenuTextColor, MenuTextHiColor;
int MenuBmpUse;
// Row height
int *row_heights;
int row_heights_size;
int row_heights_allocated;
// Avatar cache
int use_avatar_service;
IMAGE_ARRAY_DATA avatar_cache;
// Row
int row_min_heigh;
int row_border;
int row_before_group_space;
BOOL row_variable_height;
BOOL row_align_left_items_to_left;
BOOL row_align_right_items_to_right;
int row_items[NUM_ITEM_TYPE];
BOOL row_hide_group_icon;
BYTE row_align_group_mode;
// Avatar
BOOL avatars_show;
BOOL avatars_draw_border;
COLORREF avatars_border_color;
BOOL avatars_round_corners;
BOOL avatars_use_custom_corner_size;
int avatars_custom_corner_size;
BOOL avatars_ignore_size_for_row_height;
BOOL avatars_draw_overlay;
int avatars_overlay_type;
int avatars_maxheight_size;
int avatars_maxwidth_size;
// Icon
BOOL icon_hide_on_avatar;
BOOL icon_draw_on_avatar_space;
BOOL icon_ignore_size_for_row_height;
// Contact time
BOOL contact_time_show;
BOOL contact_time_show_only_if_different;
// Text
BOOL text_rtl;
BOOL text_align_right;
BOOL text_replace_smileys;
BOOL text_resize_smileys;
int text_smiley_height;
BOOL text_use_protocol_smileys;
BOOL text_ignore_size_for_row_height;
// First line
BOOL first_line_draw_smileys;
BOOL first_line_append_nick;
// Second line
BOOL second_line_show;
int second_line_top_space;
BOOL second_line_draw_smileys;
int second_line_type;
TCHAR second_line_text[TEXT_TEXT_MAX_LENGTH];
BOOL second_line_xstatus_has_priority;
BOOL second_line_show_status_if_no_away;
BOOL second_line_show_listening_if_no_away;
BOOL second_line_use_name_and_message_for_xstatus;
// Third line
BOOL third_line_show;
int third_line_top_space;
BOOL third_line_draw_smileys;
int third_line_type;
TCHAR third_line_text[TEXT_TEXT_MAX_LENGTH];
BOOL third_line_xstatus_has_priority;
BOOL third_line_show_status_if_no_away;
BOOL third_line_show_listening_if_no_away;
BOOL third_line_use_name_and_message_for_xstatus;
struct ClcModernFontInfo fontModernInfo[FONTID_MODERN_MAX+1];
HWND hWnd;
BYTE menuOwnerType;
int menuOwnerID;
DWORD m_paintCouter; //range is enoght to 49 days if painting will occure each one millisecond
BYTE useMetaIcon;
BYTE drawOverlayedStatus;
int nInsertionLevel;
BYTE dbbMetaHideExtra;
BYTE dbbBlendInActiveState;
BYTE dbbBlend25;
XPTHANDLE hCheckBoxTheme;
BYTE bCompactMode;
};
struct SHORTDATA
{
HWND hWnd;
BOOL contact_time_show_only_if_different;
int text_smiley_height;
BOOL text_replace_smileys;
BOOL text_use_protocol_smileys;
// Second line
BOOL second_line_show;
BOOL second_line_draw_smileys;
int second_line_type;
TCHAR second_line_text[TEXT_TEXT_MAX_LENGTH];
BOOL second_line_xstatus_has_priority;
BOOL second_line_show_status_if_no_away;
BOOL second_line_show_listening_if_no_away;
BOOL second_line_use_name_and_message_for_xstatus;
// Third line
BOOL third_line_show;
BOOL third_line_draw_smileys;
int third_line_type;
TCHAR third_line_text[TEXT_TEXT_MAX_LENGTH];
BOOL third_line_xstatus_has_priority;
BOOL third_line_show_status_if_no_away;
BOOL third_line_show_listening_if_no_away;
BOOL third_line_use_name_and_message_for_xstatus;
};
typedef struct tagOVERLAYICONINFO
{
char *name;
char *description;
int id;
int listID;
} OVERLAYICONINFO;
//clc.c
void ClcOptionsChanged(void);
//clcidents.c
int cliGetRowsPriorTo(ClcGroup *group,ClcGroup *subgroup,int contactIndex);
int FindItem(HWND hwnd,ClcData *dat,HANDLE hItem,ClcContact **contact,ClcGroup **subgroup,int *isVisible, BOOL isIgnoreSubcontacts );
int cliGetRowByIndex(ClcData *dat,int testindex,ClcContact **contact,ClcGroup **subgroup);
HANDLE ContactToHItem(ClcContact *contact);
HANDLE ContactToItemHandle(ClcContact *contact,DWORD *nmFlags);
void ClearRowByIndexCache();
//clcitems.c
ClcGroup *cli_AddGroup(HWND hwnd,ClcData *dat,const TCHAR *szName,DWORD flags,int groupId,int calcTotalMembers);
void cli_FreeGroup(ClcGroup *group);
int cli_AddInfoItemToGroup(ClcGroup *group,int flags,const TCHAR *pszText);
void cliRebuildEntireList(HWND hwnd,ClcData *dat);
void cli_DeleteItemFromTree(HWND hwnd,HANDLE hItem);
void cli_AddContactToTree(HWND hwnd,ClcData *dat,HANDLE hContact,int updateTotalCount,int checkHideOffline);
void cli_SortCLC(HWND hwnd,ClcData *dat,int useInsertionSort);
int GetNewSelection(ClcGroup *group,int selection, int direction);
//clcmsgs.c
LRESULT cli_ProcessExternalMessages(HWND hwnd,ClcData *dat,UINT msg,WPARAM wParam,LPARAM lParam);
//clcutils.c
void cliRecalcScrollBar(HWND hwnd,ClcData *dat);
void cliBeginRenameSelection(HWND hwnd,ClcData *dat);
int cliHitTest(HWND hwnd,ClcData *dat,int testx,int testy,ClcContact **contact,ClcGroup **group,DWORD *flags);
void cliScrollTo(HWND hwnd,ClcData *dat,int desty,int noSmooth);
int GetDropTargetInformation(HWND hwnd,ClcData *dat,POINT pt);
void LoadCLCOptions(HWND hwnd,ClcData *dat);
//clcpaint.c
void CLCPaint_cliPaintClc(HWND hwnd,ClcData *dat,HDC hdc,RECT *rcPaint);
//clcopts.c
int ClcOptInit(WPARAM wParam,LPARAM lParam);
DWORD GetDefaultExStyle(void);
void GetFontSetting(int i,LOGFONT *lf,COLORREF *colour,BYTE *effect, COLORREF *eColour1,COLORREF *eColour2);
//clistsettings.c
TCHAR * GetContactDisplayNameW( HANDLE hContact, int mode );
//groups.c
TCHAR* GetGroupNameTS( int idx, DWORD* pdwFlags );
int RenameGroupT(WPARAM groupID, LPARAM newName);
int GetContactCachedStatus(HANDLE hContact);
char *GetContactCachedProtocol(HANDLE hContact);
#endif /* _CLC_H_ */
|