summaryrefslogtreecommitdiff
path: root/plugins/Clist_modern/src/hdr/modern_static_clui.h
blob: 7a7d205f146be27ab347545fbb76f8fdee804566 (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
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
/*

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.
*/

/************************************************************************/
/**     FILE CONTAINS HEADER PART FOR .../modernb/clui.c file          **/
/**                                                                    **/
/**         !!!  DO NOT INCLUDE IN TO OTHER FILES  !!!                 **/
/************************************************************************/

/* Definitions */
#pragma once

#define TM_AUTOALPHA                1
#define TM_DELAYEDSIZING            2
#define TM_BRINGOUTTIMEOUT          3
#define TM_BRINGINTIMEOUT           4
#define TM_UPDATEBRINGTIMER         5
#define TM_SMOTHALPHATRANSITION     20
#define TM_WINDOWUPDATE             100
#define TM_STATUSBARUPDATE          200




#define MS_CLUI_SHOWMAINMENU    "CList/ShowMainMenu"
#define MS_CLUI_SHOWSTATUSMENU  "CList/ShowStatusMenu"

#define AC_SRC_NO_PREMULT_ALPHA     0x01
#define AC_SRC_NO_ALPHA             0x02
#define AC_DST_NO_PREMULT_ALPHA     0x10
#define AC_DST_NO_ALPHA             0x20

#define ANIMATION_STEP              40

#define AEROGLASS_MINALPHA          24

/* Declaration of prototypes in other modules */

int ClcUnloadModule();
int ClcGetShortData(ClcData* pData, struct SHORTDATA *pShortData);
int ClcEnterDragToScroll(HWND hwnd, int Y);

int CListMod_ContactListShutdownProc(WPARAM wParam,LPARAM lParam);
int CListMod_HideWindow(HWND hwndContactList, int mode);

int CListSettings_GetCopyFromCache(ClcCacheEntry *pDest, DWORD flag);
int CListSettings_SetToCache(ClcCacheEntry *pSrc, DWORD flag);

int CLUIServices_LoadModule(void);
INT_PTR CLUIServices_SortList(WPARAM wParam,LPARAM lParam);
INT_PTR CLUIServices_ProtocolStatusChanged(WPARAM wParam,LPARAM lParam);

void Docking_GetMonitorRectFromWindow(HWND hWnd,RECT *rc);

int EventArea_Create(HWND hCluiWnd);

int ExtraImage_ExtraIDToColumnNum(int extra);

void GroupMenus_Init();

int ModernSkinButtonLoadModule();
int ModernSkinButton_ReposButtons(HWND parent, BYTE draw,RECT *r);

void ske_ApplyTransluency();
HBITMAP ske_CreateDIB32(int cx, int cy);
HBITMAP ske_CreateDIB32Point(int cx, int cy, void ** bits);
int ske_JustUpdateWindowImage();
void ske_LoadSkinFromDB(void);
int ske_RedrawCompleteWindow();
int ske_UpdateWindowImage();
int ske_ValidateFrameImageProc(RECT *r);

HWND StatusBar_Create(HWND parent);

void RowHeight_InitModernRow();

int UnhookAll();


/* External variables */


/* Global variables */


DWORD   g_dwMainThreadID=0,
        g_dwAwayMsgThreadID=0,
        g_dwGetTextAsyncThreadID=0,
        g_dwSmoothAnimationThreadID=0,
        g_dwFillFontListThreadID=0;
        
HMENU   g_hMenuMain;
BOOL    g_bTransparentFlag=FALSE;

BOOL    g_mutex_bChangingMode=FALSE,
        g_mutex_bSizing=FALSE;        
        
BOOL    g_flag_bOnModulesLoadedCalled=FALSE;

RECT    g_rcEdgeSizingRect={0};

BOOL (WINAPI *g_proc_SetLayeredWindowAttributes)(HWND,COLORREF,BYTE,DWORD);
BOOL (WINAPI *g_proc_SetLayeredWindowAttributesNew)(HWND,COLORREF,BYTE,DWORD);
BOOL (WINAPI *g_proc_AnimateWindow)(HWND hWnd,DWORD dwTime,DWORD dwFlags);

/* Module function prototypes */

int CLUI_IsInMainWindow(HWND hwnd);
int CLUI_SizingOnBorder(POINT pt, int size);
int CLUI_SmoothAlphaTransition(HWND hwnd, BYTE GoalAlpha, BOOL wParam);
int CLUI_TestCursorOnBorders();

static int CLUI_CreateTimerForConnectingIcon(WPARAM wParam,LPARAM lParam);
static int CLUI_SmoothAlphaThreadTransition(HWND hwnd);

/*      structs         */

typedef struct tagPROTOTICKS{
	int     nIconsCount;
	int     nCycleStartTick;
	char  * szProto;
	int     nIndex;
	BOOL    bTimerCreated;
	BOOL    bGlobal;
	HIMAGELIST himlIconList;
} PROTOTICKS,*LPPROTOTICKS;

typedef struct tagCHECKFILLING
{
	HDC hDC;
	RECT rcRect;
} CHECKFILLING;

/* Module global variables */

static BYTE bAlphaEnd;
static BYTE bOldHideOffline;
static BYTE bOldUseGroups;

static WORD wBehindEdgeShowDelay,
            wBehindEdgeHideDelay,
            wBehindEdgeBorderSize;

static BOOL mutex_bAnimationInProgress=FALSE,
            mutex_bShowHideCalledFromAnimation=FALSE,
            mutex_bIgnoreActivation=FALSE,
            mutex_bDisableAutoUpdate=TRUE,
            mutex_bDuringSizing=FALSE,
            mutex_bDelayedSizing=FALSE;  //TBC is it need?
            
static BOOL flag_bFirstTimeCall=FALSE;

static BOOL bTransparentFocus=TRUE,
            bNeedFixSizingRect=FALSE,
            bShowEventStarted=FALSE;

static HANDLE hRenameMenuItem,
              hShowAvatarMenuItem,
              hHideAvatarMenuItem;

static UINT uMsgGetProfile=0;

static int nLastRequiredHeight=0,
           nRequiredHeight=0,
           nMirMenuState=0,
           nStatusMenuState=0;
 
static RECT rcNewWindowRect={0},
            rcOldWindowRect ={0},
            rcSizingRect={0},
            rcCorrectSizeRect={0};

static HANDLE hFrameContactTree;

static PROTOTICKS CycleStartTick[64]={0};//max 64 protocols 

static int nAnimatedIconStep=100;

int CheckFramesPos(RECT *wr);			//cluiframes.c
int CLUIFrames_ApplyNewSizes(int mode); //cluiframes.c
int CLUIFrames_GetTotalHeight();		//cluiframes.c
int CLUIFrames_RepaintSubContainers();  //cluiframes.c
int CLUIFramesGetMinHeight();			//cluiframes.c

int SizeFramesByWindowRect(RECT *r, HDWP * PosBatch, int mode);	//cluiframes.c

int InitSkinHotKeys();
BOOL amWakeThread();
BOOL gtaWakeThread();
void CreateViewModeFrame();

HIMAGELIST hAvatarOverlays=NULL;

OVERLAYICONINFO g_pAvatarOverlayIcons[ID_STATUS_OUTTOLUNCH - ID_STATUS_OFFLINE + 1] = 
{
	{ "AVATAR_OVERLAY_OFFLINE",		LPGEN("Offline"),		IDI_AVATAR_OVERLAY_OFFLINE,   -1},
	{ "AVATAR_OVERLAY_ONLINE",		LPGEN("Online"),		IDI_AVATAR_OVERLAY_ONLINE,	  -1},
	{ "AVATAR_OVERLAY_AWAY",		LPGEN("Away"),			IDI_AVATAR_OVERLAY_AWAY,	  -1},
	{ "AVATAR_OVERLAY_DND",			LPGEN("DND"),			IDI_AVATAR_OVERLAY_DND,		  -1},
	{ "AVATAR_OVERLAY_NA",			LPGEN("NA"),			IDI_AVATAR_OVERLAY_NA,	 	  -1},
	{ "AVATAR_OVERLAY_OCCUPIED",	LPGEN("Occupied"),		IDI_AVATAR_OVERLAY_OCCUPIED,  -1},
	{ "AVATAR_OVERLAY_CHAT",		LPGEN("Free for chat"), IDI_AVATAR_OVERLAY_CHAT,	  -1},
	{ "AVATAR_OVERLAY_INVISIBLE",	LPGEN("Invisible"),		IDI_AVATAR_OVERLAY_INVISIBLE, -1},
	{ "AVATAR_OVERLAY_PHONE",		LPGEN("On the phone"),	IDI_AVATAR_OVERLAY_PHONE,	  -1},
	{ "AVATAR_OVERLAY_LUNCH",		LPGEN("Out to lunch"),	IDI_AVATAR_OVERLAY_LUNCH,	  -1}
};

OVERLAYICONINFO g_pStatusOverlayIcons[ID_STATUS_OUTTOLUNCH - ID_STATUS_OFFLINE + 1] = 
{
	{ "STATUS_OVERLAY_OFFLINE", LPGEN("Offline"), IDI_STATUS_OVERLAY_OFFLINE, -1},
	{ "STATUS_OVERLAY_ONLINE", LPGEN("Online"), IDI_STATUS_OVERLAY_ONLINE, -1},
	{ "STATUS_OVERLAY_AWAY", LPGEN("Away"), IDI_STATUS_OVERLAY_AWAY, -1},
	{ "STATUS_OVERLAY_DND", LPGEN("DND"), IDI_STATUS_OVERLAY_DND, -1},
	{ "STATUS_OVERLAY_NA", LPGEN("NA"), IDI_STATUS_OVERLAY_NA, -1},
	{ "STATUS_OVERLAY_OCCUPIED", LPGEN("Occupied"), IDI_STATUS_OVERLAY_OCCUPIED, -1},
	{ "STATUS_OVERLAY_CHAT", LPGEN("Free for chat"), IDI_STATUS_OVERLAY_CHAT, -1},
	{ "STATUS_OVERLAY_INVISIBLE", LPGEN("Invisible"), IDI_STATUS_OVERLAY_INVISIBLE, -1},
	{ "STATUS_OVERLAY_PHONE", LPGEN("On the phone"), IDI_STATUS_OVERLAY_PHONE, -1},
	{ "STATUS_OVERLAY_LUNCH", LPGEN("Out to lunch"), IDI_STATUS_OVERLAY_LUNCH, -1}
};