diff options
-rw-r--r-- | plugins/Clist_modern/src/CLUIFrames/cluiframes.cpp | 113 | ||||
-rw-r--r-- | plugins/Clist_modern/src/hdr/modern_clist.h | 2 | ||||
-rw-r--r-- | plugins/Clist_modern/src/modern_clcitems.cpp | 2 | ||||
-rw-r--r-- | plugins/Clist_modern/src/modern_clcopts.cpp | 2 | ||||
-rw-r--r-- | plugins/Clist_modern/src/modern_clcpaint.cpp | 14 | ||||
-rw-r--r-- | plugins/Clist_modern/src/modern_clui.cpp | 42 | ||||
-rw-r--r-- | plugins/Clist_modern/src/modern_gettextasync.cpp | 2 | ||||
-rw-r--r-- | plugins/Clist_modern/src/modern_skinbutton.cpp | 88 | ||||
-rw-r--r-- | plugins/Clist_modern/src/modern_skinengine.cpp | 194 | ||||
-rw-r--r-- | plugins/Clist_modern/src/modern_skinselector.cpp | 60 | ||||
-rw-r--r-- | plugins/Clist_modern/src/modern_statusbar.cpp | 4 |
11 files changed, 211 insertions, 312 deletions
diff --git a/plugins/Clist_modern/src/CLUIFrames/cluiframes.cpp b/plugins/Clist_modern/src/CLUIFrames/cluiframes.cpp index f913c58767..bc8cbcb68a 100644 --- a/plugins/Clist_modern/src/CLUIFrames/cluiframes.cpp +++ b/plugins/Clist_modern/src/CLUIFrames/cluiframes.cpp @@ -2315,63 +2315,58 @@ int SizeFramesByWindowRect(RECT *r, HDWP * PosBatch, int mode) nRect.top += g_CluiData.TopClientMargin;
nRect.bottom -= g_CluiData.BottomClientMargin;
CLUIFramesResizeFrames(nRect);
- {
- int i;
- for (i = 0; i < g_nFramesCount; i++) {
- int dx;
- int dy;
- dx = 0;//rcNewWindowRect.left-rcOldWindowRect.left;
- dy = 0;//_window_rect.top-rcOldWindowRect.top;
- if (!g_pfwFrames[i].floating) {
- if (g_pfwFrames[i].visible && !g_pfwFrames[i].needhide && !IsWindowVisible(g_pfwFrames[i].hWnd)) {
- ShowWindow(g_pfwFrames[i].hWnd, SW_SHOW);
- if (g_pfwFrames[i].TitleBar.ShowTitleBar) ShowWindow(g_pfwFrames[i].TitleBar.hwnd, SW_SHOW);
- }
- if (g_pfwFrames[i].OwnerWindow && (INT_PTR)(g_pfwFrames[i].OwnerWindow) != -2) {
- if (!(mode & 2)) {
- HWND hwnd = GetParent(g_pfwFrames[i].OwnerWindow);
- if (NULL != g_pfwFrames[i].OwnerWindow) { /* Wine fix. */
- *PosBatch = DeferWindowPos(*PosBatch, g_pfwFrames[i].OwnerWindow, NULL, g_pfwFrames[i].wndSize.left + r->left, g_pfwFrames[i].wndSize.top + r->top,
- g_pfwFrames[i].wndSize.right - g_pfwFrames[i].wndSize.left, g_pfwFrames[i].wndSize.bottom - g_pfwFrames[i].wndSize.top, SWP_NOZORDER | SWP_NOACTIVATE);
- SetWindowPos(g_pfwFrames[i].hWnd, NULL, 0, 0,
- g_pfwFrames[i].wndSize.right - g_pfwFrames[i].wndSize.left, g_pfwFrames[i].wndSize.bottom - g_pfwFrames[i].wndSize.top, SWP_NOZORDER | SWP_NOACTIVATE/*|SWP_NOSENDCHANGING*/);
- }
+ for (int i = 0; i < g_nFramesCount; i++) {
+ int dx = 0;//rcNewWindowRect.left-rcOldWindowRect.left;
+ int dy = 0;//_window_rect.top-rcOldWindowRect.top;
+ if (!g_pfwFrames[i].floating) {
+ if (g_pfwFrames[i].visible && !g_pfwFrames[i].needhide && !IsWindowVisible(g_pfwFrames[i].hWnd)) {
+ ShowWindow(g_pfwFrames[i].hWnd, SW_SHOW);
+ if (g_pfwFrames[i].TitleBar.ShowTitleBar) ShowWindow(g_pfwFrames[i].TitleBar.hwnd, SW_SHOW);
+ }
+ if (g_pfwFrames[i].OwnerWindow && (INT_PTR)(g_pfwFrames[i].OwnerWindow) != -2) {
+ if (!(mode & 2)) {
+ HWND hwnd = GetParent(g_pfwFrames[i].OwnerWindow);
+ if (NULL != g_pfwFrames[i].OwnerWindow) { /* Wine fix. */
+ *PosBatch = DeferWindowPos(*PosBatch, g_pfwFrames[i].OwnerWindow, NULL, g_pfwFrames[i].wndSize.left + r->left, g_pfwFrames[i].wndSize.top + r->top,
+ g_pfwFrames[i].wndSize.right - g_pfwFrames[i].wndSize.left, g_pfwFrames[i].wndSize.bottom - g_pfwFrames[i].wndSize.top, SWP_NOZORDER | SWP_NOACTIVATE);
+ SetWindowPos(g_pfwFrames[i].hWnd, NULL, 0, 0,
+ g_pfwFrames[i].wndSize.right - g_pfwFrames[i].wndSize.left, g_pfwFrames[i].wndSize.bottom - g_pfwFrames[i].wndSize.top, SWP_NOZORDER | SWP_NOACTIVATE/*|SWP_NOSENDCHANGING*/);
}
- //Frame
+ }
+ //Frame
+ if (g_pfwFrames[i].TitleBar.ShowTitleBar) {
+ SetWindowPos(g_pfwFrames[i].TitleBar.hwnd, NULL, g_pfwFrames[i].wndSize.left + dx, g_pfwFrames[i].wndSize.top - g_nTitleBarHeight - g_CluiData.nGapBetweenTitlebar + dy,
+ g_pfwFrames[i].wndSize.right - g_pfwFrames[i].wndSize.left, g_nTitleBarHeight, SWP_NOZORDER | SWP_NOACTIVATE);
+ SetRect(&g_pfwFrames[i].TitleBar.wndSize, g_pfwFrames[i].wndSize.left, g_pfwFrames[i].wndSize.top - g_nTitleBarHeight - g_CluiData.nGapBetweenTitlebar, g_pfwFrames[i].wndSize.right, g_pfwFrames[i].wndSize.top - g_CluiData.nGapBetweenTitlebar);
+ UpdateWindow(g_pfwFrames[i].TitleBar.hwnd);
+ }
+ }
+ else {
+ if (1) {
+ int res = 0;
+ // set frame position
+ res = SetWindowPos(g_pfwFrames[i].hWnd, NULL, g_pfwFrames[i].wndSize.left + dx, g_pfwFrames[i].wndSize.top + dy,
+ g_pfwFrames[i].wndSize.right - g_pfwFrames[i].wndSize.left,
+ g_pfwFrames[i].wndSize.bottom - g_pfwFrames[i].wndSize.top, SWP_NOZORDER | SWP_NOACTIVATE | SWP_NOSENDCHANGING);
+ }
+ if (1) {
+ // set titlebar position
if (g_pfwFrames[i].TitleBar.ShowTitleBar) {
SetWindowPos(g_pfwFrames[i].TitleBar.hwnd, NULL, g_pfwFrames[i].wndSize.left + dx, g_pfwFrames[i].wndSize.top - g_nTitleBarHeight - g_CluiData.nGapBetweenTitlebar + dy,
- g_pfwFrames[i].wndSize.right - g_pfwFrames[i].wndSize.left, g_nTitleBarHeight, SWP_NOZORDER | SWP_NOACTIVATE);
+ g_pfwFrames[i].wndSize.right - g_pfwFrames[i].wndSize.left, g_nTitleBarHeight, SWP_NOZORDER | SWP_NOACTIVATE | SWP_NOSENDCHANGING);
SetRect(&g_pfwFrames[i].TitleBar.wndSize, g_pfwFrames[i].wndSize.left, g_pfwFrames[i].wndSize.top - g_nTitleBarHeight - g_CluiData.nGapBetweenTitlebar, g_pfwFrames[i].wndSize.right, g_pfwFrames[i].wndSize.top - g_CluiData.nGapBetweenTitlebar);
- UpdateWindow(g_pfwFrames[i].TitleBar.hwnd);
- }
- }
- else {
- if (1) {
- int res = 0;
- // set frame position
- res = SetWindowPos(g_pfwFrames[i].hWnd, NULL, g_pfwFrames[i].wndSize.left + dx, g_pfwFrames[i].wndSize.top + dy,
- g_pfwFrames[i].wndSize.right - g_pfwFrames[i].wndSize.left,
- g_pfwFrames[i].wndSize.bottom - g_pfwFrames[i].wndSize.top, SWP_NOZORDER | SWP_NOACTIVATE | SWP_NOSENDCHANGING);
- }
- if (1) {
- // set titlebar position
- if (g_pfwFrames[i].TitleBar.ShowTitleBar) {
- SetWindowPos(g_pfwFrames[i].TitleBar.hwnd, NULL, g_pfwFrames[i].wndSize.left + dx, g_pfwFrames[i].wndSize.top - g_nTitleBarHeight - g_CluiData.nGapBetweenTitlebar + dy,
- g_pfwFrames[i].wndSize.right - g_pfwFrames[i].wndSize.left, g_nTitleBarHeight, SWP_NOZORDER | SWP_NOACTIVATE | SWP_NOSENDCHANGING);
- SetRect(&g_pfwFrames[i].TitleBar.wndSize, g_pfwFrames[i].wndSize.left, g_pfwFrames[i].wndSize.top - g_nTitleBarHeight - g_CluiData.nGapBetweenTitlebar, g_pfwFrames[i].wndSize.right, g_pfwFrames[i].wndSize.top - g_CluiData.nGapBetweenTitlebar);
- }
}
- UpdateWindow(g_pfwFrames[i].hWnd);
- if (g_pfwFrames[i].TitleBar.ShowTitleBar) UpdateWindow(g_pfwFrames[i].TitleBar.hwnd);
- };
- }
-
+ }
+ UpdateWindow(g_pfwFrames[i].hWnd);
+ if (g_pfwFrames[i].TitleBar.ShowTitleBar) UpdateWindow(g_pfwFrames[i].TitleBar.hwnd);
+ };
}
- if (GetTickCount() - _dwLastStoreTick > 1000) {
- CLUIFramesStoreAllFrames();
- _dwLastStoreTick = GetTickCount();
- };
+
+ }
+ if (GetTickCount() - _dwLastStoreTick > 1000) {
+ CLUIFramesStoreAllFrames();
+ _dwLastStoreTick = GetTickCount();
}
return 0;
}
@@ -2385,10 +2380,8 @@ int CheckFramesPos(RECT *wr) GapBetweenFrames = db_get_dw(NULL, "CLUIFrames", "GapBetweenFrames", SETTING_GAPFRAMES_DEFAULT);
for (int i = 0; i < g_nFramesCount; i++) {
- int dx;
- int dy;
- dx = 0;//rcNewWindowRect.left-rcOldWindowRect.left;
- dy = 0;//_window_rect.top-rcOldWindowRect.top;
+ int dx = 0;//rcNewWindowRect.left-rcOldWindowRect.left;
+ int dy = 0;//_window_rect.top-rcOldWindowRect.top;
if (!g_pfwFrames[i].floating && g_pfwFrames[i].visible) {
if (!(g_pfwFrames[i].OwnerWindow && (INT_PTR)(g_pfwFrames[i].OwnerWindow) != -2)) {
RECT r;
@@ -2592,22 +2585,22 @@ void DrawBackGround(HWND hwnd, HDC mhdc, HBITMAP hBmpBackground, COLORREF bkColo }
else {
destw = clRect.right;
- desth = destw*bmp.bmHeight / bmp.bmWidth;
+ //desth = destw*bmp.bmHeight / bmp.bmWidth;
}
}
else {
destw = clRect.right;
- desth = clRect.bottom;
+ //desth = clRect.bottom;
}
break;
case CLB_STRETCHH:
if (backgroundBmpUse & CLBF_PROPORTIONAL) {
destw = clRect.right;
- desth = destw*bmp.bmHeight / bmp.bmWidth;
+ //desth = destw*bmp.bmHeight / bmp.bmWidth;
}
else {
destw = clRect.right;
- desth = bmp.bmHeight;
+ //desth = bmp.bmHeight;
}
break;
case CLB_STRETCHV:
@@ -2617,12 +2610,12 @@ void DrawBackGround(HWND hwnd, HDC mhdc, HBITMAP hBmpBackground, COLORREF bkColo }
else {
destw = bmp.bmWidth;
- desth = clRect.bottom;
+ //desth = clRect.bottom;
}
break;
default: //clb_topleft
destw = bmp.bmWidth;
- desth = bmp.bmHeight;
+ //desth = bmp.bmHeight;
break;
}
desth = clRect.bottom - clRect.top;
diff --git a/plugins/Clist_modern/src/hdr/modern_clist.h b/plugins/Clist_modern/src/hdr/modern_clist.h index a4c00089fc..13bf41d6ad 100644 --- a/plugins/Clist_modern/src/hdr/modern_clist.h +++ b/plugins/Clist_modern/src/hdr/modern_clist.h @@ -85,7 +85,7 @@ struct ClcCacheEntry : public ClcCacheEntryBase int NotOnList;
int IdleTS;
void* ClcContact;
- BYTE IsExpanded;
+ int IsExpanded;
TCHAR* szSecondLineText;
CSmileyString ssSecondLine;
diff --git a/plugins/Clist_modern/src/modern_clcitems.cpp b/plugins/Clist_modern/src/modern_clcitems.cpp index f9d8835630..98c69bda70 100644 --- a/plugins/Clist_modern/src/modern_clcitems.cpp +++ b/plugins/Clist_modern/src/modern_clcitems.cpp @@ -691,7 +691,7 @@ int __fastcall CLVM_GetContactHiddenStatus(MCONTACT hContact, char *szProto, Clc return -1; //subcontact if (pdnce && pdnce->isUnknown && dat != NULL && !dat->force_in_dialog) return 1; //'Unknown Contact' - if (dat != NULL && dat->filterSearch && dat->szQuickSearch && pdnce && pdnce->tszName) { + if (dat != NULL && dat->filterSearch && pdnce && pdnce->tszName) { // search filtering TCHAR *lowered_name = CharLowerW(NEWTSTR_ALLOCA(pdnce->tszName)); TCHAR *lowered_search = CharLowerW(NEWTSTR_ALLOCA(dat->szQuickSearch)); diff --git a/plugins/Clist_modern/src/modern_clcopts.cpp b/plugins/Clist_modern/src/modern_clcopts.cpp index b7d0142d1b..7c19710bd2 100644 --- a/plugins/Clist_modern/src/modern_clcopts.cpp +++ b/plugins/Clist_modern/src/modern_clcopts.cpp @@ -438,7 +438,7 @@ static INT_PTR CALLBACK DlgProcClistListOpts(HWND hwndDlg, UINT msg, WPARAM wPar tvi.mask = TVIF_HANDLE | TVIF_IMAGE | TVIF_SELECTEDIMAGE;
tvi.hItem = hti.hItem;
TreeView_GetItem(((LPNMHDR)lParam)->hwndFrom, &tvi);
- tvi.iImage = tvi.iSelectedImage = tvi.iImage = !tvi.iImage;
+ tvi.iSelectedImage = tvi.iImage = !tvi.iImage;
TreeView_SetItem(((LPNMHDR)lParam)->hwndFrom, &tvi);
SendMessage(GetParent(hwndDlg), PSM_CHANGED, (WPARAM)hwndDlg, 0);
}
diff --git a/plugins/Clist_modern/src/modern_clcpaint.cpp b/plugins/Clist_modern/src/modern_clcpaint.cpp index 83f8fcedb0..c3cd45e234 100644 --- a/plugins/Clist_modern/src/modern_clcpaint.cpp +++ b/plugins/Clist_modern/src/modern_clcpaint.cpp @@ -558,6 +558,9 @@ void CLCPaint::_AddParamShort(MODERNMASK *mpModernMask, DWORD dwParamIndex, DWO MODERNMASK *CLCPaint::_GetCLCContactRowBackModernMask(ClcGroup *group, ClcContact *Drawing, int indent, int index, BOOL selected, BOOL hottrack, ClcData *dat)
{
+ if (Drawing == NULL)
+ return 0;
+
char buf[BUF2SIZE] = { 0 };
MODERNMASK *mpModernMask = (MODERNMASK*)mir_calloc(sizeof(MODERNMASK));
@@ -566,7 +569,7 @@ MODERNMASK *CLCPaint::_GetCLCContactRowBackModernMask(ClcGroup *group, ClcContac switch (Drawing->type) {
case CLCIT_GROUP:
_AddParamShort(mpModernMask, hi_Type, hi_Group);
- _AddParamShort(mpModernMask, hi_Open, (Drawing && Drawing->group && Drawing->group->expanded) ? hi_True : hi_False);
+ _AddParamShort(mpModernMask, hi_Open, (Drawing->group && Drawing->group->expanded) ? hi_True : hi_False);
_AddParamShort(mpModernMask, hi_IsEmpty, (Drawing->group->cl.count == 0) ? hi_True : hi_False);
break;
@@ -1995,12 +1998,13 @@ void CLCPaint::_PaintClc(HWND hwnd, ClcData *dat, HDC hdc, RECT *_rcPaint) // Draw background
_DrawBackground(hwnd, dat, paintMode, rcPaint, clRect, pc);
// Draw lines
- if (dat->row_heights)
+ if (dat->row_heights) {
_DrawLines(hwnd, dat, paintMode, rcPaint, clRect, pc);
- //insertion mark
- if (dat->iInsertionMark != -1)
- _DrawInsertionMark(dat, clRect, pc);
+ //insertion mark
+ if (dat->iInsertionMark != -1)
+ _DrawInsertionMark(dat, clRect, pc);
+ }
// BitBlt from memory to destination
_CopyPaintToDest(hdc, paintMode, rcPaint, pc);
diff --git a/plugins/Clist_modern/src/modern_clui.cpp b/plugins/Clist_modern/src/modern_clui.cpp index eb1551cfa8..b276f29bff 100644 --- a/plugins/Clist_modern/src/modern_clui.cpp +++ b/plugins/Clist_modern/src/modern_clui.cpp @@ -761,15 +761,13 @@ void CLUI_ChangeWindowMode() CLUIFrames_UpdateBorders();
if (!g_CluiData.fLayered) {
- HRGN hRgn1;
RECT r;
- int v, h;
int w = 10;
GetWindowRect(pcli->hwndContactList, &r);
- h = (r.right - r.left) > (w * 2) ? w : (r.right - r.left);
- v = (r.bottom - r.top) > (w * 2) ? w : (r.bottom - r.top);
+ int h = (r.right - r.left) > (w * 2) ? w : (r.right - r.left);
+ int v = (r.bottom - r.top) > (w * 2) ? w : (r.bottom - r.top);
h = (h < v) ? h : v;
- hRgn1 = CreateRoundRectRgn(0, 0, (r.right - r.left + 1), (r.bottom - r.top + 1), h, h);
+ HRGN hRgn1 = CreateRoundRectRgn(0, 0, (r.right - r.left + 1), (r.bottom - r.top + 1), h, h);
if ((db_get_b(NULL, "CLC", "RoundCorners", SETTING_ROUNDCORNERS_DEFAULT)) && (!CallService(MS_CLIST_DOCKINGISDOCKED, 0, 0)))
SetWindowRgn(pcli->hwndContactList, hRgn1, 1);
else {
@@ -824,14 +822,13 @@ int CLUI_HideBehindEdge() if (method) {
RECT rcScreen;
RECT rcWindow;
- int bordersize = 0;
//Need to be moved out of screen
bShowEventStarted = 0;
//1. get work area rectangle
Docking_GetMonitorRectFromWindow(pcli->hwndContactList, &rcScreen);
//SystemParametersInfo(SPI_GETWORKAREA, 0, &rcScreen,FALSE);
//2. move out
- bordersize = wBehindEdgeBorderSize;
+ int bordersize = wBehindEdgeBorderSize;
GetWindowRect(pcli->hwndContactList, &rcWindow);
switch (method) {
case 1: //left
@@ -867,7 +864,6 @@ int CLUI_ShowFromBehindEdge() if (method) {
RECT rcScreen;
RECT rcWindow;
- int bordersize = 0;
//Need to be moved out of screen
//1. get work area rectangle
@@ -875,7 +871,7 @@ int CLUI_ShowFromBehindEdge() Docking_GetMonitorRectFromWindow(pcli->hwndContactList, &rcScreen);
//2. move out
- bordersize = wBehindEdgeBorderSize;
+ int bordersize = wBehindEdgeBorderSize;
GetWindowRect(pcli->hwndContactList, &rcWindow);
switch (method) {
case 1: //left
@@ -1171,8 +1167,8 @@ static int CLUI_DrawMenuBackGround(HWND hwnd, HDC hdc, int item, int state) HDC hdcBmp = CreateCompatibleDC(hdc);
HBITMAP oldbm = (HBITMAP)SelectObject(hdcBmp, dat->hMenuBackground);
int y = clRect.top, x = clRect.left, destw, desth;
- int maxx = (dat->MenuBmpUse & CLBF_TILEH) ? maxx = r1.right : x + 1;
- int maxy = (dat->MenuBmpUse & CLBF_TILEV) ? maxy = r1.bottom : y + 1;
+ int maxx = (dat->MenuBmpUse & CLBF_TILEH) ? r1.right : x + 1;
+ int maxy = (dat->MenuBmpUse & CLBF_TILEV) ? r1.bottom : y + 1;
switch (dat->MenuBmpUse & CLBM_TYPE) {
case CLB_STRETCH:
@@ -1307,11 +1303,10 @@ int CLUI_TestCursorOnBorders() RECT r;
POINT pt;
int k = 0, fx, fy;
- HWND hAux;
BOOL mouse_in_window = 0;
HWND gf = GetForegroundWindow();
GetCursorPos(&pt);
- hAux = WindowFromPoint(pt);
+ HWND hAux = WindowFromPoint(pt);
if (CLUI_CheckOwnedByClui(hAux)) {
if (g_bTransparentFlag) {
if (!bTransparentFocus && gf != hwnd) {
@@ -1726,8 +1721,7 @@ LRESULT CLUI::OnSizingMoving(UINT msg, WPARAM wParam, LPARAM lParam) else if (msg == WM_WINDOWPOSCHANGING) {
// Snaping if it is not in LayeredMode
- WINDOWPOS * wp;
- wp = (WINDOWPOS *)lParam;
+ WINDOWPOS *wp = (WINDOWPOS *)lParam;
CLUI::SnappingToEdge(wp);
return DefWindowProc(m_hWnd, msg, wParam, lParam);
}
@@ -1804,11 +1798,10 @@ LRESULT CLUI::OnSizingMoving(UINT msg, WPARAM wParam, LPARAM lParam) if (!g_CluiData.fLayered) {
HRGN hRgn1;
RECT r;
- int v, h;
int w = 10;
GetWindowRect(m_hWnd, &r);
- h = (r.right - r.left) > (w * 2) ? w : (r.right - r.left);
- v = (r.bottom - r.top) > (w * 2) ? w : (r.bottom - r.top);
+ int h = (r.right - r.left) > (w * 2) ? w : (r.right - r.left);
+ int v = (r.bottom - r.top) > (w * 2) ? w : (r.bottom - r.top);
h = (h < v) ? h : v;
hRgn1 = CreateRoundRectRgn(0, 0, (r.right - r.left + 1), (r.bottom - r.top + 1), h, h);
if ((db_get_b(NULL, "CLC", "RoundCorners", SETTING_ROUNDCORNERS_DEFAULT)) && (!CallService(MS_CLIST_DOCKINGISDOCKED, 0, 0)))
@@ -1829,14 +1822,6 @@ LRESULT CLUI::OnSizingMoving(UINT msg, WPARAM wParam, LPARAM lParam) SetProcessWorkingSetSize(GetCurrentProcess(), -1, -1);
}
return TRUE;
-
- case WM_WINDOWPOSCHANGING:
- WINDOWPOS *wp = (WINDOWPOS *)lParam;
- if (wp->flags&SWP_HIDEWINDOW && mutex_bAnimationInProgress)
- return 0;
- if (g_CluiData.fOnDesktop)
- wp->flags |= SWP_NOACTIVATE | SWP_NOZORDER;
- return DefWindowProc(m_hWnd, msg, wParam, lParam);
}
return 0;
}
@@ -2419,10 +2404,7 @@ LRESULT CLUI::OnListSizeChangeNotify(NMCLISTCONTROL * pnmc) }
else bNeedFixSizingRect = 0;
- if (!mutex_bDuringSizing)
- SetWindowPos(m_hWnd, 0, rcWindow.left, rcWindow.top, rcWindow.right - rcWindow.left, rcWindow.bottom - rcWindow.top, SWP_NOZORDER | SWP_NOACTIVATE);
- else
- SetWindowPos(m_hWnd, 0, rcWindow.left, rcWindow.top, rcWindow.right - rcWindow.left, rcWindow.bottom - rcWindow.top, SWP_NOZORDER | SWP_NOACTIVATE);
+ SetWindowPos(m_hWnd, 0, rcWindow.left, rcWindow.top, rcWindow.right - rcWindow.left, rcWindow.bottom - rcWindow.top, SWP_NOZORDER | SWP_NOACTIVATE);
nRequiredHeight = 0;
diff --git a/plugins/Clist_modern/src/modern_gettextasync.cpp b/plugins/Clist_modern/src/modern_gettextasync.cpp index 11d1c64bcf..b9bb6cdb72 100644 --- a/plugins/Clist_modern/src/modern_gettextasync.cpp +++ b/plugins/Clist_modern/src/modern_gettextasync.cpp @@ -87,7 +87,7 @@ static void gtaThreadProc(void*) break;
SHORTDATA *dat;
- if (mpChain.dat == NULL || (!IsBadReadPtr(mpChain.dat, sizeof(mpChain.dat)) && mpChain.dat->hWnd == data.hWnd))
+ if (mpChain.dat == NULL || (!IsBadReadPtr(mpChain.dat, sizeof(*mpChain.dat)) && mpChain.dat->hWnd == data.hWnd))
dat = &data;
else {
Sync(CLUI_SyncGetShortData, (WPARAM)mpChain.dat->hWnd, (LPARAM)&dat2);
diff --git a/plugins/Clist_modern/src/modern_skinbutton.cpp b/plugins/Clist_modern/src/modern_skinbutton.cpp index ac22ac2676..d843175566 100644 --- a/plugins/Clist_modern/src/modern_skinbutton.cpp +++ b/plugins/Clist_modern/src/modern_skinbutton.cpp @@ -95,7 +95,6 @@ int ModernSkinButtonUnloadModule(WPARAM, LPARAM) static int ModernSkinButtonPaintWorker(HWND hwnd, HDC whdc) { HDC hdc; - HBITMAP bmp, oldbmp; RECT rc; ModernSkinButtonCtrl* bct = (ModernSkinButtonCtrl *)GetWindowLongPtr(hwnd, GWLP_USERDATA); if (!bct) return 0; @@ -109,8 +108,8 @@ static int ModernSkinButtonPaintWorker(HWND hwnd, HDC whdc) hdc = CreateCompatibleDC(NULL); } GetClientRect(hwnd, &rc); - bmp = ske_CreateDIB32(rc.right, rc.bottom); - oldbmp = (HBITMAP)SelectObject(hdc, bmp); + HBITMAP bmp = ske_CreateDIB32(rc.right, rc.bottom); + HBITMAP oldbmp = (HBITMAP)SelectObject(hdc, bmp); if (!g_CluiData.fLayered) ske_BltBackImage(bct->hwnd, hdc, NULL); { @@ -282,20 +281,17 @@ static char *_skipblank(char * str) //str will be modified; static int _CallServiceStrParams(IN char * toParce, OUT int *Return) { - char * pszService; - char * param1 = NULL; - char * param2 = NULL; int paramCount = 0; int result = 0; - pszService = mir_strdup(toParce); + char *pszService = mir_strdup(toParce); if (!pszService) return 0; if (strlen(pszService) == 0) { mir_free(pszService); return 0; } - param2 = strrchr(pszService, '%'); + char *param2 = strrchr(pszService, '%'); if (param2) { paramCount++; @@ -304,7 +300,7 @@ static int _CallServiceStrParams(IN char * toParce, OUT int *Return) if (strlen(param2) == 0) param2 = NULL; } - param1 = strrchr(pszService, '%'); + char *param1 = strrchr(pszService, '%'); if (param1) { paramCount++; @@ -341,9 +337,8 @@ static int _CallServiceStrParams(IN char * toParce, OUT int *Return) } else { - int ret = 0; result = 1; - ret = CallService(pszService, (WPARAM)param1, (WPARAM)param2); + int ret = CallService(pszService, (WPARAM)param1, (WPARAM)param2); if (Return) *Return = ret; } mir_free(pszService); @@ -354,11 +349,10 @@ static int _CallServiceStrParams(IN char * toParce, OUT int *Return) static LRESULT CALLBACK ModernSkinButtonWndProc(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lParam) { ModernSkinButtonCtrl* bct = (msg != WM_NCCREATE) ? (ModernSkinButtonCtrl *)GetWindowLongPtr(hwndDlg, GWLP_USERDATA) : 0; - if (bct && bct->HandleService && IsBadStringPtrA(bct->HandleService, 255)) - bct->HandleService = NULL; - - if (bct) - if (bct->HandleService && ServiceExists(bct->HandleService)) { + if (bct) { + if (bct->HandleService && IsBadStringPtrA(bct->HandleService, 255)) + bct->HandleService = NULL; + else if (bct->HandleService && ServiceExists(bct->HandleService)) { HandleServiceParams MSG = { 0 }; MSG.hwnd = hwndDlg; MSG.msg = msg; @@ -367,6 +361,7 @@ static LRESULT CALLBACK ModernSkinButtonWndProc(HWND hwndDlg, UINT msg, WPARAM w int t = CallService(bct->HandleService, (WPARAM)&MSG, 0); if (MSG.handled) return t; } + } switch (msg) { case WM_NCCREATE: @@ -429,44 +424,50 @@ static LRESULT CALLBACK ModernSkinButtonWndProc(HWND hwndDlg, UINT msg, WPARAM w return DefWindowProc(hwndDlg, msg, wParam, lParam); case WM_CAPTURECHANGED: - bct->hover = 0; - bct->down = 0; - ModernSkinButtonPaintWorker(bct->hwnd, 0); + if (bct) { + bct->hover = 0; + bct->down = 0; + ModernSkinButtonPaintWorker(bct->hwnd, 0); + } break; case WM_MOUSEMOVE: - if (!bct->hover) { - SetCapture(bct->hwnd); - bct->hover = 1; - ModernSkinButtonPaintWorker(bct->hwnd, 0); - } - else { - POINT t = UNPACK_POINT(lParam); - ClientToScreen(bct->hwnd, &t); - if (WindowFromPoint(t) != bct->hwnd) - ReleaseCapture(); + if (bct) { + if (!bct->hover) { + SetCapture(bct->hwnd); + bct->hover = 1; + ModernSkinButtonPaintWorker(bct->hwnd, 0); + } + else { + POINT t = UNPACK_POINT(lParam); + ClientToScreen(bct->hwnd, &t); + if (WindowFromPoint(t) != bct->hwnd) + ReleaseCapture(); + } } return 0; case WM_LBUTTONDOWN: - bct->down = 1; - SetForegroundWindow(GetParent(bct->hwnd)); - ModernSkinButtonPaintWorker(bct->hwnd, 0); - if (bct->CommandService && IsBadStringPtrA(bct->CommandService, 255)) - bct->CommandService = NULL; - if (bct->fCallOnPress) { - if (bct->CommandService) { - if (!_CallServiceStrParams(bct->CommandService, NULL) && (bct->ValueDBSection && bct->ValueTypeDef)) - ModernSkinButtonToggleDBValue(bct->ValueDBSection, bct->ValueTypeDef); - } - bct->down = 0; - + if (bct) { + bct->down = 1; + SetForegroundWindow(GetParent(bct->hwnd)); ModernSkinButtonPaintWorker(bct->hwnd, 0); + if (bct->CommandService && IsBadStringPtrA(bct->CommandService, 255)) + bct->CommandService = NULL; + if (bct->fCallOnPress) { + if (bct->CommandService) { + if (!_CallServiceStrParams(bct->CommandService, NULL) && (bct->ValueDBSection && bct->ValueTypeDef)) + ModernSkinButtonToggleDBValue(bct->ValueDBSection, bct->ValueTypeDef); + } + bct->down = 0; + + ModernSkinButtonPaintWorker(bct->hwnd, 0); + } } return 0; case WM_LBUTTONUP: - if (bct->down) { + if (bct && bct->down) { ReleaseCapture(); bct->hover = 0; bct->down = 0; @@ -642,8 +643,7 @@ static HWND ModernSkinButtonCreateWindow(ModernSkinButtonCtrl * bct, HWND parent if (bct == NULL) return FALSE; { - TCHAR *UnicodeID; - UnicodeID = mir_a2u(bct->ID); + TCHAR *UnicodeID = mir_a2u(bct->ID); hwnd = CreateWindow(_T(MODERNSKINBUTTONCLASS), UnicodeID, WS_VISIBLE | WS_CHILD, bct->Left, bct->Top, bct->Right - bct->Left, bct->Bottom - bct->Top, parent, NULL, g_hInst, NULL); mir_free(UnicodeID); } diff --git a/plugins/Clist_modern/src/modern_skinengine.cpp b/plugins/Clist_modern/src/modern_skinengine.cpp index 9eab051c74..de1496b5ee 100644 --- a/plugins/Clist_modern/src/modern_skinengine.cpp +++ b/plugins/Clist_modern/src/modern_skinengine.cpp @@ -190,10 +190,9 @@ int IniParser::GetSkinFolder(IN const TCHAR * szFileName, OUT TCHAR * pszFolderN *pszPos = _T('\0'); _tcscpy(pszFolderName, szBuff); - TCHAR custom_folder[MAX_PATH]; - TCHAR cus[MAX_PATH]; + TCHAR custom_folder[MAX_PATH], cus[MAX_PATH]; TCHAR *b3; - _tcscpy(custom_folder, pszFolderName); + _tcsncpy(custom_folder, pszFolderName, MAX_PATH-1); b3 = custom_folder + _tcslen(custom_folder); while (b3 > custom_folder && *b3 != _T('\\')) { b3--; } *b3 = _T('\0'); @@ -533,16 +532,12 @@ int ske_ReleaseBufferDC(HDC hDC, int keepTime) BOOL ske_SetRgnOpaque(HDC memdc, HRGN hrgn, BOOL force) { - RGNDATA * rdata; - DWORD rgnsz; - DWORD d; - RECT *rect; if (g_CluiData.fDisableSkinEngine && !force) return TRUE; - rgnsz = GetRegionData(hrgn, 0, NULL); - rdata = (RGNDATA *)mir_alloc(rgnsz); + DWORD rgnsz = GetRegionData(hrgn, 0, NULL); + RGNDATA *rdata = (RGNDATA *)mir_alloc(rgnsz); GetRegionData(hrgn, rgnsz, rdata); - rect = (RECT *)rdata->Buffer; - for (d = 0; d < rdata->rdh.nCount; d++) { + RECT *rect = (RECT *)rdata->Buffer; + for (DWORD d = 0; d < rdata->rdh.nCount; d++) { ske_SetRectOpaque(memdc, &rect[d], force); } mir_free(rdata); @@ -555,12 +550,11 @@ BOOL ske_SetRectOpaque(HDC memdc, RECT *fr, BOOL force) int f = 0; BYTE * bits; BITMAP bmp; - HBITMAP hbmp; if (g_CluiData.fDisableSkinEngine && !force) return TRUE; - hbmp = (HBITMAP)GetCurrentObject(memdc, OBJ_BITMAP); + HBITMAP hbmp = (HBITMAP)GetCurrentObject(memdc, OBJ_BITMAP); GetObject(hbmp, sizeof(bmp), &bmp); if (bmp.bmPlanes != 1) @@ -613,7 +607,6 @@ static BOOL ske_SkinFillRectByGlyph(HDC hDest, HDC hSource, RECT *rFill, RECT *r mem2dc = CreateCompatibleDC(hDest); mem2bmp = ske_CreateDIB32(wr.right - wr.left, wr.bottom - wr.top); oldbmp = (HBITMAP)SelectObject(mem2dc, mem2bmp); - } if (drawMode == 0 || drawMode == 2) { @@ -642,15 +635,13 @@ static BOOL ske_SkinFillRectByGlyph(HDC hDest, HDC hSource, RECT *rFill, RECT *r return 1; } else if (mode == FM_TILE_VERT && (rGlyph->bottom - rGlyph->top > 0) && (rGlyph->right - rGlyph->left > 0)) { - HDC mem2dc; - HBITMAP mem2bmp, oldbmp; RECT wr; IntersectRect(&wr, rClip, rFill); if ((wr.bottom - wr.top)*(wr.right - wr.left) == 0) return 0; - mem2dc = CreateCompatibleDC(hDest); + HDC mem2dc = CreateCompatibleDC(hDest); //SetStretchBltMode(mem2dc, HALFTONE); - mem2bmp = ske_CreateDIB32(wr.right - wr.left, rGlyph->bottom - rGlyph->top); - oldbmp = (HBITMAP)SelectObject(mem2dc, mem2bmp); + HBITMAP mem2bmp = ske_CreateDIB32(wr.right - wr.left, rGlyph->bottom - rGlyph->top); + HBITMAP oldbmp = (HBITMAP)SelectObject(mem2dc, mem2bmp); if (!oldbmp) return 0; @@ -668,13 +659,10 @@ static BOOL ske_SkinFillRectByGlyph(HDC hDest, HDC hSource, RECT *rFill, RECT *r } if (drawMode == 0 || drawMode == 2) { if (drawMode == 0) { - - int dy; - dy = (wr.top - rFill->top) % h; + int dy = (wr.top - rFill->top) % h; if (dy >= 0) { - int ht; y = wr.top; - ht = (y + h - dy <= wr.bottom) ? (h - dy) : (wr.bottom - wr.top); + int ht = (y + h - dy <= wr.bottom) ? (h - dy) : (wr.bottom - wr.top); BitBlt(hDest, wr.left, y, w, ht, mem2dc, 0, dy, SRCCOPY); } @@ -702,16 +690,11 @@ static BOOL ske_SkinFillRectByGlyph(HDC hDest, HDC hSource, RECT *rFill, RECT *r } else { - int dy; - BLENDFUNCTION bf = { AC_SRC_OVER, 0, 255, AC_SRC_ALPHA }; - - dy = (wr.top - rFill->top) % h; - + int dy = (wr.top - rFill->top) % h; if (dy >= 0) { - int ht; y = wr.top; - ht = (y + h - dy <= wr.bottom) ? (h - dy) : (wr.bottom - wr.top); + int ht = (y + h - dy <= wr.bottom) ? (h - dy) : (wr.bottom - wr.top); ske_AlphaBlend(hDest, wr.left, y, w, ht, mem2dc, 0, dy, w, ht, bf); } @@ -730,18 +713,16 @@ static BOOL ske_SkinFillRectByGlyph(HDC hDest, HDC hSource, RECT *rFill, RECT *r DeleteDC(mem2dc); } else if (mode == FM_TILE_HORZ && (rGlyph->right - rGlyph->left > 0) && (rGlyph->bottom - rGlyph->top > 0) && (rFill->bottom - rFill->top) > 0 && (rFill->right - rFill->left) > 0) { - HDC mem2dc; RECT wr; - HBITMAP mem2bmp, oldbmp; int w = rGlyph->right - rGlyph->left; int h = rFill->bottom - rFill->top; IntersectRect(&wr, rClip, rFill); if ((wr.bottom - wr.top)*(wr.right - wr.left) == 0) return 0; h = wr.bottom - wr.top; - mem2dc = CreateCompatibleDC(hDest); + HDC mem2dc = CreateCompatibleDC(hDest); - mem2bmp = ske_CreateDIB32(w, h); - oldbmp = (HBITMAP)SelectObject(mem2dc, mem2bmp); + HBITMAP mem2bmp = ske_CreateDIB32(w, h); + HBITMAP oldbmp = (HBITMAP)SelectObject(mem2dc, mem2bmp); if (!oldbmp) return 0; @@ -756,13 +737,10 @@ static BOOL ske_SkinFillRectByGlyph(HDC hDest, HDC hSource, RECT *rFill, RECT *r ske_AlphaBlend(mem2dc, 0, -(wr.top - rFill->top), w, rFill->bottom - rFill->top, hSource, rGlyph->left, rGlyph->top, w, rGlyph->bottom - rGlyph->top, bf); if (drawMode == 0 || drawMode == 2) { if (drawMode == 0) { - - int dx; - dx = (wr.left - rFill->left) % w; + int dx = (wr.left - rFill->left) % w; if (dx >= 0) { - int wt; x = wr.left; - wt = (x + w - dx <= wr.right) ? (w - dx) : (wr.right - wr.left); + int wt = (x + w - dx <= wr.right) ? (w - dx) : (wr.right - wr.left); BitBlt(hDest, x, wr.top, wt, h, mem2dc, dx, 0, SRCCOPY); } x = wr.left + w - dx; @@ -774,8 +752,7 @@ static BOOL ske_SkinFillRectByGlyph(HDC hDest, HDC hSource, RECT *rFill, RECT *r BitBlt(hDest, x, wr.top, wr.right - x, h, mem2dc, 0, 0, SRCCOPY); } else { - int dx; - dx = (wr.left - rFill->left) % w; + int dx = (wr.left - rFill->left) % w; x = wr.left - dx; while (x < wr.right - w) { ske_AlphaBlend(hDest, x, wr.top, w, h, mem2dc, 0, 0, w, h, bf); @@ -788,12 +765,10 @@ static BOOL ske_SkinFillRectByGlyph(HDC hDest, HDC hSource, RECT *rFill, RECT *r } else { BLENDFUNCTION bf = { AC_SRC_OVER, 0, 255, AC_SRC_ALPHA }; - int dx; - dx = (wr.left - rFill->left) % w; + int dx = (wr.left - rFill->left) % w; if (dx >= 0) { - int wt; x = wr.left; - wt = (x + w - dx <= wr.right) ? (w - dx) : (wr.right - wr.left); + int wt = (x + w - dx <= wr.right) ? (w - dx) : (wr.right - wr.left); ske_AlphaBlend(hDest, x, wr.top, wt, h, mem2dc, dx, 0, wt, h, bf); } x = wr.left + w - dx; @@ -812,31 +787,26 @@ static BOOL ske_SkinFillRectByGlyph(HDC hDest, HDC hSource, RECT *rFill, RECT *r DeleteDC(mem2dc); } else if (mode == FM_TILE_BOTH && (rGlyph->right - rGlyph->left > 0) && (rGlyph->bottom - rGlyph->top > 0)) { - HDC mem2dc; int w = rGlyph->right - rGlyph->left; int x = 0; int h = rFill->bottom - rFill->top; - HBITMAP mem2bmp, oldbmp; RECT wr; IntersectRect(&wr, rClip, rFill); if ((wr.bottom - wr.top)*(wr.right - wr.left) == 0) return 0; - mem2dc = CreateCompatibleDC(hDest); - mem2bmp = ske_CreateDIB32(w, wr.bottom - wr.top); + HDC mem2dc = CreateCompatibleDC(hDest); + HBITMAP mem2bmp = ske_CreateDIB32(w, wr.bottom - wr.top); h = wr.bottom - wr.top; - oldbmp = (HBITMAP)SelectObject(mem2dc, mem2bmp); + HBITMAP oldbmp = (HBITMAP)SelectObject(mem2dc, mem2bmp); #ifdef _DEBUG if (!oldbmp) (NULL, "Tile bitmap not selected", "ERROR", MB_OK); #endif /// draw here { - //fill temp bitmap { - int y; - int dy; - dy = (wr.top - rFill->top) % (rGlyph->bottom - rGlyph->top); - y = -dy; + int dy = (wr.top - rFill->top) % (rGlyph->bottom - rGlyph->top); + int y = -dy; while (y < wr.bottom - wr.top) { ske_AlphaBlend(mem2dc, 0, y, w, rGlyph->bottom - rGlyph->top, hSource, rGlyph->left, rGlyph->top, w, rGlyph->bottom - rGlyph->top, bf); @@ -847,13 +817,10 @@ static BOOL ske_SkinFillRectByGlyph(HDC hDest, HDC hSource, RECT *rFill, RECT *r //end temp bitmap if (drawMode == 0 || drawMode == 2) { if (drawMode == 0) { - - int dx; - dx = (wr.left - rFill->left) % w; + int dx = (wr.left - rFill->left) % w; if (dx >= 0) { - int wt; x = wr.left; - wt = (x + w - dx <= wr.right) ? (w - dx) : (wr.right - wr.left); + int wt = (x + w - dx <= wr.right) ? (w - dx) : (wr.right - wr.left); BitBlt(hDest, x, wr.top, wt, h, mem2dc, dx, 0, SRCCOPY); } x = wr.left + w - dx; @@ -865,8 +832,7 @@ static BOOL ske_SkinFillRectByGlyph(HDC hDest, HDC hSource, RECT *rFill, RECT *r BitBlt(hDest, x, wr.top, wr.right - x, h, mem2dc, 0, 0, SRCCOPY); } else { - int dx; - dx = (wr.left - rFill->left) % w; + int dx = (wr.left - rFill->left) % w; x = wr.left - dx; while (x < wr.right - w) { ske_AlphaBlend(hDest, x, wr.top, w, h, mem2dc, 0, 0, w, h, bf); @@ -879,13 +845,10 @@ static BOOL ske_SkinFillRectByGlyph(HDC hDest, HDC hSource, RECT *rFill, RECT *r } else { BLENDFUNCTION bf = { AC_SRC_OVER, 0, 255, AC_SRC_ALPHA }; - - int dx; - dx = (wr.left - rFill->left) % w; + int dx = (wr.left - rFill->left) % w; if (dx >= 0) { - int wt; x = wr.left; - wt = (x + w - dx <= wr.right) ? (w - dx) : (wr.right - wr.left); + int wt = (x + w - dx <= wr.right) ? (w - dx) : (wr.right - wr.left); ske_AlphaBlend(hDest, x, wr.top, wt, h, mem2dc, dx, 0, wt, h, bf); } x = wr.left + w - dx; @@ -928,7 +891,7 @@ HBITMAP ske_CreateDIB32Point(int cx, int cy, void ** bits) UINT *ptPixels; HBITMAP DirectBitmap = CreateDIBSection(NULL, - (BITMAPINFO *)&RGB32BitsBITMAPINFO, + &RGB32BitsBITMAPINFO, DIB_RGB_COLORS, (void **)&ptPixels, NULL, 0); @@ -1051,10 +1014,7 @@ static int ske_DrawSkinObject(SKINDRAWREQUEST * preq, GLYPHOBJECT * pobj) { if (pobj->hGlyph && pobj->hGlyph != (HBITMAP)-1) { glyphdc = CreateCompatibleDC(preq->hDC); - if (!oldglyph) - oldglyph = (HBITMAP)SelectObject(glyphdc, pobj->hGlyph); - else - SelectObject(glyphdc, pobj->hGlyph); + oldglyph = (HBITMAP)SelectObject(glyphdc, pobj->hGlyph); } // Drawing { @@ -1293,9 +1253,8 @@ static int ske_DrawSkinObject(SKINDRAWREQUEST * preq, GLYPHOBJECT * pobj) } if (pobj->plTextList && pobj->plTextList->realCount > 0) { - int i; HFONT hOldFont; - for (i = 0; i < pobj->plTextList->realCount; i++) { + for (int i = 0; i < pobj->plTextList->realCount; i++) { GLYPHTEXT * gt = (GLYPHTEXT *)pobj->plTextList->items[i]; if (!gt->hFont) { if (gl_plSkinFonts && gl_plSkinFonts->realCount > 0) { @@ -1346,17 +1305,15 @@ static int ske_DrawSkinObject(SKINDRAWREQUEST * preq, GLYPHOBJECT * pobj) int ske_AddDescriptorToSkinObjectList(LPSKINOBJECTDESCRIPTOR lpDescr, SKINOBJECTSLIST* Skin) { - SKINOBJECTSLIST *sk; - if (Skin) sk = Skin; else sk = &g_SkinObjectList; - if (!sk) return 0; - if (mir_bool_strcmpi(lpDescr->szObjectID, "_HEADER_")) return 0; - {//check if new object allready presents. - DWORD i = 0; - for (i = 0; i < sk->dwObjLPAlocated; i++) - if (!mir_strcmp(sk->pObjects[i].szObjectID, lpDescr->szObjectID)) return 0; - } - if (sk->dwObjLPAlocated + 1 > sk->dwObjLPReserved) { // Realocated list to add space for new object - + SKINOBJECTSLIST *sk = (Skin ? Skin : &g_SkinObjectList); + if (mir_bool_strcmpi(lpDescr->szObjectID, "_HEADER_")) + return 0; + //check if new object allready presents. + for (DWORD i = 0; i < sk->dwObjLPAlocated; i++) + if (!mir_strcmp(sk->pObjects[i].szObjectID, lpDescr->szObjectID)) + return 0; + // Realocated list to add space for new object + if (sk->dwObjLPAlocated + 1 > sk->dwObjLPReserved) { sk->pObjects = (SKINOBJECTDESCRIPTOR*)mir_realloc(sk->pObjects, sizeof(SKINOBJECTDESCRIPTOR)*(sk->dwObjLPReserved + 1)/*alloc step*/); sk->dwObjLPReserved++; } @@ -1369,10 +1326,9 @@ int ske_AddDescriptorToSkinObjectList(LPSKINOBJECTDESCRIPTOR lpDescr, SKINOBJECT switch (lpDescr->bType) { case OT_GLYPHOBJECT: { - GLYPHOBJECT * obdat; GLYPHOBJECT * gl = (GLYPHOBJECT*)lpDescr->Data; sk->pObjects[sk->dwObjLPAlocated].Data = mir_alloc(sizeof(GLYPHOBJECT)); - obdat = (GLYPHOBJECT*)sk->pObjects[sk->dwObjLPAlocated].Data; + GLYPHOBJECT *obdat = (GLYPHOBJECT*)sk->pObjects[sk->dwObjLPAlocated].Data; memcpy(obdat, gl, sizeof(GLYPHOBJECT)); if (gl->szFileName != NULL) { obdat->szFileName = mir_strdup(gl->szFileName); @@ -1393,27 +1349,20 @@ int ske_AddDescriptorToSkinObjectList(LPSKINOBJECTDESCRIPTOR lpDescr, SKINOBJECT static LPSKINOBJECTDESCRIPTOR ske_FindObject(const char *szName, SKINOBJECTSLIST *Skin) { - // DWORD i; - SKINOBJECTSLIST* sk; - sk = (Skin == NULL) ? (&g_SkinObjectList) : Skin; + SKINOBJECTSLIST *sk = (Skin == NULL) ? (&g_SkinObjectList) : Skin; return skin_FindObjectByRequest((char *)szName, sk->pMaskList); } static LPSKINOBJECTDESCRIPTOR ske_FindObjectByMask(MODERNMASK *pModernMask, SKINOBJECTSLIST *Skin) { - // DWORD i; - SKINOBJECTSLIST* sk; - sk = (Skin == NULL) ? (&g_SkinObjectList) : Skin; - if (!sk->pMaskList) return NULL; - return skin_FindObjectByMask(pModernMask, sk->pMaskList); + SKINOBJECTSLIST *sk = (Skin == NULL) ? (&g_SkinObjectList) : Skin; + return sk->pMaskList ? skin_FindObjectByMask(pModernMask, sk->pMaskList) : NULL; } LPSKINOBJECTDESCRIPTOR ske_FindObjectByName(const char * szName, BYTE objType, SKINOBJECTSLIST* Skin) { - DWORD i; - SKINOBJECTSLIST* sk; - sk = (Skin == NULL) ? (&g_SkinObjectList) : Skin; - for (i = 0; i < sk->dwObjLPAlocated; i++) { + SKINOBJECTSLIST *sk = (Skin == NULL) ? (&g_SkinObjectList) : Skin; + for (DWORD i = 0; i < sk->dwObjLPAlocated; i++) { if (sk->pObjects[i].bType == objType || objType == OT_ANY) { if (!mir_strcmp(sk->pObjects[i].szObjectID, szName)) return &(sk->pObjects[i]); @@ -1436,11 +1385,7 @@ INT_PTR ske_Service_DrawGlyph(WPARAM wParam, LPARAM lParam) mir_cslock lck(cs_SkinChanging); - LPSKINOBJECTDESCRIPTOR pgl; - if (lParam) - pgl = ske_FindObjectByMask((MODERNMASK*)lParam, NULL); - else - pgl = ske_FindObject(preq->szObjectID, NULL); + LPSKINOBJECTDESCRIPTOR pgl = (lParam ? ske_FindObjectByMask((MODERNMASK*)lParam, NULL) : ske_FindObject(preq->szObjectID, NULL)); if (pgl == NULL) return -1; if (pgl->Data == NULL) return -1; @@ -1629,15 +1574,12 @@ static HBITMAP ske_LoadGlyphImage_TGA(const TCHAR *szFilename) } else { /* reading from resources IDR_TGA_DEFAULT_SKIN */ - DWORD size = 0; - BYTE * mem; - HGLOBAL hRes; HRSRC hRSrc = FindResourceA(g_hInst, MAKEINTRESOURCEA(IDR_TGA_DEFAULT_SKIN), "TGA"); if (!hRSrc) return NULL; - hRes = LoadResource(g_hInst, hRSrc); + HGLOBAL hRes = LoadResource(g_hInst, hRSrc); if (!hRes) return NULL; - size = SizeofResource(g_hInst, hRSrc); - mem = (BYTE*)LockResource(hRes); + DWORD size = SizeofResource(g_hInst, hRSrc); + BYTE *mem = (BYTE*)LockResource(hRes); if (size > sizeof(header)) { tga_header_t * header = (tga_header_t *)mem; if (header->pixel_depth == 32 && (header->image_type == 2 || header->image_type == 10)) { @@ -1751,13 +1693,11 @@ static HBITMAP ske_LoadGlyphImageByDecoders(const TCHAR *tszFileName) if (bmpInfo.bmBitsPixel == 32) ske_PreMultiplyChanells(hBitmap, f); else { - HDC dc24, dc32; - HBITMAP hBitmap32, obmp24, obmp32; - dc32 = CreateCompatibleDC(NULL); - dc24 = CreateCompatibleDC(NULL); - hBitmap32 = ske_CreateDIB32(bmpInfo.bmWidth, bmpInfo.bmHeight); - obmp24 = (HBITMAP)SelectObject(dc24, hBitmap); - obmp32 = (HBITMAP)SelectObject(dc32, hBitmap32); + HDC dc32 = CreateCompatibleDC(NULL); + HDC dc24 = CreateCompatibleDC(NULL); + HBITMAP hBitmap32 = ske_CreateDIB32(bmpInfo.bmWidth, bmpInfo.bmHeight); + HBITMAP obmp24 = (HBITMAP)SelectObject(dc24, hBitmap); + HBITMAP obmp32 = (HBITMAP)SelectObject(dc32, hBitmap32); BitBlt(dc32, 0, 0, bmpInfo.bmWidth, bmpInfo.bmHeight, dc24, 0, 0, SRCCOPY); SelectObject(dc24, obmp24); SelectObject(dc32, obmp32); @@ -1962,15 +1902,12 @@ static void ske_LinkSkinObjects(SKINOBJECTSLIST * pObjectList) } if (pObjectList->pTextList) { - int i; // LINK Text with objects - for (i = 0; i < pObjectList->pTextList->realCount; i++) { - GLYPHTEXT * glText; - GLYPHOBJECT *globj = NULL; - SKINOBJECTDESCRIPTOR * lpobj; - glText = (GLYPHTEXT *)pObjectList->pTextList->items[i]; - lpobj = ske_FindObjectByName(glText->szObjectName, OT_GLYPHOBJECT, pObjectList); + for (int i = 0; i < pObjectList->pTextList->realCount; i++) { + GLYPHTEXT *glText = (GLYPHTEXT *)pObjectList->pTextList->items[i]; + SKINOBJECTDESCRIPTOR *lpobj = ske_FindObjectByName(glText->szObjectName, OT_GLYPHOBJECT, pObjectList); mir_free_and_nil(glText->szObjectName); + GLYPHOBJECT *globj = NULL; if (lpobj) globj = (GLYPHOBJECT*)lpobj->Data; if (globj) { @@ -3017,10 +2954,7 @@ static int ske_ValidateSingleFrameImage(FRAMEWND * Frame, BOOL SkipBkgBlitting) } // copy image at hdc - if (SkipBkgBlitting) //image already at foreground - BitBlt(hdc, x1, y1, w1, h1, g_pCachedWindow->hImageDC, x + x1, y + y1, SRCCOPY); - else - BitBlt(hdc, x1, y1, w1, h1, g_pCachedWindow->hBackDC, x + x1, y + y1, SRCCOPY); + BitBlt(hdc, x1, y1, w1, h1, g_pCachedWindow->hBackDC, x + x1, y + y1, SRCCOPY); Frame->PaintCallbackProc(Frame->hWnd, hdc, &ru, Frame->UpdateRgn, Frame->dwFlags, Frame->PaintData); } diff --git a/plugins/Clist_modern/src/modern_skinselector.cpp b/plugins/Clist_modern/src/modern_skinselector.cpp index d0500d2c14..72389ddabe 100644 --- a/plugins/Clist_modern/src/modern_skinselector.cpp +++ b/plugins/Clist_modern/src/modern_skinselector.cpp @@ -35,8 +35,7 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. /// IMPLEMENTATIONS
char* ModernMaskToString(MODERNMASK *mm, char * buf, UINT bufsize)
{
- int i = 0;
- for (i = 0; i < (int)mm->dwParamCnt; i++) {
+ for (int i = 0; i < (int)mm->dwParamCnt; i++) {
if (mm->pl_Params[i].bMaskParamFlag) {
if (i>0)
mir_snprintf(buf, bufsize, "%s%%", buf);
@@ -51,9 +50,8 @@ char* ModernMaskToString(MODERNMASK *mm, char * buf, UINT bufsize) }
int SkinSelector_DeleteMask(MODERNMASK *mm)
{
- int i;
if (!mm->pl_Params) return 0;
- for (i = 0; i < (int)mm->dwParamCnt; i++) {
+ for (int i = 0; i < (int)mm->dwParamCnt; i++) {
free(mm->pl_Params[i].szName);
free(mm->pl_Params[i].szValue);
}
@@ -135,10 +133,9 @@ int AddModernMaskToList(MODERNMASK *mm, LISTMODERNMASK * mmTemplateList) int ClearMaskList(LISTMODERNMASK * mmTemplateList)
{
- int i;
if (!mmTemplateList) return -1;
if (!mmTemplateList->pl_Masks) return -1;
- for (i = 0; i < (int)mmTemplateList->dwMaskCnt; i++)
+ for (int i = 0; i < (int)mmTemplateList->dwMaskCnt; i++)
SkinSelector_DeleteMask(&(mmTemplateList->pl_Masks[i]));
mir_free_and_nil(mmTemplateList->pl_Masks);
mmTemplateList->dwMaskCnt = 0;
@@ -156,12 +153,10 @@ int DeleteMaskByItID(DWORD mID, LISTMODERNMASK *mmTemplateList) mmTemplateList->dwMaskCnt--;
}
else {
- MODERNMASK *newAlocation;
- DWORD i;
SkinSelector_DeleteMask(&(mmTemplateList->pl_Masks[mID]));
- newAlocation = (MODERNMASK *)mir_alloc(sizeof(MODERNMASK)*mmTemplateList->dwMaskCnt - 1);
+ MODERNMASK *newAlocation = (MODERNMASK *)mir_alloc(sizeof(MODERNMASK)*mmTemplateList->dwMaskCnt - 1);
memcpy(newAlocation, mmTemplateList->pl_Masks, sizeof(MODERNMASK)*(mID + 1));
- for (i = mID; i < mmTemplateList->dwMaskCnt - 1; i++) {
+ for (DWORD i = mID; i < mmTemplateList->dwMaskCnt - 1; i++) {
newAlocation[i] = mmTemplateList->pl_Masks[i + 1];
newAlocation[i].dwMaskId = i;
}
@@ -391,12 +386,11 @@ BOOL CompareModernMask(MODERNMASK *mmValue, MODERNMASK *mmTemplate) return res;
};
-BOOL CompareStrWithModernMask(char * szValue, MODERNMASK *mmTemplate)
+BOOL CompareStrWithModernMask(char *szValue, MODERNMASK *mmTemplate)
{
MODERNMASK mmValue = { 0 };
- int res;
if (!ParseToModernMask(&mmValue, szValue)) {
- res = CompareModernMask(&mmValue, mmTemplate);
+ BOOL res = CompareModernMask(&mmValue, mmTemplate);
SkinSelector_DeleteMask(&mmValue);
return res;
}
@@ -404,7 +398,7 @@ BOOL CompareStrWithModernMask(char * szValue, MODERNMASK *mmTemplate) };
// AddingMask
-int AddStrModernMaskToList(DWORD maskID, char * szStr, char * objectName, LISTMODERNMASK * mmTemplateList)
+int AddStrModernMaskToList(DWORD maskID, char *szStr, char *objectName, LISTMODERNMASK *mmTemplateList)
{
if (!szStr || !mmTemplateList) return -1;
@@ -418,24 +412,18 @@ int AddStrModernMaskToList(DWORD maskID, char * szStr, char * objectName, LISTMO return AddModernMaskToList(&mm, mmTemplateList);
}
-SKINOBJECTDESCRIPTOR * skin_FindObjectByMask(MODERNMASK *mm, LISTMODERNMASK * mmTemplateList)
+SKINOBJECTDESCRIPTOR *skin_FindObjectByMask(MODERNMASK *mm, LISTMODERNMASK *mmTemplateList)
{
- SKINOBJECTDESCRIPTOR * res = NULL;
- DWORD i = 0;
- while (i < mmTemplateList->dwMaskCnt) {
- if (CompareModernMask(mm, &(mmTemplateList->pl_Masks[i]))) {
- res = (SKINOBJECTDESCRIPTOR*)mmTemplateList->pl_Masks[i].pObject;
- return res;
- }
- i++;
- }
- return res;
+ for (DWORD i = 0;i < mmTemplateList->dwMaskCnt;i++)
+ if (CompareModernMask(mm, &(mmTemplateList->pl_Masks[i])))
+ return (SKINOBJECTDESCRIPTOR*)mmTemplateList->pl_Masks[i].pObject;
+
+ return NULL;
}
-SKINOBJECTDESCRIPTOR * skin_FindObjectByRequest(char * szValue, LISTMODERNMASK * mmTemplateList)
+SKINOBJECTDESCRIPTOR *skin_FindObjectByRequest(char * szValue, LISTMODERNMASK *mmTemplateList)
{
MODERNMASK mm = { 0 };
- SKINOBJECTDESCRIPTOR * res = NULL;
if (!mmTemplateList)
if (g_SkinObjectList.pMaskList)
mmTemplateList = g_SkinObjectList.pMaskList;
@@ -444,12 +432,12 @@ SKINOBJECTDESCRIPTOR * skin_FindObjectByRequest(char * szValue, LISTMODERNMASK if (!mmTemplateList) return NULL;
ParseToModernMask(&mm, szValue);
- res = skin_FindObjectByMask(&mm, mmTemplateList);
+ SKINOBJECTDESCRIPTOR *res = skin_FindObjectByMask(&mm, mmTemplateList);
SkinSelector_DeleteMask(&mm);
return res;
}
-TCHAR* GetParamNT(char * string, TCHAR * buf, int buflen, BYTE paramN, char Delim, BOOL SkipSpaces)
+TCHAR* GetParamNT(char *string, TCHAR *buf, int buflen, BYTE paramN, char Delim, BOOL SkipSpaces)
{
char *ansibuf = (char*)mir_alloc(buflen / sizeof(TCHAR));
GetParamN(string, ansibuf, buflen / sizeof(TCHAR), paramN, Delim, SkipSpaces);
@@ -570,7 +558,6 @@ int RegisterObjectByParce(char * ObjectName, char * Params) {
if (!ObjectName || !Params) return 0;
{
- int res = 0;
SKINOBJECTDESCRIPTOR obj = { 0 };
char buf[250];
obj.szObjectID = mir_strdup(ObjectName);
@@ -587,11 +574,10 @@ int RegisterObjectByParce(char * ObjectName, char * Params) GetParamN(Params, buf, SIZEOF(buf), 1, ',', 0);
if (mir_bool_strcmpi(buf, "Solid")) {
//Solid
- int r, g, b;
gl.Style = ST_BRUSH;
- r = atoi(GetParamN(Params, buf, SIZEOF(buf), 2, ',', 0));
- g = atoi(GetParamN(Params, buf, SIZEOF(buf), 3, ',', 0));
- b = atoi(GetParamN(Params, buf, SIZEOF(buf), 4, ',', 0));
+ int r = atoi(GetParamN(Params, buf, SIZEOF(buf), 2, ',', 0));
+ int g = atoi(GetParamN(Params, buf, SIZEOF(buf), 3, ',', 0));
+ int b = atoi(GetParamN(Params, buf, SIZEOF(buf), 4, ',', 0));
gl.dwAlpha = atoi(GetParamN(Params, buf, SIZEOF(buf), 5, ',', 0));
gl.dwColor = RGB(r, g, b);
}
@@ -636,7 +622,7 @@ int RegisterObjectByParce(char * ObjectName, char * Params) gl.Style = ST_SKIP;
}
obj.Data = ≷
- res = ske_AddDescriptorToSkinObjectList(&obj, NULL);
+ int res = ske_AddDescriptorToSkinObjectList(&obj, NULL);
mir_free_and_nil(obj.szObjectID);
mir_free_and_nil(gl.szFileName);
return res;
@@ -656,7 +642,7 @@ int SkinDrawGlyphMask(HDC hdc, RECT *rcSize, RECT *rcClip, MODERNMASK *ModernMas rq.hDC = hdc;
rq.rcDestRect = *rcSize;
rq.rcClipRect = *rcClip;
- strncpy(rq.szObjectID, "Masked draw", SIZEOF("Masked draw"));
+ strncpy(rq.szObjectID, "Masked draw", SIZEOF(rq.szObjectID)-1);
return ske_Service_DrawGlyph((WPARAM)&rq, (LPARAM)ModernMask);
}
@@ -678,7 +664,7 @@ int __inline SkinDrawWindowBack(HWND hwndIn, HDC hdc, RECT *rcClip, char * objec rq.hDC = hdc;
rq.rcDestRect = rc;
rq.rcClipRect = *rcClip;
- strncpy(rq.szObjectID, objectID, SIZEOF(rq.szObjectID));
+ strncpy(rq.szObjectID, objectID, SIZEOF(rq.szObjectID)-1);
///ske_Service_DrawGlyph((WPARAM)&rq,0); //$$$
return CallService(MS_SKIN_DRAWGLYPH, (WPARAM)&rq, 0);
}
diff --git a/plugins/Clist_modern/src/modern_statusbar.cpp b/plugins/Clist_modern/src/modern_statusbar.cpp index dea40a5ba3..365b594c0a 100644 --- a/plugins/Clist_modern/src/modern_statusbar.cpp +++ b/plugins/Clist_modern/src/modern_statusbar.cpp @@ -399,7 +399,7 @@ int ModernDrawStatusBarWorker(HWND hWnd, HDC hDC) p.fullWidth = w;
if (g_StatusBarData.sameWidth) {
ProtoWidth[i] = sw;
- SumWidth += w;
+ SumWidth += sw;
}
else {
ProtoWidth[i] = w;
@@ -854,7 +854,7 @@ LRESULT CALLBACK ModernStatusProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lPa bool first = true;
for (int pos = 0; pos < protoCount; pos++) {
int i = pcli->pfnGetAccountIndexByPos(pos);
- if (i < 0 && i >= protoCount)
+ if (i < 0 || i >= protoCount)
continue;
char protoF[sizeof(g_CluiData.protoFilter)];
|