summaryrefslogtreecommitdiff
path: root/plugins/Clist_modern
diff options
context:
space:
mode:
authorGeorge Hazan <george.hazan@gmail.com>2015-04-20 13:54:07 +0000
committerGeorge Hazan <george.hazan@gmail.com>2015-04-20 13:54:07 +0000
commit418db2636cc5b4e519f281c16a5e0496b80dc8d1 (patch)
treee374342da6bd1fd8136262266407b824619c27b0 /plugins/Clist_modern
parent806188a1903da4f59d7610edd5bed457c5978d84 (diff)
minor code fixes
git-svn-id: http://svn.miranda-ng.org/main/trunk@12974 1316c22d-e87f-b044-9b9b-93d7a3e3ba9c
Diffstat (limited to 'plugins/Clist_modern')
-rw-r--r--plugins/Clist_modern/src/CLUIFrames/cluiframes.cpp1
-rw-r--r--plugins/Clist_modern/src/hdr/modern_clui.h2
-rw-r--r--plugins/Clist_modern/src/hdr/modern_commonprototypes.h3
-rw-r--r--plugins/Clist_modern/src/hdr/modern_image_array.h39
-rw-r--r--plugins/Clist_modern/src/modern_clui.cpp8
-rw-r--r--plugins/Clist_modern/src/modern_image_array.cpp214
-rw-r--r--plugins/Clist_modern/src/modern_statusbar.cpp6
-rw-r--r--plugins/Clist_modern/src/modern_viewmodebar.cpp79
8 files changed, 124 insertions, 228 deletions
diff --git a/plugins/Clist_modern/src/CLUIFrames/cluiframes.cpp b/plugins/Clist_modern/src/CLUIFrames/cluiframes.cpp
index bc8cbcb68a..4709eafcf9 100644
--- a/plugins/Clist_modern/src/CLUIFrames/cluiframes.cpp
+++ b/plugins/Clist_modern/src/CLUIFrames/cluiframes.cpp
@@ -2325,7 +2325,6 @@ int SizeFramesByWindowRect(RECT *r, HDWP * PosBatch, int mode)
}
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);
diff --git a/plugins/Clist_modern/src/hdr/modern_clui.h b/plugins/Clist_modern/src/hdr/modern_clui.h
index aaa22f49b6..b9301670c2 100644
--- a/plugins/Clist_modern/src/hdr/modern_clui.h
+++ b/plugins/Clist_modern/src/hdr/modern_clui.h
@@ -43,8 +43,6 @@ public:
~CLUI();
static HRESULT InitClui() { m_pCLUI = new CLUI(); return S_OK; };
- static HWND& ClcWnd() { return pcli->hwndContactTree; }
- static HWND& CluiWnd() { return pcli->hwndContactList; }
static CLUI * GetClui() { return m_pCLUI; }
static BOOL IsMainMenuInited() { return CLUI::m_fMainMenuInited; }
diff --git a/plugins/Clist_modern/src/hdr/modern_commonprototypes.h b/plugins/Clist_modern/src/hdr/modern_commonprototypes.h
index f92b95bb30..757505caf4 100644
--- a/plugins/Clist_modern/src/hdr/modern_commonprototypes.h
+++ b/plugins/Clist_modern/src/hdr/modern_commonprototypes.h
@@ -237,6 +237,9 @@ void UnloadAvatarOverlayIcon(); /
void UnLoadContactListModule(); //clistmod.c
void UpdateAllAvatars(ClcData *dat); //cache_func.c
+void ApplyViewMode(const char *Name, bool onlySelector = false);
+void SaveViewMode(const char *name, const TCHAR *szGroupFilter, const char *szProtoFilter, DWORD statusMask, DWORD stickyStatusMask, unsigned int options, unsigned int stickies, unsigned int operators, unsigned int lmdat);
+
//cluiframes.c
void gtaRenewText(MCONTACT hContact);
int ExtraImage_ExtraIDToColumnNum(int extra);
diff --git a/plugins/Clist_modern/src/hdr/modern_image_array.h b/plugins/Clist_modern/src/hdr/modern_image_array.h
index 3d8322146d..e45b3c4fef 100644
--- a/plugins/Clist_modern/src/hdr/modern_image_array.h
+++ b/plugins/Clist_modern/src/hdr/modern_image_array.h
@@ -32,14 +32,13 @@ Created by Pescuma
#include <windows.h>
-typedef struct _IMAGE_ARRAY_DATA_NODE
+struct IMAGE_ARRAY_DATA_NODE
{
int width;
int height;
-}
-IMAGE_ARRAY_DATA_NODE;
+};
-typedef struct _IMAGE_ARRAY_DATA
+struct IMAGE_ARRAY_DATA
{
// Configuration
BOOL width_based;
@@ -59,46 +58,30 @@ typedef struct _IMAGE_ARRAY_DATA
IMAGE_ARRAY_DATA_NODE *nodes;
int nodes_size;
int nodes_allocated_size;
-}
-IMAGE_ARRAY_DATA, *LP_IMAGE_ARRAY_DATA;
+};
// Initialize data
-void ImageArray_Initialize(LP_IMAGE_ARRAY_DATA iad, BOOL width_based, int grow_step);
+void ImageArray_Initialize(IMAGE_ARRAY_DATA *iad, BOOL width_based, int grow_step);
// Free data but keep config
-void ImageArray_Clear(LP_IMAGE_ARRAY_DATA iad);
+void ImageArray_Clear(IMAGE_ARRAY_DATA *iad);
// Free data
// If keep_bitmap is TRUE, doesn't delete de bitmap and return its handle. Else, return NULL
-HBITMAP ImageArray_Free(LP_IMAGE_ARRAY_DATA iad, BOOL keep_bitmap);
+HBITMAP ImageArray_Free(IMAGE_ARRAY_DATA *iad, BOOL keep_bitmap);
// Add image to the list (return the index of the image or -1 on error)
// If pos == -1, add to the end of the list
-int ImageArray_AddImage(LP_IMAGE_ARRAY_DATA iad, HBITMAP hBmp, int pos);
+int ImageArray_AddImage(IMAGE_ARRAY_DATA *iad, HBITMAP hBmp, int pos);
// Change an image in the list (return TRUE on success)
-BOOL ImageArray_ChangeImage(LP_IMAGE_ARRAY_DATA iad, HBITMAP hBmp, int pos);
+BOOL ImageArray_ChangeImage(IMAGE_ARRAY_DATA *iad, HBITMAP hBmp, int pos);
// Remove an image
-BOOL ImageArray_RemoveImage(LP_IMAGE_ARRAY_DATA iad, int pos);
+BOOL ImageArray_RemoveImage(IMAGE_ARRAY_DATA *iad, int pos);
// Draw an image
-BOOL ImageArray_DrawImage(LP_IMAGE_ARRAY_DATA iad, int pos, HDC hdcDest, int nXDest, int nYDest, BYTE Alpha);
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
+BOOL ImageArray_DrawImage(IMAGE_ARRAY_DATA *iad, int pos, HDC hdcDest, int nXDest, int nYDest, BYTE Alpha);
#endif // __IMAGE_ARRAY_H__
diff --git a/plugins/Clist_modern/src/modern_clui.cpp b/plugins/Clist_modern/src/modern_clui.cpp
index f4957bd96a..3c4750bb19 100644
--- a/plugins/Clist_modern/src/modern_clui.cpp
+++ b/plugins/Clist_modern/src/modern_clui.cpp
@@ -273,7 +273,7 @@ HRESULT CLUI::CreateCluiFrames()
mii.hSubMenu = (HMENU)CallService(MS_CLIST_MENUGETSTATUS, 0, 0);
SetMenuItemInfo(g_hMenuMain, 1, TRUE, &mii);
- CreateCLCWindow(CluiWnd());
+ CreateCLCWindow(pcli->hwndContactList);
CLUI_ChangeWindowMode();
@@ -290,7 +290,7 @@ HRESULT CLUI::CreateCluiFrames()
}
CLUI::CLUI() :
-m_hDwmapiDll(NULL)
+ m_hDwmapiDll(NULL)
{
m_pCLUI = this;
g_CluiData.bSTATE = STATE_CLUI_LOADING;
@@ -373,7 +373,7 @@ HRESULT CLUI::RegisterAvatarMenu()
HRESULT CLUI::CreateCLCWindow(const HWND hwndClui)
{
- ClcWnd() = CreateWindow(_T(CLISTCONTROL_CLASS), _T(""),
+ pcli->hwndContactTree = CreateWindow(_T(CLISTCONTROL_CLASS), _T(""),
WS_CHILD | WS_CLIPCHILDREN | CLS_CONTACTLIST
| (db_get_b(NULL, "CList", "UseGroups", SETTING_USEGROUPS_DEFAULT) ? CLS_USEGROUPS : 0)
| (db_get_b(NULL, "CList", "HideOffline", SETTING_HIDEOFFLINE_DEFAULT) ? CLS_HIDEOFFLINE : 0)
@@ -433,7 +433,7 @@ HRESULT CLUI::FillAlphaChannel(HDC hDC, RECT *prcParent)
HRESULT CLUI::CreateCLC()
{
CLISTFrame Frame = { sizeof(Frame) };
- Frame.hWnd = ClcWnd();
+ Frame.hWnd = pcli->hwndContactTree;
Frame.align = alClient;
Frame.hIcon = LoadSkinnedIcon(SKINICON_OTHER_FRAME);
Frame.Flags = F_VISIBLE | F_SHOWTBTIP | F_NO_SUBCONTAINER | F_TCHAR;
diff --git a/plugins/Clist_modern/src/modern_image_array.cpp b/plugins/Clist_modern/src/modern_image_array.cpp
index fe8c381160..ada7a05d7a 100644
--- a/plugins/Clist_modern/src/modern_image_array.cpp
+++ b/plugins/Clist_modern/src/modern_image_array.cpp
@@ -34,23 +34,19 @@ static HBITMAP ImageArray_CreateBitmapPoint(int cx, int cy, void ** pt)
return ske_CreateDIB32Point(cx, cy, pt);
}
-
// Initialize data
-static BOOL ImageArray_Alloc(LP_IMAGE_ARRAY_DATA iad, int size)
+static BOOL ImageArray_Alloc(IMAGE_ARRAY_DATA *iad, int size)
{
int size_grow = size;
- if (size_grow > iad->nodes_allocated_size)
- {
+ if (size_grow > iad->nodes_allocated_size) {
size_grow += iad->grow_step - (size_grow % iad->grow_step);
- if (iad->nodes != NULL)
- {
+ if (iad->nodes != NULL) {
IMAGE_ARRAY_DATA_NODE *tmp = (IMAGE_ARRAY_DATA_NODE *)realloc((void *)iad->nodes,
sizeof(IMAGE_ARRAY_DATA_NODE) * size_grow);
- if (tmp == NULL)
- {
+ if (tmp == NULL) {
TRACE("Out of memory: realloc returned NULL (ImageArray_Alloc)");
ImageArray_Free(iad, FALSE);
return FALSE;
@@ -59,12 +55,10 @@ static BOOL ImageArray_Alloc(LP_IMAGE_ARRAY_DATA iad, int size)
iad->nodes = tmp;
memset(&iad->nodes[iad->nodes_allocated_size], 0, (size_grow - iad->nodes_allocated_size) * sizeof(IMAGE_ARRAY_DATA_NODE));
}
- else
- {
+ else {
iad->nodes = (IMAGE_ARRAY_DATA_NODE *)malloc(sizeof(IMAGE_ARRAY_DATA_NODE) * size_grow);
- if (iad->nodes == NULL)
- {
+ if (iad->nodes == NULL) {
TRACE("Out of memory: alloc returned NULL (ImageArray_Alloc)");
ImageArray_Free(iad, FALSE);
@@ -77,19 +71,16 @@ static BOOL ImageArray_Alloc(LP_IMAGE_ARRAY_DATA iad, int size)
iad->nodes_allocated_size = size_grow;
}
- else if (size < iad->nodes_allocated_size)
- {
+ else if (size < iad->nodes_allocated_size) {
// Give some more space to try to avoid a free
- if ((iad->nodes_allocated_size - size) / iad->grow_step >= 2)
- {
+ if ((iad->nodes_allocated_size - size) / iad->grow_step >= 2) {
IMAGE_ARRAY_DATA_NODE *tmp;
size_grow += iad->grow_step - (size_grow % iad->grow_step);
tmp = (IMAGE_ARRAY_DATA_NODE *)realloc((void *)iad->nodes, sizeof(IMAGE_ARRAY_DATA_NODE) * size_grow);
- if (tmp == NULL)
- {
+ if (tmp == NULL) {
TRACE("Out of memory: realloc returned NULL when reducing size! (ImageArray_Alloc)");
ImageArray_Free(iad, FALSE);
@@ -108,12 +99,11 @@ static BOOL ImageArray_Alloc(LP_IMAGE_ARRAY_DATA iad, int size)
// Initialize data
-void ImageArray_Initialize(LP_IMAGE_ARRAY_DATA iad, BOOL width_based, int grow_step)
+void ImageArray_Initialize(IMAGE_ARRAY_DATA *iad, BOOL width_based, int grow_step)
{
iad->width_based = width_based;
iad->grow_step = grow_step;
- if (iad->grow_step <= 0)
- {
+ if (iad->grow_step <= 0) {
iad->grow_step = 1;
}
iad->hdc = CreateCompatibleDC(NULL);
@@ -132,20 +122,18 @@ void ImageArray_Initialize(LP_IMAGE_ARRAY_DATA iad, BOOL width_based, int grow_s
// Free data
// If keep_bitmap is TRUE, doesn't delete de bitmap and return its handle. Else, return NULL
-HBITMAP ImageArray_Free(LP_IMAGE_ARRAY_DATA iad, BOOL keep_bitmap)
+HBITMAP ImageArray_Free(IMAGE_ARRAY_DATA *iad, BOOL keep_bitmap)
{
DeleteDC(iad->hdc);
- if (iad->img != NULL && !keep_bitmap)
- {
+ if (iad->img != NULL && !keep_bitmap) {
DeleteObject(iad->img);
iad->img = NULL;
iad->width = 0;
iad->height = 0;
}
- if (iad->nodes != NULL)
- {
+ if (iad->nodes != NULL) {
free(iad->nodes);
iad->nodes = NULL;
iad->nodes_allocated_size = 0;
@@ -158,22 +146,20 @@ HBITMAP ImageArray_Free(LP_IMAGE_ARRAY_DATA iad, BOOL keep_bitmap)
}
// Free data but keep config
-void ImageArray_Clear(LP_IMAGE_ARRAY_DATA iad)
+void ImageArray_Clear(IMAGE_ARRAY_DATA *iad)
{
HDC tmpdc = CreateCompatibleDC(iad->hdc);
if (iad->hdc) DeleteDC(iad->hdc);
iad->hdc = tmpdc;
- if (iad->img != NULL)
- {
+ if (iad->img != NULL) {
DeleteObject(iad->img);
iad->img = NULL;
iad->width = 0;
iad->height = 0;
}
- if (iad->nodes != NULL)
- {
+ if (iad->nodes != NULL) {
free(iad->nodes);
iad->nodes = NULL;
iad->nodes_allocated_size = 0;
@@ -184,7 +170,7 @@ void ImageArray_Clear(LP_IMAGE_ARRAY_DATA iad)
// Add image to the list (return the index of the image or -1 on error)
// If pos == -1, add to the end of the list
-int ImageArray_AddImage(LP_IMAGE_ARRAY_DATA iad, HBITMAP hBmp, int pos)
+int ImageArray_AddImage(IMAGE_ARRAY_DATA *iad, HBITMAP hBmp, int pos)
{
BITMAP bm;
int new_width, new_height;
@@ -203,45 +189,38 @@ int ImageArray_AddImage(LP_IMAGE_ARRAY_DATA iad, HBITMAP hBmp, int pos)
pos = iad->nodes_size;
// Add to end?
- if (pos >= iad->nodes_size)
- {
+ if (pos >= iad->nodes_size) {
pos = iad->nodes_size;
last_one = TRUE;
}
- else
- {
+ else {
last_one = FALSE;
}
// Get bounds
- if (!GetObject(hBmp, sizeof(BITMAP), &bm))
- {
+ if (!GetObject(hBmp, sizeof(BITMAP), &bm)) {
LeaveCriticalSection(&iad->cs);
return -1;
}
- if (iad->width_based)
- {
+ if (iad->width_based) {
new_width = max(bm.bmWidth, iad->width);
new_height = iad->height + bm.bmHeight;
}
- else
- {
+ else {
new_width = bm.bmWidth + iad->width;
new_height = max(iad->height, bm.bmHeight);
}
// Alloc image
hNewBmp = ImageArray_CreateBitmapPoint(new_width, new_height, &(iad->lpBits));
- if (hNewBmp == NULL)
- {
+ if (hNewBmp == NULL) {
LeaveCriticalSection(&iad->cs);
return -1;
}
// Alloc array
- if (!ImageArray_Alloc(iad, iad->nodes_size + 1))
- {
+ if (!ImageArray_Alloc(iad, iad->nodes_size + 1)) {
DeleteObject(hNewBmp);
LeaveCriticalSection(&iad->cs);
return -1;
@@ -266,25 +245,20 @@ int ImageArray_AddImage(LP_IMAGE_ARRAY_DATA iad, HBITMAP hBmp, int pos)
int x = 0, y = 0, w = 0, h = 0;
// 1- old data
- if (pos > 0)
- {
+ if (pos > 0) {
SelectObject(hdc_old, iad->img);
- if (iad->width_based)
- {
+ if (iad->width_based) {
w = iad->width;
h = 0;
- for (i = 0; i < pos; i++)
- {
+ for (i = 0; i < pos; i++) {
h += iad->nodes[i].height;
}
}
- else
- {
+ else {
h = iad->height;
w = 0;
- for (i = 0; i < pos; i++)
- {
+ for (i = 0; i < pos; i++) {
w += iad->nodes[i].width;
}
}
@@ -292,13 +266,11 @@ int ImageArray_AddImage(LP_IMAGE_ARRAY_DATA iad, HBITMAP hBmp, int pos)
}
// 2- new image
- if (iad->width_based)
- {
+ if (iad->width_based) {
x = 0;
y = h;
}
- else
- {
+ else {
x = w;
y = 0;
}
@@ -306,14 +278,12 @@ int ImageArray_AddImage(LP_IMAGE_ARRAY_DATA iad, HBITMAP hBmp, int pos)
BitBlt(iad->hdc, x, y, bm.bmWidth, bm.bmHeight, hdc_old, 0, 0, SRCCOPY);
// 3- old data
- if (!last_one)
- {
+ if (!last_one) {
int ox, oy;
SelectObject(hdc_old, iad->img);
- if (iad->width_based)
- {
+ if (iad->width_based) {
ox = 0;
oy = y;
@@ -323,8 +293,7 @@ int ImageArray_AddImage(LP_IMAGE_ARRAY_DATA iad, HBITMAP hBmp, int pos)
w = iad->width;
h = iad->height - h;
}
- else
- {
+ else {
ox = x;
oy = 0;
@@ -345,8 +314,7 @@ int ImageArray_AddImage(LP_IMAGE_ARRAY_DATA iad, HBITMAP hBmp, int pos)
iad->img = hNewBmp;
// Move array
- if (!last_one && iad->nodes_size > 1)
- {
+ if (!last_one && iad->nodes_size > 1) {
memmove(&iad->nodes[pos + 1], &iad->nodes[pos], (iad->nodes_size - pos) * sizeof(IMAGE_ARRAY_DATA_NODE));
}
iad->nodes[pos].width = bm.bmWidth;
@@ -364,7 +332,7 @@ int ImageArray_AddImage(LP_IMAGE_ARRAY_DATA iad, HBITMAP hBmp, int pos)
// Change an image in the list (return TRUE on success)
-BOOL ImageArray_ChangeImage(LP_IMAGE_ARRAY_DATA iad, HBITMAP hBmp, int pos)
+BOOL ImageArray_ChangeImage(IMAGE_ARRAY_DATA *iad, HBITMAP hBmp, int pos)
{
BITMAP bm;
int new_width, new_height;
@@ -384,27 +352,23 @@ BOOL ImageArray_ChangeImage(LP_IMAGE_ARRAY_DATA iad, HBITMAP hBmp, int pos)
EnterCriticalSection(&iad->cs);
// Get bounds
- if (!GetObject(hBmp, sizeof(BITMAP), &bm))
- {
+ if (!GetObject(hBmp, sizeof(BITMAP), &bm)) {
LeaveCriticalSection(&iad->cs);
return FALSE;
}
- if (iad->width_based)
- {
+ if (iad->width_based) {
new_width = max(bm.bmWidth, iad->width);
new_height = iad->height + bm.bmHeight - iad->nodes[pos].height;
}
- else
- {
+ else {
new_width = bm.bmWidth + iad->width - iad->nodes[pos].width;
new_height = max(iad->height, bm.bmHeight);
}
// Alloc image
hNewBmp = ImageArray_CreateBitmapPoint(new_width, new_height, &(iad->lpBits));
- if (hNewBmp == NULL)
- {
+ if (hNewBmp == NULL) {
LeaveCriticalSection(&iad->cs);
return FALSE;
}
@@ -427,25 +391,20 @@ BOOL ImageArray_ChangeImage(LP_IMAGE_ARRAY_DATA iad, HBITMAP hBmp, int pos)
int x = 0, y = 0, w = 0, h = 0;
// 1- old data
- if (pos > 0)
- {
+ if (pos > 0) {
SelectObject(hdc_old, iad->img);
- if (iad->width_based)
- {
+ if (iad->width_based) {
w = iad->width;
h = 0;
- for (i = 0; i < pos; i++)
- {
+ for (i = 0; i < pos; i++) {
h += iad->nodes[i].height;
}
}
- else
- {
+ else {
h = iad->height;
w = 0;
- for (i = 0; i < pos; i++)
- {
+ for (i = 0; i < pos; i++) {
w += iad->nodes[i].width;
}
}
@@ -453,13 +412,11 @@ BOOL ImageArray_ChangeImage(LP_IMAGE_ARRAY_DATA iad, HBITMAP hBmp, int pos)
}
// 2- new image
- if (iad->width_based)
- {
+ if (iad->width_based) {
x = 0;
y = h;
}
- else
- {
+ else {
x = w;
y = 0;
}
@@ -467,14 +424,12 @@ BOOL ImageArray_ChangeImage(LP_IMAGE_ARRAY_DATA iad, HBITMAP hBmp, int pos)
BitBlt(iad->hdc, x, y, bm.bmWidth, bm.bmHeight, hdc_old, 0, 0, SRCCOPY);
// 3- old data
- if (pos < iad->nodes_size - 1)
- {
+ if (pos < iad->nodes_size - 1) {
int ox, oy;
SelectObject(hdc_old, iad->img);
- if (iad->width_based)
- {
+ if (iad->width_based) {
ox = 0;
oy = y + iad->nodes[pos].height;
@@ -484,8 +439,7 @@ BOOL ImageArray_ChangeImage(LP_IMAGE_ARRAY_DATA iad, HBITMAP hBmp, int pos)
w = iad->width;
h = iad->height - h - iad->nodes[pos].height;
}
- else
- {
+ else {
ox = x + iad->nodes[pos].width;
oy = 0;
@@ -519,7 +473,7 @@ BOOL ImageArray_ChangeImage(LP_IMAGE_ARRAY_DATA iad, HBITMAP hBmp, int pos)
// Remove an image
-BOOL ImageArray_RemoveImage(LP_IMAGE_ARRAY_DATA iad, int pos)
+BOOL ImageArray_RemoveImage(IMAGE_ARRAY_DATA *iad, int pos)
{
int new_width, new_height;
HBITMAP hNewBmp;
@@ -535,21 +489,18 @@ BOOL ImageArray_RemoveImage(LP_IMAGE_ARRAY_DATA iad, int pos)
EnterCriticalSection(&iad->cs);
// Get bounds
- if (iad->width_based)
- {
+ if (iad->width_based) {
new_width = iad->width;
new_height = iad->height - iad->nodes[pos].height;
}
- else
- {
+ else {
new_width = iad->width - iad->nodes[pos].width;
new_height = iad->height;
}
// Alloc image
hNewBmp = ImageArray_CreateBitmapPoint(new_width, new_height, &(iad->lpBits));
- if (hNewBmp == NULL)
- {
+ if (hNewBmp == NULL) {
LeaveCriticalSection(&iad->cs);
return FALSE;
}
@@ -571,39 +522,31 @@ BOOL ImageArray_RemoveImage(LP_IMAGE_ARRAY_DATA iad, int pos)
{
int x = 0, y = 0, w = 0, h = 0;
- if (pos > 0)
- {
+ if (pos > 0) {
SelectObject(hdc_old, iad->img);
- if (iad->width_based)
- {
+ if (iad->width_based) {
w = iad->width;
h = 0;
- for (i = 0; i < pos; i++)
- {
+ for (i = 0; i < pos; i++) {
h += iad->nodes[i].height;
}
}
- else
- {
+ else {
h = iad->height;
w = 0;
for (i = 0; i < pos; i++)
- {
w += iad->nodes[i].width;
- }
}
BitBlt(iad->hdc, 0, 0, w, h, hdc_old, 0, 0, SRCCOPY);
}
- if (pos < iad->nodes_size - 1)
- {
+ if (pos < iad->nodes_size - 1) {
int ox, oy;
SelectObject(hdc_old, iad->img);
- if (iad->width_based)
- {
+ if (iad->width_based) {
ox = 0;
oy = h + iad->nodes[pos].height;
@@ -613,8 +556,7 @@ BOOL ImageArray_RemoveImage(LP_IMAGE_ARRAY_DATA iad, int pos)
w = iad->width;
h = iad->height - h - iad->nodes[pos].height;
}
- else
- {
+ else {
ox = w + iad->nodes[pos].width;
oy = 0;
@@ -634,8 +576,7 @@ BOOL ImageArray_RemoveImage(LP_IMAGE_ARRAY_DATA iad, int pos)
iad->img = hNewBmp;
// Move array
- if (pos < iad->nodes_size - 1)
- {
+ if (pos < iad->nodes_size - 1) {
memmove(&iad->nodes[pos], &iad->nodes[pos + 1], (iad->nodes_size - pos - 1) * sizeof(IMAGE_ARRAY_DATA_NODE));
}
@@ -655,7 +596,7 @@ BOOL ImageArray_RemoveImage(LP_IMAGE_ARRAY_DATA iad, int pos)
-BOOL ImageArray_DrawImage(LP_IMAGE_ARRAY_DATA iad, int pos, HDC hdcDest, int nXDest, int nYDest, BYTE Alpha)
+BOOL ImageArray_DrawImage(IMAGE_ARRAY_DATA *iad, int pos, HDC hdcDest, int nXDest, int nYDest, BYTE Alpha)
{
if (hdcDest == NULL || pos < 0 || pos >= iad->nodes_size)
return FALSE;
@@ -664,43 +605,36 @@ BOOL ImageArray_DrawImage(LP_IMAGE_ARRAY_DATA iad, int pos, HDC hdcDest, int nXD
{
int w, h, i;
- if (iad->width_based)
- {
+ if (iad->width_based) {
w = 0;
h = 0;
- for (i = 0; i < pos; i++)
- {
+ for (i = 0; i < pos; i++) {
h += iad->nodes[i].height;
}
}
- else
- {
+ else {
h = 0;
w = 0;
- for (i = 0; i < pos; i++)
- {
+ for (i = 0; i < pos; i++) {
w += iad->nodes[i].width;
}
}
- {
- BLENDFUNCTION bf = { AC_SRC_OVER, 0, Alpha, AC_SRC_ALPHA };
- /*ske_*/AlphaBlend(hdcDest, nXDest, nYDest, iad->nodes[pos].width, iad->nodes[pos].height, iad->hdc, w, h, iad->nodes[pos].width, iad->nodes[pos].height, bf);
- }
- }
+ BLENDFUNCTION bf = { AC_SRC_OVER, 0, Alpha, AC_SRC_ALPHA };
+ AlphaBlend(hdcDest, nXDest, nYDest, iad->nodes[pos].width, iad->nodes[pos].height, iad->hdc, w, h, iad->nodes[pos].width, iad->nodes[pos].height, bf);
+ }
LeaveCriticalSection(&iad->cs);
return FALSE;
}
-BOOL ImageArray_GetImageSize(LP_IMAGE_ARRAY_DATA iad, int pos, SIZE * lpSize)
+BOOL ImageArray_GetImageSize(IMAGE_ARRAY_DATA *iad, int pos, SIZE * lpSize)
{
EnterCriticalSection(&iad->cs);
- if (lpSize)
- {
+ if (lpSize) {
lpSize->cx = iad->nodes[pos].width;
lpSize->cy = iad->nodes[pos].height;
}
LeaveCriticalSection(&iad->cs);
return TRUE;
-} \ No newline at end of file
+}
diff --git a/plugins/Clist_modern/src/modern_statusbar.cpp b/plugins/Clist_modern/src/modern_statusbar.cpp
index bbc8549f10..bd4e0cb2fc 100644
--- a/plugins/Clist_modern/src/modern_statusbar.cpp
+++ b/plugins/Clist_modern/src/modern_statusbar.cpp
@@ -13,10 +13,7 @@ POINT lastpnt;
HWND hModernStatusBar = NULL;
HANDLE hFramehModernStatusBar = NULL;
-extern void ApplyViewMode(const char *Name, bool onlySelector = false);
-extern void SaveViewMode(const char *name, const TCHAR *szGroupFilter, const char *szProtoFilter, DWORD statusMask, DWORD stickyStatusMask, unsigned int options, unsigned int stickies, unsigned int operators, unsigned int lmdat);
-//int FindFrameID(HWND FrameHwnd);
COLORREF sttGetColor(char * module, char * color, COLORREF defColor);
#define DBFONTF_BOLD 1
@@ -872,10 +869,11 @@ LRESULT CALLBACK ModernStatusProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lPa
return DefWindowProc(hwnd, msg, wParam, lParam);
}
+TCHAR pluginname[] = _T("ModernStatusBar");
+
HWND StatusBar_Create(HWND parent)
{
WNDCLASS wndclass = { 0 };
- TCHAR pluginname[] = _T("ModernStatusBar");
int h = GetSystemMetrics(SM_CYSMICON) + 2;
if (GetClassInfo(g_hInst, pluginname, &wndclass) == 0) {
wndclass.lpfnWndProc = ModernStatusProc;
diff --git a/plugins/Clist_modern/src/modern_viewmodebar.cpp b/plugins/Clist_modern/src/modern_viewmodebar.cpp
index a9b76352b9..cbaf820fd8 100644
--- a/plugins/Clist_modern/src/modern_viewmodebar.cpp
+++ b/plugins/Clist_modern/src/modern_viewmodebar.cpp
@@ -55,7 +55,6 @@ IDC_LASTMESSAGEOP, IDC_LASTMESSAGEUNIT, IDC_LASTMSG, IDC_LASTMSGVALUE, IDC_USEGR
static UINT _page2Controls[] = { IDC_CLIST, IDC_STATIC9, IDC_STATIC8, IDC_CLEARALL, IDC_CURVIEWMODE2, 0 };
-void ApplyViewMode(const char *Name, bool onlySelector = false);
static UINT _buttons[] = { IDC_RESETMODES, IDC_SELECTMODE, IDC_CONFIGUREMODES, 0 };
static BOOL sttDrawViewModeBackground(HWND hwnd, HDC hdc, RECT *rect);
@@ -71,15 +70,14 @@ static int DrawViewModeBar(HWND hWnd, HDC hDC)
static int ViewModePaintCallbackProc(HWND hWnd, HDC hDC, RECT *, HRGN, DWORD, void *)
{
- int i;
RECT MyRect = { 0 };
GetWindowRect(hWnd, &MyRect);
DrawViewModeBar(hWnd, hDC);
- for (i = 0; _buttons[i] != 0; i++)
- {
+ for (int i = 0; _buttons[i] != 0; i++) {
RECT childRect;
- POINT Offset;
GetWindowRect(GetDlgItem(hWnd, _buttons[i]), &childRect);
+
+ POINT Offset;
Offset.x = childRect.left - MyRect.left;
Offset.y = childRect.top - MyRect.top;
SendDlgItemMessage(hWnd, _buttons[i], BUTTONDRAWINPARENT, (WPARAM)hDC, (LPARAM)&Offset);
@@ -118,13 +116,9 @@ int FillModes(char *szsetting)
if (szsetting[0] == 13)
return 1;
- TCHAR * temp;
- mir_utf8decode(szsetting, &temp);
- if (temp) {
+ ptrT temp(mir_utf8decodeT(szsetting));
+ if (temp != NULL)
SendDlgItemMessage(clvmHwnd, IDC_VIEWMODES, LB_INSERTSTRING, -1, (LPARAM)temp);
- mir_free(temp);
- }
-
return 1;
}
@@ -185,24 +179,22 @@ static DWORD GetMaskForItem(HANDLE hItem)
static void UpdateStickies()
{
- DWORD localMask;
- int i;
-
for (MCONTACT hContact = db_find_first(); hContact; hContact = db_find_next(hContact)) {
MCONTACT hItem = (MCONTACT)SendDlgItemMessage(clvmHwnd, IDC_CLIST, CLM_FINDCONTACT, hContact, 0);
if (hItem)
SendDlgItemMessage(clvmHwnd, IDC_CLIST, CLM_SETCHECKMARK, (WPARAM)hItem, (BYTE)db_get_dw(hContact, CLVM_MODULE, g_szModename, 0) ? 1 : 0);
- localMask = HIWORD(db_get_dw(hContact, CLVM_MODULE, g_szModename, 0));
+
+ DWORD localMask = HIWORD(db_get_dw(hContact, CLVM_MODULE, g_szModename, 0));
UpdateClistItem(hItem, (localMask == 0 || localMask == stickyStatusMask) ? stickyStatusMask : localMask);
}
- for (i = ID_STATUS_OFFLINE; i <= ID_STATUS_OUTTOLUNCH; i++)
+ for (int i = ID_STATUS_OFFLINE; i <= ID_STATUS_OUTTOLUNCH; i++)
SendDlgItemMessage(clvmHwnd, IDC_CLIST, CLM_SETEXTRAIMAGE, (WPARAM)hInfoItem, MAKELONG(i - ID_STATUS_OFFLINE, (1 << (i - ID_STATUS_OFFLINE)) & stickyStatusMask ? i - ID_STATUS_OFFLINE : ID_STATUS_OUTTOLUNCH - ID_STATUS_OFFLINE + 1));
HANDLE hItem = (HANDLE)SendDlgItemMessage(clvmHwnd, IDC_CLIST, CLM_GETNEXTITEM, CLGN_ROOT, 0);
hItem = (HANDLE)SendDlgItemMessage(clvmHwnd, IDC_CLIST, CLM_GETNEXTITEM, CLGN_NEXTGROUP, (LPARAM)hItem);
while (hItem) {
- for (i = ID_STATUS_OFFLINE; i <= ID_STATUS_OUTTOLUNCH; i++)
+ for (int i = ID_STATUS_OFFLINE; i <= ID_STATUS_OUTTOLUNCH; i++)
SendDlgItemMessage(clvmHwnd, IDC_CLIST, CLM_SETEXTRAIMAGE, (WPARAM)hItem, MAKELONG(i - ID_STATUS_OFFLINE, nullImage));
hItem = (HANDLE)SendDlgItemMessage(clvmHwnd, IDC_CLIST, CLM_GETNEXTITEM, CLGN_NEXTGROUP, (LPARAM)hItem);
}
@@ -228,8 +220,7 @@ static int FillDialog(HWND hwnd)
item.mask = LVIF_TEXT;
item.iItem = 1000;
- for (i = 0; i < protoCount; i++)
- {
+ for (i = 0; i < protoCount; i++) {
item.pszText = accs[i]->szModuleName;
newItem = SendMessageA(hwndList, LVM_INSERTITEMA, 0, (LPARAM)&item);
}
@@ -266,8 +257,7 @@ static int FillDialog(HWND hwnd)
lvc.mask = LVCF_FMT;
lvc.fmt = LVCFMT_IMAGE | LVCFMT_LEFT;
ListView_InsertColumn(hwndList, 0, &lvc);
- for (i = ID_STATUS_OFFLINE; i <= ID_STATUS_OUTTOLUNCH; i++)
- {
+ for (i = ID_STATUS_OFFLINE; i <= ID_STATUS_OUTTOLUNCH; i++) {
LVITEM item = { 0 };
item.mask = LVIF_TEXT;
item.pszText = pcli->pfnGetStatusModeDescription(i, 0);
@@ -296,35 +286,31 @@ static int FillDialog(HWND hwnd)
static void SetAllChildIcons(HWND hwndList, HANDLE hFirstItem, int iColumn, int iImage)
{
- int typeOfFirst, iOldIcon;
- HANDLE hItem, hChildItem;
-
- typeOfFirst = SendMessage(hwndList, CLM_GETITEMTYPE, (WPARAM)hFirstItem, 0);
- //check groups
- if (typeOfFirst == CLCIT_GROUP) hItem = hFirstItem;
- else hItem = (HANDLE)SendMessage(hwndList, CLM_GETNEXTITEM, CLGN_NEXTGROUP, (LPARAM)hFirstItem);
- while (hItem)
- {
- hChildItem = (HANDLE)SendMessage(hwndList, CLM_GETNEXTITEM, CLGN_CHILD, (LPARAM)hItem);
+ int typeOfFirst = SendMessage(hwndList, CLM_GETITEMTYPE, (WPARAM)hFirstItem, 0);
+
+ // check groups
+ HANDLE hItem = (typeOfFirst == CLCIT_GROUP) ? hFirstItem : (HANDLE)SendMessage(hwndList, CLM_GETNEXTITEM, CLGN_NEXTGROUP, (LPARAM)hFirstItem);
+ while (hItem) {
+ HANDLE hChildItem = (HANDLE)SendMessage(hwndList, CLM_GETNEXTITEM, CLGN_CHILD, (LPARAM)hItem);
if (hChildItem)
SetAllChildIcons(hwndList, hChildItem, iColumn, iImage);
hItem = (HANDLE)SendMessage(hwndList, CLM_GETNEXTITEM, CLGN_NEXTGROUP, (LPARAM)hItem);
}
- //check contacts
+
+ // check contacts
if (typeOfFirst == CLCIT_CONTACT) hItem = hFirstItem;
else hItem = (HANDLE)SendMessage(hwndList, CLM_GETNEXTITEM, CLGN_NEXTCONTACT, (LPARAM)hFirstItem);
while (hItem) {
- iOldIcon = SendMessage(hwndList, CLM_GETEXTRAIMAGE, (WPARAM)hItem, iColumn);
- if (iOldIcon != EMPTY_EXTRA_ICON && iOldIcon != iImage) SendMessage(hwndList, CLM_SETEXTRAIMAGE, (WPARAM)hItem, MAKELPARAM(iColumn, iImage));
+ int iOldIcon = SendMessage(hwndList, CLM_GETEXTRAIMAGE, (WPARAM)hItem, iColumn);
+ if (iOldIcon != EMPTY_EXTRA_ICON && iOldIcon != iImage)
+ SendMessage(hwndList, CLM_SETEXTRAIMAGE, (WPARAM)hItem, MAKELPARAM(iColumn, iImage));
hItem = (HANDLE)SendMessage(hwndList, CLM_GETNEXTITEM, CLGN_NEXTCONTACT, (LPARAM)hItem);
}
}
static void SetIconsForColumn(HWND hwndList, HANDLE hItem, HANDLE hItemAll, int iColumn, int iImage)
{
- int itemType;
-
- itemType = SendMessage(hwndList, CLM_GETITEMTYPE, (WPARAM)hItem, 0);
+ int itemType = SendMessage(hwndList, CLM_GETITEMTYPE, (WPARAM)hItem, 0);
if (itemType == CLCIT_CONTACT) {
int oldiImage = SendMessage(hwndList, CLM_GETEXTRAIMAGE, (WPARAM)hItem, iColumn);
if (oldiImage != EMPTY_EXTRA_ICON && oldiImage != iImage)
@@ -531,8 +517,7 @@ static void UpdateFilters()
if (db_get_ts(NULL, CLVM_MODULE, szSetting, &dbv_gf))
goto cleanup;
mir_snprintf(szSetting, SIZEOF(szSetting), "%c%s_OPT", 246, szBuf);
- if ((opt = db_get_dw(NULL, CLVM_MODULE, szSetting, -1)) != -1)
- {
+ if ((opt = db_get_dw(NULL, CLVM_MODULE, szSetting, -1)) != -1) {
SendDlgItemMessage(clvmHwnd, IDC_AUTOCLEARSPIN, UDM_SETPOS, 0, MAKELONG(LOWORD(opt), 0));
}
mir_snprintf(szSetting, SIZEOF(szSetting), "%c%s_SM", 246, szBuf);
@@ -551,8 +536,7 @@ static void UpdateFilters()
item.pszText = szTemp;
item.cchTextMax = SIZEOF(szTemp);
- for (i = 0; i < ListView_GetItemCount(hwndList); i++)
- {
+ for (i = 0; i < ListView_GetItemCount(hwndList); i++) {
item.iItem = i;
SendMessageA(hwndList, LVM_GETITEMA, 0, (LPARAM)&item);
mir_snprintf(szMask, SIZEOF(szMask), "%s|", szTemp);
@@ -575,8 +559,7 @@ static void UpdateFilters()
ListView_SetCheckState(hwndList, 0, dwFlags & CLVM_INCLUDED_UNGROUPED ? TRUE : FALSE);
- for (i = 1; i < ListView_GetItemCount(hwndList); i++)
- {
+ for (i = 1; i < ListView_GetItemCount(hwndList); i++) {
item.iItem = i;
SendMessage(hwndList, LVM_GETITEM, 0, (LPARAM)&item);
mir_sntprintf(szMask, SIZEOF(szMask), _T("%s|"), szTemp);
@@ -1141,13 +1124,13 @@ LRESULT CALLBACK ViewModeFrameWndProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM
case IDC_RESETMODES:
clvm_reset_command :
ApplyViewMode("");
- break;
+ break;
case IDC_CONFIGUREMODES:
clvm_config_command :
if (!g_ViewModeOptDlg)
CreateDialogParam(g_hInst, MAKEINTRESOURCE(IDD_OPT_VIEWMODES), 0, DlgProcViewModesSetup, 0);
- break;
+ break;
}
default:
@@ -1384,15 +1367,13 @@ void ApplyViewMode(const char *Name, bool onlySelector)
if (HIWORD(g_CluiData.filterFlags) > 0)
g_CluiData.bFilterEffective |= CLVM_STICKY_CONTACTS;
- if (g_CluiData.bFilterEffective & CLVM_FILTER_STATUS)
- {
+ if (g_CluiData.bFilterEffective & CLVM_FILTER_STATUS) {
if (g_CluiData.boldHideOffline == (BYTE)-1)
g_CluiData.boldHideOffline = db_get_b(NULL, "CList", "HideOffline", SETTING_HIDEOFFLINE_DEFAULT);
CallService(MS_CLIST_SETHIDEOFFLINE, 0, 0);
}
- else if (g_CluiData.boldHideOffline != (BYTE)-1)
- {
+ else if (g_CluiData.boldHideOffline != (BYTE)-1) {
CallService(MS_CLIST_SETHIDEOFFLINE, g_CluiData.boldHideOffline, 0);
g_CluiData.boldHideOffline = -1;
}