summaryrefslogtreecommitdiff
path: root/plugins/Clist_modern
diff options
context:
space:
mode:
authorTobias Weimer <wishmaster51@googlemail.com>2014-12-16 23:12:06 +0000
committerTobias Weimer <wishmaster51@googlemail.com>2014-12-16 23:12:06 +0000
commitc7b7307fff2c3b3b01517018c65c7af82e7cd3aa (patch)
tree260b52dd0a97e9be25843abfcba1c0a38334f13b /plugins/Clist_modern
parente7dcf9d53cd6b8f9732c8fe7fb5bc96f77630863 (diff)
clist_modern: Some warnings fixed
git-svn-id: http://svn.miranda-ng.org/main/trunk@11480 1316c22d-e87f-b044-9b9b-93d7a3e3ba9c
Diffstat (limited to 'plugins/Clist_modern')
-rw-r--r--plugins/Clist_modern/src/CLUIFrames/cluiframes.cpp147
-rw-r--r--plugins/Clist_modern/src/modern_cachefuncs.cpp6
-rw-r--r--plugins/Clist_modern/src/modern_clcpaint.cpp51
-rw-r--r--plugins/Clist_modern/src/modern_rowtemplateopt.cpp2
-rw-r--r--plugins/Clist_modern/src/modern_skinengine.cpp87
5 files changed, 127 insertions, 166 deletions
diff --git a/plugins/Clist_modern/src/CLUIFrames/cluiframes.cpp b/plugins/Clist_modern/src/CLUIFrames/cluiframes.cpp
index e43d540057..afa6862cd6 100644
--- a/plugins/Clist_modern/src/CLUIFrames/cluiframes.cpp
+++ b/plugins/Clist_modern/src/CLUIFrames/cluiframes.cpp
@@ -737,16 +737,14 @@ static int CLUIFramesStoreFrameSettings(int Frameid)
static int CLUIFramesStoreAllFrames()
{
- int i;
if (_fCluiFramesModuleNotStarted) return -1;
- for (i = 0; i < g_nFramesCount; i++)
+ for (int i = 0; i < g_nFramesCount; i++)
CLUIFramesStoreFrameSettings(i);
return 0;
}
static int CLUIFramesGetalClientFrame(void)
{
- int i;
if (_fCluiFramesModuleNotStarted) return -1;
if (_nClientFrameId != eUnknownId) {
@@ -759,7 +757,7 @@ static int CLUIFramesGetalClientFrame(void)
}
}
- for (i = 0; i < g_nFramesCount; i++)
+ for (int i = 0; i < g_nFramesCount; i++)
if (g_pfwFrames[i].align == alClient) {
_nClientFrameId = i;
return i;
@@ -1301,11 +1299,9 @@ static int _us_DoSetFrameOptions(WPARAM wParam, LPARAM lParam)
//wparam = lparam = 0
static int _us_DoShowAllFrames(WPARAM, LPARAM)
{
- int i;
-
if (_fCluiFramesModuleNotStarted) return -1;
- for (i = 0; i < g_nFramesCount; i++)
+ for (int i = 0; i < g_nFramesCount; i++)
g_pfwFrames[i].visible = TRUE;
CLUIFramesOnClistResize((WPARAM)pcli->hwndContactList, 0);
return 0;
@@ -1314,11 +1310,9 @@ static int _us_DoShowAllFrames(WPARAM, LPARAM)
//wparam = lparam = 0
static int _us_DoShowTitles(WPARAM, LPARAM)
{
- int i;
-
if (_fCluiFramesModuleNotStarted) return -1;
- for (i = 0; i < g_nFramesCount; i++)
+ for (int i = 0; i < g_nFramesCount; i++)
g_pfwFrames[i].TitleBar.ShowTitleBar = TRUE;
CLUIFramesOnClistResize((WPARAM)pcli->hwndContactList, 0);
return 0;
@@ -1388,20 +1382,21 @@ static int _us_DoMoveFrame(WPARAM wParam, LPARAM lParam)
int pos = id2pos(wParam);
if (pos >= 0 && (int)pos < g_nFramesCount) {
- SortData *sd;
curpos = g_pfwFrames[pos].order;
curalign = g_pfwFrames[pos].align;
v = 0;
- sd = (SortData*)malloc(sizeof(SortData)*g_nFramesCount);
+ SortData *sd = (SortData*)malloc(sizeof(SortData)*g_nFramesCount);
memset(sd, 0, sizeof(SortData)*g_nFramesCount);
for (i = 0; i < g_nFramesCount; i++) {
if (g_pfwFrames[i].floating || (!g_pfwFrames[i].visible) || (g_pfwFrames[i].align != curalign)) { continue; };
sd[v].order = g_pfwFrames[i].order;
- sd[v].realpos = i;
- v++;
- };
- if (v == 0) { return 0; };
+ sd[v++].realpos = i;
+ }
+ if (v == 0) {
+ free(sd);
+ return 0;
+ }
qsort(sd, v, sizeof(SortData), sortfunc);
for (i = 0; i < v; i++)
g_pfwFrames[sd[i].realpos].order = i + 1; //to be sure that order is incremental
@@ -2000,7 +1995,6 @@ static int CLUIFrameMoveResize(const FRAMEWND *Frame)
static BOOL CLUIFramesFitInSize(void)
{
- int i;
int sumheight = 0;
int tbh = 0; // title bar height
int clientfrm;
@@ -2008,7 +2002,7 @@ static BOOL CLUIFramesFitInSize(void)
if (clientfrm != -1)
tbh = g_nTitleBarHeight*btoint(g_pfwFrames[clientfrm].TitleBar.ShowTitleBar);
- for (i = 0; i < g_nFramesCount; i++) {
+ for (int i = 0; i < g_nFramesCount; i++) {
if ((g_pfwFrames[i].align != alClient) && (!g_pfwFrames[i].floating) && (g_pfwFrames[i].visible) && (!g_pfwFrames[i].needhide)) {
sumheight += (g_pfwFrames[i].height) + (g_nTitleBarHeight*btoint(g_pfwFrames[i].TitleBar.ShowTitleBar)) + 2/*+btoint(Frames[i].UseBorder)*2*/;
if (sumheight>_nContactListHeight - tbh - 2) {
@@ -2023,12 +2017,11 @@ static BOOL CLUIFramesFitInSize(void)
}
int CLUIFrames_GetTotalHeight()
{
- int i;
- int sumheight = 0;
- RECT border;
if (pcli->hwndContactList == NULL) return 0;
- for (i = 0; i < g_nFramesCount; i++) {
+ int sumheight = 0;
+ RECT border;
+ for (int i = 0; i < g_nFramesCount; i++) {
if ((g_pfwFrames[i].visible) && (!g_pfwFrames[i].needhide) && (!g_pfwFrames[i].floating) && (pcli->hwndContactTree) && (g_pfwFrames[i].hWnd != pcli->hwndContactTree))
sumheight += (g_pfwFrames[i].height) + (g_nTitleBarHeight*btoint(g_pfwFrames[i].TitleBar.ShowTitleBar));
};
@@ -2050,26 +2043,25 @@ int CLUIFrames_GetTotalHeight()
int CLUIFramesGetMinHeight()
{
- int i, tbh, clientfrm, sumheight = 0;
+ int tbh = 0, sumheight = 0;
RECT border;
int allbord = 0;
if (pcli->hwndContactList == NULL) return 0;
// search for alClient frame and get the titlebar's height
- tbh = 0;
- clientfrm = CLUIFramesGetalClientFrame();
+ int clientfrm = CLUIFramesGetalClientFrame();
if (clientfrm != -1)
tbh = g_nTitleBarHeight*btoint(g_pfwFrames[clientfrm].TitleBar.ShowTitleBar);
- for (i = 0; i < g_nFramesCount; i++) {
+ for (int i = 0; i < g_nFramesCount; i++) {
if ((g_pfwFrames[i].align != alClient) && (g_pfwFrames[i].visible) && (!g_pfwFrames[i].needhide) && (!g_pfwFrames[i].floating)) {
RECT wsize;
GetWindowRect(g_pfwFrames[i].hWnd, &wsize);
sumheight += (wsize.bottom - wsize.top) + (g_nTitleBarHeight*btoint(g_pfwFrames[i].TitleBar.ShowTitleBar));
}
- };
+ }
GetBorderSize(pcli->hwndContactList, &border);
@@ -2129,7 +2121,7 @@ static int CLUIFramesResizeFrames(const RECT newsize)
for (i = 0; i < g_nFramesCount; i++) {
sdarray[i].order = g_pfwFrames[i].order;
sdarray[i].realpos = i;
- };
+ }
qsort(sdarray, g_nFramesCount, sizeof(SortData), sortfunc);
}
@@ -2272,25 +2264,33 @@ int CLUIFrames_ApplyNewSizes(int mode)
static int _us_DoUpdateFrame(WPARAM wParam, LPARAM lParam)
{
- if (_fCluiFramesModuleNotStarted) return -1;
- if (wParam == -1) { CLUIFramesOnClistResize((WPARAM)pcli->hwndContactList, 0); return 0; }
- if (lParam&FU_FMPOS) CLUIFramesOnClistResize((WPARAM)pcli->hwndContactList, 1);
+ if (_fCluiFramesModuleNotStarted)
+ return -1;
+ if (wParam == -1) {
+ CLUIFramesOnClistResize((WPARAM)pcli->hwndContactList, 0);
+ return 0;
+ }
+ if (lParam&FU_FMPOS)
+ CLUIFramesOnClistResize((WPARAM)pcli->hwndContactList, 1);
int pos = id2pos(wParam);
- if (pos < 0 || pos >= g_nFramesCount) { return -1; }
- if (lParam&FU_TBREDRAW) CLUIFramesForceUpdateTB(&g_pfwFrames[pos]);
- if (lParam&FU_FMREDRAW) CLUIFramesForceUpdateFrame(&g_pfwFrames[pos]);
+ if (pos < 0 || pos >= g_nFramesCount)
+ return -1;
+ if (lParam&FU_TBREDRAW)
+ CLUIFramesForceUpdateTB(&g_pfwFrames[pos]);
+ if (lParam&FU_FMREDRAW)
+ CLUIFramesForceUpdateFrame(&g_pfwFrames[pos]);
return 0;
}
int CLUIFrames_OnClistResize_mod(WPARAM, LPARAM mode)
{
- RECT nRect;
int tick;
GapBetweenFrames = db_get_dw(NULL, "CLUIFrames", "GapBetweenFrames", SETTING_GAPFRAMES_DEFAULT);
g_CluiData.nGapBetweenTitlebar = db_get_dw(NULL, "CLUIFrames", "GapBetweenTitleBar", SETTING_GAPTITLEBAR_DEFAULT);
if (_fCluiFramesModuleNotStarted) return -1;
+ RECT nRect;
GetClientRect(pcli->hwndContactList, &nRect);
nRect.left += g_CluiData.LeftClientMargin;
@@ -2391,12 +2391,12 @@ int SizeFramesByWindowRect(RECT *r, HDWP * PosBatch, int mode)
int CheckFramesPos(RECT *wr)
{
//CALLED only FROM MainWindow procedure at CLUI.c
- int i;
- if (_fCluiFramesModuleNotStarted) return -1;
+ if (_fCluiFramesModuleNotStarted)
+ return -1;
g_CluiData.nGapBetweenTitlebar = (int)db_get_dw(NULL, "CLUIFrames", "GapBetweenTitleBar", SETTING_GAPTITLEBAR_DEFAULT);
GapBetweenFrames = db_get_dw(NULL, "CLUIFrames", "GapBetweenFrames", SETTING_GAPFRAMES_DEFAULT);
- for (i = 0; i < g_nFramesCount; i++) {
+ for (int i = 0; i < g_nFramesCount; i++) {
int dx;
int dy;
dx = 0;//rcNewWindowRect.left-rcOldWindowRect.left;
@@ -2554,20 +2554,15 @@ int OnFrameTitleBarBackgroundChange(WPARAM, LPARAM)
void DrawBackGround(HWND hwnd, HDC mhdc, HBITMAP hBmpBackground, COLORREF bkColour, DWORD backgroundBmpUse)
{
- HDC hdcMem, hdc;
+ HDC hdc;
RECT clRect, *rcPaint;
int yScroll = 0;
- int y;
PAINTSTRUCT paintst = { 0 };
- HBITMAP hBmpOsb, hOldBmp;
- HFONT oFont;
-
- HFONT hFont;
//InvalidateRect(hwnd, 0, FALSE);
- hFont = (HFONT)SendMessage(hwnd, WM_GETFONT, 0, 0);
+ HFONT hFont = (HFONT)SendMessage(hwnd, WM_GETFONT, 0, 0);
if (mhdc) {
hdc = mhdc;
@@ -2581,31 +2576,27 @@ void DrawBackGround(HWND hwnd, HDC mhdc, HBITMAP hBmpBackground, COLORREF bkColo
GetClientRect(hwnd, &clRect);
if (rcPaint == NULL) rcPaint = &clRect;
if (rcPaint->right - rcPaint->left == 0 || rcPaint->top - rcPaint->bottom == 0) rcPaint = &clRect;
- y = -yScroll;
- hdcMem = CreateCompatibleDC(hdc);
- hBmpOsb = CreateBitmap(clRect.right, clRect.bottom, 1, GetDeviceCaps(hdc, BITSPIXEL), NULL);
- hOldBmp = (HBITMAP)SelectObject(hdcMem, hBmpOsb);
- oFont = (HFONT)SelectObject(hdcMem, hFont);
+ int y = -yScroll;
+ HDC hdcMem = CreateCompatibleDC(hdc);
+ HBITMAP hBmpOsb = CreateBitmap(clRect.right, clRect.bottom, 1, GetDeviceCaps(hdc, BITSPIXEL), NULL);
+ HBITMAP hOldBmp = (HBITMAP)SelectObject(hdcMem, hBmpOsb);
+ HFONT oFont = (HFONT)SelectObject(hdcMem, hFont);
SetBkMode(hdcMem, TRANSPARENT);
SetStretchBltMode(hdcMem, HALFTONE);
- { HBRUSH hBrush;
-
- hBrush = CreateSolidBrush(bkColour);
+ HBRUSH hBrush = CreateSolidBrush(bkColour);
FillRect(hdcMem, rcPaint, hBrush);
DeleteObject(hBrush);
if (hBmpBackground) {
BITMAP bmp;
- HDC hdcBmp;
int x, y;
- int maxx, maxy;
int destw, desth;
GetObject(hBmpBackground, sizeof(bmp), &bmp);
- hdcBmp = CreateCompatibleDC(hdcMem);
+ HDC hdcBmp = CreateCompatibleDC(hdcMem);
SelectObject(hdcBmp, hBmpBackground);
y = backgroundBmpUse&CLBF_SCROLL ? -yScroll : 0;
- maxx = backgroundBmpUse&CLBF_TILEH ? clRect.right : 1;
- maxy = backgroundBmpUse&CLBF_TILEV ? maxy = rcPaint->bottom : y + 1;
+ int maxx = backgroundBmpUse&CLBF_TILEH ? clRect.right : 1;
+ int maxy = backgroundBmpUse&CLBF_TILEV ? maxy = rcPaint->bottom : y + 1;
switch (backgroundBmpUse&CLBM_TYPE) {
case CLB_STRETCH:
if (backgroundBmpUse&CLBF_PROPORTIONAL) {
@@ -2656,7 +2647,6 @@ void DrawBackGround(HWND hwnd, HDC mhdc, HBITMAP hBmpBackground, COLORREF bkColo
}
DeleteDC(hdcBmp);
}
- }
{
@@ -2677,23 +2667,20 @@ void DrawBackGround(HWND hwnd, HDC mhdc, HBITMAP hBmpBackground, COLORREF bkColo
int DrawTitleBar(HDC hdcMem2, RECT *rect, int Frameid)
{
- int pos;
BOOL bThemed = FALSE;
HDC hdcMem;
- HFONT hoTTBFont;
RECT rc = *rect;
- HBRUSH hBack, hoBrush;
HBITMAP b1 = NULL, b2 = NULL;
hdcMem = CreateCompatibleDC(hdcMem2);
SetBkMode(hdcMem, TRANSPARENT);
- hoTTBFont = (HFONT)SelectObject(hdcMem, _hTitleBarFont);
+ HFONT hoTTBFont = (HFONT)SelectObject(hdcMem, _hTitleBarFont);
ske_ResetTextEffect(hdcMem);
ske_ResetTextEffect(hdcMem2);
- hBack = GetSysColorBrush(COLOR_3DFACE);
- hoBrush = (HBRUSH)SelectObject(hdcMem, hBack);
+ HBRUSH hBack = GetSysColorBrush(COLOR_3DFACE);
+ HBRUSH hoBrush = (HBRUSH)SelectObject(hdcMem, hBack);
- pos = id2pos(Frameid);
+ int pos = id2pos(Frameid);
if (pos >= 0 && pos < g_nFramesCount) {
GetClientRect(g_pfwFrames[pos].TitleBar.hwnd, &rc);
@@ -2858,26 +2845,10 @@ static LRESULT CALLBACK CLUIFrameTitleBarProc(HWND hwnd, UINT msg, WPARAM wParam
// Frames[Frameid].TitleBar.hmenu = hmenu;
AppendMenu(hmenu, MF_STRING | MF_DISABLED | MF_GRAYED, 15, g_pfwFrames[framepos].name);
AppendMenu(hmenu, MF_SEPARATOR, 16, _T(""));
-
- if (g_pfwFrames[framepos].Locked) {
- AppendMenu(hmenu, MF_STRING | MF_CHECKED, frame_menu_lock, TranslateT("Lock frame"));
- }
- else { AppendMenu(hmenu, MF_STRING, frame_menu_lock, TranslateT("Lock frame")); };
-
- if (g_pfwFrames[framepos].visible) {
- AppendMenu(hmenu, MF_STRING | MF_CHECKED, frame_menu_visible, TranslateT("Visible"));
- }
- else { AppendMenu(hmenu, MF_STRING, frame_menu_visible, TranslateT("Visible")); };
-
- if (g_pfwFrames[framepos].TitleBar.ShowTitleBar) {
- AppendMenu(hmenu, MF_STRING | MF_CHECKED, frame_menu_showtitlebar, TranslateT("Show title bar"));
- }
- else { AppendMenu(hmenu, MF_STRING, frame_menu_showtitlebar, TranslateT("Show title bar")); };
-
- if (g_pfwFrames[framepos].floating) {
- AppendMenu(hmenu, MF_STRING | MF_CHECKED, frame_menu_floating, TranslateT("Floating"));
- }
- else { AppendMenu(hmenu, MF_STRING, frame_menu_floating, TranslateT("Floating")); };
+ AppendMenu(hmenu, g_pfwFrames[framepos].Locked ? (MF_STRING | MF_CHECKED) : MF_STRING, frame_menu_lock, TranslateT("Lock frame"));
+ AppendMenu(hmenu, g_pfwFrames[framepos].visible ? (MF_STRING | MF_CHECKED) : MF_STRING, frame_menu_visible, TranslateT("Visible"));
+ AppendMenu(hmenu, g_pfwFrames[framepos].TitleBar.ShowTitleBar ? (MF_STRING | MF_CHECKED) : MF_STRING, frame_menu_showtitlebar, TranslateT("Show title bar"));
+ AppendMenu(hmenu, g_pfwFrames[framepos].floating ? (MF_STRING | MF_CHECKED) : MF_STRING, frame_menu_floating, TranslateT("Floating"));
}
TrackPopupMenu(hmenu, TPM_LEFTALIGN, pt.x, pt.y, 0, hwnd, 0);
@@ -2910,8 +2881,8 @@ static LRESULT CALLBACK CLUIFrameTitleBarProc(HWND hwnd, UINT msg, WPARAM wParam
POINT pt;
GetCursorPos(&pt);
g_pfwFrames[framepos].TitleBar.oldpos = pt;
- };
- };
+ }
+ }
//ScreenToClient(Frames[framepos].ContainerWnd,&Frames[framepos].TitleBar.oldpos);
diff --git a/plugins/Clist_modern/src/modern_cachefuncs.cpp b/plugins/Clist_modern/src/modern_cachefuncs.cpp
index 4b808d886a..fd8b30654c 100644
--- a/plugins/Clist_modern/src/modern_cachefuncs.cpp
+++ b/plugins/Clist_modern/src/modern_cachefuncs.cpp
@@ -185,9 +185,6 @@ void CSmileyString::DestroySmileyList()
void CSmileyString::ReplaceSmileys(struct SHORTDATA *dat, ClcCacheEntry *pdnce, TCHAR * szText, BOOL replace_smileys)
{
- SMADD_BATCHPARSE2 sp = { 0 };
- SMADD_BATCHPARSERES *spr;
-
int last_pos = 0;
iMaxSmileyHeight = 0;
@@ -199,6 +196,7 @@ void CSmileyString::ReplaceSmileys(struct SHORTDATA *dat, ClcCacheEntry *pdnce,
int text_size = (int)_tcslen(szText);
// Call service for the first time to see if needs to be used...
+ SMADD_BATCHPARSE2 sp = { 0 };
sp.cbSize = sizeof(sp);
if (dat->text_use_protocol_smileys) {
@@ -215,7 +213,7 @@ void CSmileyString::ReplaceSmileys(struct SHORTDATA *dat, ClcCacheEntry *pdnce,
sp.str = szText;
sp.flag = SAFL_TCHAR;
- spr = (SMADD_BATCHPARSERES*)CallService(MS_SMILEYADD_BATCHPARSE, 0, (LPARAM)&sp);
+ SMADD_BATCHPARSERES *spr = (SMADD_BATCHPARSERES*)CallService(MS_SMILEYADD_BATCHPARSE, 0, (LPARAM)&sp);
// Did not find a simley
if (spr == NULL || (INT_PTR)spr == CALLSERVICE_NOTFOUND)
diff --git a/plugins/Clist_modern/src/modern_clcpaint.cpp b/plugins/Clist_modern/src/modern_clcpaint.cpp
index 5b968952ed..f70227591f 100644
--- a/plugins/Clist_modern/src/modern_clcpaint.cpp
+++ b/plugins/Clist_modern/src/modern_clcpaint.cpp
@@ -556,11 +556,10 @@ void CLCPaint::_AddParamShort(MODERNMASK *mpModernMask, DWORD dwParamIndex, DWO
AddParam(mpModernMask, HASH[dwParamIndex], HASHTEXT[dwValueIndex], HASH[dwValueIndex]);
}
-MODERNMASK* CLCPaint::_GetCLCContactRowBackModernMask(ClcGroup *group, ClcContact *Drawing, int indent, int index, BOOL selected, BOOL hottrack, ClcData *dat)
+MODERNMASK *CLCPaint::_GetCLCContactRowBackModernMask(ClcGroup *group, ClcContact *Drawing, int indent, int index, BOOL selected, BOOL hottrack, ClcData *dat)
{
- MODERNMASK *mpModernMask = NULL;
char buf[BUF2SIZE] = { 0 };
- mpModernMask = (MODERNMASK*)mir_calloc(sizeof(MODERNMASK));
+ MODERNMASK *mpModernMask = (MODERNMASK*)mir_calloc(sizeof(MODERNMASK));
_AddParamShort(mpModernMask, hi_Module, hi_CL);
_AddParamShort(mpModernMask, hi_ID, hi_Row);
@@ -669,13 +668,11 @@ MODERNMASK* CLCPaint::_GetCLCContactRowBackModernMask(ClcGroup *group, ClcContac
void CLCPaint::_RTLRect(RECT *rect, int width)
{
- int left, right;
if (!rect) return;
- left = (width)-rect->right;
- right = (width)-rect->left;
+ int left = (width)-rect->right;
+ int right = (width)-rect->left;
rect->left = left;//-offset;
rect->right = right;//-offset;
- return;
}
void CLCPaint::_PaintRowItemsEx(HWND hwnd, HDC hdcMem, ClcData *dat, ClcContact *Drawing, RECT row_rc, RECT free_row_rc, int selected, int hottrack)
@@ -1701,14 +1698,9 @@ void CLCPaint::_DrawLines(HWND hWnd, ClcData *dat, int paintMode, RECT* rcPaint,
// Draw line, if needed
if (y > rcPaint->top - dat->row_heights[line_num]) {
- int selected;
- int hottrack;
- int left_pos;
- int right_pos;
int free_row_height;
RECT row_rc;
RECT free_row_rc;
- MODERNMASK *mpRequest = NULL;
RECT rc;
// Get item to draw
@@ -1733,10 +1725,10 @@ void CLCPaint::_DrawLines(HWND hWnd, ClcData *dat, int paintMode, RECT* rcPaint,
RowHeight_CalcRowHeight(dat, hWnd, Drawing, line_num);
// Init settings
- selected = ((line_num == dat->selection) && (dat->hwndRenameEdit != NULL || dat->showSelAlways || dat->exStyle&CLS_EX_SHOWSELALWAYS || is_foreground) && Drawing->type != CLCIT_DIVIDER);
- hottrack = dat->exStyle&CLS_EX_TRACKSELECT && Drawing->type != CLCIT_DIVIDER && dat->iHotTrack == line_num;
- left_pos = clRect.left + dat->leftMargin + indent * dat->groupIndent + subident;
- right_pos = dat->rightMargin; // Border
+ int selected = ((line_num == dat->selection) && (dat->hwndRenameEdit != NULL || dat->showSelAlways || dat->exStyle&CLS_EX_SHOWSELALWAYS || is_foreground) && Drawing->type != CLCIT_DIVIDER);
+ int hottrack = dat->exStyle&CLS_EX_TRACKSELECT && Drawing->type != CLCIT_DIVIDER && dat->iHotTrack == line_num;
+ int left_pos = clRect.left + dat->leftMargin + indent * dat->groupIndent + subident;
+ int right_pos = dat->rightMargin; // Border
SetRect(&row_rc, clRect.left, y, clRect.right, y + dat->row_heights[line_num]);
free_row_rc = row_rc;
@@ -1770,6 +1762,7 @@ void CLCPaint::_DrawLines(HWND hWnd, ClcData *dat, int paintMode, RECT* rcPaint,
else
SkinDrawGlyph(pc.hdcMem, &row_rc, rcPaint, "CL,ID=GreyAlternate");
}
+ MODERNMASK *mpRequest = NULL;
if (!(paintMode & (DM_CLASSIC | DM_CONTROL))) {
// Row background
if (!(paintMode & DM_CONTROL)) { //Build mpRequest string
@@ -1866,20 +1859,22 @@ void CLCPaint::_DrawLines(HWND hWnd, ClcData *dat, int paintMode, RECT* rcPaint,
Drawing->pos_check = rc;
}
_PaintRowItems(hWnd, pc.hdcMem, dat, Drawing, row_rc, free_row_rc, left_pos, right_pos, selected, hottrack, rcPaint);
- if (mpRequest && !dat->force_in_dialog) {
- free(mpRequest->pl_Params[1].szValue);
- mpRequest->pl_Params[1].szValue = strdupn("Ovl", 3);
- mpRequest->pl_Params[1].dwValueHash = mod_CalcHash("Ovl");
- {
- RECT mrc = row_rc;
- if (Drawing->type == CLCIT_GROUP &&
- Drawing->group->parent->groupId == 0 &&
- Drawing->group->parent->cl.items[0] != Drawing) {
- mrc.top += dat->row_before_group_space;
+ if (mpRequest) {
+ if (!dat->force_in_dialog) {
+ free(mpRequest->pl_Params[1].szValue);
+ mpRequest->pl_Params[1].szValue = strdupn("Ovl", 3);
+ mpRequest->pl_Params[1].dwValueHash = mod_CalcHash("Ovl");
+ {
+ RECT mrc = row_rc;
+ if (Drawing->type == CLCIT_GROUP &&
+ Drawing->group->parent->groupId == 0 &&
+ Drawing->group->parent->cl.items[0] != Drawing) {
+ mrc.top += dat->row_before_group_space;
+ }
+ SkinDrawGlyphMask(pc.hdcMem, &mrc, rcPaint, mpRequest);
}
- SkinDrawGlyphMask(pc.hdcMem, &mrc, rcPaint, mpRequest);
+ SkinSelector_DeleteMask(mpRequest);
}
- SkinSelector_DeleteMask(mpRequest);
mir_free(mpRequest);
}
}
diff --git a/plugins/Clist_modern/src/modern_rowtemplateopt.cpp b/plugins/Clist_modern/src/modern_rowtemplateopt.cpp
index bfb0fd386f..dbdb9b9ecc 100644
--- a/plugins/Clist_modern/src/modern_rowtemplateopt.cpp
+++ b/plugins/Clist_modern/src/modern_rowtemplateopt.cpp
@@ -326,7 +326,7 @@ void RefreshTree(HWND hwndDlg, HTREEITEM hti)
else
mir_sntprintf(buf, SIZEOF(buf), TranslateT("%s, contain %s"), TranslateTS(types[cell->type]), cell->cont != TC_COL ? TranslateT("columns") : TranslateT("lines"));
}
- if (cell->layer) _tcsncat(buf, TranslateT(" layered"), SIZEOF(buf));
+ if (cell->layer) _tcsncat_s(buf, TranslateT(" layered"),_TRUNCATE);
tvi.mask = TVIF_HANDLE | TVIF_TEXT;
tvi.pszText = buf;
TreeView_SetItem(htree, &tvi);
diff --git a/plugins/Clist_modern/src/modern_skinengine.cpp b/plugins/Clist_modern/src/modern_skinengine.cpp
index 3860214cc3..c0b522e461 100644
--- a/plugins/Clist_modern/src/modern_skinengine.cpp
+++ b/plugins/Clist_modern/src/modern_skinengine.cpp
@@ -2416,14 +2416,14 @@ static int ske_AlphaTextOut(HDC hDC, LPCTSTR lpString, int nCount, RECT *lpRect,
BITMAP bmpDest;
GetObject(hDestBitmap, sizeof(BITMAP), &bmpDest);
- BOOL destHasNotDIB = FALSE;
- BYTE *pDestBits = NULL;
- if (bmpDest.bmBits == NULL) {
- destHasNotDIB = TRUE;
+ bool destHasNotDIB = (bmpDest.bmBits == NULL);
+ BYTE *pDestBits;
+ if (destHasNotDIB) {
pDestBits = (BYTE*)malloc(bmpDest.bmHeight * bmpDest.bmWidthBytes);
GetBitmapBits(hDestBitmap, bmpDest.bmHeight*bmpDest.bmWidthBytes, pDestBits);
}
- else pDestBits = (BYTE*)bmpDest.bmBits;
+ else
+ pDestBits = (BYTE*)bmpDest.bmBits;
// Creating offscreen buffer
HDC hOffscreenDC = CreateCompatibleDC(hDC);
@@ -2436,8 +2436,11 @@ static int ske_AlphaTextOut(HDC hDC, LPCTSTR lpString, int nCount, RECT *lpRect,
RECT workRect = *lpRect;
int workRectWidth = workRect.right - workRect.left;
int workRectHeight = workRect.bottom - workRect.top;
- if (workRectWidth <= 0 || workRectHeight <= 0)
+ if (workRectWidth <= 0 || workRectHeight <= 0) {
+ if(destHasNotDIB)
+ mir_free(pDestBits);
return 0;
+ }
SIZE textSize;
GetTextExtentPoint32(hOffscreenDC, lpString, nCount, &textSize);
@@ -2534,10 +2537,7 @@ static int ske_AlphaTextOut(HDC hDC, LPCTSTR lpString, int nCount, RECT *lpRect,
DWORD width = textSize.cx;
DWORD heigh = textSize.cy;
- BYTE *pDestScanLine;
- BYTE *pBufScanLine;
- BYTE *pix;
- BYTE *bufpix;
+ BYTE *pDestScanLine, *pBufScanLine, *pix, *bufpix;
BYTE al = 255 - ((BYTE)(ARGBcolor >> 24));
BYTE r = GetRValue(ARGBcolor);
@@ -2728,9 +2728,12 @@ BOOL ske_ImageList_DrawEx(HIMAGELIST himl, int i, HDC hdcDst, int x, int y, int
return ImageList_DrawEx(himl, i, hdcDst, x, y, dx, dy, rgbBk, rgbFg, fStyle);
BYTE alpha;
- if (fStyle&ILD_BLEND25) alpha = 64;
- else if (fStyle&ILD_BLEND50) alpha = 128;
- else alpha = 255;
+ if (fStyle&ILD_BLEND25)
+ alpha = 64;
+ else if (fStyle&ILD_BLEND50)
+ alpha = 128;
+ else
+ alpha = 255;
HICON hIcon = ske_ImageList_GetIcon(himl, i);
if (hIcon == NULL)
@@ -2756,22 +2759,14 @@ BOOL ske_DrawIconEx(HDC hdcDst, int xLeft, int yTop, HICON hIcon, int cxWidth, i
ICONINFO ici;
BYTE alpha = (BYTE)((diFlags & 0xFF000000) >> 24);
-
- HDC imDC;
- HBITMAP oldBmp, imBmp, tBmp = NULL;
+ HBITMAP tBmp = NULL;
BITMAP imbt, immaskbt;
- BYTE * imbits;
- BYTE * imimagbits;
- BYTE * immaskbits;
+ BYTE *imbits, *imimagbits, *immaskbits;
DWORD cx, cy, icy;
BYTE *t1, *t2, *t3;
- BOOL NoDIBImage = FALSE;
//lockimagelist
- BYTE hasmask = FALSE;
- BYTE no32bit = FALSE;
- BYTE noMirrorMask = FALSE;
- BYTE hasalpha = FALSE;
+ BYTE hasmask = FALSE, no32bit = FALSE, noMirrorMask = FALSE, hasalpha = FALSE;
alpha = alpha ? alpha : 255;
if (g_CluiData.fDisableSkinEngine && !(diFlags & 0x80))
@@ -2790,27 +2785,27 @@ BOOL ske_DrawIconEx(HDC hdcDst, int xLeft, int yTop, HICON hIcon, int cxWidth, i
cy = imbt.bmHeight;
if (imbt.bmBitsPixel != 32) {
- HBITMAP otBmp = NULL;
no32bit = TRUE;
HDC tempDC1 = CreateCompatibleDC(hdcDst);
tBmp = ske_CreateDIB32(imbt.bmWidth, imbt.bmHeight);
if (tBmp) {
GetObject(tBmp, sizeof(BITMAP), &imbt);
- otBmp = (HBITMAP)SelectObject(tempDC1, tBmp);
+ HBITMAP otBmp = (HBITMAP)SelectObject(tempDC1, tBmp);
DrawIconEx(tempDC1, 0, 0, hIcon, imbt.bmWidth, imbt.bmHeight, istepIfAniCur, hbrFlickerFreeDraw, DI_IMAGE);
noMirrorMask = TRUE;
+ SelectObject(tempDC1, otBmp);
}
- SelectObject(tempDC1, otBmp);
DeleteDC(tempDC1);
}
-
- if (imbt.bmBits == NULL) {
- NoDIBImage = TRUE;
+
+ bool NoDIBImage = (imbt.bmBits == NULL);
+ if (NoDIBImage) {
imimagbits = (BYTE*)malloc(cy*imbt.bmWidthBytes);
GetBitmapBits(ici.hbmColor, cy*imbt.bmWidthBytes, (void*)imimagbits);
}
- else imimagbits = (BYTE*)imbt.bmBits;
+ else
+ imimagbits = (BYTE*)imbt.bmBits;
if (immaskbt.bmBits == NULL) {
immaskbits = (BYTE*)malloc(cy*immaskbt.bmWidthBytes);
@@ -2820,19 +2815,17 @@ BOOL ske_DrawIconEx(HDC hdcDst, int xLeft, int yTop, HICON hIcon, int cxWidth, i
icy = imbt.bmHeight;
cx = imbt.bmWidth;
- imDC = CreateCompatibleDC(hdcDst);
- imBmp = ske_CreateDIB32Point(cx, icy, (void**)&imbits);
- oldBmp = (HBITMAP)SelectObject(imDC, imBmp);
+ HDC imDC = CreateCompatibleDC(hdcDst);
+ HBITMAP imBmp = ske_CreateDIB32Point(cx, icy, (void**)&imbits);
+ HBITMAP oldBmp = (HBITMAP)SelectObject(imDC, imBmp);
if (imbits != NULL && imimagbits != NULL && immaskbits != NULL) {
- int x; int y;
- int bottom, right, top, h;
- int mwb, mwb2;
- mwb = immaskbt.bmWidthBytes;
- mwb2 = imbt.bmWidthBytes;
- bottom = icy;
- right = cx;
- top = 0;
- h = icy;
+ int x, y;
+ int mwb = immaskbt.bmWidthBytes;
+ int mwb2 = imbt.bmWidthBytes;
+ int bottom = icy;
+ int right = cx;
+ int top = 0;
+ int h = icy;
for (y = top; (y < bottom) && !hasmask; y++) {
t1 = immaskbits + y*mwb;
for (x = 0; (x < mwb) && !hasmask; x++)
@@ -3633,7 +3626,6 @@ static void ske_AddParseSkinFont(char * szFontID, char * szDefineString)
if (!sf)
return;
- char buf[255];
LOGFONTA logfont = { 0 };
logfont.lfCharSet = DEFAULT_CHARSET;
logfont.lfOutPrecision = OUT_DEFAULT_PRECIS;
@@ -3641,6 +3633,7 @@ static void ske_AddParseSkinFont(char * szFontID, char * szDefineString)
logfont.lfQuality = DEFAULT_QUALITY;
logfont.lfPitchAndFamily = DEFAULT_PITCH | FF_DONTCARE;
+ char buf[255];
strncpy(logfont.lfFaceName, GetParamN(szDefineString, buf, sizeof(buf), 0, ',', TRUE), 32);
logfont.lfHeight = atoi(GetParamN(szDefineString, buf, sizeof(buf), 1, ',', TRUE));
if (logfont.lfHeight < 0) {
@@ -3661,8 +3654,12 @@ static void ske_AddParseSkinFont(char * szFontID, char * szDefineString)
if (!gl_plSkinFonts)
gl_plSkinFonts = List_Create(0, 1);
if (gl_plSkinFonts)
- List_Insert(gl_plSkinFonts, (void*)sf, gl_plSkinFonts->realCount);
+ List_Insert(gl_plSkinFonts, sf, gl_plSkinFonts->realCount);
+ else
+ mir_free(sf);
}
+ else
+ mir_free(sf);
}
/*