summaryrefslogtreecommitdiff
path: root/plugins/Clist_modern/src
diff options
context:
space:
mode:
authorGeorge Hazan <george.hazan@gmail.com>2012-07-30 12:03:09 +0000
committerGeorge Hazan <george.hazan@gmail.com>2012-07-30 12:03:09 +0000
commitdafcac872a4631fef8d3ba4c8e895e4316b88814 (patch)
tree20596125354c65d1e6858d249ab17abb1dbb6e56 /plugins/Clist_modern/src
parent94e565e4774327b30af368e7aa3bfc0c7cace5b9 (diff)
code cleaning
git-svn-id: http://svn.miranda-ng.org/main/trunk@1274 1316c22d-e87f-b044-9b9b-93d7a3e3ba9c
Diffstat (limited to 'plugins/Clist_modern/src')
-rw-r--r--plugins/Clist_modern/src/modern_clcitems.cpp6
-rw-r--r--plugins/Clist_modern/src/modern_clcpaint.cpp74
-rw-r--r--plugins/Clist_modern/src/modern_clistevents.cpp6
-rw-r--r--plugins/Clist_modern/src/modern_clui.cpp4
-rw-r--r--plugins/Clist_modern/src/modern_cluiframes.cpp2
-rw-r--r--plugins/Clist_modern/src/modern_docking.cpp10
-rw-r--r--plugins/Clist_modern/src/modern_image_array.cpp28
-rw-r--r--plugins/Clist_modern/src/modern_row.cpp40
-rw-r--r--plugins/Clist_modern/src/modern_rowheight_funcs.cpp30
-rw-r--r--plugins/Clist_modern/src/modern_skinengine.cpp14
-rw-r--r--plugins/Clist_modern/src/modern_skinselector.cpp6
-rw-r--r--plugins/Clist_modern/src/modern_statusbar.cpp1804
-rw-r--r--plugins/Clist_modern/src/modern_tbbutton.cpp6
13 files changed, 946 insertions, 1084 deletions
diff --git a/plugins/Clist_modern/src/modern_clcitems.cpp b/plugins/Clist_modern/src/modern_clcitems.cpp
index 6e5d78a0c7..412f961496 100644
--- a/plugins/Clist_modern/src/modern_clcitems.cpp
+++ b/plugins/Clist_modern/src/modern_clcitems.cpp
@@ -348,7 +348,7 @@ int RestoreSelection( struct ClcData *dat, HANDLE hSelected )
dat->selection = pcli->pfnGetRowsPriorTo(&dat->list, selgroup, List_IndexOf((SortedList*)&selgroup->cl, selcontact->subcontacts ));
if (dat->selection != -1 )
- dat->selection += selcontact->isSubcontact;
+ dat->selection += selcontact->isSubcontact;
}
return dat->selection;
@@ -726,7 +726,7 @@ int cliGetGroupContentsCount(struct ClcGroup *group, int visibleOnly)
else if (group->cl.items[group->scanIndex]->type == CLCIT_GROUP && (!(visibleOnly&0x01) || group->cl.items[group->scanIndex]->group->expanded)) {
group = group->cl.items[group->scanIndex]->group;
group->scanIndex = 0;
- count += group->cl.count;
+ count += group->cl.count;
continue;
}
else if ((group->cl.items[group->scanIndex]->type == CLCIT_CONTACT) &&
@@ -806,7 +806,7 @@ int __fastcall CLVM_GetContactHiddenStatus(HANDLE hContact, char *szProto, struc
PDNCE pdnce = (PDNCE)pcli->pfnGetCacheEntry(hContact);
if (pdnce) {
now = g_CluiData.t_now;
- now -= g_CluiData.lastMsgFilter;
+ now -= g_CluiData.lastMsgFilter;
if (g_CluiData.bFilterEffective & CLVM_FILTER_LASTMSG_OLDERTHAN)
filterResult = filterResult & (pdnce->dwLastMsgTime < now);
else if (g_CluiData.bFilterEffective & CLVM_FILTER_LASTMSG_NEWERTHAN)
diff --git a/plugins/Clist_modern/src/modern_clcpaint.cpp b/plugins/Clist_modern/src/modern_clcpaint.cpp
index ce8c16421b..0a882160a8 100644
--- a/plugins/Clist_modern/src/modern_clcpaint.cpp
+++ b/plugins/Clist_modern/src/modern_clcpaint.cpp
@@ -411,11 +411,11 @@ RECT CLCPaint::_GetRectangle( struct ClcData *dat, RECT *row_rc, RECT *free_row
if ( dat->row_align_left_items_to_left )
width_tmp = real_width;
- rc.left += ( width_tmp - real_width ) >> 1;
+ rc.left += ( width_tmp - real_width ) >> 1;
rc.right = rc.left + real_width;
- rc.top += ( rc.bottom - rc.top - height ) >> 1;
+ rc.top += ( rc.bottom - rc.top - height ) >> 1;
rc.bottom = rc.top + height;
- *left_pos += width_tmp + horizontal_space;
+ *left_pos += width_tmp + horizontal_space;
free_row_rc->left = row_rc->left + *left_pos;
}
else // if ( !left )
@@ -431,10 +431,10 @@ RECT CLCPaint::_GetRectangle( struct ClcData *dat, RECT *row_rc, RECT *free_row
{
rc.left = max( rc.left + horizontal_space, rc.right - width_tmp ) + (( width_tmp - real_width ) >> 1 );
rc.right = min( rc.left + real_width, rc.right );
- rc.top += max( 0, ( rc.bottom - rc.top - height ) >> 1 );
+ rc.top += max( 0, ( rc.bottom - rc.top - height ) >> 1 );
rc.bottom = min( rc.top + height, rc.bottom );
- *right_pos += min( width_tmp + horizontal_space, free_row_rc->right - free_row_rc->left );
+ *right_pos += min( width_tmp + horizontal_space, free_row_rc->right - free_row_rc->left );
free_row_rc->right = row_rc->right - *right_pos;
}
}
@@ -481,28 +481,28 @@ void CLCPaint::_DrawTextSmiley( HDC hdcMem, RECT * free_rc, SIZE * text_size, T
else
{
// Draw text and smileys
- for ( ; i < plText->realCount && i >= 0 && pos_x < text_size->cx && len > 0; i += ( uTextFormat & DT_RTLREADING ? -1 : 1 ))
+ for ( ; i < plText->realCount && i >= 0 && pos_x < text_size->cx && len > 0; i += ( uTextFormat & DT_RTLREADING ? -1 : 1 ))
{
ClcContactTextPiece *piece = ( ClcContactTextPiece * ) plText->items[i];
RECT text_rc = *free_rc;
if ( uTextFormat & DT_RTLREADING )
- text_rc.right -= pos_x;
+ text_rc.right -= pos_x;
else
- text_rc.left += pos_x;
+ text_rc.left += pos_x;
if ( piece->type == TEXT_PIECE_TYPE_TEXT )
{
tmp_rc = text_rc;
- tmp_rc.right += 50;
+ tmp_rc.right += 50;
ske_DrawText( hdcMem, &szText[piece->start_pos + start], min( len, piece->len ), &tmp_rc, DT_CALCRECT | ( uTextFormat & ~DT_END_ELLIPSIS ));
- pos_x += tmp_rc.right - tmp_rc.left + 2;
+ pos_x += tmp_rc.right - tmp_rc.left + 2;
if ( uTextFormat & DT_RTLREADING )
text_rc.left = max( text_rc.left, text_rc.right - ( tmp_rc.right - tmp_rc.left ));
ske_DrawText( hdcMem, &szText[piece->start_pos + start], min( len, piece->len ), &text_rc, uTextFormat );
- len -= piece->len;
+ len -= piece->len;
}
else
{
@@ -515,7 +515,7 @@ void CLCPaint::_DrawTextSmiley( HDC hdcMem, RECT * free_rc, SIZE * text_size, T
else
{
LONG fac_width, fac_height;
- len -= piece->len;
+ len -= piece->len;
if ( piece->smiley_height > row_height && ResizeSizeSmiley )
{
@@ -534,7 +534,7 @@ void CLCPaint::_DrawTextSmiley( HDC hdcMem, RECT * free_rc, SIZE * text_size, T
if ( fac_width <= text_rc.right - text_rc.left )
{
- text_rc.top += ( row_height - fac_height ) >> 1;
+ text_rc.top += ( row_height - fac_height ) >> 1;
ske_DrawIconEx( hdcMem, text_rc.left, text_rc.top, piece->smiley,
fac_width, fac_height, 0, NULL, DI_NORMAL|(( factor < 1 )?128:0 )); //TO DO enchance drawing quality
@@ -544,7 +544,7 @@ void CLCPaint::_DrawTextSmiley( HDC hdcMem, RECT * free_rc, SIZE * text_size, T
ske_DrawText( hdcMem, _T( "..." ), 3, &text_rc, uTextFormat );
}
- pos_x += fac_width;
+ pos_x += fac_width;
}
}
}
@@ -888,7 +888,7 @@ void CLCPaint::_PaintRowItemsEx( HWND hwnd, HDC hdcMem, struct ClcData *dat, str
count_rc.right = 0;
count_rc.left = 0;
ske_DrawTextA( hdcMem, szCounts, lstrlenA( szCounts ), &count_rc, DT_CALCRECT );
- count_size.cx += count_rc.right-count_rc.left;
+ count_size.cx += count_rc.right-count_rc.left;
count_size.cy = count_rc.bottom-count_rc.top;
}
// modify text rect
@@ -1155,7 +1155,7 @@ void CLCPaint::_PaintRowItemsEx( HWND hwnd, HDC hdcMem, struct ClcData *dat, str
count_rc.right = 0;
count_rc.left = 0;
ske_DrawTextA( hdcMem, szCounts, lstrlenA( szCounts ), &count_rc, DT_CALCRECT );
- count_size.cx += count_rc.right-count_rc.left;
+ count_size.cx += count_rc.right-count_rc.left;
count_size.cy = count_rc.bottom-count_rc.top;
}
// modify text rect
@@ -1989,10 +1989,10 @@ void CLCPaint::_DrawLines( HWND hWnd, struct ClcData * dat, HDC hdc, int paintMo
SetRect( &row_rc, clRect.left, y, clRect.right, y + dat->row_heights[line_num] );
free_row_rc = row_rc;
- free_row_rc.left += left_pos;
- free_row_rc.right -= right_pos;
- free_row_rc.top += dat->row_border;
- free_row_rc.bottom -= dat->row_border;
+ free_row_rc.left += left_pos;
+ free_row_rc.right -= right_pos;
+ free_row_rc.top += dat->row_border;
+ free_row_rc.bottom -= dat->row_border;
free_row_height = free_row_rc.bottom - free_row_rc.top;
{
@@ -2120,7 +2120,7 @@ void CLCPaint::_DrawLines( HWND hWnd, struct ClcData * dat, HDC hdc, int paintMo
//RECT rc;
rc = free_row_rc;
rc.right = rc.left + dat->checkboxSize;
- rc.top += ( rc.bottom - rc.top - dat->checkboxSize ) >> 1;
+ rc.top += ( rc.bottom - rc.top - dat->checkboxSize ) >> 1;
rc.bottom = rc.top + dat->checkboxSize;
if ( dat->text_rtl != 0 ) _RTLRect( &rc, free_row_rc.right, 0 );
@@ -2130,7 +2130,7 @@ void CLCPaint::_DrawLines( HWND hWnd, struct ClcData * dat, HDC hdc, int paintMo
}
else DrawFrameControl( pc.hdcMem, &rc, DFC_BUTTON, DFCS_BUTTONCHECK|DFCS_FLAT|( Drawing->flags&CONTACTF_CHECKED?DFCS_CHECKED:0 )|( hottrack?DFCS_HOT:0 ));
- left_pos += dat->checkboxSize + EXTRA_CHECKBOX_SPACE + HORIZONTAL_SPACE;
+ left_pos += dat->checkboxSize + EXTRA_CHECKBOX_SPACE + HORIZONTAL_SPACE;
free_row_rc.left = row_rc.left + left_pos;
// Store pos
@@ -2158,7 +2158,7 @@ void CLCPaint::_DrawLines( HWND hWnd, struct ClcData * dat, HDC hdc, int paintMo
}
}
}
- y += dat->row_heights[line_num];
+ y += dat->row_heights[line_num];
//increment by subcontacts
if (( group->cl.items && group->scanIndex < group->cl.count && group->cl.items[group->scanIndex]->subcontacts != NULL && group->cl.items[group->scanIndex]->type != CLCIT_GROUP )
&& ( group->cl.items[group->scanIndex]->SubExpanded && dat->expandMeta ))
@@ -2541,7 +2541,7 @@ void CLCPaint::_CalcItemsPos( HWND hwnd, HDC hdcMem, struct ClcData *dat, struct
// Store init text position:
text_left_pos = left_pos;
- left_pos += MIN_TEXT_WIDTH;
+ left_pos += MIN_TEXT_WIDTH;
free_row_rc.left = row_rc.left + left_pos;
item_text = item;
@@ -2613,8 +2613,8 @@ void CLCPaint::_CalcItemsPos( HWND hwnd, HDC hdcMem, struct ClcData *dat, struct
// Get rect
text_rc = free_row_rc;
- free_height -= text_size.cy;
- text_rc.top += free_height >> 1;
+ free_height -= text_size.cy;
+ text_rc.top += free_height >> 1;
text_rc.bottom = text_rc.top + text_size.cy;
if ( dat->text_align_right )
@@ -2671,7 +2671,7 @@ void CLCPaint::_CalcItemsPos( HWND hwnd, HDC hdcMem, struct ClcData *dat, struct
}
// Get rect
- free_height -= max( text_size.cy, counts_size.cy );
+ free_height -= max( text_size.cy, counts_size.cy );
text_rc.top = free_row_rc.top + ( free_height >> 1 );
text_rc.bottom = text_rc.top + max( text_size.cy, counts_size.cy );
@@ -2734,7 +2734,7 @@ void CLCPaint::_CalcItemsPos( HWND hwnd, HDC hdcMem, struct ClcData *dat, struct
// Get rect
tmp = min( free_height, dat->second_line_top_space + second_line_text_size.cy );
- free_height -= tmp;
+ free_height -= tmp;
text_rc.top = free_row_rc.top + ( free_height >> 1 );
text_rc.bottom = text_rc.top + free_row_rc.bottom - free_row_rc.top - free_height;
@@ -2770,7 +2770,7 @@ void CLCPaint::_CalcItemsPos( HWND hwnd, HDC hdcMem, struct ClcData *dat, struct
// Get rect
tmp = min( free_height, dat->third_line_top_space + third_line_text_size.cy );
- free_height -= tmp;
+ free_height -= tmp;
text_rc.top = free_row_rc.top + ( free_height >> 1 );
text_rc.bottom = text_rc.top + free_row_rc.bottom - free_row_rc.top - free_height;
@@ -2816,14 +2816,14 @@ void CLCPaint::_CalcItemsPos( HWND hwnd, HDC hdcMem, struct ClcData *dat, struct
//devider
RECT trc = free_row_rc;
RECT rc = free_row_rc;
- rc.top += ( rc.bottom - rc.top ) >> 1;
+ rc.top += ( rc.bottom - rc.top ) >> 1;
rc.bottom = rc.top + 2;
rc.right = rc.left + (( rc.right - rc.left - text_size.cx )>>1 ) - 3;
trc.left = rc.right + 3;
trc.right = trc.left + text_size.cx + 6;
if ( text_size.cy < trc.bottom - trc.top )
{
- trc.top += ( trc.bottom - trc.top - text_size.cy ) >> 1;
+ trc.top += ( trc.bottom - trc.top - text_size.cy ) >> 1;
trc.bottom = trc.top + text_size.cy;
}
_StoreItemPos( Drawing, CIT_TEXT, &trc );
@@ -2844,7 +2844,7 @@ void CLCPaint::_CalcItemsPos( HWND hwnd, HDC hdcMem, struct ClcData *dat, struct
if ( text_size.cy < rc.bottom - rc.top )
{
- rc.top += ( rc.bottom - rc.top - text_size.cy ) >> 1;
+ rc.top += ( rc.bottom - rc.top - text_size.cy ) >> 1;
rc.bottom = rc.top + text_size.cy;
}
@@ -2863,7 +2863,7 @@ void CLCPaint::_CalcItemsPos( HWND hwnd, HDC hdcMem, struct ClcData *dat, struct
if ( counts_size.cy < counts_rc.bottom - counts_rc.top )
{
- counts_rc.top += ( counts_rc.bottom - counts_rc.top - counts_size.cy + 1 ) >> 1;
+ counts_rc.top += ( counts_rc.bottom - counts_rc.top - counts_size.cy + 1 ) >> 1;
counts_rc.bottom = counts_rc.top + counts_size.cy;
}
// Draw counts
@@ -2895,7 +2895,7 @@ void CLCPaint::_CalcItemsPos( HWND hwnd, HDC hdcMem, struct ClcData *dat, struct
uTextFormat &= ~DT_VCENTER;
if ( second_line_text_size.cx > 0 && free_rc.bottom > free_rc.top )
{
- free_rc.top += dat->second_line_top_space;
+ free_rc.top += dat->second_line_top_space;
if ( free_rc.bottom > free_rc.top )
{
@@ -2916,7 +2916,7 @@ void CLCPaint::_CalcItemsPos( HWND hwnd, HDC hdcMem, struct ClcData *dat, struct
if ( third_line_text_size.cx > 0 && free_rc.bottom > free_rc.top )
{
- free_rc.top += dat->third_line_top_space;
+ free_rc.top += dat->third_line_top_space;
if ( free_rc.bottom > free_rc.top )
{
@@ -3280,9 +3280,9 @@ void CLCPaint::_DrawContactLine( HDC hdcMem, struct ClcData *dat, struct ClcCont
RECT rc2 = *free_row_rc;
rc1.right = text_rc.left-3;
rc2.left = text_rc.right+3;
- rc1.top += ( rc1.bottom - rc1.top ) >> 1;
+ rc1.top += ( rc1.bottom - rc1.top ) >> 1;
rc1.bottom = rc1.top + 2;
- rc2.top += ( rc2.bottom - rc2.top ) >> 1;
+ rc2.top += ( rc2.bottom - rc2.top ) >> 1;
rc2.bottom = rc2.top + 2;
{
RECT rcTemp = rc1;
diff --git a/plugins/Clist_modern/src/modern_clistevents.cpp b/plugins/Clist_modern/src/modern_clistevents.cpp
index 4453329c66..79de8c29e5 100644
--- a/plugins/Clist_modern/src/modern_clistevents.cpp
+++ b/plugins/Clist_modern/src/modern_clistevents.cpp
@@ -349,14 +349,14 @@ static int EventArea_DrawWorker(HWND hWnd, HDC hDC)
//ske_DrawText(hDC,_T("DEBUG"),lstrlen(_T("DEBUG")),&rc,0);
{
int iCount = GetMenuItemCount(g_CluiData.hMenuNotify);
- rc.left += 26;
+ rc.left += 26;
if (g_CluiData.hUpdateContact != 0)
{
TCHAR *szName = pcli->pfnGetContactDisplayName(g_CluiData.hUpdateContact, 0);
int iIcon = CallService(MS_CLIST_GETCONTACTICON, (WPARAM) g_CluiData.hUpdateContact, 0);
ske_ImageList_DrawEx(g_himlCListClc, iIcon, hDC, rc.left, (rc.bottom + rc.top - GetSystemMetrics(SM_CYSMICON)) / 2, GetSystemMetrics(SM_CXSMICON), GetSystemMetrics(SM_CYSMICON), CLR_NONE, CLR_NONE, ILD_NORMAL);
- rc.left += 18;
+ rc.left += 18;
ske_DrawText(hDC, szName, -1, &rc, DT_VCENTER | DT_SINGLELINE);
ske_ImageList_DrawEx(g_himlCListClc, (int)g_CluiData.iIconNotify, hDC, 4, (rc.bottom + rc.top - 16) / 2, 16, 16, CLR_NONE, CLR_NONE, ILD_NORMAL);
}
@@ -374,7 +374,7 @@ static int EventArea_DrawWorker(HWND hWnd, HDC hDC)
szName = pcli->pfnGetContactDisplayName(nmi->hContact, 0);
iIcon = CallService(MS_CLIST_GETCONTACTICON, (WPARAM) nmi->hContact, 0);
ske_ImageList_DrawEx(g_himlCListClc, iIcon, hDC, rc.left, (rc.bottom + rc.top - GetSystemMetrics(SM_CYSMICON)) / 2, GetSystemMetrics(SM_CXSMICON), GetSystemMetrics(SM_CYSMICON), CLR_NONE, CLR_NONE, ILD_NORMAL);
- rc.left += 18;
+ rc.left += 18;
ske_ImageList_DrawEx(g_himlCListClc, nmi->iIcon, hDC, 4, (rc.bottom + rc.top) / 2 - 8, 16, 16, CLR_NONE, CLR_NONE, ILD_NORMAL);
ske_DrawText(hDC, szName, -1, &rc, DT_VCENTER | DT_SINGLELINE);
}
diff --git a/plugins/Clist_modern/src/modern_clui.cpp b/plugins/Clist_modern/src/modern_clui.cpp
index fe27bc2a34..f40beebf46 100644
--- a/plugins/Clist_modern/src/modern_clui.cpp
+++ b/plugins/Clist_modern/src/modern_clui.cpp
@@ -1624,8 +1624,8 @@ int CLUI_SizingOnBorder(POINT pt, int PerformSize)
else if ( pt.y >= r.top && pt.y <= r.top + SIZING_MARGIN ) sizeOnBorderFlag = SCF_TOP;
}
- if ( pt.x <= r.right && pt.x >= r.right - SIZING_MARGIN ) sizeOnBorderFlag += SCF_RIGHT;
- else if ( pt.x >= r.left && pt.x <= r.left + SIZING_MARGIN ) sizeOnBorderFlag += SCF_LEFT;
+ if ( pt.x <= r.right && pt.x >= r.right - SIZING_MARGIN ) sizeOnBorderFlag += SCF_RIGHT;
+ else if ( pt.x >= r.left && pt.x <= r.left + SIZING_MARGIN ) sizeOnBorderFlag += SCF_LEFT;
if ( !(pt.x >= r.left && pt.x <= r.right && pt.y >= r.top && pt.y <= r.bottom)) sizeOnBorderFlag = SCF_NONE;
diff --git a/plugins/Clist_modern/src/modern_cluiframes.cpp b/plugins/Clist_modern/src/modern_cluiframes.cpp
index 9f0edf0a11..486ce0f4e7 100644
--- a/plugins/Clist_modern/src/modern_cluiframes.cpp
+++ b/plugins/Clist_modern/src/modern_cluiframes.cpp
@@ -2146,7 +2146,7 @@ static int CLUIFrameMoveResize(const FRAMEWND *Frame)
{
SetWindowPos(Frame->OwnerWindow,NULL,Frame->wndSize.left+Off.x,Frame->wndSize.top+Off.y,
Frame->wndSize.right-Frame->wndSize.left,
- Frame->wndSize.bottom-Frame->wndSize.top,SWP_NOZORDER|SWP_NOACTIVATE ); //- -= -=
+ Frame->wndSize.bottom-Frame->wndSize.top,SWP_NOZORDER|SWP_NOACTIVATE ); //- -= -=
SetWindowPos(Frame->hWnd,NULL,0,0,
Frame->wndSize.right-Frame->wndSize.left,
diff --git a/plugins/Clist_modern/src/modern_docking.cpp b/plugins/Clist_modern/src/modern_docking.cpp
index e05de26096..63a8220bd0 100644
--- a/plugins/Clist_modern/src/modern_docking.cpp
+++ b/plugins/Clist_modern/src/modern_docking.cpp
@@ -229,7 +229,7 @@ int Docking_ProcessWindowMessage(WPARAM wParam,LPARAM lParam)
g_CluiData.mutexPreventDockMoving = 0;
SetWindowPos(msg->hwnd,0,rcWindow.left,rcWindow.top,0,0,SWP_NOSIZE|SWP_NOZORDER|SWP_NOREDRAW|SWP_NOSENDCHANGING);
Sync(CLUIFrames_OnMoving,msg->hwnd,&rcWindow);
- ModernSkinButton_ReposButtons( msg->hwnd, SBRF_DO_NOT_DRAW, NULL );// -= -= -=
+ ModernSkinButton_ReposButtons( msg->hwnd, SBRF_DO_NOT_DRAW, NULL );// -= -= -=
g_CluiData.mutexPreventDockMoving = 1;
return 1;
}
@@ -244,7 +244,7 @@ int Docking_ProcessWindowMessage(WPARAM wParam,LPARAM lParam)
Docking_AdjustPosition(msg->hwnd,&rcMonitor,&rc);
MoveWindow(msg->hwnd,rc.left,rc.top,rc.right-rc.left,rc.bottom-rc.top,TRUE);
Sync(CLUIFrames_OnMoving,msg->hwnd,&rc);
- ModernSkinButton_ReposButtons(msg->hwnd, SBRF_DO_NOT_DRAW, NULL);// -= -= -=
+ ModernSkinButton_ReposButtons(msg->hwnd, SBRF_DO_NOT_DRAW, NULL);// -= -= -=
return 1;
}
@@ -265,7 +265,7 @@ int Docking_ProcessWindowMessage(WPARAM wParam,LPARAM lParam)
rc = *(RECT*)(msg->lParam);
g_CluiData.mutexPreventDockMoving = 0;
Sync(CLUIFrames_OnMoving,msg->hwnd,&rc);
- // -= -= -=
+ // -= -= -=
return TRUE;
}
case WM_SHOWWINDOW:
@@ -286,7 +286,7 @@ int Docking_ProcessWindowMessage(WPARAM wParam,LPARAM lParam)
Docking_AdjustPosition(msg->hwnd,&rcMonitor,&rc);
MoveWindow(msg->hwnd,rc.left,rc.top,rc.right-rc.left,rc.bottom-rc.top,FALSE);
Sync(CLUIFrames_OnMoving,msg->hwnd,&rc);
- ModernSkinButton_ReposButtons(msg->hwnd, SBRF_DO_NOT_DRAW,NULL);// -= -= -=
+ ModernSkinButton_ReposButtons(msg->hwnd, SBRF_DO_NOT_DRAW,NULL);// -= -= -=
}
else {
SHAppBarMessage(ABM_REMOVE,&abd);
@@ -350,7 +350,7 @@ int Docking_ProcessWindowMessage(WPARAM wParam,LPARAM lParam)
Docking_GetMonitorRectFromWindow(msg->hwnd,&rcMonitor);
GetWindowRect(msg->hwnd,&rc);
Docking_AdjustPosition(msg->hwnd,&rcMonitor,&rc);
- Sync(CLUIFrames_OnMoving,msg->hwnd,&rc); // -= -= -=
+ Sync(CLUIFrames_OnMoving,msg->hwnd,&rc); // -= -= -=
ModernSkinButton_ReposButtons(msg->hwnd, SBRF_DO_NOT_DRAW, NULL);
g_CluiData.mutexPreventDockMoving = 1;
diff --git a/plugins/Clist_modern/src/modern_image_array.cpp b/plugins/Clist_modern/src/modern_image_array.cpp
index 21a87c18d7..11b51081a9 100644
--- a/plugins/Clist_modern/src/modern_image_array.cpp
+++ b/plugins/Clist_modern/src/modern_image_array.cpp
@@ -41,7 +41,7 @@ static BOOL ImageArray_Alloc(LP_IMAGE_ARRAY_DATA iad, int size)
if (size_grow > iad->nodes_allocated_size)
{
- size_grow += iad->grow_step - (size_grow % iad->grow_step);
+ size_grow += iad->grow_step - (size_grow % iad->grow_step);
if (iad->nodes != NULL)
{
@@ -83,7 +83,7 @@ static BOOL ImageArray_Alloc(LP_IMAGE_ARRAY_DATA iad, int size)
{
IMAGE_ARRAY_DATA_NODE *tmp;
- size_grow += iad->grow_step - (size_grow % iad->grow_step);
+ 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);
@@ -275,7 +275,7 @@ int ImageArray_AddImage(LP_IMAGE_ARRAY_DATA iad, HBITMAP hBmp, int pos)
h = 0;
for (i=0; i < pos; i++)
{
- h += iad->nodes[i].height;
+ h += iad->nodes[i].height;
}
}
else
@@ -284,7 +284,7 @@ int ImageArray_AddImage(LP_IMAGE_ARRAY_DATA iad, HBITMAP hBmp, int pos)
w = 0;
for (i=0; i < pos; i++)
{
- w += iad->nodes[i].width;
+ w += iad->nodes[i].width;
}
}
BitBlt(iad->hdc, 0, 0, w, h, hdc_old, 0, 0, SRCCOPY);
@@ -317,7 +317,7 @@ int ImageArray_AddImage(LP_IMAGE_ARRAY_DATA iad, HBITMAP hBmp, int pos)
oy = y;
x = 0;
- y += bm.bmHeight;
+ y += bm.bmHeight;
w = iad->width;
h = iad->height - h;
@@ -327,7 +327,7 @@ int ImageArray_AddImage(LP_IMAGE_ARRAY_DATA iad, HBITMAP hBmp, int pos)
ox = x;
oy = 0;
- x += bm.bmWidth;
+ x += bm.bmWidth;
y = 0;
w = iad->width - w;
@@ -436,7 +436,7 @@ BOOL ImageArray_ChangeImage(LP_IMAGE_ARRAY_DATA iad, HBITMAP hBmp, int pos)
h = 0;
for (i=0; i < pos; i++)
{
- h += iad->nodes[i].height;
+ h += iad->nodes[i].height;
}
}
else
@@ -445,7 +445,7 @@ BOOL ImageArray_ChangeImage(LP_IMAGE_ARRAY_DATA iad, HBITMAP hBmp, int pos)
w = 0;
for (i=0; i < pos; i++)
{
- w += iad->nodes[i].width;
+ w += iad->nodes[i].width;
}
}
BitBlt(iad->hdc, 0, 0, w, h, hdc_old, 0, 0, SRCCOPY);
@@ -478,7 +478,7 @@ BOOL ImageArray_ChangeImage(LP_IMAGE_ARRAY_DATA iad, HBITMAP hBmp, int pos)
oy = y + iad->nodes[pos].height;
x = 0;
- y += bm.bmHeight;
+ y += bm.bmHeight;
w = iad->width;
h = iad->height - h - iad->nodes[pos].height;
@@ -488,7 +488,7 @@ BOOL ImageArray_ChangeImage(LP_IMAGE_ARRAY_DATA iad, HBITMAP hBmp, int pos)
ox = x + iad->nodes[pos].width;
oy = 0;
- x += bm.bmWidth;
+ x += bm.bmWidth;
y = 0;
w = iad->width - w - iad->nodes[pos].width;
@@ -580,7 +580,7 @@ BOOL ImageArray_RemoveImage(LP_IMAGE_ARRAY_DATA iad, int pos)
h = 0;
for (i=0; i < pos; i++)
{
- h += iad->nodes[i].height;
+ h += iad->nodes[i].height;
}
}
else
@@ -589,7 +589,7 @@ BOOL ImageArray_RemoveImage(LP_IMAGE_ARRAY_DATA iad, int pos)
w = 0;
for (i=0; i < pos; i++)
{
- w += iad->nodes[i].width;
+ w += iad->nodes[i].width;
}
}
BitBlt(iad->hdc, 0, 0, w, h, hdc_old, 0, 0, SRCCOPY);
@@ -669,7 +669,7 @@ BOOL ImageArray_DrawImage(LP_IMAGE_ARRAY_DATA iad, int pos, HDC hdcDest, int nXD
h = 0;
for (i=0; i < pos; i++)
{
- h += iad->nodes[i].height;
+ h += iad->nodes[i].height;
}
}
else
@@ -678,7 +678,7 @@ BOOL ImageArray_DrawImage(LP_IMAGE_ARRAY_DATA iad, int pos, HDC hdcDest, int nXD
w = 0;
for (i=0; i < pos; i++)
{
- w += iad->nodes[i].width;
+ w += iad->nodes[i].width;
}
}
{
diff --git a/plugins/Clist_modern/src/modern_row.cpp b/plugins/Clist_modern/src/modern_row.cpp
index d2799d2b9a..f6bf9e272a 100644
--- a/plugins/Clist_modern/src/modern_row.cpp
+++ b/plugins/Clist_modern/src/modern_row.cpp
@@ -407,12 +407,12 @@ void rowCalculateMinSize(ROWCELL* cell)
if (curchild->layer)
{
//w = max(w, curchild->r.right);
- wl += curchild->r.right;
+ wl += curchild->r.right;
fullWidth = max(fullWidth,max(curchild->full_width,curchild->w));
}
else
{
- w += curchild->r.right;
+ w += curchild->r.right;
fullWidth += max(curchild->full_width,curchild->w);
}
}
@@ -432,7 +432,7 @@ void rowCalculateMinSize(ROWCELL* cell)
// h = max(h, curchild->r.bottom);
}
else
- h += curchild->r.bottom;
+ h += curchild->r.bottom;
curchild = curchild->next;
}
@@ -499,7 +499,7 @@ void rowPlacing(pROWCELL cell)
case TC_TEXT2:
case TC_TEXT3:
case TC_SPACE:
- cell->r.right += cell->r.left;
+ cell->r.right += cell->r.left;
break;
default:
{
@@ -508,10 +508,10 @@ void rowPlacing(pROWCELL cell)
case TC_LEFT:
break;
case TC_HCENTER:
- cell->r.left += (cell->r.right - cell->w)/2;
+ cell->r.left += (cell->r.right - cell->w)/2;
break;
case TC_RIGHT:
- cell->r.left += cell->r.right - cell->w;
+ cell->r.left += cell->r.right - cell->w;
}
cell->r.right = cell->r.left + cell->w;
}
@@ -522,10 +522,10 @@ void rowPlacing(pROWCELL cell)
case TC_TOP:
break;
case TC_VCENTER:
- cell->r.top += (cell->r.bottom - cell->h)/2;
+ cell->r.top += (cell->r.bottom - cell->h)/2;
break;
case TC_BOTTOM:
- cell->r.top += cell->r.bottom - cell->h;
+ cell->r.top += cell->r.bottom - cell->h;
}
cell->r.bottom = cell->r.top + cell->h;
}
@@ -541,7 +541,7 @@ void rowLayerProc(pROWCELL cell, pROWCELL parent)
if (cell->sizing)
{
cell->r.left = parent->r.left;
- //cell->r.right += cell->r.left;
+ //cell->r.right += cell->r.left;
}
else
{
@@ -620,7 +620,7 @@ void rowPositioning(pROWCELL cell, int &dist)
continue;
}
- cw += curchild->r.right;
+ cw += curchild->r.right;
if (curchild->sizing)
{
@@ -628,12 +628,12 @@ void rowPositioning(pROWCELL cell, int &dist)
r++;
}
else
- size += curchild->r.right;
+ size += curchild->r.right;
curchild = curchild->next;
}
- w -= size;
+ w -= size;
fixedsized -= size;
if (r == 0)
@@ -641,10 +641,10 @@ void rowPositioning(pROWCELL cell, int &dist)
switch(cell->halign)
{
case TC_HCENTER:
- x += (dist - cw)/2;// - 1;
+ x += (dist - cw)/2;// - 1;
break;
case TC_RIGHT:
- x += dist - cw;
+ x += dist - cw;
break;
}
}
@@ -667,7 +667,7 @@ void rowPositioning(pROWCELL cell, int &dist)
curchild->r.left = x;
- w -= size;
+ w -= size;
if (curchild->sizing)
{
if ((0&!curchild->fitwidth) || r>1) //пока отключено -проблемы с выравниванием
@@ -703,7 +703,7 @@ void rowPositioning(pROWCELL cell, int &dist)
size = curchild->r.right;
rowPositioning(curchild, size);
- x += size;
+ x += size;
if ( !curchild->sizing)
size = 0;
@@ -725,7 +725,7 @@ void rowPositioning(pROWCELL cell, int &dist)
continue;
}
- size += curchild->r.bottom;
+ size += curchild->r.bottom;
curchild = curchild->next;
}
@@ -734,10 +734,10 @@ void rowPositioning(pROWCELL cell, int &dist)
switch(cell->valign)
{
case TC_VCENTER:
- y += (h - size) / 2;
+ y += (h - size) / 2;
break;
case TC_BOTTOM:
- y += (h - size);
+ y += (h - size);
break;
}
}
@@ -753,7 +753,7 @@ void rowPositioning(pROWCELL cell, int &dist)
else
{
curchild->r.top = y;
- y += curchild->r.bottom;
+ y += curchild->r.bottom;
curchild->r.left = cell->r.left;
curchild->r.right = dist;
diff --git a/plugins/Clist_modern/src/modern_rowheight_funcs.cpp b/plugins/Clist_modern/src/modern_rowheight_funcs.cpp
index 3839cafc97..0737505c86 100644
--- a/plugins/Clist_modern/src/modern_rowheight_funcs.cpp
+++ b/plugins/Clist_modern/src/modern_rowheight_funcs.cpp
@@ -144,11 +144,11 @@ int mod_CalcRowHeight_worker(struct ClcData *dat, HWND hwnd, struct ClcContact *
// calc width and height
g_clcPainter.ChangeToFont(hdc,dat,contact->group->expanded?FONTID_OPENGROUPCOUNTS:FONTID_CLOSEDGROUPCOUNTS,NULL);
ske_DrawText(hdc,_T(" "),1,&count_rc,DT_CALCRECT | DT_NOPREFIX);
- size.cx += count_rc.right-count_rc.left;
+ size.cx += count_rc.right-count_rc.left;
count_rc.right = 0;
count_rc.left = 0;
ske_DrawTextA(hdc,szCounts,lstrlenA(szCounts),&count_rc,DT_CALCRECT);
- size.cx += count_rc.right-count_rc.left;
+ size.cx += count_rc.right-count_rc.left;
tmp = max(tmp,count_rc.bottom-count_rc.top);
}
}
@@ -395,7 +395,7 @@ BOOL RowHeights_Alloc(struct ClcData *dat, int size)
{
int size_grow = size;
- size_grow += 100 - (size_grow % 100);
+ size_grow += 100 - (size_grow % 100);
if (dat->row_heights != NULL)
{
@@ -458,7 +458,7 @@ int RowHeights_GetMaxRowHeight(struct ClcData *dat, HWND hwnd)
{
tmp = max(tmp, dat->text_smiley_height);
}
- max_height += tmp;
+ max_height += tmp;
if (dat->second_line_show)
{
@@ -467,7 +467,7 @@ int RowHeights_GetMaxRowHeight(struct ClcData *dat, HWND hwnd)
{
tmp = max(tmp, dat->text_smiley_height);
}
- max_height += dat->second_line_top_space + tmp;
+ max_height += dat->second_line_top_space + tmp;
}
if (dat->third_line_show)
@@ -477,7 +477,7 @@ int RowHeights_GetMaxRowHeight(struct ClcData *dat, HWND hwnd)
{
tmp = max(tmp, dat->text_smiley_height);
}
- max_height += dat->third_line_top_space + tmp;
+ max_height += dat->third_line_top_space + tmp;
}
// Get other font sizes
@@ -506,7 +506,7 @@ int RowHeights_GetMaxRowHeight(struct ClcData *dat, HWND hwnd)
max_height = max(max_height, ICON_HEIGHT);
}
- max_height += 2 * dat->row_border;
+ max_height += 2 * dat->row_border;
// Min size
max_height = max(max_height, dat->row_min_heigh);
@@ -645,7 +645,7 @@ int RowHeights_GetRowHeight_worker(struct ClcData *dat, HWND hwnd, struct ClcCon
{
tmp = max(tmp, contact->ssText.iMaxSmileyHeight);
}
- height += tmp;
+ height += tmp;
if ( !minimalistic && dat->second_line_show && pdnce->szSecondLineText && pdnce->szSecondLineText[0])
{
@@ -654,7 +654,7 @@ int RowHeights_GetRowHeight_worker(struct ClcData *dat, HWND hwnd, struct ClcCon
{
tmp = max(tmp, pdnce->ssSecondLine.iMaxSmileyHeight);
}
- height += dat->second_line_top_space + tmp;
+ height += dat->second_line_top_space + tmp;
}
if ( !minimalistic && dat->third_line_show && pdnce->szThirdLineText && pdnce->szThirdLineText[0])
@@ -664,7 +664,7 @@ int RowHeights_GetRowHeight_worker(struct ClcData *dat, HWND hwnd, struct ClcCon
{
tmp = max(tmp, pdnce->ssThirdLine.iMaxSmileyHeight);
}
- height += dat->third_line_top_space + tmp;
+ height += dat->third_line_top_space + tmp;
}
}
@@ -702,7 +702,7 @@ int RowHeights_GetRowHeight_worker(struct ClcData *dat, HWND hwnd, struct ClcCon
}
}
- height += 2 * dat->row_border;
+ height += 2 * dat->row_border;
// Min size
height = max(height, dat->row_min_heigh);
@@ -729,7 +729,7 @@ int cliGetRowTopY(struct ClcData *dat, int item)
for (i=0 ; i < item ; i++)
{
- y += dat->row_heights[i];
+ y += dat->row_heights[i];
}
return y;
@@ -747,7 +747,7 @@ int cliGetRowBottomY(struct ClcData *dat, int item)
for (i=0 ; i <= item ; i++)
{
- y += dat->row_heights[i];
+ y += dat->row_heights[i];
}
return y;
@@ -762,7 +762,7 @@ int cliGetRowTotalHeight(struct ClcData *dat)
for (i=0 ; i < dat->row_heights_size ; i++)
{
- y += dat->row_heights[i];
+ y += dat->row_heights[i];
}
return y;
@@ -779,7 +779,7 @@ int cliRowHitTest(struct ClcData *dat, int pos_y)
for (i=0 ; i < dat->row_heights_size ; i++)
{
- y += dat->row_heights[i];
+ y += dat->row_heights[i];
if (pos_y < y)
return i;
diff --git a/plugins/Clist_modern/src/modern_skinengine.cpp b/plugins/Clist_modern/src/modern_skinengine.cpp
index d51972abc3..0351e8c2e5 100644
--- a/plugins/Clist_modern/src/modern_skinengine.cpp
+++ b/plugins/Clist_modern/src/modern_skinengine.cpp
@@ -748,9 +748,9 @@ BOOL ske_SetRectOpaque(HDC memdc,RECT *fr, BOOL force)
for ( int x = 0; x < width; x++ )
{
*pColumn = 255;
- pColumn += 4;
+ pColumn += 4;
}
- pLine -= bmp.bmWidthBytes;
+ pLine -= bmp.bmWidthBytes;
}
if (f)
{
@@ -1852,7 +1852,7 @@ static BOOL ske_ReadTGAImageData(void * From, DWORD fromSize, BYTE * destBuf, DW
fromCount += 4;
}
else fread (rgba, sizeof (BYTE), 4, fp);
- for (i=0; i < size; ++i, ptr += 4)
+ for (i=0; i < size; ++i, ptr += 4)
{
ptr[2] = rgba[2];
ptr[1] = rgba[1];
@@ -1862,7 +1862,7 @@ static BOOL ske_ReadTGAImageData(void * From, DWORD fromSize, BYTE * destBuf, DW
}
else
{ /* not run-length packet */
- for (i=0; i < size; ++i, ptr += 4)
+ for (i=0; i < size; ++i, ptr += 4)
{
ptr[0] = from? from[fromCount++]:(BYTE)fgetc (fp);
ptr[1] = from? from[fromCount++]:(BYTE)fgetc (fp);
@@ -2843,7 +2843,7 @@ static int ske_AlphaTextOut (HDC hDC, LPCTSTR lpString, int nCount, RECT * lpRec
// Calc sizes and offsets
- textSize.cx += 2; // CORRECTION: for italic
+ textSize.cx += 2; // CORRECTION: for italic
int drx = 0; // x-axis offset of draw point
@@ -2881,8 +2881,8 @@ static int ske_AlphaTextOut (HDC hDC, LPCTSTR lpString, int nCount, RECT * lpRec
textSize.cy = workRectHeight;
}
- textSize.cx += 4; // CORRECTION: for effects ???
- textSize.cy += 4; // CORRECTION: for effects ???
+ textSize.cx += 4; // CORRECTION: for effects ???
+ textSize.cy += 4; // CORRECTION: for effects ???
if ( textSize.cx > 0 && textSize.cy > 0 ) // Ok we need to paint
{
diff --git a/plugins/Clist_modern/src/modern_skinselector.cpp b/plugins/Clist_modern/src/modern_skinselector.cpp
index 2500bc3ac6..76048d652a 100644
--- a/plugins/Clist_modern/src/modern_skinselector.cpp
+++ b/plugins/Clist_modern/src/modern_skinselector.cpp
@@ -82,7 +82,7 @@ BOOL wildcmpi(TCHAR* name, TCHAR* mask)
if (*mask == '\0') return ((BOOL)!*mask); /* true */
}
if (*name == '\0') return ((BOOL)!*mask); /* *mask == EOS */
- if (*mask != '?' && _qtoupper(*mask) != _qtoupper(*name)) name -= (size_t)(mask - last) - 1, mask = last;
+ if (*mask != '?' && _qtoupper(*mask) != _qtoupper(*name)) name -= (size_t)(mask - last) - 1, mask = last;
}
}
@@ -103,7 +103,7 @@ BOOL wildcmpi(char * name, char * mask)
if (*mask == '\0') return ((BOOL)!*mask); /* true */
}
if (*name == '\0') return ((BOOL)!*mask); /* *mask == EOS */
- if (*mask != '?' && _qtoupper(*mask) != _qtoupper(*name)) name -= (size_t)(mask - last) - 1, mask = last;
+ if (*mask != '?' && _qtoupper(*mask) != _qtoupper(*name)) name -= (size_t)(mask - last) - 1, mask = last;
}
}
@@ -124,7 +124,7 @@ BOOL __inline wildcmp(const char * name, const char * mask, BYTE option)
if (*mask == '\0') return ((BOOL)!*mask); /* true */
}
if (*name == '\0') return ((BOOL)!*mask); /* *mask == EOS */
- if (*mask != '?' && *mask != *name) name -= (size_t)(mask - last) - 1, mask = last;
+ if (*mask != '?' && *mask != *name) name -= (size_t)(mask - last) - 1, mask = last;
}
}
diff --git a/plugins/Clist_modern/src/modern_statusbar.cpp b/plugins/Clist_modern/src/modern_statusbar.cpp
index f7e61abab1..6ebc8b1bbc 100644
--- a/plugins/Clist_modern/src/modern_statusbar.cpp
+++ b/plugins/Clist_modern/src/modern_statusbar.cpp
@@ -23,46 +23,55 @@ COLORREF sttGetColor(char * module, char * color, COLORREF defColor);
#define DBFONTF_ITALIC 2
#define DBFONTF_UNDERLINE 4
-typedef struct _ProtoItemData
+typedef struct _ProtoItemData : public MZeroedObject
{
- HICON icon;
- HICON extraIcon;
- int iconIndex;
- char * ProtoName;
- char * AccountName;
- int ProtoStatus;
- TCHAR *ProtoHumanName;
- char *ProtoEMailCount;
- char * ProtoStatusText;
- TCHAR * ProtoXStatus;
- int ProtoPos;
- int fullWidth;
- RECT protoRect;
- BOOL DoubleIcons;
-
- BYTE showProtoIcon;
- BYTE showProtoName;
- BYTE showStatusName;
- BYTE xStatusMode; // 0-only main, 1-xStatus, 2-main as overlay
- BYTE connectingIcon;
- BYTE showProtoEmails;
- BYTE SBarRightClk;
- int PaddingLeft;
- int PaddingRight;
-
- bool isDimmed;
-
-} ProtoItemData;
-
-ProtoItemData *ProtosData = NULL;
-int allocedItemData = 0;
-STATUSBARDATA g_StatusBarData = {0};
+ ~_ProtoItemData()
+ {
+ mir_free(ProtoXStatus);
+ mir_free(ProtoName);
+ mir_free(AccountName);
+ mir_free(ProtoHumanName);
+ mir_free(ProtoEMailCount);
+ mir_free(ProtoStatusText);
+ }
+ HICON icon;
+ HICON extraIcon;
+ int iconIndex;
+ char *ProtoName;
+ char *AccountName;
+ int ProtoStatus;
+ TCHAR *ProtoHumanName;
+ char *ProtoEMailCount;
+ char *ProtoStatusText;
+ TCHAR *ProtoXStatus;
+ int ProtoPos;
+ int fullWidth;
+ RECT protoRect;
+ BOOL DoubleIcons;
+
+ BYTE showProtoIcon;
+ BYTE showProtoName;
+ BYTE showStatusName;
+ BYTE xStatusMode; // 0-only main, 1-xStatus, 2-main as overlay
+ BYTE connectingIcon;
+ BYTE showProtoEmails;
+ BYTE SBarRightClk;
+ int PaddingLeft;
+ int PaddingRight;
+
+ bool isDimmed;
+}
+ ProtoItemData;
+
+static OBJLIST<ProtoItemData> ProtosData(5);
+
+STATUSBARDATA g_StatusBarData = {0};
-char * ApendSubSetting(char * buf, int size, char *first, char *second)
+char* ApendSubSetting(char * buf, int size, char *first, char *second)
{
- _snprintf(buf,size,"%sFont%s",first,second);
- return buf;
+ _snprintf(buf,size,"%sFont%s",first,second);
+ return buf;
}
int LoadStatusBarData()
@@ -79,77 +88,74 @@ int LoadStatusBarData()
g_StatusBarData.nProtosPerLine = db_get_b(NULL,"CLUI","StatusBarProtosPerLine",SETTING_PROTOSPERLINE_DEFAULT);
g_StatusBarData.Align = db_get_b(NULL,"CLUI","Align",SETTING_ALIGN_DEFAULT);
g_StatusBarData.VAlign = db_get_b(NULL,"CLUI","VAlign",SETTING_VALIGN_DEFAULT);
- g_StatusBarData.sameWidth = db_get_b(NULL,"CLUI","EqualSections",SETTING_EQUALSECTIONS_DEFAULT);
- g_StatusBarData.rectBorders.left = db_get_dw(NULL,"CLUI","LeftOffset",SETTING_LEFTOFFSET_DEFAULT);
- g_StatusBarData.rectBorders.right = db_get_dw(NULL,"CLUI","RightOffset",SETTING_RIGHTOFFSET_DEFAULT);
- g_StatusBarData.rectBorders.top = db_get_dw(NULL,"CLUI","TopOffset",SETTING_TOPOFFSET_DEFAULT);
- g_StatusBarData.rectBorders.bottom = db_get_dw(NULL,"CLUI","BottomOffset",SETTING_BOTTOMOFFSET_DEFAULT);
- g_StatusBarData.extraspace = (BYTE)db_get_dw(NULL,"CLUI","SpaceBetween",SETTING_SPACEBETWEEN_DEFAULT);
+ g_StatusBarData.sameWidth = db_get_b(NULL,"CLUI","EqualSections",SETTING_EQUALSECTIONS_DEFAULT);
+ g_StatusBarData.rectBorders.left = db_get_dw(NULL,"CLUI","LeftOffset",SETTING_LEFTOFFSET_DEFAULT);
+ g_StatusBarData.rectBorders.right = db_get_dw(NULL,"CLUI","RightOffset",SETTING_RIGHTOFFSET_DEFAULT);
+ g_StatusBarData.rectBorders.top = db_get_dw(NULL,"CLUI","TopOffset",SETTING_TOPOFFSET_DEFAULT);
+ g_StatusBarData.rectBorders.bottom = db_get_dw(NULL,"CLUI","BottomOffset",SETTING_BOTTOMOFFSET_DEFAULT);
+ g_StatusBarData.extraspace = (BYTE)db_get_dw(NULL,"CLUI","SpaceBetween",SETTING_SPACEBETWEEN_DEFAULT);
if (g_StatusBarData.BarFont) DeleteObject(g_StatusBarData.BarFont);
- g_StatusBarData.BarFont = NULL;//LoadFontFromDB("ModernData","StatusBar",&g_StatusBarData.fontColor);
- {
- int vis = db_get_b(NULL,"CLUI","ShowSBar",SETTING_SHOWSBAR_DEFAULT);
- int frameopt;
- int frameID = Sync( FindFrameID, hModernStatusBar );
- frameopt = CallService(MS_CLIST_FRAMES_GETFRAMEOPTIONS,MAKEWPARAM(FO_FLAGS,frameID),0);
- frameopt = frameopt & (~F_VISIBLE);
- if (vis)
- {
- ShowWindow(hModernStatusBar,SW_SHOW);
- frameopt |= F_VISIBLE;
- }
- else
- {
- ShowWindow(hModernStatusBar,SW_HIDE);
- };
- CallService(MS_CLIST_FRAMES_SETFRAMEOPTIONS,MAKEWPARAM(FO_FLAGS,frameID),frameopt);
- }
- g_StatusBarData.TextEffectID = db_get_b(NULL,"StatusBar","TextEffectID",SETTING_TEXTEFFECTID_DEFAULT);
- g_StatusBarData.TextEffectColor1 = db_get_dw(NULL,"StatusBar","TextEffectColor1",SETTING_TEXTEFFECTCOLOR1_DEFAULT);
- g_StatusBarData.TextEffectColor2 = db_get_dw(NULL,"StatusBar","TextEffectColor2",SETTING_TEXTEFFECTCOLOR2_DEFAULT);
-
- if (g_StatusBarData.hBmpBackground) {DeleteObject(g_StatusBarData.hBmpBackground); g_StatusBarData.hBmpBackground = NULL;}
-
- if (g_CluiData.fDisableSkinEngine)
- {
- DBVARIANT dbv;
- g_StatusBarData.bkColour = sttGetColor("StatusBar","BkColour",CLCDEFAULT_BKCOLOUR);
- if (db_get_b(NULL,"StatusBar","UseBitmap",CLCDEFAULT_USEBITMAP)) {
- if ( !DBGetContactSettingString(NULL,"StatusBar","BkBitmap",&dbv)) {
- g_StatusBarData.hBmpBackground = (HBITMAP)CallService(MS_UTILS_LOADBITMAP,0,(LPARAM)dbv.pszVal);
- db_free(&dbv);
- }
- }
- g_StatusBarData.bkUseWinColors = db_get_b(NULL,"StatusBar", "UseWinColours", CLCDEFAULT_USEWINDOWSCOLOURS);
- g_StatusBarData.backgroundBmpUse = db_get_w(NULL,"StatusBar","BkBmpUse",CLCDEFAULT_BKBMPUSE);
- }
- SendMessage(pcli->hwndContactList,WM_SIZE,0,0);
+ g_StatusBarData.BarFont = NULL;//LoadFontFromDB("ModernData","StatusBar",&g_StatusBarData.fontColor);
- return 1;
+ int vis = db_get_b(NULL,"CLUI","ShowSBar",SETTING_SHOWSBAR_DEFAULT);
+ int frameopt;
+ int frameID = Sync( FindFrameID, hModernStatusBar );
+ frameopt = CallService(MS_CLIST_FRAMES_GETFRAMEOPTIONS,MAKEWPARAM(FO_FLAGS,frameID),0);
+ frameopt = frameopt & (~F_VISIBLE);
+ if (vis) {
+ ShowWindow(hModernStatusBar,SW_SHOW);
+ frameopt |= F_VISIBLE;
+ }
+ else ShowWindow(hModernStatusBar,SW_HIDE);
+ CallService(MS_CLIST_FRAMES_SETFRAMEOPTIONS,MAKEWPARAM(FO_FLAGS,frameID),frameopt);
+
+ g_StatusBarData.TextEffectID = db_get_b(NULL,"StatusBar","TextEffectID",SETTING_TEXTEFFECTID_DEFAULT);
+ g_StatusBarData.TextEffectColor1 = db_get_dw(NULL,"StatusBar","TextEffectColor1",SETTING_TEXTEFFECTCOLOR1_DEFAULT);
+ g_StatusBarData.TextEffectColor2 = db_get_dw(NULL,"StatusBar","TextEffectColor2",SETTING_TEXTEFFECTCOLOR2_DEFAULT);
+
+ if (g_StatusBarData.hBmpBackground) {DeleteObject(g_StatusBarData.hBmpBackground); g_StatusBarData.hBmpBackground = NULL;}
+
+ if (g_CluiData.fDisableSkinEngine) {
+ DBVARIANT dbv;
+ g_StatusBarData.bkColour = sttGetColor("StatusBar","BkColour",CLCDEFAULT_BKCOLOUR);
+ if (db_get_b(NULL,"StatusBar","UseBitmap",CLCDEFAULT_USEBITMAP)) {
+ if ( !DBGetContactSettingString(NULL,"StatusBar","BkBitmap",&dbv)) {
+ g_StatusBarData.hBmpBackground = (HBITMAP)CallService(MS_UTILS_LOADBITMAP,0,(LPARAM)dbv.pszVal);
+ db_free(&dbv);
+ }
+ }
+ g_StatusBarData.bkUseWinColors = db_get_b(NULL,"StatusBar", "UseWinColours", CLCDEFAULT_USEWINDOWSCOLOURS);
+ g_StatusBarData.backgroundBmpUse = db_get_w(NULL,"StatusBar","BkBmpUse",CLCDEFAULT_BKBMPUSE);
+ }
+ SendMessage(pcli->hwndContactList,WM_SIZE,0,0);
+
+ return 1;
}
int BgStatusBarChange(WPARAM wParam,LPARAM lParam)
{
- if (MirandaExiting()) return 0;
- LoadStatusBarData();
- return 0;
+ if (MirandaExiting())
+ return 0;
+
+ LoadStatusBarData();
+ return 0;
}
//ProtocolData;
int NewStatusPaintCallbackProc(HWND hWnd, HDC hDC, RECT * rcPaint, HRGN rgn, DWORD dFlags, void * CallBackData)
{
- return ModernDrawStatusBar(hWnd,hDC);
+ return ModernDrawStatusBar(hWnd,hDC);
}
int ModernDrawStatusBar(HWND hwnd, HDC hDC)
{
- if (hwnd == (HWND)-1) return 0;
- if (GetParent(hwnd) == pcli->hwndContactList)
- return ModernDrawStatusBarWorker(hwnd,hDC);
- else
- CLUI__cliInvalidateRect(hwnd,NULL,FALSE);
- return 0;
+ if (hwnd == (HWND)-1) return 0;
+ if (GetParent(hwnd) == pcli->hwndContactList)
+ return ModernDrawStatusBarWorker(hwnd,hDC);
+
+ CLUI__cliInvalidateRect(hwnd,NULL,FALSE);
+ return 0;
}
int ModernDrawStatusBarWorker(HWND hWnd, HDC hDC)
@@ -157,22 +163,17 @@ int ModernDrawStatusBarWorker(HWND hWnd, HDC hDC)
int line;
int iconHeight = GetSystemMetrics(SM_CYSMICON)+2;
int protosperline = 0;
- int visProtoCount = 0;
- int protoCount;
int SumWidth = 0;
int rectwidth = 0;
int aligndx = 0;
int * ProtoWidth = NULL;
- int i,j,po = 0;
+ int i,po = 0;
char servName[40];
char protoNameExt[40];
// Count visible protos
- PROTOACCOUNT **accs;
RECT rc;
HFONT hOldFont;
- int iconY, textY;
- int spaceWidth;
int maxwidth = 0;
int xstatus = 0;
SIZE textSize = {0};
@@ -188,949 +189,810 @@ int ModernDrawStatusBarWorker(HWND hWnd, HDC hDC)
g_StatusBarData.nProtosPerLine = db_get_b(NULL,"CLUI","StatusBarProtosPerLine",SETTING_PROTOSPERLINE_DEFAULT);
hOldFont = g_clcPainter.ChangeToFont(hDC,NULL,FONTID_STATUSBAR_PROTONAME,NULL);
- // hOldFont = SelectObject(hDC,g_StatusBarData.BarFont);
- // SetTextColor(hDC,g_StatusBarData.fontColor);
- {
+ GetTextExtentPoint32A(hDC," ",1,&textSize);
+ int spaceWidth = textSize.cx;
+ int textY = rc.top+((rc.bottom-rc.top-textSize.cy)>>1);
+ int iconY = rc.top+((rc.bottom-rc.top-GetSystemMetrics(SM_CXSMICON))>>1);
- GetTextExtentPoint32A(hDC," ",1,&textSize);
- spaceWidth = textSize.cx;
- textY = rc.top+((rc.bottom-rc.top-textSize.cy)>>1);
- }
- iconY = rc.top+((rc.bottom-rc.top-GetSystemMetrics(SM_CXSMICON))>>1);
+ ProtosData.destroy();
- {
- ProtoEnumAccounts( &protoCount, &accs );
- if (allocedItemData && ProtosData) {
- for (int k = 0; k < allocedItemData; k++) {
- mir_free(ProtosData[k].ProtoXStatus);
- mir_free(ProtosData[k].ProtoName);
- mir_free(ProtosData[k].AccountName);
- mir_free(ProtosData[k].ProtoHumanName);
- mir_free(ProtosData[k].ProtoEMailCount);
- mir_free(ProtosData[k].ProtoStatusText);
- }
- mir_free_and_nil(ProtosData);
- allocedItemData = 0;
- }
- if ( protoCount == 0 )
- return 0;
+ int protoCount;
+ PROTOACCOUNT **accs;
+ ProtoEnumAccounts( &protoCount, &accs );
+ if (protoCount == 0)
+ return 0;
- ProtosData = (ProtoItemData*)mir_alloc(sizeof(ProtoItemData)*protoCount);
- memset(ProtosData,0,sizeof(ProtoItemData)*protoCount);
- for (j = 0; j < protoCount; j++)
- {
- int vis;
- char buf[256];
-
- i = pcli->pfnGetAccountIndexByPos(j);
- if (i == -1)
- vis = FALSE;
- else
- vis = pcli->pfnGetProtocolVisibility(accs[i]->szModuleName);
- if ( !vis) continue;
+ for (int j = 0; j < protoCount; j++) {
+ int vis;
+ char buf[256];
+
+ i = pcli->pfnGetAccountIndexByPos(j);
+ if (i == -1)
+ vis = FALSE;
+ else
+ vis = pcli->pfnGetProtocolVisibility(accs[i]->szModuleName);
+ if ( !vis)
+ continue;
- mir_snprintf(buf, SIZEOF(buf), "SBarAccountIsCustom_%s", accs[i]->szModuleName);
-
- if (g_StatusBarData.perProtoConfig && db_get_b(NULL, "CLUI", buf, SETTING_SBARACCOUNTISCUSTOM_DEFAULT))
- {
- mir_snprintf(buf, SIZEOF(buf), "HideAccount_%s", accs[i]->szModuleName);
- if (db_get_b(NULL, "CLUI", buf, SETTING_SBARHIDEACCOUNT_DEFAULT))
- continue;
-
- mir_snprintf(buf, SIZEOF(buf), "SBarShow_%s", accs[i]->szModuleName);
- {
- BYTE showOps = db_get_b(NULL,"CLUI", buf, SETTING_SBARSHOW_DEFAULT);
- ProtosData[visProtoCount].showProtoIcon = showOps&1;
- ProtosData[visProtoCount].showProtoName = showOps&2;
- ProtosData[visProtoCount].showStatusName = showOps&4;
- }
+ mir_snprintf(buf, SIZEOF(buf), "SBarAccountIsCustom_%s", accs[i]->szModuleName);
- mir_snprintf(buf, SIZEOF(buf), "ShowXStatus_%s", accs[i]->szModuleName);
- ProtosData[visProtoCount].xStatusMode = db_get_b(NULL,"CLUI", buf, SETTING_SBARSHOW_DEFAULT);
+ ProtoItemData* p = new ProtoItemData;
- mir_snprintf(buf, SIZEOF(buf), "UseConnectingIcon_%s", accs[i]->szModuleName);
- ProtosData[visProtoCount].connectingIcon = db_get_b(NULL,"CLUI", buf, SETTING_USECONNECTINGICON_DEFAULT);
+ if (g_StatusBarData.perProtoConfig && db_get_b(NULL, "CLUI", buf, SETTING_SBARACCOUNTISCUSTOM_DEFAULT)) {
+ mir_snprintf(buf, SIZEOF(buf), "HideAccount_%s", accs[i]->szModuleName);
+ if (db_get_b(NULL, "CLUI", buf, SETTING_SBARHIDEACCOUNT_DEFAULT))
+ continue;
- mir_snprintf(buf, SIZEOF(buf), "ShowUnreadEmails_%s", accs[i]->szModuleName);
- ProtosData[visProtoCount].showProtoEmails = db_get_b(NULL,"CLUI", buf, SETTING_SHOWUNREADEMAILS_DEFAULT);
+ mir_snprintf(buf, SIZEOF(buf), "SBarShow_%s", accs[i]->szModuleName);
- mir_snprintf(buf, SIZEOF(buf), "SBarRightClk_%s", accs[i]->szModuleName);
- ProtosData[visProtoCount].SBarRightClk = db_get_b(NULL,"CLUI", buf, SETTING_SBARRIGHTCLK_DEFAULT);
+ BYTE showOps = db_get_b(NULL,"CLUI", buf, SETTING_SBARSHOW_DEFAULT);
+ p->showProtoIcon = showOps & 1;
+ p->showProtoName = showOps & 2;
+ p->showStatusName = showOps & 4;
- mir_snprintf(buf, SIZEOF(buf), "PaddingLeft_%s", accs[i]->szModuleName);
- ProtosData[visProtoCount].PaddingLeft = db_get_dw(NULL,"CLUI", buf, SETTING_PADDINGLEFT_DEFAULT);
+ mir_snprintf(buf, SIZEOF(buf), "ShowXStatus_%s", accs[i]->szModuleName);
+ p->xStatusMode = db_get_b(NULL,"CLUI", buf, SETTING_SBARSHOW_DEFAULT);
- mir_snprintf(buf, SIZEOF(buf), "PaddingRight_%s", accs[i]->szModuleName);
- ProtosData[visProtoCount].PaddingRight = db_get_dw(NULL,"CLUI", buf, SETTING_PADDINGRIGHT_DEFAULT);
- }
- else
- {
- ProtosData[visProtoCount].showProtoIcon = g_StatusBarData.showProtoIcon;
- ProtosData[visProtoCount].showProtoName = g_StatusBarData.showProtoName;
- ProtosData[visProtoCount].showStatusName = g_StatusBarData.showStatusName;
- ProtosData[visProtoCount].xStatusMode = g_StatusBarData.xStatusMode;
- ProtosData[visProtoCount].connectingIcon = g_StatusBarData.connectingIcon;
- ProtosData[visProtoCount].showProtoEmails = g_StatusBarData.showProtoEmails;
- ProtosData[visProtoCount].SBarRightClk = 0;
- ProtosData[visProtoCount].PaddingLeft = 0;
- ProtosData[visProtoCount].PaddingRight = 0;
- }
+ mir_snprintf(buf, SIZEOF(buf), "UseConnectingIcon_%s", accs[i]->szModuleName);
+ p->connectingIcon = db_get_b(NULL,"CLUI", buf, SETTING_USECONNECTINGICON_DEFAULT);
- ProtosData[visProtoCount].ProtoStatus = CallProtoService(accs[i]->szModuleName,PS_GETSTATUS,0,0);
-
- ProtosData[visProtoCount].ProtoEMailCount = NULL;
- if (ProtosData[visProtoCount].ProtoStatus > ID_STATUS_OFFLINE)
- {
- // create service name
- mir_snprintf(servName, SIZEOF(servName), "%s/GetUnreadEmailCount", accs[i]->szModuleName);
- if (ProtosData[visProtoCount].showProtoEmails == 1 && ServiceExists(servName))
- {
- mir_snprintf(protoNameExt, SIZEOF(protoNameExt),"[%d]", (int) CallService(servName, 0, 0));
- ProtosData[visProtoCount].ProtoEMailCount = mir_strdup(protoNameExt);
- }
- }
+ mir_snprintf(buf, SIZEOF(buf), "ShowUnreadEmails_%s", accs[i]->szModuleName);
+ p->showProtoEmails = db_get_b(NULL,"CLUI", buf, SETTING_SHOWUNREADEMAILS_DEFAULT);
- ProtosData[visProtoCount].ProtoHumanName = mir_tstrdup(accs[i]->tszAccountName);
- ProtosData[visProtoCount].AccountName = mir_strdup(accs[i]->szModuleName);
- ProtosData[visProtoCount].ProtoName = mir_strdup(accs[i]->szProtoName);
- ProtosData[visProtoCount].ProtoStatusText = mir_strdup((char*)CallService(MS_CLIST_GETSTATUSMODEDESCRIPTION,(WPARAM)ProtosData[visProtoCount].ProtoStatus,0));
- ProtosData[visProtoCount].ProtoPos = visProtoCount;
-
- ProtosData[visProtoCount].isDimmed = 0;
- if (g_CluiData.bFilterEffective & CLVM_FILTER_PROTOS)
- {
- char szTemp[2048];
- mir_snprintf(szTemp, SIZEOF(szTemp), "%s|", ProtosData[visProtoCount].AccountName );
- ProtosData[visProtoCount].isDimmed = strstr(g_CluiData.protoFilter, szTemp) ? 0 : 1;
- }
-
- visProtoCount++;
- allocedItemData++;
+ mir_snprintf(buf, SIZEOF(buf), "SBarRightClk_%s", accs[i]->szModuleName);
+ p->SBarRightClk = db_get_b(NULL,"CLUI", buf, SETTING_SBARRIGHTCLK_DEFAULT);
+
+ mir_snprintf(buf, SIZEOF(buf), "PaddingLeft_%s", accs[i]->szModuleName);
+ p->PaddingLeft = db_get_dw(NULL,"CLUI", buf, SETTING_PADDINGLEFT_DEFAULT);
+
+ mir_snprintf(buf, SIZEOF(buf), "PaddingRight_%s", accs[i]->szModuleName);
+ p->PaddingRight = db_get_dw(NULL,"CLUI", buf, SETTING_PADDINGRIGHT_DEFAULT);
+ }
+ else {
+ p->showProtoIcon = g_StatusBarData.showProtoIcon;
+ p->showProtoName = g_StatusBarData.showProtoName;
+ p->showStatusName = g_StatusBarData.showStatusName;
+ p->xStatusMode = g_StatusBarData.xStatusMode;
+ p->connectingIcon = g_StatusBarData.connectingIcon;
+ p->showProtoEmails = g_StatusBarData.showProtoEmails;
+ p->SBarRightClk = 0;
+ p->PaddingLeft = 0;
+ p->PaddingRight = 0;
}
- // Calculate rects
+ p->ProtoStatus = CallProtoService(accs[i]->szModuleName,PS_GETSTATUS,0,0);
- //START MULTILINE HERE
- {
- int orig_protoCount = protoCount;
- int orig_visProtoCount = visProtoCount;
- ProtoItemData * orig_ProtosData = ProtosData;
- int linecount;
- if (g_StatusBarData.nProtosPerLine)
- protosperline = g_StatusBarData.nProtosPerLine;
- else if (orig_visProtoCount)
- protosperline = orig_visProtoCount;
- else if (protoCount)
- {
- protosperline = protoCount;
- orig_visProtoCount = protoCount;
- }
- else
- {
- protosperline = 1;
- orig_visProtoCount = 1;
+ p->ProtoEMailCount = NULL;
+ if (p->ProtoStatus > ID_STATUS_OFFLINE) {
+ // create service name
+ mir_snprintf(servName, SIZEOF(servName), "%s/GetUnreadEmailCount", accs[i]->szModuleName);
+ if (p->showProtoEmails == 1 && ServiceExists(servName)) {
+ mir_snprintf(protoNameExt, SIZEOF(protoNameExt),"[%d]", (int) CallService(servName, 0, 0));
+ p->ProtoEMailCount = mir_strdup(protoNameExt);
}
- protosperline = min(protosperline,orig_visProtoCount);
- linecount = protosperline ? (orig_visProtoCount+(protosperline-1))/protosperline : 1; //divide with rounding to up
- for (line = 0; line < linecount; line++)
- {
- int height;
- int rowsdy;
- int rowheight = max(textSize.cy+2,iconHeight);
- protoCount = min(protosperline,(orig_protoCount-line*protosperline));
- visProtoCount = min(protosperline,(orig_visProtoCount-line*protosperline));
- ProtosData += line*protosperline;
- GetClientRect(hWnd,&rc);
-
- rc.top += g_StatusBarData.rectBorders.top;
- rc.bottom -= g_StatusBarData.rectBorders.bottom;
-
- aligndx = 0;
- maxwidth = 0;
- xstatus = 0;
- SumWidth = 0;
- height = (rowheight*linecount);
-
- if (height > (rc.bottom - rc.top))
- {
- rowheight = (rc.bottom - rc.top) / linecount;
- height = (rowheight*linecount);
- }
+ }
- rowsdy = ((rc.bottom-rc.top)-height)/2;
- if (rowheight*(line)+rowsdy < rc.top-rowheight) continue;
- if (rowheight*(line+1)+rowsdy>rc.bottom+rowheight)
- {
- ProtosData = orig_ProtosData;
- break;
- }
- if (g_StatusBarData.VAlign == 0) //top
- {
- rc.bottom = rc.top+rowheight*(line+1);
- rc.top = rc.top+rowheight*line+1;
- }
- else if (g_StatusBarData.VAlign == 1) //center
- {
- rc.bottom = rc.top+rowsdy+rowheight*(line+1);
- rc.top = rc.top+rowsdy+rowheight*line+1;
+ p->ProtoHumanName = mir_tstrdup(accs[i]->tszAccountName);
+ p->AccountName = mir_strdup(accs[i]->szModuleName);
+ p->ProtoName = mir_strdup(accs[i]->szProtoName);
+ p->ProtoStatusText = mir_strdup((char*)CallService(MS_CLIST_GETSTATUSMODEDESCRIPTION,(WPARAM)p->ProtoStatus,0));
+ p->ProtoPos = ProtosData.getCount();
+
+ p->isDimmed = 0;
+ if (g_CluiData.bFilterEffective & CLVM_FILTER_PROTOS) {
+ char szTemp[2048];
+ mir_snprintf(szTemp, SIZEOF(szTemp), "%s|", p->AccountName );
+ p->isDimmed = strstr(g_CluiData.protoFilter, szTemp) ? 0 : 1;
+ }
+
+ ProtosData.insert(p);
+ }
+
+ //START MULTILINE HERE
+ int orig_protoCount = protoCount;
+ int orig_visProtoCount = ProtosData.getCount();
+
+ if (g_StatusBarData.nProtosPerLine)
+ protosperline = g_StatusBarData.nProtosPerLine;
+ else if (orig_visProtoCount)
+ protosperline = orig_visProtoCount;
+ else if (protoCount) {
+ protosperline = protoCount;
+ orig_visProtoCount = protoCount;
+ }
+ else {
+ protosperline = 1;
+ orig_visProtoCount = 1;
+ }
+ protosperline = min(protosperline,orig_visProtoCount);
+
+ int linecount = protosperline ? (orig_visProtoCount+(protosperline-1))/protosperline : 1; //divide with rounding to up
+ for (line = 0; line < linecount; line++) {
+ int rowheight = max(textSize.cy+2,iconHeight);
+ protoCount = min(protosperline,(orig_protoCount-line*protosperline));
+ int visProtoCount = min(protosperline,(orig_visProtoCount-line*protosperline));
+ GetClientRect(hWnd,&rc);
+
+ rc.top += g_StatusBarData.rectBorders.top;
+ rc.bottom -= g_StatusBarData.rectBorders.bottom;
+
+ aligndx = 0;
+ maxwidth = 0;
+ xstatus = 0;
+ SumWidth = 0;
+
+ int height = (rowheight*linecount);
+ if (height > (rc.bottom - rc.top)) {
+ rowheight = (rc.bottom - rc.top) / linecount;
+ height = (rowheight*linecount);
+ }
+
+ int rowsdy = ((rc.bottom-rc.top)-height)/2;
+ if (rowheight*(line)+rowsdy < rc.top-rowheight) continue;
+ if (rowheight*(line+1)+rowsdy>rc.bottom+rowheight)
+ break;
+
+ if (g_StatusBarData.VAlign == 0) { //top
+ rc.bottom = rc.top+rowheight*(line+1);
+ rc.top = rc.top+rowheight*line+1;
+ }
+ else if (g_StatusBarData.VAlign == 1) { //center
+ rc.bottom = rc.top+rowsdy+rowheight*(line+1);
+ rc.top = rc.top+rowsdy+rowheight*line+1;
+ }
+ else if (g_StatusBarData.VAlign == 2) { //bottom
+ rc.top = rc.bottom - (rowheight*(linecount - line));
+ rc.bottom = rc.bottom - (rowheight*(linecount - line - 1)+1);
+ }
+
+ textY = rc.top+(((rc.bottom-rc.top)-textSize.cy)/2);
+ iconY = rc.top+(((rc.bottom-rc.top)-iconHeight)/2);
+
+ //Code for each line
+ DWORD sw;
+ rectwidth = rc.right-rc.left-g_StatusBarData.rectBorders.left-g_StatusBarData.rectBorders.right;
+ if (visProtoCount > 1) sw = (rectwidth-(g_StatusBarData.extraspace*(visProtoCount-1)))/visProtoCount;
+ else sw = rectwidth;
+ mir_free(ProtoWidth);
+ ProtoWidth = (int*)mir_alloc(sizeof(int)*visProtoCount);
+ for (i=0; i < visProtoCount; i++) {
+ ProtoItemData& p = ProtosData[line*protosperline + i];
+ SIZE textSize;
+
+ DWORD w = 0;
+ w = p.PaddingLeft;
+ w += p.PaddingRight;
+
+ if (p.showProtoIcon) {
+ w += GetSystemMetrics(SM_CXSMICON)+1;
+
+ p.extraIcon = NULL;
+ if ((p.xStatusMode & 8) && p.ProtoStatus > ID_STATUS_OFFLINE) {
+ char str[MAXMODULELABELLENGTH];
+ mir_snprintf(str, SIZEOF(str), "%s/GetXStatus", p.AccountName);
+ if (ServiceExists(str)) {
+ char *dbTitle = "XStatusName";
+ char *dbTitle2 = NULL;
+ xstatus = CallProtoService(p.AccountName,"/GetXStatus",(WPARAM)&dbTitle,(LPARAM)&dbTitle2);
+ if (dbTitle && xstatus) {
+ DBVARIANT dbv = {0};
+ if ( !DBGetContactSettingTString(NULL, p.AccountName, dbTitle, &dbv)) {
+ p.ProtoXStatus = mir_tstrdup(dbv.ptszVal);
+ db_free(&dbv);
+ }
+ }
+ }
}
- else if (g_StatusBarData.VAlign == 2) //bottom
- {
- rc.top = rc.bottom - (rowheight*(linecount - line));
- rc.bottom = rc.bottom - (rowheight*(linecount - line - 1)+1);
+
+ if ((p.xStatusMode & 3)) {
+ if (p.ProtoStatus > ID_STATUS_OFFLINE) {
+ char str[MAXMODULELABELLENGTH];
+ mir_snprintf(str, SIZEOF(str), "%s/GetXStatusIcon", p.AccountName);
+ if ( ServiceExists(str))
+ p.extraIcon = (HICON)CallService(str,0,0);
+ if (p.extraIcon && (p.xStatusMode & 3) == 3)
+ w += GetSystemMetrics(SM_CXSMICON)+1;
+ }
}
+ }
- textY = rc.top+(((rc.bottom-rc.top)-textSize.cy)/2);
- iconY = rc.top+(((rc.bottom-rc.top)-iconHeight)/2);
-
- { //Code for each line
- {
- DWORD sw;
- rectwidth = rc.right-rc.left-g_StatusBarData.rectBorders.left-g_StatusBarData.rectBorders.right;
- if (visProtoCount>1) sw = (rectwidth-(g_StatusBarData.extraspace*(visProtoCount-1)))/visProtoCount;
- else sw = rectwidth;
- mir_free(ProtoWidth);
- ProtoWidth = (int*)mir_alloc(sizeof(int)*visProtoCount);
- for (i=0; i < visProtoCount; i++)
- {
- SIZE textSize;
- DWORD w = 0;
- // FIXME strange error occurs here due to Dimon log
- w = ProtosData[i].PaddingLeft;
- w += ProtosData[i].PaddingRight;
-
- if ( ProtosData[i].showProtoIcon )
- {
-
- w += GetSystemMetrics(SM_CXSMICON)+1;
-
- ProtosData[i].extraIcon = NULL;
- if ((ProtosData[i].xStatusMode&8) && ProtosData[i].ProtoStatus>ID_STATUS_OFFLINE)
- {
- char str[MAXMODULELABELLENGTH];
- mir_snprintf(str, SIZEOF(str), "%s/GetXStatus", ProtosData[i].AccountName);
- if (ServiceExists(str))
- {
- char * dbTitle = "XStatusName";
- char * dbTitle2 = NULL;
- xstatus = CallProtoService(ProtosData[i].AccountName,"/GetXStatus",(WPARAM)&dbTitle,(LPARAM)&dbTitle2);
- if (dbTitle && xstatus)
- {
- DBVARIANT dbv = {0};
- if ( !DBGetContactSettingTString(NULL,ProtosData[i].AccountName,dbTitle,&dbv))
- {
- ProtosData[i].ProtoXStatus = mir_tstrdup(dbv.ptszVal);
- db_free(&dbv);
- }
- }
- }
- }
- if ((ProtosData[i].xStatusMode&3))
- {
- if (ProtosData[i].ProtoStatus>ID_STATUS_OFFLINE)
- {
- char str[MAXMODULELABELLENGTH];
- mir_snprintf(str, SIZEOF(str), "%s/GetXStatusIcon", ProtosData[i].AccountName);
- if (ServiceExists(str))
- ProtosData[i].extraIcon = (HICON)CallService(str,0,0);
- if (ProtosData[i].extraIcon && (ProtosData[i].xStatusMode&3) == 3)
- w += GetSystemMetrics(SM_CXSMICON)+1;
-
- }
- }
- }
+ if (p.showProtoName) {
+ GetTextExtentPoint32(hDC, p.ProtoHumanName, lstrlen(p.ProtoHumanName), &textSize);
+ w += textSize.cx + 3 + spaceWidth;
+ }
- if (ProtosData[i].showProtoName)
- {
- GetTextExtentPoint32(hDC,ProtosData[i].ProtoHumanName,lstrlen(ProtosData[i].ProtoHumanName),&textSize);
- w += textSize.cx + 3 + spaceWidth;
- }
+ if (p.showProtoEmails && p.ProtoEMailCount) {
+ GetTextExtentPoint32A(hDC, p.ProtoEMailCount, lstrlenA(p.ProtoEMailCount), &textSize);
+ w += textSize.cx + 3 + spaceWidth;
+ }
- if (ProtosData[i].showProtoEmails && ProtosData[i].ProtoEMailCount )
- {
- GetTextExtentPoint32A(hDC,ProtosData[i].ProtoEMailCount,lstrlenA(ProtosData[i].ProtoEMailCount),&textSize);
- w += textSize.cx+3+spaceWidth;
- }
+ if (p.showStatusName) {
+ GetTextExtentPoint32A(hDC, p.ProtoStatusText, lstrlenA(p.ProtoStatusText), &textSize);
+ w += textSize.cx + 3 + spaceWidth;
+ }
- if (ProtosData[i].showStatusName)
- {
- GetTextExtentPoint32A(hDC,ProtosData[i].ProtoStatusText,lstrlenA(ProtosData[i].ProtoStatusText),&textSize);
- w += textSize.cx + 3 + spaceWidth;
- }
+ if ((p.xStatusMode&8) && p.ProtoXStatus) {
+ GetTextExtentPoint32(hDC, p.ProtoXStatus, lstrlen(p.ProtoXStatus),&textSize);
+ w += textSize.cx + 3 + spaceWidth;
+ }
- if ((ProtosData[i].xStatusMode&8) && ProtosData[i].ProtoXStatus)
- {
- GetTextExtentPoint32(hDC,ProtosData[i].ProtoXStatus,lstrlen(ProtosData[i].ProtoXStatus),&textSize);
- w += textSize.cx + 3 + spaceWidth;
- }
+ if (p.showProtoName || (p.showProtoEmails && p.ProtoEMailCount) || p.showStatusName || ((p.xStatusMode & 8) && p.ProtoXStatus))
+ w -= spaceWidth;
- if (( ProtosData[i].showProtoName) ||
- (ProtosData[i].showProtoEmails && ProtosData[i].ProtoEMailCount ) ||
- (ProtosData[i].showStatusName) ||
- ((ProtosData[i].xStatusMode&8) && ProtosData[i].ProtoXStatus))
- w -= spaceWidth;
-
- ProtosData[i].fullWidth = w;
- if (g_StatusBarData.sameWidth)
- {
- ProtoWidth[i] = sw;
- SumWidth += w;
- }
- else
- {
- ProtoWidth[i] = w;
- SumWidth += w;
- }
- }
+ p.fullWidth = w;
+ if (g_StatusBarData.sameWidth) {
+ ProtoWidth[i] = sw;
+ SumWidth += w;
+ }
+ else {
+ ProtoWidth[i] = w;
+ SumWidth += w;
+ }
+ }
+
+ // Reposition rects
+ for (i=0; i < visProtoCount; i++)
+ if (ProtoWidth[i] > maxwidth)
+ maxwidth = ProtoWidth[i];
- // Reposition rects
- for (i=0; i < visProtoCount; i++)
- if (ProtoWidth[i]>maxwidth) maxwidth = ProtoWidth[i];
+ if (g_StatusBarData.sameWidth) {
+ for (i=0; i < visProtoCount; i++)
+ ProtoWidth[i] = maxwidth;
+ SumWidth = maxwidth * visProtoCount;
+ }
+ SumWidth += (visProtoCount-1) * (g_StatusBarData.extraspace+1);
+
+ if (SumWidth > rectwidth) {
+ float f = (float)rectwidth/SumWidth;
+ SumWidth = 0;
+ for (i=0; i < visProtoCount; i++) {
+ ProtoWidth[i] = (int)((float)ProtoWidth[i]*f);
+ SumWidth += ProtoWidth[i];
+ }
+ SumWidth += (visProtoCount-1)*(g_StatusBarData.extraspace+1);
+ }
+ }
- if (g_StatusBarData.sameWidth)
- {
- for (i=0; i < visProtoCount; i++)
- ProtoWidth[i] = maxwidth;
- SumWidth = maxwidth*visProtoCount;
+ if (g_StatusBarData.Align == 1) //center
+ aligndx = (rectwidth-SumWidth)>>1;
+ else if (g_StatusBarData.Align == 2) //right
+ aligndx = (rectwidth-SumWidth);
+
+ // Draw in rects
+
+ RECT r = rc;
+ r.left += g_StatusBarData.rectBorders.left+aligndx;
+ for (i=0; i < ProtosData.getCount(); i++) {
+ ProtoItemData& p = ProtosData[i];
+ HRGN rgn;
+ HICON hIcon = NULL;
+ HICON hxIcon = NULL;
+ BOOL NeedDestroy = FALSE;
+ int x = r.left;
+ x += p.PaddingLeft;
+ r.right = r.left+ProtoWidth[i];
+
+ if (p.showProtoIcon) {
+ if (p.ProtoStatus > ID_STATUS_OFFLINE && (p.xStatusMode & 3) > 0) {
+ char str[MAXMODULELABELLENGTH];
+ mir_snprintf(str, SIZEOF(str), "%s/GetXStatusIcon", p.AccountName);
+ if ( ServiceExists(str)) {
+ hxIcon = p.extraIcon;
+ if (hxIcon) {
+ if ((p.xStatusMode & 3) == 2) {
+ hIcon = GetMainStatusOverlay(p.ProtoStatus);
+ NeedDestroy = TRUE;
}
- SumWidth += (visProtoCount-1)*(g_StatusBarData.extraspace+1);
-
- if (SumWidth>rectwidth)
- {
- float f = (float)rectwidth/SumWidth;
- //dx = (int)(0.5+(float)dx/visProtoCount);
- //SumWidth -= dx*visProtoCount;
- SumWidth = 0;
- for (i=0; i < visProtoCount; i++)
- {
- ProtoWidth[i] = (int)((float)ProtoWidth[i]*f);
- SumWidth += ProtoWidth[i];
- }
- SumWidth += (visProtoCount-1)*(g_StatusBarData.extraspace+1);
+ else if ((p.xStatusMode & 3) == 1) {
+ hIcon = hxIcon;
+ NeedDestroy = TRUE;
+ hxIcon = NULL;
}
}
- if (g_StatusBarData.Align == 1) //center
- aligndx = (rectwidth-SumWidth)>>1;
- else if (g_StatusBarData.Align == 2) //right
- aligndx = (rectwidth-SumWidth);
- // Draw in rects
- //ske_SelectTextEffect(hDC,g_StatusBarData.TextEffectID,g_StatusBarData.TextEffectColor1,g_StatusBarData.TextEffectColor2);
- {
- RECT r = rc;
-// r.top += g_StatusBarData.rectBorders.top;
-// r.bottom -= g_StatusBarData.rectBorders.bottom;
- r.left += g_StatusBarData.rectBorders.left+aligndx;
- for (i=0; i < visProtoCount; i++)
- {
- HRGN rgn;
- int x = r.left;
- HICON hIcon = NULL;
- HICON hxIcon = NULL;
- BOOL NeedDestroy = FALSE;
- x = r.left;
- x += ProtosData[i].PaddingLeft;
- r.right = r.left+ProtoWidth[i];
-
- if ( ProtosData[i].showProtoIcon )
- {
- if (ProtosData[i].ProtoStatus>ID_STATUS_OFFLINE && ((ProtosData[i].xStatusMode)&3)>0)
- {
- char str[MAXMODULELABELLENGTH];
- mir_snprintf(str, SIZEOF(str), "%s/GetXStatusIcon", ProtosData[i].AccountName);
- if (ServiceExists(str))
- {
- hxIcon = ProtosData[i].extraIcon;
- if (hxIcon)
- {
- if (((ProtosData[i].xStatusMode)&3) == 2)
- {
- hIcon = GetMainStatusOverlay(ProtosData[i].ProtoStatus);
- NeedDestroy = TRUE;
- }
- else if (((ProtosData[i].xStatusMode)&3) == 1)
- {
- hIcon = hxIcon;
- NeedDestroy = TRUE;
- hxIcon = NULL;
- }
-
- }
- }
- }
- if (hIcon == NULL && (hxIcon == NULL || (((ProtosData[i].xStatusMode)&3) == 3)))
- {
- if (hIcon == NULL && (ProtosData[i].connectingIcon == 1) && ProtosData[i].ProtoStatus >= ID_STATUS_CONNECTING && ProtosData[i].ProtoStatus <= ID_STATUS_CONNECTING+MAX_CONNECT_RETRIES)
- {
- hIcon = (HICON)CLUI_GetConnectingIconService((WPARAM)ProtosData[i].AccountName,0);
- if (hIcon) NeedDestroy = TRUE;
- else hIcon = LoadSkinnedProtoIcon(ProtosData[i].AccountName,ProtosData[i].ProtoStatus);
- }
- else hIcon = LoadSkinnedProtoIcon(ProtosData[i].AccountName,ProtosData[i].ProtoStatus);
- }
-
+ }
+ }
- rgn = CreateRectRgn(r.left,r.top,r.right,r.bottom);
- //
- {
- if (g_StatusBarData.sameWidth)
- {
- int fw = ProtosData[i].fullWidth;
- int rw = r.right-r.left;
- if (g_StatusBarData.Align == 1)
- {
- x = r.left+((rw-fw)/2);
- }
- else if (g_StatusBarData.Align == 2)
- {
- x = r.left+((rw-fw));
- }
- else x = r.left;
- }
- }
+ if (hIcon == NULL && (hxIcon == NULL || ((p.xStatusMode & 3) == 3))) {
+ if (hIcon == NULL && (p.connectingIcon == 1) && p.ProtoStatus >= ID_STATUS_CONNECTING && p.ProtoStatus <= ID_STATUS_CONNECTING + MAX_CONNECT_RETRIES) {
+ hIcon = (HICON)CLUI_GetConnectingIconService((WPARAM)p.AccountName,0);
+ if (hIcon)
+ NeedDestroy = TRUE;
+ else
+ hIcon = LoadSkinnedProtoIcon(p.AccountName,p.ProtoStatus);
+ }
+ else hIcon = LoadSkinnedProtoIcon(p.AccountName,p.ProtoStatus);
+ }
-
- SelectClipRgn(hDC,rgn);
- ProtosData[i].DoubleIcons = FALSE;
-
- DWORD dim = ProtosData[i].isDimmed ? (( 64 << 24 ) | 0x80 ) : 0;
-
- if ((ProtosData[i].xStatusMode&3) == 3)
- {
- if (hIcon) mod_DrawIconEx_helper(hDC,x,iconY,hIcon,GetSystemMetrics(SM_CXSMICON),GetSystemMetrics(SM_CYSMICON),0,NULL, DI_NORMAL|dim );
- if (hxIcon)
- {
- mod_DrawIconEx_helper(hDC,x+GetSystemMetrics(SM_CXSMICON)+1,iconY,hxIcon,GetSystemMetrics(SM_CXSMICON),GetSystemMetrics(SM_CYSMICON),0,NULL,DI_NORMAL|dim);
- x += GetSystemMetrics(SM_CXSMICON)+1;
- }
- ProtosData[i].DoubleIcons = hIcon && hxIcon;
- }
- else
- {
- if (hxIcon) mod_DrawIconEx_helper(hDC,x,iconY,hxIcon,GetSystemMetrics(SM_CXSMICON),GetSystemMetrics(SM_CYSMICON),0,NULL,DI_NORMAL|dim);
- if (hIcon) mod_DrawIconEx_helper(hDC,x,iconY,hIcon,GetSystemMetrics(SM_CXSMICON),GetSystemMetrics(SM_CYSMICON),0,NULL,DI_NORMAL| ((hxIcon && (ProtosData[i].xStatusMode&4))?(192 << 24):0 ) | dim );
- }
+ rgn = CreateRectRgn(r.left,r.top,r.right,r.bottom);
+
+ if (g_StatusBarData.sameWidth) {
+ int fw = p.fullWidth;
+ int rw = r.right-r.left;
+ if (g_StatusBarData.Align == 1)
+ x = r.left+((rw-fw)/2);
+ else if (g_StatusBarData.Align == 2)
+ x = r.left+((rw-fw));
+ else
+ x = r.left;
+ }
- if (( hxIcon || hIcon) && TRUE /* TODO g_StatusBarData.bDrawLockOverlay options to draw locked proto*/ )
- {
- if ( db_get_b( NULL,ProtosData[i].AccountName,"LockMainStatus",0 ))
- {
- HICON hLockOverlay = LoadSkinnedIcon(SKINICON_OTHER_STATUS_LOCKED);
- if (hLockOverlay != NULL)
- {
- mod_DrawIconEx_helper(hDC, x, iconY, hLockOverlay, GetSystemMetrics(SM_CXSMICON),GetSystemMetrics(SM_CYSMICON),0,NULL,DI_NORMAL | dim);
- CallService(MS_SKIN2_RELEASEICON, (WPARAM)hLockOverlay, 0); }
- }
- }
- if (hxIcon) DestroyIcon_protect(hxIcon);
- if (NeedDestroy) DestroyIcon_protect(hIcon);
- else CallService(MS_SKIN2_RELEASEICON, (WPARAM)hIcon, 0);
- x += GetSystemMetrics(SM_CXSMICON)+1;
- }
- if (ProtosData[i].showProtoName)
- {
- SIZE textSize;
- RECT rt = r;
- rt.left = x+(spaceWidth>>1);
- rt.top = textY;
- ske_DrawText(hDC,ProtosData[i].ProtoHumanName,lstrlen(ProtosData[i].ProtoHumanName),&rt,0);
-
- if ((ProtosData[i].showProtoEmails && ProtosData[i].ProtoEMailCount != NULL) || ProtosData[i].showStatusName || ((ProtosData[i].xStatusMode&8) && ProtosData[i].ProtoXStatus))
- {
- GetTextExtentPoint32(hDC, ProtosData[i].ProtoHumanName, lstrlen(ProtosData[i].ProtoHumanName), &textSize);
- x += textSize.cx + 3;
- }
- }
+ SelectClipRgn(hDC,rgn);
+ p.DoubleIcons = FALSE;
- if (ProtosData[i].showProtoEmails && ProtosData[i].ProtoEMailCount != NULL)
- {
- SIZE textSize;
- RECT rt = r;
- rt.left = x+(spaceWidth>>1);
- rt.top = textY;
- ske_DrawTextA(hDC,ProtosData[i].ProtoEMailCount,lstrlenA(ProtosData[i].ProtoEMailCount),&rt,0);
- //TextOutS(hDC,x,textY,ProtosData[i].ProtoName,lstrlenA(ProtosData[i].ProtoName));
- if (ProtosData[i].showStatusName || ((ProtosData[i].xStatusMode&8) && ProtosData[i].ProtoXStatus))
- {
- GetTextExtentPoint32A(hDC,ProtosData[i].ProtoEMailCount,lstrlenA(ProtosData[i].ProtoEMailCount),&textSize);
- x += textSize.cx+3;
- }
- }
+ DWORD dim = p.isDimmed ? (( 64 << 24 ) | 0x80 ) : 0;
- if (ProtosData[i].showStatusName)
- {
- SIZE textSize;
- RECT rt = r;
- rt.left = x+(spaceWidth>>1);
- rt.top = textY;
- ske_DrawTextA(hDC, ProtosData[i].ProtoStatusText, lstrlenA(ProtosData[i].ProtoStatusText),&rt,0);
- if (((ProtosData[i].xStatusMode&8) && ProtosData[i].ProtoXStatus))
- {
- GetTextExtentPoint32A(hDC,ProtosData[i].ProtoStatusText,lstrlenA(ProtosData[i].ProtoStatusText),&textSize);
- x += textSize.cx+3;
- }
- //TextOutS(hDC,x,textY,ProtosData[i].ProtoStatusText,lstrlenA(ProtosData[i].ProtoStatusText));
- }
+ if ((p.xStatusMode&3) == 3) {
+ if (hIcon)
+ mod_DrawIconEx_helper(hDC,x,iconY,hIcon,GetSystemMetrics(SM_CXSMICON),GetSystemMetrics(SM_CYSMICON),0,NULL, DI_NORMAL|dim );
+ if (hxIcon) {
+ mod_DrawIconEx_helper(hDC,x+GetSystemMetrics(SM_CXSMICON)+1,iconY,hxIcon,GetSystemMetrics(SM_CXSMICON),GetSystemMetrics(SM_CYSMICON),0,NULL,DI_NORMAL|dim);
+ x += GetSystemMetrics(SM_CXSMICON)+1;
+ }
+ p.DoubleIcons = hIcon && hxIcon;
+ }
+ else {
+ if (hxIcon)
+ mod_DrawIconEx_helper(hDC,x,iconY,hxIcon,GetSystemMetrics(SM_CXSMICON),GetSystemMetrics(SM_CYSMICON),0,NULL,DI_NORMAL|dim);
+ if (hIcon)
+ mod_DrawIconEx_helper(hDC,x,iconY,hIcon,GetSystemMetrics(SM_CXSMICON),GetSystemMetrics(SM_CYSMICON),0,NULL,DI_NORMAL| ((hxIcon && (p.xStatusMode&4))?(192 << 24):0 ) | dim );
+ }
- if ((ProtosData[i].xStatusMode&8) && ProtosData[i].ProtoXStatus)
- {
- RECT rt = r;
- rt.left = x+(spaceWidth>>1);
- rt.top = textY;
- ske_DrawText(hDC,ProtosData[i].ProtoXStatus,lstrlen(ProtosData[i].ProtoXStatus),&rt,0);
- //TextOutS(hDC,x,textY,ProtosData[i].ProtoStatusText,lstrlenA(ProtosData[i].ProtoStatusText));
- }
+ if (hxIcon || hIcon) { /* TODO g_StatusBarData.bDrawLockOverlay options to draw locked proto*/
+ if ( db_get_b( NULL,p.AccountName,"LockMainStatus",0 )) {
+ HICON hLockOverlay = LoadSkinnedIcon(SKINICON_OTHER_STATUS_LOCKED);
+ if (hLockOverlay != NULL) {
+ mod_DrawIconEx_helper(hDC, x, iconY, hLockOverlay, GetSystemMetrics(SM_CXSMICON),GetSystemMetrics(SM_CYSMICON),0,NULL,DI_NORMAL | dim);
+ CallService(MS_SKIN2_RELEASEICON, (WPARAM)hLockOverlay, 0);
+ }
+ }
+ }
+ if (hxIcon) DestroyIcon_protect(hxIcon);
+ if (NeedDestroy) DestroyIcon_protect(hIcon);
+ else CallService(MS_SKIN2_RELEASEICON, (WPARAM)hIcon, 0);
+ x += GetSystemMetrics(SM_CXSMICON)+1;
+ }
- ProtosData[i].protoRect = r;
+ if (p.showProtoName) {
+ SIZE textSize;
+ RECT rt = r;
+ rt.left = x+(spaceWidth>>1);
+ rt.top = textY;
+ ske_DrawText(hDC,p.ProtoHumanName,lstrlen(p.ProtoHumanName),&rt,0);
- r.left = r.right+g_StatusBarData.extraspace;
- //SelectClipRgn(hDC,NULL);
- DeleteObject(rgn);
+ if ((p.showProtoEmails && p.ProtoEMailCount != NULL) || p.showStatusName || ((p.xStatusMode&8) && p.ProtoXStatus)) {
+ GetTextExtentPoint32(hDC, p.ProtoHumanName, lstrlen(p.ProtoHumanName), &textSize);
+ x += textSize.cx + 3;
+ }
+ }
- }
- }
+ if (p.showProtoEmails && p.ProtoEMailCount != NULL) {
+ SIZE textSize;
+ RECT rt = r;
+ rt.left = x+(spaceWidth>>1);
+ rt.top = textY;
+ ske_DrawTextA(hDC, p.ProtoEMailCount, lstrlenA(p.ProtoEMailCount), &rt, 0);
+ if (p.showStatusName || ((p.xStatusMode&8) && p.ProtoXStatus)) {
+ GetTextExtentPoint32A(hDC,p.ProtoEMailCount,lstrlenA(p.ProtoEMailCount),&textSize);
+ x += textSize.cx+3;
+ }
+ }
- mir_free_and_nil(ProtoWidth);
- } //code for each line
- ProtosData = orig_ProtosData;
+ if (p.showStatusName) {
+ SIZE textSize;
+ RECT rt = r;
+ rt.left = x+(spaceWidth>>1);
+ rt.top = textY;
+ ske_DrawTextA(hDC, p.ProtoStatusText, lstrlenA(p.ProtoStatusText), &rt, 0);
+ if (((p.xStatusMode & 8) && p.ProtoXStatus)) {
+ GetTextExtentPoint32A(hDC, p.ProtoStatusText, lstrlenA(p.ProtoStatusText), &textSize);
+ x += textSize.cx+3;
}
}
+
+ if ((p.xStatusMode&8) && p.ProtoXStatus) {
+ RECT rt = r;
+ rt.left = x+(spaceWidth>>1);
+ rt.top = textY;
+ ske_DrawText(hDC,p.ProtoXStatus,lstrlen(p.ProtoXStatus),&rt,0);
+ }
+
+ p.protoRect = r;
+
+ r.left = r.right+g_StatusBarData.extraspace;
+ DeleteObject(rgn);
}
+ mir_free(ProtoWidth);
+
SelectObject(hDC,hOldFont);
ske_ResetTextEffect(hDC);
return 0;
}
-static BOOL _ModernStatus_OnExtraIconClick( int protoIndex )
+static BOOL _ModernStatus_OnExtraIconClick(int protoIndex)
{
- /** FIXME
- Create Protocol services and
- move This portion of code to related Protocols
- */
-
- if ( !mir_strcmpi( ProtosData[protoIndex].ProtoName, "ICQ" ))
- {
- if ( ProtosData[protoIndex].ProtoStatus < ID_STATUS_ONLINE ) return FALSE;
-
- HMENU hMainStatusMenu = (HMENU)CallService(MS_CLIST_MENUGETSTATUS,0,0);
- if ( !hMainStatusMenu ) return FALSE;
-
- HMENU hProtoStatusMenu = GetSubMenu( hMainStatusMenu, protoIndex );
- if ( !hProtoStatusMenu ) return FALSE;
-
- int extraStatusMenuIndex = 1;
- HMENU hExtraStatusMenu = GetSubMenu( hProtoStatusMenu, extraStatusMenuIndex );
- if ( !hExtraStatusMenu ) return FALSE;
-
- POINT pt; GetCursorPos( &pt );
- {
- HWND hWnd = (HWND) CallService( MS_CLUI_GETHWND, 0 ,0 );
- TrackPopupMenu( hExtraStatusMenu, TPM_TOPALIGN|TPM_LEFTALIGN|TPM_LEFTBUTTON, pt.x, pt.y, 0, hWnd, NULL );
- }
- return TRUE;
- }
- else if ( !mir_strcmpi( ProtosData[protoIndex].ProtoName, "JABBER" ))
- {
- if ( ProtosData[protoIndex].ProtoStatus < ID_STATUS_ONLINE ) return FALSE;
- // Show Moods
- char szService[128];
- mir_snprintf(szService, SIZEOF(szService), "%s/AdvStatusSet/Mood", ProtosData[protoIndex].AccountName );
- if ( ServiceExists( szService ))
- {
- CallService( szService, 0 ,0 );
- return TRUE;
- }
- }
- return FALSE;
+ if ( !mir_strcmpi(ProtosData[protoIndex].ProtoName, "ICQ")) {
+ if (ProtosData[protoIndex].ProtoStatus < ID_STATUS_ONLINE)
+ return FALSE;
+
+ HMENU hMainStatusMenu = (HMENU)CallService(MS_CLIST_MENUGETSTATUS,0,0);
+ if ( !hMainStatusMenu)
+ return FALSE;
+
+ HMENU hProtoStatusMenu = GetSubMenu( hMainStatusMenu, protoIndex );
+ if ( !hProtoStatusMenu)
+ return FALSE;
+
+ int extraStatusMenuIndex = 1;
+ HMENU hExtraStatusMenu = GetSubMenu( hProtoStatusMenu, extraStatusMenuIndex );
+ if ( !hExtraStatusMenu)
+ return FALSE;
+
+ POINT pt; GetCursorPos( &pt );
+ HWND hWnd = (HWND) CallService( MS_CLUI_GETHWND, 0 ,0 );
+ TrackPopupMenu( hExtraStatusMenu, TPM_TOPALIGN|TPM_LEFTALIGN|TPM_LEFTBUTTON, pt.x, pt.y, 0, hWnd, NULL );
+ return TRUE;
+ }
+
+ if ( !mir_strcmpi( ProtosData[protoIndex].ProtoName, "JABBER" )) {
+ if ( ProtosData[protoIndex].ProtoStatus < ID_STATUS_ONLINE )
+ return FALSE;
+
+ // Show Moods
+ char szService[128];
+ mir_snprintf(szService, SIZEOF(szService), "%s/AdvStatusSet/Mood", ProtosData[protoIndex].AccountName );
+ if ( ServiceExists(szService)) {
+ CallService(szService, 0, 0);
+ return TRUE;
+ }
+ }
+ return FALSE;
}
#define TOOLTIP_TOLERANCE 5
LRESULT CALLBACK ModernStatusProc(HWND hwnd,UINT msg,WPARAM wParam,LPARAM lParam)
{
static POINT ptToolTipShow = {0};
- switch (msg)
- {
+ switch (msg) {
case WM_CREATE:
g_StatusBarData.hTheme = xpt_AddThemeHandle(hwnd,L"STATUS");
break;
- case WM_DESTROY:
+
+ case WM_DESTROY:
xpt_FreeThemeForWindow(hwnd);
- if (allocedItemData && ProtosData) {
- for (int k = 0; k < allocedItemData; k++) {
- mir_free(ProtosData[k].AccountName);
- mir_free(ProtosData[k].ProtoName);
- mir_free(ProtosData[k].ProtoEMailCount);
- mir_free(ProtosData[k].ProtoHumanName);
- mir_free(ProtosData[k].ProtoStatusText);
- mir_free(ProtosData[k].ProtoEMailCount);
- mir_free(ProtosData[k].ProtoXStatus);
- }
- mir_free_and_nil(ProtosData);
- allocedItemData = 0;
- }
+ ProtosData.destroy();
break;
- case WM_SIZE:
+
+ case WM_SIZE:
if ( !g_CluiData.fLayered || GetParent(hwnd) != pcli->hwndContactList)
InvalidateRect(hwnd,NULL,FALSE);
return DefWindowProc(hwnd, msg, wParam, lParam);
- case WM_ERASEBKGND:
+
+ case WM_ERASEBKGND:
return 1;
- case WM_PAINT:
+
+ case WM_PAINT:
if (GetParent(hwnd) == pcli->hwndContactList && g_CluiData.fLayered)
- CallService(MS_SKINENG_INVALIDATEFRAMEIMAGE,(WPARAM)hwnd,0);
- else if (GetParent(hwnd) == pcli->hwndContactList && !g_CluiData.fLayered)
+ CallService(MS_SKINENG_INVALIDATEFRAMEIMAGE,(WPARAM)hwnd,0);
+ else if (GetParent(hwnd) == pcli->hwndContactList && !g_CluiData.fLayered) {
+ RECT rc = {0};
+ GetClientRect(hwnd,&rc);
+ rc.right++;
+ rc.bottom++;
+ HDC hdc = GetDC(hwnd);
+ HDC hdc2 = CreateCompatibleDC(hdc);
+ HBITMAP hbmp = ske_CreateDIB32(rc.right, rc.bottom);
+ HBITMAP hbmpo = (HBITMAP)SelectObject(hdc2, hbmp);
+ SetBkMode(hdc2,TRANSPARENT);
+ ske_BltBackImage(hwnd, hdc2, &rc);
+ ModernDrawStatusBarWorker(hwnd,hdc2);
+ BitBlt(hdc, rc.left, rc.top, rc.right-rc.left, rc.bottom-rc.top, hdc2, rc.left, rc.top, SRCCOPY);
+ SelectObject(hdc2, hbmpo);
+ DeleteObject(hbmp);
+ mod_DeleteDC(hdc2);
+
+ SelectObject(hdc,GetStockObject(DEFAULT_GUI_FONT));
+ ReleaseDC(hwnd,hdc);
+ ValidateRect(hwnd,NULL);
+ }
+ else {
+ RECT rc;
+ GetClientRect(hwnd,&rc);
+
+ PAINTSTRUCT ps;
+ HDC hdc = BeginPaint(hwnd,&ps);
+ HDC hdc2 = CreateCompatibleDC(hdc);
+ HBITMAP hbmp = ske_CreateDIB32(rc.right,rc.bottom);
+ HBITMAP hbmpo = (HBITMAP) SelectObject(hdc2,hbmp);
+
+ HBRUSH br = GetSysColorBrush(COLOR_3DFACE);
+ FillRect(hdc2,&ps.rcPaint,br);
+ ModernDrawStatusBarWorker(hwnd,hdc2);
+ BitBlt(hdc,ps.rcPaint.left,ps.rcPaint.top,ps.rcPaint.right-ps.rcPaint.left,ps.rcPaint.bottom-ps.rcPaint.top,
+ hdc2,ps.rcPaint.left,ps.rcPaint.top,SRCCOPY);
+ SelectObject(hdc2,hbmpo);
+ DeleteObject(hbmp);
+ mod_DeleteDC(hdc2);
+ ps.fErase = FALSE;
+ EndPaint(hwnd,&ps);
+ }
+ return DefWindowProc(hwnd, msg, wParam, lParam);
+
+ case WM_GETMINMAXINFO:
+ {
+ RECT rct;
+ GetWindowRect(hwnd,&rct);
+ memset((LPMINMAXINFO)lParam,0,sizeof(MINMAXINFO));
+ ((LPMINMAXINFO)lParam)->ptMinTrackSize.x = 16;
+ ((LPMINMAXINFO)lParam)->ptMinTrackSize.y = 16;
+ ((LPMINMAXINFO)lParam)->ptMaxTrackSize.x = 1600;
+ ((LPMINMAXINFO)lParam)->ptMaxTrackSize.y = 1600;
+ }
+ return 0;
+
+ case WM_SHOWWINDOW:
{
- HDC hdc, hdc2;
- HBITMAP hbmp,hbmpo;
- RECT rc = {0};
- GetClientRect(hwnd,&rc);
- rc.right++;
- rc.bottom++;
- hdc = GetDC(hwnd);
- hdc2 = CreateCompatibleDC(hdc);
- hbmp = ske_CreateDIB32(rc.right,rc.bottom);
- hbmpo = (HBITMAP)SelectObject(hdc2,hbmp);
- SetBkMode(hdc2,TRANSPARENT);
- ske_BltBackImage(hwnd,hdc2,&rc);
- ModernDrawStatusBarWorker(hwnd,hdc2);
- BitBlt(hdc,rc.left,rc.top,rc.right-rc.left,rc.bottom-rc.top,
- hdc2,rc.left,rc.top,SRCCOPY);
- SelectObject(hdc2,hbmpo);
- DeleteObject(hbmp);
- mod_DeleteDC(hdc2);
-
- SelectObject(hdc,GetStockObject(DEFAULT_GUI_FONT));
- ReleaseDC(hwnd,hdc);
- ValidateRect(hwnd,NULL);
- }
- else
- {
- HDC hdc, hdc2;
- HBITMAP hbmp, hbmpo;
- RECT rc;
- PAINTSTRUCT ps;
- HBRUSH br = GetSysColorBrush(COLOR_3DFACE);
- GetClientRect(hwnd,&rc);
- hdc = BeginPaint(hwnd,&ps);
- hdc2 = CreateCompatibleDC(hdc);
- hbmp = ske_CreateDIB32(rc.right,rc.bottom);
- hbmpo = (HBITMAP) SelectObject(hdc2,hbmp);
- FillRect(hdc2,&ps.rcPaint,br);
- ModernDrawStatusBarWorker(hwnd,hdc2);
- //BitBlt(hdc,ps.rcPaint.left,ps.rcPaint.top,ps.rcPaint.right-ps.rcPaint.left,ps.rcPaint.bottom-ps.rcPaint.top,
- // hdc2,ps.rcPaint.left,ps.rcPaint.top,SRCCOPY);
- BitBlt(hdc,ps.rcPaint.left,ps.rcPaint.top,ps.rcPaint.right-ps.rcPaint.left,ps.rcPaint.bottom-ps.rcPaint.top,
- hdc2,ps.rcPaint.left,ps.rcPaint.top,SRCCOPY);
- SelectObject(hdc2,hbmpo);
- DeleteObject(hbmp);
- mod_DeleteDC(hdc2);
- ps.fErase = FALSE;
- EndPaint(hwnd,&ps);
- }
- return DefWindowProc(hwnd, msg, wParam, lParam);
-
- case WM_GETMINMAXINFO:{
- RECT rct;
- GetWindowRect(hwnd,&rct);
- memset((LPMINMAXINFO)lParam,0,sizeof(MINMAXINFO));
- ((LPMINMAXINFO)lParam)->ptMinTrackSize.x = 16;
- ((LPMINMAXINFO)lParam)->ptMinTrackSize.y = 16;
- ((LPMINMAXINFO)lParam)->ptMaxTrackSize.x = 1600;
- ((LPMINMAXINFO)lParam)->ptMaxTrackSize.y = 1600;
- return(0);
- }
-
- case WM_SHOWWINDOW:
- {
- int res;
- int ID;
- if (tooltipshoing){
- NotifyEventHooks(g_CluiData.hEventStatusBarHideToolTip,0,0);
- tooltipshoing = FALSE;
- };
- ID=Sync( FindFrameID, hwnd );
- if (ID)
- {
- res = CallService(MS_CLIST_FRAMES_GETFRAMEOPTIONS, MAKEWPARAM(FO_FLAGS,ID),0);
- if (res >= 0) db_set_b(0,"CLUI","ShowSBar",(BYTE)(wParam/*(res&F_VISIBLE)*/?1:0));
- }
- }
- break;
- case WM_TIMER:
- {
- if (wParam == TM_STATUSBARHIDE)
- {
- KillTimer(hwnd,TM_STATUSBARHIDE);
- if (tooltipshoing)
- {
- NotifyEventHooks(g_CluiData.hEventStatusBarHideToolTip,0,0);
- tooltipshoing = FALSE;
- ReleaseCapture();
- };
- }
- else if (wParam == TM_STATUSBAR)
- {
- POINT pt;
- KillTimer(hwnd,TM_STATUSBAR);
- GetCursorPos(&pt);
- if (pt.x == lastpnt.x && pt.y == lastpnt.y)
- {
- int i;
- RECT rc;
- ScreenToClient(hwnd,&pt);
- for (i=0; i < allocedItemData; i++)
- {
- rc = ProtosData[i].protoRect;
- if (PtInRect(&rc,pt))
- {
- NotifyEventHooks(g_CluiData.hEventStatusBarShowToolTip,(WPARAM)ProtosData[i].AccountName,0);
- CLUI_SafeSetTimer(hwnd,TM_STATUSBARHIDE,db_get_w(NULL,"CLUIFrames","HideToolTipTime",SETTING_HIDETOOLTIPTIME_DEFAULT),0);
- tooltipshoing = TRUE;
- ClientToScreen(hwnd,&pt);
- ptToolTipShow = pt;
- SetCapture(hwnd);
- return 0;
- }
- }
- return 0;
- }
- }
- return 0;
- }
- case WM_MOUSEMOVE:
- if (tooltipshoing)
- {
- POINT pt;
- GetCursorPos(&pt);
- if (abs(pt.x-ptToolTipShow.x)>TOOLTIP_TOLERANCE || abs(pt.y-ptToolTipShow.y)>TOOLTIP_TOLERANCE)
- {
- KillTimer(hwnd,TM_STATUSBARHIDE);
- NotifyEventHooks(g_CluiData.hEventStatusBarHideToolTip,0,0);
- tooltipshoing = FALSE;
- ReleaseCapture();
- }
- }
- break;
- case WM_SETCURSOR:
- {
- if (g_CluiData.bBehindEdgeSettings) CLUI_UpdateTimer(0);
- {
- POINT pt;
- GetCursorPos(&pt);
- SendMessage(GetParent(hwnd),msg,wParam,lParam);
- if (pt.x == lastpnt.x && pt.y == lastpnt.y)
- {
- return(CLUI_TestCursorOnBorders());
- };
- lastpnt = pt;
- if (tooltipshoing)
- if (abs(pt.x-ptToolTipShow.x)>TOOLTIP_TOLERANCE || abs(pt.y-ptToolTipShow.y)>TOOLTIP_TOLERANCE)
- {
- KillTimer(hwnd,TM_STATUSBARHIDE);
- NotifyEventHooks(g_CluiData.hEventStatusBarHideToolTip,0,0);
- tooltipshoing = FALSE;
- ReleaseCapture();
- };
- KillTimer(hwnd,TM_STATUSBAR);
- CLUI_SafeSetTimer(hwnd,TM_STATUSBAR,db_get_w(NULL,"CLC","InfoTipHoverTime",CLCDEFAULT_INFOTIPTIME),0);
-
- return(CLUI_TestCursorOnBorders());
- }
- }
- case WM_LBUTTONDOWN:
- case WM_MBUTTONDOWN:
- case WM_RBUTTONDOWN:
- {
- RECT rc;
- POINT pt;
- int i;
- pt.x = (short)LOWORD(lParam);
- pt.y = (short)HIWORD(lParam);
- KillTimer(hwnd,TM_STATUSBARHIDE);
- KillTimer(hwnd,TM_STATUSBAR);
-
- if (tooltipshoing){
- NotifyEventHooks(g_CluiData.hEventStatusBarHideToolTip,0,0);
- };
- tooltipshoing = FALSE;
- for (i=0; i < allocedItemData; i++)
- {
- RECT rc1;
- BOOL isOnExtra = FALSE;
-
- rc = ProtosData[i].protoRect;
- rc1 = rc;
- rc1.left = rc.left+16;
- rc1.right = rc1.left+16;
- if (PtInRect(&rc,pt) && PtInRect(&rc1,pt) && ProtosData[i].DoubleIcons)
- isOnExtra = TRUE;
- if (PtInRect(&rc,pt))
- {
- HMENU hMenu = NULL;
-
- BOOL bShift = ( GetKeyState( VK_SHIFT )&0x8000 );
- BOOL bCtrl = ( GetKeyState( VK_CONTROL )&0x8000 );
-
- if (( msg == WM_MBUTTONDOWN || ( msg == WM_RBUTTONDOWN && bCtrl ) || isOnExtra) && _ModernStatus_OnExtraIconClick( i ))
- {
- return TRUE;
- }
- if ( msg == WM_LBUTTONDOWN && bCtrl )
- {
- if ( g_CluiData.bFilterEffective != CLVM_FILTER_PROTOS || !bShift )
- {
- ApplyViewMode( "" );
- mir_snprintf( g_CluiData.protoFilter, SIZEOF(g_CluiData.protoFilter), "%s|", ProtosData[i].AccountName );
- g_CluiData.bFilterEffective = CLVM_FILTER_PROTOS;
- }
- else
- {
- char protoF[ sizeof(g_CluiData.protoFilter) ];
- mir_snprintf( protoF, SIZEOF(protoF), "%s|", ProtosData[i].AccountName );
- char * pos = strstri( g_CluiData.protoFilter, ProtosData[i].AccountName );
- if ( pos )
- {
- // remove filter
- int len = strlen( protoF );
- memmove( pos, pos + len, strlen( pos + len ) + 1 );
-
- if ( strlen( g_CluiData.protoFilter ) == 0 )
- ApplyViewMode( "" );
- else
- g_CluiData.bFilterEffective = CLVM_FILTER_PROTOS;
- }
- else
- {
- //add filter
- mir_snprintf( g_CluiData.protoFilter, SIZEOF(g_CluiData.protoFilter), "%s%s", g_CluiData.protoFilter, protoF );
- g_CluiData.bFilterEffective = CLVM_FILTER_PROTOS;
- }
- }
- if ( g_CluiData.bFilterEffective == CLVM_FILTER_PROTOS)
- {
- char filterName[ sizeof(g_CluiData.protoFilter) ] = { 0 };
- filterName[0] = (char)13;
-
- int protoCount;
- PROTOACCOUNT ** accs;
- ProtoEnumAccounts( &protoCount, &accs );
-
- bool first = true;
- for ( int pos = 0; pos < protoCount; pos++ )
- {
- int i = pcli->pfnGetAccountIndexByPos( pos );
-
- if ( i < 0 && i >= protoCount )
- continue;
-
- char protoF[ sizeof(g_CluiData.protoFilter) ];
- mir_snprintf( protoF, SIZEOF(protoF), "%s|", accs[i]->szModuleName );
- if ( strstri( g_CluiData.protoFilter, protoF ))
- {
- char * temp = mir_utf8encodeT( accs[i]->tszAccountName );
- if ( !first )
- strncat( filterName, "; ", SIZEOF(filterName) - strlen(filterName));
- strncat( filterName, temp, SIZEOF(filterName) - strlen(filterName));
- first = false;
- mir_free( temp );
- }
- }
-
- SaveViewMode( filterName, _T(""), g_CluiData.protoFilter, 0, -1, 0, 0, 0, 0 );
-
- ApplyViewMode( filterName );
- }
- pcli->pfnClcBroadcast(CLM_AUTOREBUILD, 0, 0);
- CLUI__cliInvalidateRect( hwnd, NULL, FALSE );
- SetCapture( NULL );
- return 0;
- }
- if ( !hMenu)
- {
- if (msg == WM_RBUTTONDOWN)
- {
- BOOL a = ((g_StatusBarData.perProtoConfig && ProtosData[i].SBarRightClk) || g_StatusBarData.SBarRightClk );
- if ( a ^ bShift )
- hMenu = (HMENU)CallService(MS_CLIST_MENUGETMAIN,0,0);
- else
- hMenu = (HMENU)CallService(MS_CLIST_MENUGETSTATUS,0,0);
- }
- else
- {
- hMenu = (HMENU)CallService(MS_CLIST_MENUGETSTATUS,0,0);
- unsigned int cpnl = 0;
- int mcnt = GetMenuItemCount(hMenu);
- for (int j = 0; j < mcnt; ++j) {
- HMENU hMenus = GetSubMenu(hMenu, j);
- if (hMenus && cpnl++ == i) {
- hMenu = hMenus;
- break;
- }
- }
- }
- }
- ClientToScreen(hwnd,&pt);
- {
- HWND parent = GetParent(hwnd);
- if (parent != pcli->hwndContactList) parent = GetParent(parent);
- TrackPopupMenu(hMenu,TPM_TOPALIGN|TPM_LEFTALIGN|TPM_LEFTBUTTON,pt.x,pt.y,0,parent,NULL);
- }
- return 0;
- }
- }
- GetClientRect( hwnd, &rc );
- if ( PtInRect( &rc, pt ) && msg == WM_LBUTTONDOWN && g_CluiData.bFilterEffective == CLVM_FILTER_PROTOS )
- {
- ApplyViewMode( "" );
- CLUI__cliInvalidateRect( hwnd, NULL, FALSE );
- SetCapture( NULL );
- return 0;
- }
- return SendMessage(GetParent(hwnd), msg, wParam, lParam );
- }
- }
- return DefWindowProc(hwnd, msg, wParam, lParam);
+ if (tooltipshoing) {
+ NotifyEventHooks(g_CluiData.hEventStatusBarHideToolTip,0,0);
+ tooltipshoing = FALSE;
+ }
+ int ID = Sync(FindFrameID, hwnd);
+ if (ID) {
+ int res = CallService(MS_CLIST_FRAMES_GETFRAMEOPTIONS, MAKEWPARAM(FO_FLAGS,ID),0);
+ if (res >= 0)
+ db_set_b(0,"CLUI","ShowSBar",(BYTE)(wParam/*(res&F_VISIBLE)*/?1:0));
+ }
+ }
+ break;
+
+ case WM_TIMER:
+ if (wParam == TM_STATUSBARHIDE) {
+ KillTimer(hwnd,TM_STATUSBARHIDE);
+ if (tooltipshoing) {
+ NotifyEventHooks(g_CluiData.hEventStatusBarHideToolTip,0,0);
+ tooltipshoing = FALSE;
+ ReleaseCapture();
+ }
+ }
+ else if (wParam == TM_STATUSBAR) {
+ POINT pt;
+ KillTimer(hwnd,TM_STATUSBAR);
+ GetCursorPos(&pt);
+ if (pt.x == lastpnt.x && pt.y == lastpnt.y) {
+ RECT rc;
+ ScreenToClient(hwnd, &pt);
+ for (int i=0; i < ProtosData.getCount(); i++) {
+ rc = ProtosData[i].protoRect;
+ if (PtInRect(&rc,pt)) {
+ NotifyEventHooks(g_CluiData.hEventStatusBarShowToolTip,(WPARAM)ProtosData[i].AccountName,0);
+ CLUI_SafeSetTimer(hwnd,TM_STATUSBARHIDE,db_get_w(NULL,"CLUIFrames","HideToolTipTime",SETTING_HIDETOOLTIPTIME_DEFAULT),0);
+ tooltipshoing = TRUE;
+ ClientToScreen(hwnd,&pt);
+ ptToolTipShow = pt;
+ SetCapture(hwnd);
+ return 0;
+ }
+ }
+ return 0;
+ }
+ }
+ return 0;
+
+ case WM_MOUSEMOVE:
+ if (tooltipshoing) {
+ POINT pt;
+ GetCursorPos(&pt);
+ if ( abs(pt.x-ptToolTipShow.x) > TOOLTIP_TOLERANCE || abs(pt.y-ptToolTipShow.y) > TOOLTIP_TOLERANCE) {
+ KillTimer(hwnd,TM_STATUSBARHIDE);
+ NotifyEventHooks(g_CluiData.hEventStatusBarHideToolTip,0,0);
+ tooltipshoing = FALSE;
+ ReleaseCapture();
+ }
+ }
+ break;
+
+ case WM_SETCURSOR:
+ if (g_CluiData.bBehindEdgeSettings) CLUI_UpdateTimer(0);
+ {
+ POINT pt;
+ GetCursorPos(&pt);
+ SendMessage(GetParent(hwnd),msg,wParam,lParam);
+ if (pt.x == lastpnt.x && pt.y == lastpnt.y)
+ return(CLUI_TestCursorOnBorders());
+
+ lastpnt = pt;
+ if (tooltipshoing)
+ if ( abs(pt.x-ptToolTipShow.x) > TOOLTIP_TOLERANCE || abs(pt.y-ptToolTipShow.y) > TOOLTIP_TOLERANCE) {
+ KillTimer(hwnd,TM_STATUSBARHIDE);
+ NotifyEventHooks(g_CluiData.hEventStatusBarHideToolTip,0,0);
+ tooltipshoing = FALSE;
+ ReleaseCapture();
+ }
+ KillTimer(hwnd,TM_STATUSBAR);
+ CLUI_SafeSetTimer(hwnd, TM_STATUSBAR, db_get_w(NULL,"CLC","InfoTipHoverTime", CLCDEFAULT_INFOTIPTIME),0);
+ }
+ return CLUI_TestCursorOnBorders();
+
+ case WM_LBUTTONDOWN:
+ case WM_MBUTTONDOWN:
+ case WM_RBUTTONDOWN:
+ {
+ RECT rc;
+ POINT pt;
+ pt.x = (short)LOWORD(lParam);
+ pt.y = (short)HIWORD(lParam);
+ KillTimer(hwnd,TM_STATUSBARHIDE);
+ KillTimer(hwnd,TM_STATUSBAR);
+
+ if (tooltipshoing)
+ NotifyEventHooks(g_CluiData.hEventStatusBarHideToolTip,0,0);
+
+ tooltipshoing = FALSE;
+ for (int i=0; i < ProtosData.getCount(); i++) {
+ ProtoItemData& p = ProtosData[i];
+ BOOL isOnExtra = FALSE;
+
+ rc = p.protoRect;
+ RECT rc1 = rc;
+ rc1.left = rc.left+16;
+ rc1.right = rc1.left+16;
+ if ( PtInRect(&rc, pt) && PtInRect(&rc1,pt) && p.DoubleIcons)
+ isOnExtra = TRUE;
+
+ if ( PtInRect(&rc,pt)) {
+ HMENU hMenu = NULL;
+
+ BOOL bShift = ( GetKeyState( VK_SHIFT ) & 0x8000);
+ BOOL bCtrl = ( GetKeyState( VK_CONTROL ) & 0x8000);
+
+ if ((msg == WM_MBUTTONDOWN || (msg == WM_RBUTTONDOWN && bCtrl) || isOnExtra) && _ModernStatus_OnExtraIconClick( i ))
+ return TRUE;
+
+ if (msg == WM_LBUTTONDOWN && bCtrl) {
+ if ( g_CluiData.bFilterEffective != CLVM_FILTER_PROTOS || !bShift ) {
+ ApplyViewMode("");
+ mir_snprintf( g_CluiData.protoFilter, SIZEOF(g_CluiData.protoFilter), "%s|", p.AccountName );
+ g_CluiData.bFilterEffective = CLVM_FILTER_PROTOS;
+ }
+ else {
+ char protoF[ sizeof(g_CluiData.protoFilter) ];
+ mir_snprintf( protoF, SIZEOF(protoF), "%s|", p.AccountName );
+ char *pos = strstri( g_CluiData.protoFilter, p.AccountName );
+ if (pos) {
+ // remove filter
+ int len = strlen( protoF );
+ memmove( pos, pos + len, strlen( pos + len ) + 1 );
+
+ if ( strlen( g_CluiData.protoFilter ) == 0 )
+ ApplyViewMode( "" );
+ else
+ g_CluiData.bFilterEffective = CLVM_FILTER_PROTOS;
+ }
+ else {
+ //add filter
+ mir_snprintf( g_CluiData.protoFilter, SIZEOF(g_CluiData.protoFilter), "%s%s", g_CluiData.protoFilter, protoF );
+ g_CluiData.bFilterEffective = CLVM_FILTER_PROTOS;
+ }
+ }
+
+ if (g_CluiData.bFilterEffective == CLVM_FILTER_PROTOS) {
+ char filterName[ sizeof(g_CluiData.protoFilter) ] = { 0 };
+ filterName[0] = (char)13;
+
+ int protoCount;
+ PROTOACCOUNT ** accs;
+ ProtoEnumAccounts( &protoCount, &accs );
+
+ bool first = true;
+ for (int pos = 0; pos < protoCount; pos++) {
+ int i = pcli->pfnGetAccountIndexByPos( pos );
+ if ( i < 0 && i >= protoCount )
+ continue;
+
+ char protoF[ sizeof(g_CluiData.protoFilter) ];
+ mir_snprintf( protoF, SIZEOF(protoF), "%s|", accs[i]->szModuleName );
+ if ( strstri(g_CluiData.protoFilter, protoF)) {
+ char * temp = mir_utf8encodeT( accs[i]->tszAccountName );
+ if ( !first )
+ strncat( filterName, "; ", SIZEOF(filterName) - strlen(filterName));
+ strncat( filterName, temp, SIZEOF(filterName) - strlen(filterName));
+ first = false;
+ mir_free( temp );
+ }
+ }
+
+ SaveViewMode( filterName, _T(""), g_CluiData.protoFilter, 0, -1, 0, 0, 0, 0 );
+
+ ApplyViewMode( filterName );
+ }
+ pcli->pfnClcBroadcast(CLM_AUTOREBUILD, 0, 0);
+ CLUI__cliInvalidateRect( hwnd, NULL, FALSE );
+ SetCapture( NULL );
+ return 0;
+ }
+
+ if ( !hMenu) {
+ if (msg == WM_RBUTTONDOWN) {
+ BOOL a = ((g_StatusBarData.perProtoConfig && p.SBarRightClk) || g_StatusBarData.SBarRightClk );
+ if ( a ^ bShift )
+ hMenu = (HMENU)CallService(MS_CLIST_MENUGETMAIN,0,0);
+ else
+ hMenu = (HMENU)CallService(MS_CLIST_MENUGETSTATUS,0,0);
+ }
+ else {
+ hMenu = (HMENU)CallService(MS_CLIST_MENUGETSTATUS,0,0);
+ unsigned int cpnl = 0;
+ int mcnt = GetMenuItemCount(hMenu);
+ for (int j = 0; j < mcnt; ++j) {
+ HMENU hMenus = GetSubMenu(hMenu, j);
+ if (hMenus && cpnl++ == i) {
+ hMenu = hMenus;
+ break;
+ }
+ }
+ }
+ }
+
+ ClientToScreen(hwnd,&pt);
+
+ HWND parent = GetParent(hwnd);
+ if (parent != pcli->hwndContactList) parent = GetParent(parent);
+ TrackPopupMenu(hMenu,TPM_TOPALIGN|TPM_LEFTALIGN|TPM_LEFTBUTTON,pt.x,pt.y,0,parent,NULL);
+ return 0;
+ }
+ }
+
+ GetClientRect(hwnd, &rc);
+ if ( PtInRect( &rc, pt ) && msg == WM_LBUTTONDOWN && g_CluiData.bFilterEffective == CLVM_FILTER_PROTOS) {
+ ApplyViewMode( "" );
+ CLUI__cliInvalidateRect( hwnd, NULL, FALSE );
+ SetCapture( NULL );
+ return 0;
+ }
+ return SendMessage(GetParent(hwnd), msg, wParam, lParam );
+ }
+ }
+ return DefWindowProc(hwnd, msg, wParam, lParam);
}
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.style = 0;
- wndclass.lpfnWndProc = ModernStatusProc;
- wndclass.cbClsExtra = 0;
- wndclass.cbWndExtra = 0;
- wndclass.hInstance = g_hInst;
- wndclass.hIcon = NULL;
- wndclass.hCursor = LoadCursor (NULL, IDC_ARROW);
- wndclass.hbrBackground = GetSysColorBrush(COLOR_3DFACE);
- wndclass.lpszMenuName = NULL;
- wndclass.lpszClassName = pluginname;
- RegisterClass(&wndclass);
- }
- hModernStatusBar = CreateWindow(pluginname,pluginname,WS_CHILD|WS_VISIBLE|WS_CLIPCHILDREN,
- 0,0,0,h,parent,NULL,g_hInst,NULL);
- // register frame
- {
- CLISTFrame Frame;
- memset(&Frame,0,sizeof(Frame));
- Frame.cbSize = sizeof(CLISTFrame);
- Frame.hWnd = hModernStatusBar;
- Frame.align = alBottom;
- Frame.hIcon = LoadSkinnedIcon (SKINICON_OTHER_MIRANDA);
- Frame.Flags = (db_get_b(NULL,"CLUI","ShowSBar",SETTING_SHOWSBAR_DEFAULT)?F_VISIBLE:0)|F_LOCKED|F_NOBORDER|F_NO_SUBCONTAINER|F_TCHAR;
- Frame.height = h;
- Frame.tname = _T("Status Bar");
- Frame.TBtname = TranslateT("Status Bar");
- hFramehModernStatusBar = (HANDLE)CallService(MS_CLIST_FRAMES_ADDFRAME,(WPARAM)&Frame,(LPARAM)0);
- CallService(MS_SKINENG_REGISTERPAINTSUB,(WPARAM)Frame.hWnd,(LPARAM)NewStatusPaintCallbackProc); //$$$$$ register sub for frame
- }
-
- LoadStatusBarData();
- CLUIServices_ProtocolStatusChanged(0,0);
- CallService(MS_CLIST_FRAMES_UPDATEFRAME,-1,0);
- return hModernStatusBar;
+ WNDCLASS wndclass = {0};
+ TCHAR pluginname[] = _T("ModernStatusBar");
+ int h = GetSystemMetrics(SM_CYSMICON)+2;
+ if ( GetClassInfo(g_hInst,pluginname,&wndclass) == 0) {
+ wndclass.style = 0;
+ wndclass.lpfnWndProc = ModernStatusProc;
+ wndclass.cbClsExtra = 0;
+ wndclass.cbWndExtra = 0;
+ wndclass.hInstance = g_hInst;
+ wndclass.hIcon = NULL;
+ wndclass.hCursor = LoadCursor (NULL, IDC_ARROW);
+ wndclass.hbrBackground = GetSysColorBrush(COLOR_3DFACE);
+ wndclass.lpszMenuName = NULL;
+ wndclass.lpszClassName = pluginname;
+ RegisterClass(&wndclass);
+ }
+
+ hModernStatusBar = CreateWindow(pluginname, pluginname, WS_CHILD | WS_VISIBLE | WS_CLIPCHILDREN,
+ 0, 0, 0, h, parent, NULL, g_hInst, NULL);
+
+ // register frame
+ CLISTFrame Frame;
+ memset(&Frame,0,sizeof(Frame));
+ Frame.cbSize = sizeof(CLISTFrame);
+ Frame.hWnd = hModernStatusBar;
+ Frame.align = alBottom;
+ Frame.hIcon = LoadSkinnedIcon (SKINICON_OTHER_MIRANDA);
+ Frame.Flags = (db_get_b(NULL,"CLUI","ShowSBar",SETTING_SHOWSBAR_DEFAULT)?F_VISIBLE:0)|F_LOCKED|F_NOBORDER|F_NO_SUBCONTAINER|F_TCHAR;
+ Frame.height = h;
+ Frame.tname = _T("Status Bar");
+ Frame.TBtname = TranslateT("Status Bar");
+ hFramehModernStatusBar = (HANDLE)CallService(MS_CLIST_FRAMES_ADDFRAME,(WPARAM)&Frame,(LPARAM)0);
+ CallService(MS_SKINENG_REGISTERPAINTSUB,(WPARAM)Frame.hWnd,(LPARAM)NewStatusPaintCallbackProc); //$$$$$ register sub for frame
+
+ LoadStatusBarData();
+ CLUIServices_ProtocolStatusChanged(0,0);
+ CallService(MS_CLIST_FRAMES_UPDATEFRAME,-1,0);
+ return hModernStatusBar;
}
diff --git a/plugins/Clist_modern/src/modern_tbbutton.cpp b/plugins/Clist_modern/src/modern_tbbutton.cpp
index ce37acb5ae..448c01ea66 100644
--- a/plugins/Clist_modern/src/modern_tbbutton.cpp
+++ b/plugins/Clist_modern/src/modern_tbbutton.cpp
@@ -175,9 +175,9 @@ static void PaintWorker(TBBUTTONDATA *bct, HDC hdcPaint , POINT *pOffset)
/* correct rect according to rcMargins */
rcTemp.left += bct->rcMargins.left;
- rcTemp.top += bct->rcMargins.top;
- rcTemp.bottom -= bct->rcMargins.bottom;
- rcTemp.right -= bct->rcMargins.right;
+ rcTemp.top += bct->rcMargins.top;
+ rcTemp.bottom -= bct->rcMargins.bottom;
+ rcTemp.right -= bct->rcMargins.right;
}
rcIcon = rcTemp;