diff options
author | George Hazan <george.hazan@gmail.com> | 2015-05-08 21:58:33 +0000 |
---|---|---|
committer | George Hazan <george.hazan@gmail.com> | 2015-05-08 21:58:33 +0000 |
commit | 56eab17c447514113ec49d7b5ab4e6db8acbee38 (patch) | |
tree | 6de3d44156b9d898ff6e39ff3d2dd6205d1781e4 | |
parent | ed1356b99f5b2789496f2813ba9948c24149e60c (diff) |
old pieces of avatar processing code removed
git-svn-id: http://svn.miranda-ng.org/main/trunk@13487 1316c22d-e87f-b044-9b9b-93d7a3e3ba9c
-rw-r--r-- | plugins/Clist_modern/src/hdr/modern_clc.h | 2 | ||||
-rw-r--r-- | plugins/Clist_modern/src/init.cpp | 3 | ||||
-rw-r--r-- | plugins/Clist_modern/src/modern_aniavatars.cpp | 6 | ||||
-rw-r--r-- | plugins/Clist_modern/src/modern_cachefuncs.cpp | 38 | ||||
-rw-r--r-- | plugins/Clist_modern/src/modern_clc.cpp | 9 | ||||
-rw-r--r-- | plugins/Clist_modern/src/modern_clistevents.cpp | 12 | ||||
-rw-r--r-- | plugins/Clist_modern/src/modern_clistopts.cpp | 9 | ||||
-rw-r--r-- | plugins/Clist_modern/src/modern_clui.cpp | 14 | ||||
-rw-r--r-- | plugins/Clist_modern/src/modern_viewmodebar.cpp | 2 | ||||
-rw-r--r-- | src/modules/clist/Docking.cpp | 216 |
10 files changed, 125 insertions, 186 deletions
diff --git a/plugins/Clist_modern/src/hdr/modern_clc.h b/plugins/Clist_modern/src/hdr/modern_clc.h index 36ad9ecff1..7f6c2cb894 100644 --- a/plugins/Clist_modern/src/hdr/modern_clc.h +++ b/plugins/Clist_modern/src/hdr/modern_clc.h @@ -215,7 +215,7 @@ struct ClcContact : public ClcContactBase // int status;
BOOL image_is_special;
int avatar_pos;
- struct avatarCacheEntry *avatar_data;
+ avatarCacheEntry *avatar_data;
SIZE avatar_size;
CSmileyString ssText;
diff --git a/plugins/Clist_modern/src/init.cpp b/plugins/Clist_modern/src/init.cpp index a7c156fb27..870ac56431 100644 --- a/plugins/Clist_modern/src/init.cpp +++ b/plugins/Clist_modern/src/init.cpp @@ -106,7 +106,8 @@ extern "C" __declspec(dllexport) int Unload(void) {
TRACE("Unloading Clist Modern\r\n");
- if (IsWindow(pcli->hwndContactList)) DestroyWindow(pcli->hwndContactList);
+ if (IsWindow(pcli->hwndContactList))
+ DestroyWindow(pcli->hwndContactList);
pcli->hwndContactList = NULL;
ToolbarButtonUnloadModule();
diff --git a/plugins/Clist_modern/src/modern_aniavatars.cpp b/plugins/Clist_modern/src/modern_aniavatars.cpp index bd2c81c38b..4981ac56d4 100644 --- a/plugins/Clist_modern/src/modern_aniavatars.cpp +++ b/plugins/Clist_modern/src/modern_aniavatars.cpp @@ -946,8 +946,7 @@ int AniAva_SetAvatarPos(MCONTACT hContact, RECT *rc, int overlayIdx, BYTE bAlpha int AniAva_UpdateOptions()
{
BOOL bReloadAvatars = FALSE;
- BOOL bBeEnabled = (db_get_b(NULL, "CList", "AvatarsAnimated", ServiceExists(MS_AV_GETAVATARBITMAP)) &&
- db_get_b(NULL, "CList", "AvatarsShow", SETTINGS_SHOWAVATARS_DEFAULT));
+ BOOL bBeEnabled = db_get_b(NULL, "CList", "AvatarsAnimated", db_get_b(NULL, "CList", "AvatarsShow", SETTINGS_SHOWAVATARS_DEFAULT));
if (bBeEnabled && !s_bModuleStarted) {
AniAva_InitModule();
bReloadAvatars = TRUE;
@@ -988,8 +987,7 @@ void AniAva_UpdateParent() int AniAva_InitModule()
{
- if (!(db_get_b(NULL, "CList", "AvatarsAnimated", ServiceExists(MS_AV_GETAVATARBITMAP)) &&
- db_get_b(NULL, "CList", "AvatarsShow", SETTINGS_SHOWAVATARS_DEFAULT)))
+ if (!db_get_b(NULL, "CList", "AvatarsAnimated", db_get_b(NULL, "CList", "AvatarsShow", SETTINGS_SHOWAVATARS_DEFAULT)))
return 0;
WNDCLASSEX wc = { sizeof(wc) };
diff --git a/plugins/Clist_modern/src/modern_cachefuncs.cpp b/plugins/Clist_modern/src/modern_cachefuncs.cpp index fc827e024a..d586363953 100644 --- a/plugins/Clist_modern/src/modern_cachefuncs.cpp +++ b/plugins/Clist_modern/src/modern_cachefuncs.cpp @@ -406,7 +406,6 @@ int Cache_GetLineText( BOOL show_status_if_no_away, BOOL show_listening_if_no_away, BOOL use_name_and_message_for_xstatus, BOOL pdnce_time_show_only_if_different) { - if (text == NULL) return TEXT_EMPTY; text[0] = '\0'; @@ -485,13 +484,13 @@ int Cache_GetLineText( return TEXT_LISTENING_TO; case TEXT_TEXT: - { - TCHAR *tmp = variables_parsedup(variable_text, pdnce->tszName, pdnce->hContact); - mir_tstrncpy(text, tmp, text_size); - mir_free(tmp); - CopySkipUnprintableChars(text, text, text_size - 1); - } - return TEXT_TEXT; + { + TCHAR *tmp = variables_parsedup(variable_text, pdnce->tszName, pdnce->hContact); + mir_tstrncpy(text, tmp, text_size); + mir_free(tmp); + CopySkipUnprintableChars(text, text, text_size - 1); + } + return TEXT_TEXT; case TEXT_CONTACT_TIME: if (pdnce->hTimeZone) { @@ -654,9 +653,7 @@ static int CopySkipUnprintableChars(TCHAR *to, TCHAR * buf, DWORD size) // Return TRUE if finished, FALSE if was stoped static BOOL ExecuteOnAllContacts(ClcData *dat, ExecuteOnAllContactsFuncPtr func, void *param) { - BOOL res; - res = ExecuteOnAllContactsOfGroup(&dat->list, func, param); - return res; + return ExecuteOnAllContactsOfGroup(&dat->list, func, param); } static BOOL ExecuteOnAllContactsOfGroup(ClcGroup *group, ExecuteOnAllContactsFuncPtr func, void *param) @@ -708,13 +705,14 @@ BOOL ReduceAvatarPosition(ClcContact *contact, BOOL, void *param) void Cache_ProceedAvatarInList(ClcData *dat, ClcContact *contact) { - struct avatarCacheEntry * ace = contact->avatar_data; + avatarCacheEntry * ace = contact->avatar_data; int old_pos = contact->avatar_pos; if (ace == NULL || ace->dwFlags == AVS_BITMAP_EXPIRED || ace->hbmPic == NULL) { - //Avatar was not ready or removed - need to remove it from cache + // Avatar was not ready or removed - need to remove it from cache if (old_pos >= 0) { ImageArray_RemoveImage(&dat->avatar_cache, old_pos); + // Update all items ExecuteOnAllContacts(dat, ReduceAvatarPosition, (void *)&old_pos); contact->avatar_pos = AVATAR_POS_DONT_HAVE; @@ -750,14 +748,12 @@ void Cache_ProceedAvatarInList(ClcData *dat, ClcContact *contact) HDC hdc = CreateCompatibleDC(dat->avatar_cache.hdc); HBITMAP hDrawBmp = ske_CreateDIB32Point(width_clip, height_clip, &pt); HBITMAP oldBmp = (HBITMAP)SelectObject(hdc, hDrawBmp); - //need to draw avatar bitmap here - { - int w = width_clip; - int h = height_clip; - DrawAvatarImageWithGDIp(hdc, 0, 0, w, h, ace->hbmPic, 0, 0, ace->bmWidth, ace->bmHeight, ace->dwFlags, 255); - } + + // need to draw avatar bitmap here + DrawAvatarImageWithGDIp(hdc, 0, 0, width_clip, height_clip, ace->hbmPic, 0, 0, ace->bmWidth, ace->bmHeight, ace->dwFlags, 255); SelectObject(hdc, oldBmp); DeleteDC(hdc); + // Add to list if (old_pos >= 0) { ImageArray_ChangeImage(&dat->avatar_cache, hDrawBmp, old_pos); @@ -782,8 +778,8 @@ void Cache_GetAvatar(ClcData *dat, ClcContact *contact) } if (dat->avatars_show && !db_get_b(contact->hContact, "CList", "HideContactAvatar", 0)) { - contact->avatar_data = (struct avatarCacheEntry *)CallService(MS_AV_GETAVATARBITMAP, (WPARAM)contact->hContact, 0); - if (contact->avatar_data == NULL || contact->avatar_data->cbSize != sizeof(struct avatarCacheEntry) || contact->avatar_data->dwFlags == AVS_BITMAP_EXPIRED) + contact->avatar_data = (avatarCacheEntry *)CallService(MS_AV_GETAVATARBITMAP, contact->hContact, 0); + if (contact->avatar_data == NULL || contact->avatar_data->cbSize != sizeof(avatarCacheEntry) || contact->avatar_data->dwFlags == AVS_BITMAP_EXPIRED) contact->avatar_data = NULL; if (contact->avatar_data != NULL) diff --git a/plugins/Clist_modern/src/modern_clc.cpp b/plugins/Clist_modern/src/modern_clc.cpp index e1ecd0152b..6c43dfb1d3 100644 --- a/plugins/Clist_modern/src/modern_clc.cpp +++ b/plugins/Clist_modern/src/modern_clc.cpp @@ -1718,7 +1718,7 @@ int ClcUnloadModule() return 0; } -int ClcDoProtoAck(MCONTACT, ACKDATA * ack) +int ClcDoProtoAck(MCONTACT, ACKDATA *ack) { if (MirandaExiting()) return 0; if (ack->type == ACKTYPE_STATUS) { @@ -1759,13 +1759,6 @@ int ClcDoProtoAck(MCONTACT, ACKDATA * ack) } } } - else if (ack->type == ACKTYPE_AVATAR) { - if (ack->result == ACKRESULT_SUCCESS) { - PROTO_AVATAR_INFORMATIONT *pai = (PROTO_AVATAR_INFORMATIONT*)ack->hProcess; - if (pai != NULL && pai->hContact != NULL) - pcli->pfnClcBroadcast(INTM_AVATARCHANGED, (WPARAM)pai->hContact, 0); - } - } else if (ack->type == ACKTYPE_EMAIL) { CLUIUnreadEmailCountChanged(0, 0); } diff --git a/plugins/Clist_modern/src/modern_clistevents.cpp b/plugins/Clist_modern/src/modern_clistevents.cpp index 85a278a7ad..c03ed3b766 100644 --- a/plugins/Clist_modern/src/modern_clistevents.cpp +++ b/plugins/Clist_modern/src/modern_clistevents.cpp @@ -57,7 +57,7 @@ struct CListEvent { int imlIconOverlayIndex;
};
-static struct CListEvent *event;
+static CListEvent *event;
static int eventCount;
static int disableTrayFlash;
static int disableIconFlash;
@@ -83,10 +83,8 @@ struct NotifyMenuItemExData { static CLISTEVENT* MyGetEvent(int iSelection)
{
- int i;
-
- for (i = 0; i < pcli->events.count; i++) {
- struct CListEvent* p = pcli->events.items[i];
+ for (int i = 0; i < pcli->events.count; i++) {
+ CListEvent *p = pcli->events.items[i];
if (p->menuId == iSelection)
return &p->cle;
}
@@ -100,9 +98,9 @@ CListEvent* cliCreateEvent(void) return p;
}
-struct CListEvent* cli_AddEvent(CLISTEVENT *cle)
+CListEvent* cli_AddEvent(CLISTEVENT *cle)
{
- struct CListEvent* p = corecli.pfnAddEvent(cle);
+ CListEvent* p = corecli.pfnAddEvent(cle);
if (p == NULL)
return NULL;
diff --git a/plugins/Clist_modern/src/modern_clistopts.cpp b/plugins/Clist_modern/src/modern_clistopts.cpp index 6bac4ae659..0f317ee373 100644 --- a/plugins/Clist_modern/src/modern_clistopts.cpp +++ b/plugins/Clist_modern/src/modern_clistopts.cpp @@ -228,7 +228,7 @@ static INT_PTR CALLBACK DlgProcItemAvatarOpts(HWND hwndDlg, UINT msg, WPARAM wPa case WM_INITDIALOG:
TranslateDialogDefault(hwndDlg);
CheckDlgButton(hwndDlg, IDC_SHOW_AVATARS, db_get_b(NULL, "CList", "AvatarsShow", SETTINGS_SHOWAVATARS_DEFAULT) == 1 ? BST_CHECKED : BST_UNCHECKED);
- CheckDlgButton(hwndDlg, IDC_SHOW_ANIAVATARS, db_get_b(NULL, "CList", "AvatarsAnimated", ServiceExists(MS_AV_GETAVATARBITMAP)) == 1 ? BST_CHECKED : BST_UNCHECKED);
+ CheckDlgButton(hwndDlg, IDC_SHOW_ANIAVATARS, db_get_b(NULL, "CList", "AvatarsAnimated", BST_CHECKED));
CheckDlgButton(hwndDlg, IDC_AVATAR_FASTDRAW, db_get_b(NULL, "CList", "AvatarsInSeparateWnd", SETTINGS_AVATARINSEPARATE_DEFAULT) ? BST_CHECKED : BST_UNCHECKED);
CheckDlgButton(hwndDlg, IDC_AVATAR_DRAW_BORDER, db_get_b(NULL, "CList", "AvatarsDrawBorders", SETTINGS_AVATARDRAWBORDER_DEFAULT) == 1 ? BST_CHECKED : BST_UNCHECKED);
CheckDlgButton(hwndDlg, IDC_AVATAR_ROUND_CORNERS, db_get_b(NULL, "CList", "AvatarsRoundCorners", SETTINGS_AVATARROUNDCORNERS_DEFAULT) == 1 ? BST_CHECKED : BST_UNCHECKED);
@@ -308,11 +308,6 @@ static INT_PTR CALLBACK DlgProcItemAvatarOpts(HWND hwndDlg, UINT msg, WPARAM wPa EnableWindow(GetDlgItem(hwndDlg, IDC_AVATAR_OVERLAY_ICON_PROTOCOL), FALSE);
EnableWindow(GetDlgItem(hwndDlg, IDC_AVATAR_OVERLAY_ICON_CONTACT), FALSE);
}
-
- if (!ServiceExists(MS_AV_GETAVATARBITMAP)) {
- EnableWindow(GetDlgItem(hwndDlg, IDC_SHOW_ANIAVATARS), FALSE);
- SetDlgItemText(hwndDlg, IDC_SHOW_ANIAVATARS, TranslateT("Animate avatars (GDI+ and Avatar service module (avs.dll) are required)"));
- }
break;
case WM_COMMAND:
@@ -332,7 +327,7 @@ static INT_PTR CALLBACK DlgProcItemAvatarOpts(HWND hwndDlg, UINT msg, WPARAM wPa EnableWindow(GetDlgItem(hwndDlg, IDC_AVATAR_SIZE), enabled);
EnableWindow(GetDlgItem(hwndDlg, IDC_AVATAR_SIZE_SPIN), enabled);
EnableWindow(GetDlgItem(hwndDlg, IDC_AVATAR_SIZE_PIXELS3), enabled);
- EnableWindow(GetDlgItem(hwndDlg, IDC_SHOW_ANIAVATARS), enabled && ServiceExists(MS_AV_GETAVATARBITMAP));
+ EnableWindow(GetDlgItem(hwndDlg, IDC_SHOW_ANIAVATARS), enabled);
EnableWindow(GetDlgItem(hwndDlg, IDC_AVATAR_WIDTH), enabled);
EnableWindow(GetDlgItem(hwndDlg, IDC_AVATAR_WIDTH_SPIN), enabled);
diff --git a/plugins/Clist_modern/src/modern_clui.cpp b/plugins/Clist_modern/src/modern_clui.cpp index ed66adfadf..4e160f4ad0 100644 --- a/plugins/Clist_modern/src/modern_clui.cpp +++ b/plugins/Clist_modern/src/modern_clui.cpp @@ -203,20 +203,6 @@ int CLUI::OnEvent_ContactMenuPreBuild(WPARAM, LPARAM) Menu_ShowItem(hHideAvatarMenuItem, false);
}
else {
- int has_avatar;
-
- if (ServiceExists(MS_AV_GETAVATARBITMAP))
- has_avatar = CallService(MS_AV_GETAVATARBITMAP, (WPARAM)hItem, 0);
- else {
- DBVARIANT dbv;
- if (db_get_ts(hItem, "ContactPhoto", "File", &dbv))
- has_avatar = 0;
- else {
- has_avatar = 1;
- db_free(&dbv);
- }
- }
-
bool bHideAvatar = db_get_b(hItem, "CList", "HideContactAvatar", 0) != 0;
Menu_ShowItem(hShowAvatarMenuItem, bHideAvatar);
Menu_ShowItem(hHideAvatarMenuItem, !bHideAvatar);
diff --git a/plugins/Clist_modern/src/modern_viewmodebar.cpp b/plugins/Clist_modern/src/modern_viewmodebar.cpp index 57ae8d4969..56767b068b 100644 --- a/plugins/Clist_modern/src/modern_viewmodebar.cpp +++ b/plugins/Clist_modern/src/modern_viewmodebar.cpp @@ -720,8 +720,6 @@ INT_PTR CALLBACK DlgProcViewModesSetup(HWND hwndDlg, UINT msg, WPARAM wParam, LP ShowWindow(GetDlgItem(hwndDlg, _page2Controls[i++]), SW_HIDE);
ShowWindow(hwndDlg, SW_SHOWNORMAL);
EnableWindow(GetDlgItem(hwndDlg, IDC_APPLY), FALSE);
- //EnableWindow(GetDlgItem(hwndDlg, IDC_VARIABLES), FALSE);
- //EnableWindow(GetDlgItem(hwndDlg, IDC_VARIABLES), ServiceExists(MS_VARS_FORMATSTRING));
SendDlgItemMessage(hwndDlg, IDC_AUTOCLEARSPIN, UDM_SETRANGE, 0, MAKELONG(1000, 0));
SetWindowText(hwndDlg, TranslateT("Configure view modes"));
}
diff --git a/src/modules/clist/Docking.cpp b/src/modules/clist/Docking.cpp index d01381fdd6..3ebda96ee4 100644 --- a/src/modules/clist/Docking.cpp +++ b/src/modules/clist/Docking.cpp @@ -41,8 +41,7 @@ static void Docking_GetMonitorRectFromPoint(LPPOINT pt, LPRECT rc) HMONITOR hMonitor = MonitorFromPoint(*pt, MONITOR_DEFAULTTONEAREST); // always returns a valid value
monitorInfo.cbSize = sizeof(monitorInfo);
- if (GetMonitorInfo(hMonitor, &monitorInfo))
- {
+ if (GetMonitorInfo(hMonitor, &monitorInfo)) {
*rc = monitorInfo.rcMonitor;
return;
}
@@ -64,7 +63,7 @@ static void Docking_RectToDock(LPRECT rc) static void Docking_PosCommand(HWND hwnd, LPRECT rc, bool query)
{
- APPBARDATA abd = {0};
+ APPBARDATA abd = { 0 };
abd.cbSize = sizeof(abd);
abd.hWnd = hwnd;
@@ -76,7 +75,7 @@ static void Docking_PosCommand(HWND hwnd, LPRECT rc, bool query) static UINT_PTR Docking_Command(HWND hwnd, int cmd)
{
- APPBARDATA abd = {0};
+ APPBARDATA abd = { 0 };
abd.cbSize = sizeof(abd);
abd.hWnd = hwnd;
@@ -90,13 +89,11 @@ static void Docking_AdjustPosition(HWND hwnd, LPRECT rcDisplay, LPRECT rc, bool rc->top = rcDisplay->top;
rc->bottom = rcDisplay->bottom;
- if (docked == DOCKED_LEFT)
- {
+ if (docked == DOCKED_LEFT) {
rc->right = rcDisplay->left + (rc->right - rc->left);
rc->left = rcDisplay->left;
}
- else
- {
+ else {
rc->left = rcDisplay->right - (rc->right - rc->left);
rc->right = rcDisplay->right;
}
@@ -107,16 +104,14 @@ static void Docking_AdjustPosition(HWND hwnd, LPRECT rcDisplay, LPRECT rc, bool else
rc->left = rc->right - cx;
- if (!query)
- {
+ if (!query) {
Docking_PosCommand(hwnd, rc, false);
dockPos = *(LPPOINT)rc;
}
- if (move)
- {
+ if (move) {
MoveWindow(hwnd, rc->left, rc->top, rc->right - rc->left,
- rc->bottom - rc->top, TRUE);
+ rc->bottom - rc->top, TRUE);
}
}
@@ -142,18 +137,15 @@ INT_PTR Docking_IsDocked(WPARAM, LPARAM) int fnDocking_ProcessWindowMessage(WPARAM wParam, LPARAM lParam)
{
static int draggingTitle;
- MSG *msg = (MSG *) wParam;
+ MSG *msg = (MSG *)wParam;
- if (msg->message == WM_DESTROY)
- {
- if (docked)
- {
- db_set_b(NULL, "CList", "Docked", (BYTE) docked);
- db_set_dw(NULL, "CList", "DockX", (DWORD) dockPos.x);
- db_set_dw(NULL, "CList", "DockY", (DWORD) dockPos.y);
+ if (msg->message == WM_DESTROY) {
+ if (docked) {
+ db_set_b(NULL, "CList", "Docked", (BYTE)docked);
+ db_set_dw(NULL, "CList", "DockX", (DWORD)dockPos.x);
+ db_set_dw(NULL, "CList", "DockY", (DWORD)dockPos.y);
}
- else
- {
+ else {
db_unset(NULL, "CList", "Docked");
db_unset(NULL, "CList", "DockX");
db_unset(NULL, "CList", "DockY");
@@ -163,12 +155,11 @@ int fnDocking_ProcessWindowMessage(WPARAM wParam, LPARAM lParam) if (!docked && msg->message != WM_CREATE && msg->message != WM_MOVING)
return 0;
- switch (msg->message)
- {
+ switch (msg->message) {
case WM_CREATE:
draggingTitle = 0;
docked = db_get_b(NULL, "CLUI", "DockToSides", 1) ?
- (char) db_get_b(NULL, "CList", "Docked", 0) : 0;
+ (char)db_get_b(NULL, "CList", "Docked", 0) : 0;
dockPos.x = (int)db_get_dw(NULL, "CList", "DockX", 0);
dockPos.y = (int)db_get_dw(NULL, "CList", "DockY", 0);
break;
@@ -178,86 +169,80 @@ int fnDocking_ProcessWindowMessage(WPARAM wParam, LPARAM lParam) break;
case WM_WINDOWPOSCHANGING:
- {
- LPWINDOWPOS wp = (LPWINDOWPOS)msg->lParam;
-
- bool vis = Docking_IsWindowVisible(msg->hwnd);
- if (wp->flags & SWP_SHOWWINDOW)
- vis = !IsIconic(msg->hwnd);
- if (wp->flags & SWP_HIDEWINDOW)
- vis = false;
-
- if (vis)
{
- if (!(wp->flags & (SWP_NOMOVE | SWP_NOSIZE)))
- {
- bool addbar = Docking_Command(msg->hwnd, ABM_NEW) != 0;
+ LPWINDOWPOS wp = (LPWINDOWPOS)msg->lParam;
- RECT rc = {0};
- GetWindowRect(msg->hwnd, &rc);
+ bool vis = Docking_IsWindowVisible(msg->hwnd);
+ if (wp->flags & SWP_SHOWWINDOW)
+ vis = !IsIconic(msg->hwnd);
+ if (wp->flags & SWP_HIDEWINDOW)
+ vis = false;
- int cx = rc.right - rc.left;
- if (!(wp->flags & SWP_NOMOVE)) { rc.left = wp->x; rc.top = wp->y; }
+ if (vis) {
+ if (!(wp->flags & (SWP_NOMOVE | SWP_NOSIZE))) {
+ bool addbar = Docking_Command(msg->hwnd, ABM_NEW) != 0;
- if (addbar)
- Docking_RectToDock(&rc);
+ RECT rc = { 0 };
+ GetWindowRect(msg->hwnd, &rc);
- if (!(wp->flags & SWP_NOSIZE))
- {
- rc.right = rc.left + wp->cx;
- rc.bottom = rc.top + wp->cy;
- addbar |= (cx != wp->cx);
- }
+ int cx = rc.right - rc.left;
+ if (!(wp->flags & SWP_NOMOVE)) { rc.left = wp->x; rc.top = wp->y; }
- Docking_SetSize(msg->hwnd, &rc, !addbar, false);
+ if (addbar)
+ Docking_RectToDock(&rc);
- if (!(wp->flags & SWP_NOMOVE)) { wp->x = rc.left; wp->y = rc.top; }
- if (!(wp->flags & SWP_NOSIZE)) wp->cy = rc.bottom - rc.top;
+ if (!(wp->flags & SWP_NOSIZE)) {
+ rc.right = rc.left + wp->cx;
+ rc.bottom = rc.top + wp->cy;
+ addbar |= (cx != wp->cx);
+ }
- *((LRESULT *) lParam) = TRUE;
- return TRUE;
- }
- else
- {
- if ((wp->flags & SWP_SHOWWINDOW) && Docking_Command(msg->hwnd, ABM_NEW))
- {
- RECT rc = {0};
- GetWindowRect(msg->hwnd, &rc);
- Docking_RectToDock(&rc);
+ Docking_SetSize(msg->hwnd, &rc, !addbar, false);
- Docking_SetSize(msg->hwnd, &rc, false, false);
+ if (!(wp->flags & SWP_NOMOVE)) { wp->x = rc.left; wp->y = rc.top; }
+ if (!(wp->flags & SWP_NOSIZE)) wp->cy = rc.bottom - rc.top;
- wp->x = rc.left;
- wp->y = rc.top;
- wp->cy = rc.bottom - rc.top;
- wp->cx = rc.right - rc.left;
- wp->flags &= ~(SWP_NOSIZE | SWP_NOMOVE);
+ *((LRESULT *)lParam) = TRUE;
+ return TRUE;
+ }
+ else {
+ if ((wp->flags & SWP_SHOWWINDOW) && Docking_Command(msg->hwnd, ABM_NEW)) {
+ RECT rc = { 0 };
+ GetWindowRect(msg->hwnd, &rc);
+ Docking_RectToDock(&rc);
+
+ Docking_SetSize(msg->hwnd, &rc, false, false);
+
+ wp->x = rc.left;
+ wp->y = rc.top;
+ wp->cy = rc.bottom - rc.top;
+ wp->cx = rc.right - rc.left;
+ wp->flags &= ~(SWP_NOSIZE | SWP_NOMOVE);
+ }
}
}
}
break;
- }
case WM_WINDOWPOSCHANGED:
- {
- LPWINDOWPOS wp = (LPWINDOWPOS)msg->lParam;
- bool vis = Docking_IsWindowVisible(msg->hwnd);
- if (wp->flags & SWP_SHOWWINDOW)
- vis = !IsIconic(msg->hwnd);
- if (wp->flags & SWP_HIDEWINDOW)
- vis = false;
-
- if (!vis)
- Docking_Command(msg->hwnd, ABM_REMOVE);
- else
- Docking_Command(msg->hwnd, ABM_WINDOWPOSCHANGED);
+ {
+ LPWINDOWPOS wp = (LPWINDOWPOS)msg->lParam;
+ bool vis = Docking_IsWindowVisible(msg->hwnd);
+ if (wp->flags & SWP_SHOWWINDOW)
+ vis = !IsIconic(msg->hwnd);
+ if (wp->flags & SWP_HIDEWINDOW)
+ vis = false;
+
+ if (!vis)
+ Docking_Command(msg->hwnd, ABM_REMOVE);
+ else
+ Docking_Command(msg->hwnd, ABM_WINDOWPOSCHANGED);
+ }
break;
- }
case WM_DISPLAYCHANGE:
- if (Docking_IsWindowVisible(msg->hwnd))
- {
- RECT rc = {0};
+ if (Docking_IsWindowVisible(msg->hwnd)) {
+ RECT rc = { 0 };
GetWindowRect(msg->hwnd, &rc);
Docking_RectToDock(&rc);
Docking_SetSize(msg->hwnd, &rc, false, true);
@@ -265,8 +250,7 @@ int fnDocking_ProcessWindowMessage(WPARAM wParam, LPARAM lParam) break;
case WM_MOVING:
- if (!docked)
- {
+ if (!docked) {
RECT rcMonitor;
POINT ptCursor;
@@ -275,7 +259,7 @@ int fnDocking_ProcessWindowMessage(WPARAM wParam, LPARAM lParam) return 0;
// GetMessagePos() is no good, position is always unsigned
-// GetCursorPos(&ptCursor);
+ // GetCursorPos(&ptCursor);
DWORD pos = GetMessagePos();
ptCursor.x = GET_X_LPARAM(pos);
ptCursor.y = GET_Y_LPARAM(pos);
@@ -283,40 +267,36 @@ int fnDocking_ProcessWindowMessage(WPARAM wParam, LPARAM lParam) if (((ptCursor.x < rcMonitor.left + EDGESENSITIVITY) ||
(ptCursor.x >= rcMonitor.right - EDGESENSITIVITY)) &&
- db_get_b(NULL, "CLUI", "DockToSides", 1))
- {
+ db_get_b(NULL, "CLUI", "DockToSides", 1)) {
docked = (ptCursor.x < rcMonitor.left + EDGESENSITIVITY) ? DOCKED_LEFT : DOCKED_RIGHT;
PostMessage(msg->hwnd, WM_LBUTTONUP, 0, MAKELPARAM(ptCursor.x, ptCursor.y));
Docking_Command(msg->hwnd, ABM_NEW);
Docking_AdjustPosition(msg->hwnd, &rcMonitor, (LPRECT)msg->lParam, false, true);
- *((LRESULT *) lParam) = TRUE;
+ *((LRESULT *)lParam) = TRUE;
return TRUE;
}
}
break;
case WM_NCHITTEST:
- switch (DefWindowProc(msg->hwnd, WM_NCHITTEST, msg->wParam, msg->lParam))
- {
+ switch (DefWindowProc(msg->hwnd, WM_NCHITTEST, msg->wParam, msg->lParam)) {
case HTSIZE: case HTTOP: case HTTOPLEFT: case HTTOPRIGHT:
case HTBOTTOM: case HTBOTTOMRIGHT: case HTBOTTOMLEFT:
- *((LRESULT *) lParam) = HTCLIENT;
+ *((LRESULT *)lParam) = HTCLIENT;
return TRUE;
case HTLEFT:
- if (docked == DOCKED_LEFT)
- {
- *((LRESULT *) lParam) = HTCLIENT;
+ if (docked == DOCKED_LEFT) {
+ *((LRESULT *)lParam) = HTCLIENT;
return TRUE;
}
break;
case HTRIGHT:
- if (docked == DOCKED_RIGHT)
- {
- *((LRESULT *) lParam) = HTCLIENT;
+ if (docked == DOCKED_RIGHT) {
+ *((LRESULT *)lParam) = HTCLIENT;
return TRUE;
}
break;
@@ -330,28 +310,26 @@ int fnDocking_ProcessWindowMessage(WPARAM wParam, LPARAM lParam) SetActiveWindow(msg->hwnd);
SetCapture(msg->hwnd);
draggingTitle = 1;
- *((LRESULT *) lParam) = 0;
+ *((LRESULT *)lParam) = 0;
return 1;
case WM_MOUSEMOVE:
- if (draggingTitle)
- {
+ if (draggingTitle) {
RECT rc;
POINT pt;
GetClientRect(msg->hwnd, &rc);
- if ((docked == DOCKED_LEFT && (short) LOWORD(msg->lParam) > rc.right) ||
- (docked == DOCKED_RIGHT && (short) LOWORD(msg->lParam) < 0))
- {
+ if ((docked == DOCKED_LEFT && (short)LOWORD(msg->lParam) > rc.right) ||
+ (docked == DOCKED_RIGHT && (short)LOWORD(msg->lParam) < 0)) {
ReleaseCapture();
draggingTitle = 0;
docked = 0;
GetCursorPos(&pt);
PostMessage(msg->hwnd, WM_NCLBUTTONDOWN, HTCAPTION, MAKELPARAM(pt.x, pt.y));
SetWindowPos(msg->hwnd, 0, pt.x - rc.right / 2,
- pt.y - GetSystemMetrics(SM_CYFRAME) - GetSystemMetrics(SM_CYSMCAPTION) / 2,
- db_get_dw(NULL, "CList", "Width", 0),
- db_get_dw(NULL, "CList", "Height", 0),
- SWP_NOZORDER);
+ pt.y - GetSystemMetrics(SM_CYFRAME) - GetSystemMetrics(SM_CYSMCAPTION) / 2,
+ db_get_dw(NULL, "CList", "Width", 0),
+ db_get_dw(NULL, "CList", "Height", 0),
+ SWP_NOZORDER);
Docking_Command(msg->hwnd, ABM_REMOVE);
}
return 1;
@@ -359,26 +337,22 @@ int fnDocking_ProcessWindowMessage(WPARAM wParam, LPARAM lParam) break;
case WM_LBUTTONUP:
- if (draggingTitle)
- {
+ if (draggingTitle) {
ReleaseCapture();
draggingTitle = 0;
}
break;
case WM_DOCKCALLBACK:
- switch (msg->wParam)
- {
+ switch (msg->wParam) {
case ABN_WINDOWARRANGE:
ShowWindow(msg->hwnd, msg->lParam ? SW_HIDE : SW_SHOW);
break;
case ABN_POSCHANGED:
- {
- RECT rc = {0};
- GetWindowRect(msg->hwnd, &rc);
- Docking_SetSize(msg->hwnd, &rc, false, true);
- }
+ RECT rc = { 0 };
+ GetWindowRect(msg->hwnd, &rc);
+ Docking_SetSize(msg->hwnd, &rc, false, true);
break;
}
return 1;
|