diff options
author | George Hazan <george.hazan@gmail.com> | 2012-10-30 20:08:15 +0000 |
---|---|---|
committer | George Hazan <george.hazan@gmail.com> | 2012-10-30 20:08:15 +0000 |
commit | cdff820aeb7d935d18fb66027102f69ec96bf92c (patch) | |
tree | d1746bf9d6525f235d2268b03c65280a030443cf /plugins/Clist_modern/src | |
parent | 54afc006dbe5a48decbbf5d4f0c332b52e776ec8 (diff) |
minor clists' code cleaning
git-svn-id: http://svn.miranda-ng.org/main/trunk@2118 1316c22d-e87f-b044-9b9b-93d7a3e3ba9c
Diffstat (limited to 'plugins/Clist_modern/src')
17 files changed, 794 insertions, 927 deletions
diff --git a/plugins/Clist_modern/src/hdr/modern_cache_funcs.h b/plugins/Clist_modern/src/hdr/modern_cache_funcs.h index ba2b59f2c3..af86a029d4 100644 --- a/plugins/Clist_modern/src/hdr/modern_cache_funcs.h +++ b/plugins/Clist_modern/src/hdr/modern_cache_funcs.h @@ -31,11 +31,11 @@ Created by Pescuma #include "modern_clc.h"
#include "modern_commonprototypes.h"
-void Cache_GetText(struct ClcData *dat, struct ClcContact *contact, BOOL forceRenew);
-void Cache_GetFirstLineText(struct ClcData *dat, struct ClcContact *contact);
+void Cache_GetText(struct ClcData *dat, ClcContact *contact, BOOL forceRenew);
+void Cache_GetFirstLineText(struct ClcData *dat, ClcContact *contact);
void Cache_GetSecondLineText(struct SHORTDATA *dat, PDNCE pdnce);
void Cache_GetThirdLineText(struct SHORTDATA *dat, PDNCE pdnce);
-void Cache_GetAvatar(struct ClcData *dat, struct ClcContact *contact);
+void Cache_GetAvatar(struct ClcData *dat, ClcContact *contact);
void Cache_GetTimezone(struct ClcData *dat, HANDLE hContact);
int Cache_GetLineText(PDNCE pdnce, int type, LPTSTR text, int text_size, TCHAR *variable_text, BOOL xstatus_has_priority,
BOOL show_status_if_no_away, BOOL show_listening_if_no_away, BOOL use_name_and_message_for_xstatus,
diff --git a/plugins/Clist_modern/src/hdr/modern_clc.h b/plugins/Clist_modern/src/hdr/modern_clc.h index e17ee3e03c..62d9473a60 100644 --- a/plugins/Clist_modern/src/hdr/modern_clc.h +++ b/plugins/Clist_modern/src/hdr/modern_clc.h @@ -128,7 +128,7 @@ void clcSetDelayTimer( UINT_PTR uIDEvent, HWND hwnd, int nDelay = -1); #define DROPTARGET_ONMETACONTACT 6
#define DROPTARGET_ONSUBCONTACT 7
-struct ClcGroup;
+ClcGroup;
#define CONTACTF_ONLINE 1
#define CONTACTF_INVISTO 2
@@ -208,7 +208,7 @@ struct tContactItems struct ClcContact : public ClcContactBase
{
- struct ClcContact *subcontacts;
+ ClcContact *subcontacts;
BYTE SubAllocated;
BYTE SubExpanded;
BYTE isSubcontact;
@@ -403,22 +403,22 @@ typedef struct tagOVERLAYICONINFO void ClcOptionsChanged(void);
//clcidents.c
-int cliGetRowsPriorTo(struct ClcGroup *group,struct ClcGroup *subgroup,int contactIndex);
-int FindItem(HWND hwnd,struct ClcData *dat,HANDLE hItem,struct ClcContact **contact,struct ClcGroup **subgroup,int *isVisible, BOOL isIgnoreSubcontacts );
-int cliGetRowByIndex(struct ClcData *dat,int testindex,struct ClcContact **contact,struct ClcGroup **subgroup);
-HANDLE ContactToHItem(struct ClcContact *contact);
-HANDLE ContactToItemHandle(struct ClcContact *contact,DWORD *nmFlags);
+int cliGetRowsPriorTo(ClcGroup *group,ClcGroup *subgroup,int contactIndex);
+int FindItem(HWND hwnd,struct ClcData *dat,HANDLE hItem,ClcContact **contact,ClcGroup **subgroup,int *isVisible, BOOL isIgnoreSubcontacts );
+int cliGetRowByIndex(struct ClcData *dat,int testindex,ClcContact **contact,ClcGroup **subgroup);
+HANDLE ContactToHItem(ClcContact *contact);
+HANDLE ContactToItemHandle(ClcContact *contact,DWORD *nmFlags);
void ClearRowByIndexCache();
//clcitems.c
-struct ClcGroup *cli_AddGroup(HWND hwnd,struct ClcData *dat,const TCHAR *szName,DWORD flags,int groupId,int calcTotalMembers);
-void cli_FreeGroup(struct ClcGroup *group);
-int cli_AddInfoItemToGroup(struct ClcGroup *group,int flags,const TCHAR *pszText);
+ClcGroup *cli_AddGroup(HWND hwnd,struct ClcData *dat,const TCHAR *szName,DWORD flags,int groupId,int calcTotalMembers);
+void cli_FreeGroup(ClcGroup *group);
+int cli_AddInfoItemToGroup(ClcGroup *group,int flags,const TCHAR *pszText);
void cliRebuildEntireList(HWND hwnd,struct ClcData *dat);
void cli_DeleteItemFromTree(HWND hwnd,HANDLE hItem);
void cli_AddContactToTree(HWND hwnd,struct ClcData *dat,HANDLE hContact,int updateTotalCount,int checkHideOffline);
void cli_SortCLC(HWND hwnd,struct ClcData *dat,int useInsertionSort);
-int GetNewSelection(struct ClcGroup *group,int selection, int direction);
+int GetNewSelection(ClcGroup *group,int selection, int direction);
//clcmsgs.c
LRESULT cli_ProcessExternalMessages(HWND hwnd,struct ClcData *dat,UINT msg,WPARAM wParam,LPARAM lParam);
@@ -426,7 +426,7 @@ LRESULT cli_ProcessExternalMessages(HWND hwnd,struct ClcData *dat,UINT msg,WPARA //clcutils.c
void cliRecalcScrollBar(HWND hwnd,struct ClcData *dat);
void cliBeginRenameSelection(HWND hwnd,struct ClcData *dat);
-int cliHitTest(HWND hwnd,struct ClcData *dat,int testx,int testy,struct ClcContact **contact,struct ClcGroup **group,DWORD *flags);
+int cliHitTest(HWND hwnd,struct ClcData *dat,int testx,int testy,ClcContact **contact,ClcGroup **group,DWORD *flags);
void cliScrollTo(HWND hwnd,struct ClcData *dat,int desty,int noSmooth);
int GetDropTargetInformation(HWND hwnd,struct ClcData *dat,POINT pt);
void LoadCLCOptions(HWND hwnd,struct ClcData *dat);
diff --git a/plugins/Clist_modern/src/hdr/modern_clcpaint.h b/plugins/Clist_modern/src/hdr/modern_clcpaint.h index fdca01884f..73c275fe56 100644 --- a/plugins/Clist_modern/src/hdr/modern_clcpaint.h +++ b/plugins/Clist_modern/src/hdr/modern_clcpaint.h @@ -14,7 +14,7 @@ public: BOOL IsForegroundWindow( HWND hWnd );
HFONT ChangeToFont( HDC hdc, struct ClcData *dat, int id, int *fontHeight );
- int GetBasicFontID( struct ClcContact * contact );
+ int GetBasicFontID( ClcContact * contact );
void GetTextSize( SIZE *text_size, HDC hdcMem, RECT free_row_rc, TCHAR *szText, SortedList *plText, UINT uTextFormat, int smiley_height );
void AddParam( MODERNMASK * mpModernMask, DWORD dwParamHash, const char* szValue, DWORD dwValueHash );
BOOL CheckMiniMode( struct ClcData *dat, BOOL selected, BOOL hot );
@@ -101,33 +101,33 @@ private: void _SetHotTrackColour( HDC hdc, struct ClcData *dat );
int _GetStatusOnlineness( int status );
int _GetGeneralisedStatus();
- int _GetRealStatus( struct ClcContact * pContact, int nStatus );
+ int _GetRealStatus( ClcContact * pContact, int nStatus );
RECT _GetRectangle( struct ClcData *dat, RECT *row_rc, RECT *free_row_rc, int *left_pos, int *right_pos, BOOL left, int real_width, int width, int height, int horizontal_space );
void _DrawTextSmiley( HDC hdcMem, RECT * free_rc, SIZE * text_size, TCHAR *szText, int start, int len, SortedList *plText, UINT uTextFormat, BOOL ResizeSizeSmiley );
void _AddParameter( MODERNMASK * mpModernMask, MASKPARAM * lpParam );
void _AddParamShort( MODERNMASK * mpModernMask, DWORD dwParamIndex, DWORD dwValueIndex );
void _FillParam( MASKPARAM * lpParam, DWORD dwParamHash, const char* szValue, DWORD dwValueHash );
- MODERNMASK * _GetCLCContactRowBackModernMask( struct ClcGroup * group, struct ClcContact * Drawing, int indent, int index, BOOL selected, BOOL hottrack, struct ClcData * dat );
+ MODERNMASK * _GetCLCContactRowBackModernMask( ClcGroup * group, ClcContact * Drawing, int indent, int index, BOOL selected, BOOL hottrack, struct ClcData * dat );
void _RTLRect( RECT *rect, int width, int offset );
- void _PaintRowItemsEx( HWND hwnd, HDC hdcMem, struct ClcData *dat, struct ClcContact *Drawing, RECT row_rc, RECT free_row_rc, int left_pos, int right_pos, int selected, int hottrack, RECT *rcPaint );
- void _DrawStatusIcon( struct ClcContact * Drawing, struct ClcData *dat, int iImage, HDC hdcMem, int x, int y, int cx, int cy, DWORD colorbg, DWORD colorfg, int mode );
+ void _PaintRowItemsEx( HWND hwnd, HDC hdcMem, struct ClcData *dat, ClcContact *Drawing, RECT row_rc, RECT free_row_rc, int left_pos, int right_pos, int selected, int hottrack, RECT *rcPaint );
+ void _DrawStatusIcon( ClcContact * Drawing, struct ClcData *dat, int iImage, HDC hdcMem, int x, int y, int cx, int cy, DWORD colorbg, DWORD colorfg, int mode );
BOOL _DrawNonEnginedBackground( HWND hwnd, HDC hdcMem, RECT * rcPaint, RECT clRect, struct ClcData * dat );
void _PaintClc( HWND hwnd, struct ClcData *dat, HDC hdc, RECT *rcPaint );
- void _StoreItemPos( struct ClcContact *contact, int ItemType, RECT * rc );
- void _CalcItemsPos( HWND hwnd, HDC hdcMem, struct ClcData *dat, struct ClcContact *Drawing, RECT *in_row_rc, RECT *in_free_row_rc, int left_pos, int right_pos, int selected, int hottrack );
+ void _StoreItemPos( ClcContact *contact, int ItemType, RECT * rc );
+ void _CalcItemsPos( HWND hwnd, HDC hdcMem, struct ClcData *dat, ClcContact *Drawing, RECT *in_row_rc, RECT *in_free_row_rc, int left_pos, int right_pos, int selected, int hottrack );
BOOL __IsVisible( RECT * firtRect, RECT * secondRect );
- void _GetBlendMode( IN struct ClcData *dat, IN struct ClcContact * Drawing, IN BOOL selected, IN BOOL hottrack, IN BOOL bFlag, OUT COLORREF * OutColourFg, OUT int * OutMode );
- void _DrawContactItems( HWND hwnd, HDC hdcMem, struct ClcData *dat, struct ClcContact *Drawing, RECT *row_rc, RECT *free_row_rc, int left_pos, int right_pos, int selected, int hottrack, RECT *rcPaint );
- void _PaintRowItems ( HWND hwnd, HDC hdcMem, struct ClcData *dat, struct ClcContact *Drawing, RECT row_rc, RECT free_row_rc, int left_pos, int right_pos, int selected, int hottrack, RECT *rcPaint );
+ void _GetBlendMode( IN struct ClcData *dat, IN ClcContact * Drawing, IN BOOL selected, IN BOOL hottrack, IN BOOL bFlag, OUT COLORREF * OutColourFg, OUT int * OutMode );
+ void _DrawContactItems( HWND hwnd, HDC hdcMem, struct ClcData *dat, ClcContact *Drawing, RECT *row_rc, RECT *free_row_rc, int left_pos, int right_pos, int selected, int hottrack, RECT *rcPaint );
+ void _PaintRowItems ( HWND hwnd, HDC hdcMem, struct ClcData *dat, ClcContact *Drawing, RECT row_rc, RECT free_row_rc, int left_pos, int right_pos, int selected, int hottrack, RECT *rcPaint );
- void _DrawContactAvatar ( HDC hdcMem, struct ClcData *dat, struct ClcContact *Drawing, RECT *row_rc, int& selected, int& hottrack, RECT& text_rc, RECT * prcItem );
- void _DrawContactIcon ( HDC hdcMem, struct ClcData *dat, struct ClcContact *Drawing, int& selected, int& hottrack, RECT& text_rc, RECT * prcItem );
- void _DrawContactText ( HDC hdcMem, struct ClcData *dat, struct ClcContact *Drawing, int& selected, int& hottrack, RECT& text_rc, RECT * prcItem, UINT uTextFormat );
- void _DrawContactSubText ( HDC hdcMem, struct ClcData *dat, struct ClcContact *Drawing, int& selected, int& hottrack, RECT& text_rc, RECT * prcItem, UINT uTextFormat, BYTE itemType );
- void _DrawContactTime ( HDC hdcMem, struct ClcData *dat, struct ClcContact *Drawing, int& selected, int& hottrack, RECT& text_rc, RECT * prcItem );
- void _DrawContactExtraIcon ( HDC hdcMem, struct ClcData *dat, struct ClcContact *Drawing, int& selected, int& hottrack, RECT& text_rc, RECT * rc, int iImage );
- void _DrawContactSelection ( HDC hdcMem, struct ClcData *dat, struct ClcContact *Drawing, int& selected, int& hottrack, RECT *rcPaint, RECT * prcItem );
- void _DrawContactLine ( HDC hdcMem, struct ClcData *dat, struct ClcContact *Drawing, RECT *free_row_rc, RECT *rcPaint, RECT& text_rc );
+ void _DrawContactAvatar ( HDC hdcMem, struct ClcData *dat, ClcContact *Drawing, RECT *row_rc, int& selected, int& hottrack, RECT& text_rc, RECT * prcItem );
+ void _DrawContactIcon ( HDC hdcMem, struct ClcData *dat, ClcContact *Drawing, int& selected, int& hottrack, RECT& text_rc, RECT * prcItem );
+ void _DrawContactText ( HDC hdcMem, struct ClcData *dat, ClcContact *Drawing, int& selected, int& hottrack, RECT& text_rc, RECT * prcItem, UINT uTextFormat );
+ void _DrawContactSubText ( HDC hdcMem, struct ClcData *dat, ClcContact *Drawing, int& selected, int& hottrack, RECT& text_rc, RECT * prcItem, UINT uTextFormat, BYTE itemType );
+ void _DrawContactTime ( HDC hdcMem, struct ClcData *dat, ClcContact *Drawing, int& selected, int& hottrack, RECT& text_rc, RECT * prcItem );
+ void _DrawContactExtraIcon ( HDC hdcMem, struct ClcData *dat, ClcContact *Drawing, int& selected, int& hottrack, RECT& text_rc, RECT * rc, int iImage );
+ void _DrawContactSelection ( HDC hdcMem, struct ClcData *dat, ClcContact *Drawing, int& selected, int& hottrack, RECT *rcPaint, RECT * prcItem );
+ void _DrawContactLine ( HDC hdcMem, struct ClcData *dat, ClcContact *Drawing, RECT *free_row_rc, RECT *rcPaint, RECT& text_rc );
int _rcWidth( RECT *rc ) { return rc->right-rc->left; }
int _rcHeight( RECT *rc ) { return rc->bottom-rc->top; }
diff --git a/plugins/Clist_modern/src/hdr/modern_commonprototypes.h b/plugins/Clist_modern/src/hdr/modern_commonprototypes.h index d8cb8d33e9..21abadc64c 100644 --- a/plugins/Clist_modern/src/hdr/modern_commonprototypes.h +++ b/plugins/Clist_modern/src/hdr/modern_commonprototypes.h @@ -89,7 +89,7 @@ typedef INT_PTR (*PSYNCCALLBACKPROC)(WPARAM,LPARAM); /* CLCItems */
-BOOL CLCItems_IsShowOfflineGroup(struct ClcGroup* group);
+BOOL CLCItems_IsShowOfflineGroup(ClcGroup* group);
/* CListMod */
int CListMod_HideWindow(HWND hwndContactList, int mode);
@@ -137,7 +137,7 @@ int ModernSkinButton_ReposButtons(HWND parent, BYTE draw, RECT * r); int ModernSkinButtonUnloadModule(WPARAM,LPARAM);
/* RowHeight */
-int RowHeight_CalcRowHeight(struct ClcData *dat, HWND hwnd, struct ClcContact *contact, int item);
+int RowHeight_CalcRowHeight(struct ClcData *dat, HWND hwnd, ClcContact *contact, int item);
/* SkinEngine */
BOOL ske_AlphaBlend(HDC hdcDest,int nXOriginDest,int nYOriginDest,int nWidthDest,int nHeightDest,HDC hdcSrc,int nXOriginSrc,int nYOriginSrc,int nWidthSrc,int nHeightSrc,BLENDFUNCTION blendFunction);
@@ -225,7 +225,7 @@ int GetAverageMode( void ); //clisttray.c int GetContactCachedStatus(HANDLE hContact); //clistsettings.c
INT_PTR GetContactIcon(WPARAM wParam,LPARAM lParam); //clistmod.c
int GetContactIconC(pdisplayNameCacheEntry cacheEntry); //clistmod.c
-int GetContactIndex(struct ClcGroup *group,struct ClcContact *contact); //clcidents.c
+int GetContactIndex(ClcGroup *group,ClcContact *contact); //clcidents.c
int GetStatusForContact(HANDLE hContact,char *szProto); //clistsettings.c
int InitCustomMenus(void); //clistmenus.c
int InitFramesMenus(void); //framesmenus.c
@@ -288,18 +288,18 @@ void cliFreeCacheItem( pdisplayNameCacheEntry p ); void cliRebuildEntireList(HWND hwnd,struct ClcData *dat);
void cliRecalcScrollBar(HWND hwnd,struct ClcData *dat);
void CLUI_cliOnCreateClc(void);
-int cli_AddItemToGroup(struct ClcGroup *group, int iAboveItem);
-int cli_AddInfoItemToGroup(struct ClcGroup *group,int flags,const TCHAR *pszText);
-int cliGetGroupContentsCount(struct ClcGroup *group, int visibleOnly);
+int cli_AddItemToGroup(ClcGroup *group, int iAboveItem);
+int cli_AddInfoItemToGroup(ClcGroup *group,int flags,const TCHAR *pszText);
+int cliGetGroupContentsCount(ClcGroup *group, int visibleOnly);
int cliFindRowByText(HWND hwnd, struct ClcData *dat, const TCHAR *text, int prefixOk);
-int cliGetRowsPriorTo(struct ClcGroup *group,struct ClcGroup *subgroup,int contactIndex);
+int cliGetRowsPriorTo(ClcGroup *group,ClcGroup *subgroup,int contactIndex);
int cli_IconFromStatusMode(const char *szProto,int nStatus, HANDLE hContact);
int cli_RemoveEvent(HANDLE hContact, HANDLE hDbEvent);
void cli_AddContactToTree(HWND hwnd,struct ClcData *dat,HANDLE hContact,int updateTotalCount,int checkHideOffline);
void cli_DeleteItemFromTree(HWND hwnd, HANDLE hItem);
-void cli_FreeContact( struct ClcContact* );
-void cli_FreeGroup( struct ClcGroup* );
-char* cli_GetGroupCountsText(struct ClcData *dat, struct ClcContact *contact);
+void cli_FreeContact( ClcContact* );
+void cli_FreeGroup( ClcGroup* );
+char* cli_GetGroupCountsText(struct ClcData *dat, ClcContact *contact);
void cli_ChangeContactIcon(HANDLE hContact,int iIcon,int add);
LRESULT cli_ProcessExternalMessages(HWND hwnd,struct ClcData *dat,UINT msg,WPARAM wParam,LPARAM lParam);
struct CListEvent* cliCreateEvent( void );
@@ -307,11 +307,11 @@ struct CListEvent* cli_AddEvent(CLISTEVENT *cle); LRESULT CALLBACK cli_ContactListControlWndProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam);
int cliShowHide(WPARAM wParam,LPARAM lParam);
BOOL CLUI__cliInvalidateRect(HWND hWnd, CONST RECT* lpRect,BOOL bErase );
-int cliCompareContacts(const struct ClcContact *contact1,const struct ClcContact *contact2);
-int cliFindItem(HWND hwnd,struct ClcData *dat,HANDLE hItem,struct ClcContact **contact,struct ClcGroup **subgroup,int *isVisible);
+int cliCompareContacts(const ClcContact *contact1,const ClcContact *contact2);
+int cliFindItem(HWND hwnd,struct ClcData *dat,HANDLE hItem,ClcContact **contact,ClcGroup **subgroup,int *isVisible);
void cliTrayIconUpdateBase(const char *szChangedProto);
void cliCluiProtocolStatusChanged(int status,const char * proto);
-HMENU cliBuildGroupPopupMenu(struct ClcGroup *group);
+HMENU cliBuildGroupPopupMenu(ClcGroup *group);
void cliInvalidateDisplayNameCacheEntry(HANDLE hContact);
void cliCheckCacheItem(pdisplayNameCacheEntry pdnce);
void cli_SaveStateAndRebuildList(HWND hwnd, struct ClcData *dat);
@@ -319,7 +319,7 @@ void CLUI_cli_LoadCluiGlobalOpts(void); INT_PTR cli_TrayIconProcessMessage(WPARAM wParam,LPARAM lParam);
BOOL CLUI__cliInvalidateRect(HWND hWnd, CONST RECT* lpRect,BOOL bErase );
-struct ClcContact* cliCreateClcContact( void );
+ClcContact* cliCreateClcContact( void );
ClcCacheEntryBase* cliCreateCacheItem(HANDLE hContact);
ClcCacheEntryBase* cliGetCacheEntry(HANDLE hContact);
diff --git a/plugins/Clist_modern/src/hdr/modern_gettextasync.h b/plugins/Clist_modern/src/hdr/modern_gettextasync.h index 881e2b738d..3a4d9639bc 100644 --- a/plugins/Clist_modern/src/hdr/modern_gettextasync.h +++ b/plugins/Clist_modern/src/hdr/modern_gettextasync.h @@ -2,4 +2,4 @@ void InitCacheAsync();
void UninitCacheAsync();
void gtaRenewText(HANDLE hContact);
-int gtaAddRequest(struct ClcData *dat,struct ClcContact *contact,HANDLE hContact);
\ No newline at end of file +int gtaAddRequest(struct ClcData *dat,ClcContact *contact,HANDLE hContact);
diff --git a/plugins/Clist_modern/src/hdr/modern_rowheight_funcs.h b/plugins/Clist_modern/src/hdr/modern_rowheight_funcs.h index 57223cf3c0..ea74b5498f 100644 --- a/plugins/Clist_modern/src/hdr/modern_rowheight_funcs.h +++ b/plugins/Clist_modern/src/hdr/modern_rowheight_funcs.h @@ -47,7 +47,7 @@ BOOL RowHeights_Alloc(struct ClcData *dat, int size); int RowHeights_GetMaxRowHeight(struct ClcData *dat, HWND hwnd);
// Calc and store row height
-int RowHeights_GetRowHeight(struct ClcData *dat, HWND hwnd, struct ClcContact *contact, int item);
+int RowHeights_GetRowHeight(struct ClcData *dat, HWND hwnd, ClcContact *contact, int item);
// Calc and store row height for all itens in the list
void RowHeights_CalcRowHeights(struct ClcData *dat, HWND hwnd);
diff --git a/plugins/Clist_modern/src/modern_cachefuncs.cpp b/plugins/Clist_modern/src/modern_cachefuncs.cpp index ce11e9214a..575aba3a1c 100644 --- a/plugins/Clist_modern/src/modern_cachefuncs.cpp +++ b/plugins/Clist_modern/src/modern_cachefuncs.cpp @@ -37,7 +37,7 @@ Modified by FYR #include "./hdr/modern_gettextasync.h"
#include "hdr/modern_sync.h"
-typedef BOOL (* ExecuteOnAllContactsFuncPtr) (struct ClcContact *contact, BOOL subcontact, void *param);
+typedef BOOL (* ExecuteOnAllContactsFuncPtr) (ClcContact *contact, BOOL subcontact, void *param);
/***********************************/
@@ -49,7 +49,7 @@ typedef BOOL (* ExecuteOnAllContactsFuncPtr) (struct ClcContact *contact, BOOL s static int CopySkipUnprintableChars(TCHAR *to, TCHAR * buf, DWORD size);
static BOOL ExecuteOnAllContacts(struct ClcData *dat, ExecuteOnAllContactsFuncPtr func, void *param);
-static BOOL ExecuteOnAllContactsOfGroup(struct ClcGroup *group, ExecuteOnAllContactsFuncPtr func, void *param);
+static BOOL ExecuteOnAllContactsOfGroup(ClcGroup *group, ExecuteOnAllContactsFuncPtr func, void *param);
int CLUI_SyncGetShortData(WPARAM wParam, LPARAM lParam);
void CListSettings_FreeCacheItemData(pdisplayNameCacheEntry pDst);
void CListSettings_FreeCacheItemDataOption( pdisplayNameCacheEntry pDst, DWORD flag );
@@ -72,7 +72,7 @@ void Cache_GetTimezone(struct ClcData *dat, HANDLE hContact) * Get all lines of text
*/
-void Cache_GetText(struct ClcData *dat, struct ClcContact *contact, BOOL forceRenew)
+void Cache_GetText(struct ClcData *dat, ClcContact *contact, BOOL forceRenew)
{
Cache_GetFirstLineText(dat, contact);
if ( !dat->force_in_dialog) {
@@ -518,7 +518,7 @@ int Cache_GetLineText(PDNCE pdnce, int type, LPTSTR text, int text_size, TCHAR * /*
* Get the text for First Line
*/
-void Cache_GetFirstLineText(struct ClcData *dat, struct ClcContact *contact)
+void Cache_GetFirstLineText(struct ClcData *dat, ClcContact *contact)
{
if (GetCurrentThreadId() != g_dwMainThreadID)
return;
@@ -678,7 +678,7 @@ static BOOL ExecuteOnAllContacts(struct ClcData *dat, ExecuteOnAllContactsFuncPt return res;
}
-static BOOL ExecuteOnAllContactsOfGroup(struct ClcGroup *group, ExecuteOnAllContactsFuncPtr func, void *param)
+static BOOL ExecuteOnAllContactsOfGroup(ClcGroup *group, ExecuteOnAllContactsFuncPtr func, void *param)
{
if ( !group)
return TRUE;
@@ -706,7 +706,7 @@ static BOOL ExecuteOnAllContactsOfGroup(struct ClcGroup *group, ExecuteOnAllCont /*
* Avatar working routines
*/
-BOOL UpdateAllAvatarsProxy(struct ClcContact *contact, BOOL subcontact, void *param)
+BOOL UpdateAllAvatarsProxy(ClcContact *contact, BOOL subcontact, void *param)
{
Cache_GetAvatar((struct ClcData *)param, contact);
return TRUE;
@@ -717,7 +717,7 @@ void UpdateAllAvatars(struct ClcData *dat) ExecuteOnAllContacts(dat,UpdateAllAvatarsProxy,dat);
}
-BOOL ReduceAvatarPosition(struct ClcContact *contact, BOOL subcontact, void *param)
+BOOL ReduceAvatarPosition(ClcContact *contact, BOOL subcontact, void *param)
{
if (contact->avatar_pos >= *((int *)param))
contact->avatar_pos--;
@@ -725,7 +725,7 @@ BOOL ReduceAvatarPosition(struct ClcContact *contact, BOOL subcontact, void *par return TRUE;
}
-void Cache_ProceedAvatarInList(struct ClcData *dat, struct ClcContact *contact)
+void Cache_ProceedAvatarInList(struct ClcData *dat, ClcContact *contact)
{
struct avatarCacheEntry * ace = contact->avatar_data;
int old_pos = contact->avatar_pos;
@@ -831,7 +831,7 @@ void Cache_ProceedAvatarInList(struct ClcData *dat, struct ClcContact *contact) }
}
-void Cache_GetAvatar(struct ClcData *dat, struct ClcContact *contact)
+void Cache_GetAvatar(struct ClcData *dat, ClcContact *contact)
{
int old_pos = contact->avatar_pos;
// workaround for avatar service and other wich destroys service on OK_TOEXIT
diff --git a/plugins/Clist_modern/src/modern_clc.cpp b/plugins/Clist_modern/src/modern_clc.cpp index 40bb4a73cc..1725e0be57 100644 --- a/plugins/Clist_modern/src/modern_clc.cpp +++ b/plugins/Clist_modern/src/modern_clc.cpp @@ -54,7 +54,7 @@ HANDLE hIconChangedHook = NULL; HANDLE hAckHook = NULL;
HANDLE hAvatarChanged = NULL;
static BOOL g_bSortTimerIsSet = FALSE;
-static struct ClcContact * hitcontact = NULL;
+static ClcContact * hitcontact = NULL;
static int clcHookSmileyAddOptionsChanged(WPARAM wParam,LPARAM lParam);
@@ -315,7 +315,7 @@ static int clcProceedDragToScroll(HWND hwnd, int Y) static int clcSearchNextContact(HWND hwnd, struct ClcData *dat, int index, const TCHAR *text, int prefixOk, BOOL fSearchUp)
{
- struct ClcGroup *group = &dat->list;
+ ClcGroup *group = &dat->list;
int testlen = lstrlen(text);
BOOL fReturnAsFound = FALSE;
int nLastFound = -1;
@@ -344,7 +344,7 @@ static int clcSearchNextContact(HWND hwnd, struct ClcData *dat, int index, const found = ((prefixOk && CSTR_EQUAL == CompareString(LOCALE_INVARIANT, NORM_IGNORECASE, text, -1, group->cl.items[group->scanIndex]->szText, testlen)) || (!prefixOk && !lstrcmpi(text, group->cl.items[group->scanIndex]->szText)));
}
if (found) {
- struct ClcGroup *contactGroup = group;
+ ClcGroup *contactGroup = group;
int contactScanIndex = group->scanIndex;
int foundindex;
for (; group; group = group->parent)
@@ -376,7 +376,7 @@ static int clcSearchNextContact(HWND hwnd, struct ClcData *dat, int index, const return -1;
}
-static BOOL clcItemNotHiddenOffline(struct ClcData * dat, struct ClcGroup* group, struct ClcContact * contact)
+static BOOL clcItemNotHiddenOffline(struct ClcData * dat, ClcGroup* group, ClcContact * contact)
{
PDNCE pdnce;
@@ -451,7 +451,7 @@ static LRESULT clcOnHitTest(struct ClcData *dat, HWND hwnd, UINT msg, WPARAM wPa }
static LRESULT clcOnCommand(struct ClcData *dat, HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam)
{
- struct ClcContact *contact;
+ ClcContact *contact;
int hit = pcli->pfnGetRowByIndex(dat, dat->selection, &contact, NULL);
if (hit == -1) return 0;
if ( contact->type == CLCIT_CONTACT && CallService(MS_CLIST_MENUPROCESSCOMMAND, MAKEWPARAM(LOWORD(wParam), MPCF_CONTACTMENU), (LPARAM) contact->hContact)) return 0;
@@ -672,8 +672,8 @@ static LRESULT clcOnKeyDown(struct ClcData *dat, HWND hwnd, UINT msg, WPARAM wPa if (changeGroupExpand)
{
int hit;
- struct ClcContact *contact;
- struct ClcGroup *group;
+ ClcContact *contact;
+ ClcGroup *group;
//dat->szQuickSearch[0] = 0;
hit = cliGetRowByIndex(dat,dat->selection,&contact,&group);
if (hit != -1)
@@ -695,7 +695,7 @@ static LRESULT clcOnKeyDown(struct ClcData *dat, HWND hwnd, UINT msg, WPARAM wPa else if (changeGroupExpand == 1 && contact->SubExpanded)
{
//Contract
- struct ClcContact * ht = NULL;
+ ClcContact * ht = NULL;
KillTimer(hwnd,TIMERID_SUBEXPAND);
contact->SubExpanded = 0;
db_set_b(contact->hContact,"CList","Expanded",0);
@@ -712,7 +712,7 @@ static LRESULT clcOnKeyDown(struct ClcData *dat, HWND hwnd, UINT msg, WPARAM wPa }
else if (changeGroupExpand == 2 && !contact->SubExpanded && dat->expandMeta)
{
- struct ClcContact * ht = NULL;
+ ClcContact * ht = NULL;
KillTimer(hwnd,TIMERID_SUBEXPAND);
contact->SubExpanded = 1;
db_set_b(contact->hContact,"CList","Expanded",1);
@@ -723,8 +723,8 @@ static LRESULT clcOnKeyDown(struct ClcData *dat, HWND hwnd, UINT msg, WPARAM wPa if (ht)
{
int i=0;
- struct ClcContact *contact2;
- struct ClcGroup *group2;
+ ClcContact *contact2;
+ ClcGroup *group2;
if (FindItem(hwnd,dat,contact->hContact,&contact2,&group2,NULL,FALSE))
{
i = cliGetRowsPriorTo(&dat->list,group2,GetContactIndex(group2,contact2));
@@ -830,7 +830,7 @@ static LRESULT clcOnTimer(struct ClcData *dat, HWND hwnd, UINT msg, WPARAM wPara }
case TIMERID_SUBEXPAND:
{
- struct ClcContact * ht = NULL;
+ ClcContact * ht = NULL;
KillTimer(hwnd,TIMERID_SUBEXPAND);
if (hitcontact && dat->expandMeta)
{
@@ -845,8 +845,8 @@ static LRESULT clcOnTimer(struct ClcData *dat, HWND hwnd, UINT msg, WPARAM wPara cliRecalcScrollBar(hwnd,dat);
if (ht) {
int i=0;
- struct ClcContact *contact;
- struct ClcGroup *group;
+ ClcContact *contact;
+ ClcGroup *group;
if (FindItem(hwnd,dat,hitcontact->hContact,&contact,&group,NULL,FALSE))
{
i = cliGetRowsPriorTo(&dat->list,group,GetContactIndex(group,contact));
@@ -928,8 +928,8 @@ static LRESULT clcOnLButtonDown(struct ClcData *dat, HWND hwnd, UINT msg, WPARAM }
}
{
- struct ClcContact *contact;
- struct ClcGroup *group;
+ ClcContact *contact;
+ ClcGroup *group;
int hit;
DWORD hitFlags;
fMouseUpped = FALSE;
@@ -987,8 +987,8 @@ static LRESULT clcOnLButtonDown(struct ClcData *dat, HWND hwnd, UINT msg, WPARAM if (hit != -1 && !(hitFlags&CLCHT_NOWHERE) && contact->type == CLCIT_GROUP)
if (hitFlags&CLCHT_ONITEMICON)
{
- struct ClcGroup *selgroup;
- struct ClcContact *selcontact;
+ ClcGroup *selgroup;
+ ClcContact *selcontact;
dat->selection = cliGetRowByIndex(dat,dat->selection,&selcontact,&selgroup);
pcli->pfnSetGroupExpand(hwnd,dat,contact->group,-1);
if (dat->selection != -1)
@@ -1185,7 +1185,7 @@ static LRESULT clcOnMouseMove(struct ClcData *dat, HWND hwnd, UINT msg, WPARAM w int target = GetDropTargetInformation(hwnd,dat,pt);
if (dat->dragStage&DRAGSTAGEF_OUTSIDE && target != DROPTARGET_OUTSIDE) {
NMCLISTCONTROL nm;
- struct ClcContact *contact;
+ ClcContact *contact;
cliGetRowByIndex(dat,dat->iDragItem,&contact,NULL);
nm.hdr.code = CLN_DRAGSTOP;
nm.hdr.hwndFrom = hwnd;
@@ -1203,7 +1203,7 @@ static LRESULT clcOnMouseMove(struct ClcData *dat, HWND hwnd, UINT msg, WPARAM w case DROPTARGET_ONCONTACT:
if (ServiceExists(MS_MC_ADDTOMETA))
{
- struct ClcContact *contSour;
+ ClcContact *contSour;
cliGetRowByIndex(dat,dat->iDragItem,&contSour,NULL);
if (contSour->type == CLCIT_CONTACT && g_szMetaModuleName && mir_strcmp(contSour->proto,g_szMetaModuleName))
{
@@ -1219,7 +1219,7 @@ static LRESULT clcOnMouseMove(struct ClcData *dat, HWND hwnd, UINT msg, WPARAM w case DROPTARGET_ONMETACONTACT:
if (ServiceExists(MS_MC_ADDTOMETA))
{
- struct ClcContact *contSour,*contDest;
+ ClcContact *contSour,*contDest;
cliGetRowByIndex(dat,dat->selection,&contDest,NULL);
cliGetRowByIndex(dat,dat->iDragItem,&contSour,NULL);
if (contSour->type == CLCIT_CONTACT && g_szMetaModuleName && mir_strcmp(contSour->proto,g_szMetaModuleName))
@@ -1237,7 +1237,7 @@ static LRESULT clcOnMouseMove(struct ClcData *dat, HWND hwnd, UINT msg, WPARAM w case DROPTARGET_ONSUBCONTACT:
if (ServiceExists(MS_MC_ADDTOMETA))
{
- struct ClcContact *contSour,*contDest;
+ ClcContact *contSour,*contDest;
cliGetRowByIndex(dat,dat->selection,&contDest,NULL);
cliGetRowByIndex(dat,dat->iDragItem,&contSour,NULL);
if (contSour->type == CLCIT_CONTACT && g_szMetaModuleName && mir_strcmp(contSour->proto,g_szMetaModuleName))
@@ -1264,7 +1264,7 @@ static LRESULT clcOnMouseMove(struct ClcData *dat, HWND hwnd, UINT msg, WPARAM w case DROPTARGET_OUTSIDE:
{
NMCLISTCONTROL nm;
- struct ClcContact *contact;
+ ClcContact *contact;
if (pt.x >= 0 && pt.x < clRect.right && ((pt.y < 0 && pt.y>-dat->dragAutoScrollHeight) || (pt.y >= clRect.bottom && pt.y < clRect.bottom+dat->dragAutoScrollHeight)))
{
@@ -1291,11 +1291,11 @@ static LRESULT clcOnMouseMove(struct ClcData *dat, HWND hwnd, UINT msg, WPARAM w }
default:
{
- struct ClcGroup *group = NULL;
+ ClcGroup *group = NULL;
cliGetRowByIndex(dat,dat->iDragItem,NULL,&group);
if (group && group->parent)
{
- struct ClcContact *contSour;
+ ClcContact *contSour;
cliGetRowByIndex(dat,dat->iDragItem,&contSour,NULL);
if ( !contSour->isSubcontact)
hNewCursor = LoadCursor(GetModuleHandle(NULL), MAKEINTRESOURCE(IDC_DROPUSER));
@@ -1350,7 +1350,7 @@ static LRESULT clcOnLButtonUp(struct ClcData *dat, HWND hwnd, UINT msg, WPARAM w case DROPTARGET_ONCONTACT:
if (ServiceExists(MS_MC_ADDTOMETA))
{
- struct ClcContact *contDest, *contSour;
+ ClcContact *contDest, *contSour;
int res;
HANDLE handle,hcontact;
@@ -1399,7 +1399,7 @@ static LRESULT clcOnLButtonUp(struct ClcData *dat, HWND hwnd, UINT msg, WPARAM w break;
case DROPTARGET_ONMETACONTACT:
{
- struct ClcContact *contDest, *contSour;
+ ClcContact *contDest, *contSour;
int res;
cliGetRowByIndex(dat,dat->iDragItem,&contSour,NULL);
cliGetRowByIndex(dat,dat->selection,&contDest,NULL);
@@ -1460,7 +1460,7 @@ static LRESULT clcOnLButtonUp(struct ClcData *dat, HWND hwnd, UINT msg, WPARAM w break;
case DROPTARGET_ONSUBCONTACT:
{
- struct ClcContact *contDest, *contSour;
+ ClcContact *contDest, *contSour;
int res;
cliGetRowByIndex(dat,dat->iDragItem,&contSour,NULL);
cliGetRowByIndex(dat,dat->selection,&contDest,NULL);
@@ -1511,8 +1511,8 @@ static LRESULT clcOnLButtonUp(struct ClcData *dat, HWND hwnd, UINT msg, WPARAM w break;
case DROPTARGET_INSERTION:
{
- struct ClcContact *contact, *destcontact;
- struct ClcGroup *group, *destgroup;
+ ClcContact *contact, *destcontact;
+ ClcGroup *group, *destgroup;
BOOL NeedRename = FALSE;
TCHAR newName[128] = {0};
int newIndex,i;
@@ -1599,7 +1599,7 @@ static LRESULT clcOnDestroy(struct ClcData *dat, HWND hwnd, UINT msg, WPARAM wPa }
static LRESULT clcOnIntmGroupChanged(struct ClcData *dat, HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam)
{
- struct ClcContact *contact;
+ ClcContact *contact;
BYTE iExtraImage[MAXEXTRACOLUMNS];
WORD iWideExtraImage[MAXEXTRACOLUMNS];
BYTE flags = 0;
@@ -1637,15 +1637,15 @@ static LRESULT clcOnIntmGroupChanged(struct ClcData *dat, HWND hwnd, UINT msg, W static LRESULT clcOnIntmIconChanged(struct ClcData *dat, HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam)
{
- struct ClcContact *contact = NULL;
- struct ClcGroup *group = NULL;
+ ClcContact *contact = NULL;
+ ClcGroup *group = NULL;
int recalcScrollBar = 0, shouldShow;
BOOL needRepaint = FALSE;
WORD status;
RECT iconRect = {0};
int contacticon = CallService(MS_CLIST_GETCONTACTICON, wParam, 1);
HANDLE hSelItem = NULL;
- struct ClcContact *selcontact = NULL;
+ ClcContact *selcontact = NULL;
char *szProto = (char *) CallService(MS_PROTO_GETCONTACTBASEPROTO, wParam, 0);
if (szProto == NULL)
@@ -1714,7 +1714,7 @@ static LRESULT clcOnIntmIconChanged(struct ClcData *dat, HWND hwnd, UINT msg, WP }
if (hSelItem) {
- struct ClcGroup *selgroup;
+ ClcGroup *selgroup;
if (pcli->pfnFindItem(hwnd, dat, hSelItem, &selcontact, &selgroup, NULL))
dat->selection = pcli->pfnGetRowsPriorTo(&dat->list, selgroup, List_IndexOf(( SortedList* )&selgroup->cl, selcontact));
else
@@ -1738,7 +1738,7 @@ static LRESULT clcOnIntmIconChanged(struct ClcData *dat, HWND hwnd, UINT msg, WP static LRESULT clcOnIntmAvatarChanged(struct ClcData *dat, HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam)
{
- struct ClcContact *contact;
+ ClcContact *contact;
if (FindItem(hwnd,dat,(HANDLE)wParam,&contact,NULL,NULL,FALSE))
Cache_GetAvatar(dat, contact);
else if (dat->use_avatar_service && !wParam)
@@ -1750,7 +1750,7 @@ static LRESULT clcOnIntmAvatarChanged(struct ClcData *dat, HWND hwnd, UINT msg, static LRESULT clcOnIntmTimeZoneChanged(struct ClcData *dat, HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam)
{
- struct ClcContact *contact;
+ ClcContact *contact;
if ( !FindItem(hwnd,dat,(HANDLE)wParam,&contact,NULL,NULL,FALSE))
return corecli.pfnContactListControlWndProc(hwnd,msg,wParam,lParam);
@@ -1764,7 +1764,7 @@ static LRESULT clcOnIntmTimeZoneChanged(struct ClcData *dat, HWND hwnd, UINT msg static LRESULT clcOnIntmNameChanged(struct ClcData *dat, HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam)
{
- struct ClcContact *contact;
+ ClcContact *contact;
int ret = corecli.pfnContactListControlWndProc(hwnd, msg, wParam, lParam);
pcli->pfnInvalidateDisplayNameCacheEntry((HANDLE)wParam);
@@ -1792,13 +1792,13 @@ static LRESULT clcOnIntmApparentModeChanged(struct ClcData *dat, HWND hwnd, UINT static LRESULT clcOnIntmStatusMsgChanged(struct ClcData *dat, HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam)
{
- struct ClcContact *contact;
+ ClcContact *contact;
HANDLE hContact = (HANDLE)wParam;
if (hContact == NULL || IsHContactInfo(hContact) || IsHContactGroup(hContact))
return corecli.pfnContactListControlWndProc(hwnd, msg, wParam, lParam);
if ( !FindItem(hwnd,dat,hContact,&contact,NULL,NULL,FALSE))
return corecli.pfnContactListControlWndProc(hwnd, msg, wParam, lParam);
- if (contact)//!IsBadWritePtr(contact, sizeof(struct ClcContact)))
+ if (contact)//!IsBadWritePtr(contact, sizeof(ClcContact)))
{
Cache_GetText(dat,contact,1);
cliRecalcScrollBar(hwnd,dat);
@@ -1810,7 +1810,7 @@ static LRESULT clcOnIntmStatusMsgChanged(struct ClcData *dat, HWND hwnd, UINT ms static LRESULT clcOnIntmNotOnListChanged(struct ClcData *dat, HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam)
{
DBCONTACTWRITESETTING *dbcws = (DBCONTACTWRITESETTING*)lParam;
- struct ClcContact *contact;
+ ClcContact *contact;
if ( !FindItem(hwnd,dat,(HANDLE)wParam,&contact,NULL,NULL,TRUE))
return corecli.pfnContactListControlWndProc(hwnd, msg, wParam, lParam);
@@ -1843,7 +1843,7 @@ static LRESULT clcOnIntmStatusChanged(struct ClcData *dat, HWND hwnd, UINT msg, if (wParam != 0) {
pdisplayNameCacheEntry pdnce = (pdisplayNameCacheEntry)pcli->pfnGetCacheEntry((HANDLE)wParam);
if (pdnce && pdnce->m_cache_cszProto) {
- struct ClcContact *contact = NULL;
+ ClcContact *contact = NULL;
pdnce___SetStatus( pdnce, GetStatusForContact(pdnce->hContact,pdnce->m_cache_cszProto));
if ( !dat->force_in_dialog && (dat->second_line_show || dat->third_line_show))
gtaRenewText(pdnce->hContact);
diff --git a/plugins/Clist_modern/src/modern_clcidents.cpp b/plugins/Clist_modern/src/modern_clcidents.cpp index 903844eb9c..c1739d6a3c 100644 --- a/plugins/Clist_modern/src/modern_clcidents.cpp +++ b/plugins/Clist_modern/src/modern_clcidents.cpp @@ -26,13 +26,13 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. #include "hdr/modern_commonprototypes.h"
#define CacheArrSize 255
-struct ClcGroup *CacheIndex[CacheArrSize] = {NULL};
+ClcGroup *CacheIndex[CacheArrSize] = {NULL};
bool CacheIndexClear = TRUE;
/* the CLC uses 3 different ways to identify elements in its list, this file
contains routines to convert between them.
-1) struct ClcContact/struct ClcGroup pair. Only ever used within the duration
+1) ClcContact/ClcGroup pair. Only ever used within the duration
of a single operation, but used at some point in nearly everything
2) index integer. The 0-based number of the item from the top. Only visible
items are counted (ie not closed groups). Used for saving selection and drag
@@ -46,14 +46,14 @@ exclusively externally 2->1: GetRowByIndex()
*/
-int GetContactIndex(struct ClcGroup *group,struct ClcContact *contact)
+int GetContactIndex(ClcGroup *group,ClcContact *contact)
{
for (int i=0; i < group->cl.count; i++)
if (group->cl.items[i]->hContact == contact->hContact) return i;
return -1;
}
-int cliGetRowsPriorTo(struct ClcGroup *group,struct ClcGroup *subgroup,int contactIndex)
+int cliGetRowsPriorTo(ClcGroup *group,ClcGroup *subgroup,int contactIndex)
{
int count = 0;
BYTE k;
@@ -103,16 +103,16 @@ int cliGetRowsPriorTo(struct ClcGroup *group,struct ClcGroup *subgroup,int conta return -1;
}
-int cliFindItem(HWND hwnd,struct ClcData *dat,HANDLE hItem,struct ClcContact **contact,struct ClcGroup **subgroup,int *isVisible)
+int cliFindItem(HWND hwnd,struct ClcData *dat,HANDLE hItem,ClcContact **contact,ClcGroup **subgroup,int *isVisible)
{
return FindItem(hwnd,dat, hItem,contact,subgroup,isVisible,FALSE);
}
-int FindItem(HWND hwnd,struct ClcData *dat,HANDLE hItem,struct ClcContact **contact,struct ClcGroup **subgroup,int *isVisible, BOOL isIgnoreSubcontacts)
+int FindItem(HWND hwnd,struct ClcData *dat,HANDLE hItem,ClcContact **contact,ClcGroup **subgroup,int *isVisible, BOOL isIgnoreSubcontacts)
{
int index = 0, i;
int nowVisible = 1;
- struct ClcGroup *group;
+ ClcGroup *group;
group = &dat->list;
@@ -121,7 +121,7 @@ int FindItem(HWND hwnd,struct ClcData *dat,HANDLE hItem,struct ClcContact **cont for (;;) {
if (group->scanIndex == group->cl.count) {
- struct ClcGroup *tgroup;
+ ClcGroup *tgroup;
group = group->parent;
if (group == NULL) break;
nowVisible = 1;
@@ -170,7 +170,7 @@ int FindItem(HWND hwnd,struct ClcData *dat,HANDLE hItem,struct ClcContact **cont if (group->cl.items[group->scanIndex]->subcontacts[i].hContact == hItem)
{
#ifdef _DEBUG
- if (IsBadWritePtr(&group->cl.items[group->scanIndex]->subcontacts[i], sizeof(struct ClcContact)))
+ if (IsBadWritePtr(&group->cl.items[group->scanIndex]->subcontacts[i], sizeof(ClcContact)))
{
log1("FindIltem->IsBadWritePtr | 2o [%08x]", &group->cl.items[group->scanIndex]->subcontacts[i]);
PostMessage(hwnd,CLM_AUTOREBUILD,0,0);
@@ -206,10 +206,10 @@ void ClearRowByIndexCache() CacheIndexClear = TRUE;
};
}
-int cliGetRowByIndex(struct ClcData *dat,int testindex,struct ClcContact **contact,struct ClcGroup **subgroup)
+int cliGetRowByIndex(struct ClcData *dat,int testindex,ClcContact **contact,ClcGroup **subgroup)
{
int index = 0,i;
- struct ClcGroup *group = &dat->list;
+ ClcGroup *group = &dat->list;
if (testindex < 0) return (-1);
{
@@ -270,7 +270,7 @@ int cliGetRowByIndex(struct ClcData *dat,int testindex,struct ClcContact **conta return -1;
}
-HANDLE ContactToHItem(struct ClcContact *contact)
+HANDLE ContactToHItem(ClcContact *contact)
{
switch(contact->type) {
case CLCIT_CONTACT:
@@ -283,7 +283,7 @@ case CLCIT_INFO: return NULL;
}
-HANDLE ContactToItemHandle(struct ClcContact *contact,DWORD *nmFlags)
+HANDLE ContactToItemHandle(ClcContact *contact,DWORD *nmFlags)
{
switch(contact->type) {
case CLCIT_CONTACT:
diff --git a/plugins/Clist_modern/src/modern_clcitems.cpp b/plugins/Clist_modern/src/modern_clcitems.cpp index 7c1ec84dda..b912bf3762 100644 --- a/plugins/Clist_modern/src/modern_clcitems.cpp +++ b/plugins/Clist_modern/src/modern_clcitems.cpp @@ -27,7 +27,7 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. #include "m_metacontacts.h"
#include "hdr/modern_commonprototypes.h"
-void AddSubcontacts(struct ClcData *dat, struct ClcContact * cont, BOOL showOfflineHereGroup)
+void AddSubcontacts(ClcData *dat, ClcContact *cont, BOOL showOfflineHereGroup)
{
int subcount,i,j;
HANDLE hsub;
@@ -45,66 +45,56 @@ void AddSubcontacts(struct ClcData *dat, struct ClcContact * cont, BOOL showOffl cont->isSubcontact = 0;
mir_free(cont->subcontacts);
- cont->subcontacts = (struct ClcContact *) mir_calloc(sizeof(struct ClcContact)*subcount);
+ cont->subcontacts = (ClcContact *) mir_calloc(sizeof(ClcContact)*subcount);
cont->SubAllocated = subcount;
i=0;
for (j = 0; j < subcount; j++) {
- WORD wStatus;
-
hsub = (HANDLE)CallService(MS_MC_GETSUBCONTACT,(WPARAM)cont->hContact,j);
cacheEntry = (pdisplayNameCacheEntry)pcli->pfnGetCacheEntry(hsub);
- wStatus = pdnce___GetStatus( cacheEntry );
- if (showOfflineHereGroup || (!(db_get_b(NULL,"CLC","MetaHideOfflineSub",SETTING_METAHIDEOFFLINESUB_DEFAULT) && db_get_b(NULL,"CList","HideOffline",SETTING_HIDEOFFLINE_DEFAULT)) ||
- wStatus != ID_STATUS_OFFLINE )
- // &&
- //(!cacheEntry->Hidden || style&CLS_SHOWHIDDEN)
- )
-
- {
- cont->subcontacts[i].hContact = cacheEntry->hContact;
-
- cont->subcontacts[i].avatar_pos = AVATAR_POS_DONT_HAVE;
- Cache_GetAvatar(dat, &cont->subcontacts[i]);
-
- cont->subcontacts[i].iImage = CallService(MS_CLIST_GETCONTACTICON,(WPARAM)cacheEntry->hContact,1);
- memset(cont->subcontacts[i].iExtraImage,0xFF,sizeof(cont->subcontacts[i].iExtraImage));
- memset((void*)cont->subcontacts[i].iWideExtraImage,0xFF,sizeof(cont->subcontacts[i].iWideExtraImage));
- cont->subcontacts[i].proto = cacheEntry->m_cache_cszProto;
- cont->subcontacts[i].type = CLCIT_CONTACT;
- cont->subcontacts[i].flags = 0;//CONTACTF_ONLINE;
- cont->subcontacts[i].isSubcontact = i+1;
- cont->subcontacts[i].lastPaintCounter = 0;
- cont->subcontacts[i].subcontacts = cont;
- cont->subcontacts[i].image_is_special = FALSE;
- //cont->subcontacts[i].status = cacheEntry->status;
- Cache_GetTimezone(dat, (&cont->subcontacts[i])->hContact);
- Cache_GetText(dat, &cont->subcontacts[i],1);
-
- {
- int apparentMode;
- char *szProto;
- int idleMode;
- szProto = cacheEntry->m_cache_cszProto;
- if (szProto != NULL && !pcli->pfnIsHiddenMode(dat,wStatus))
- cont->subcontacts[i].flags |= CONTACTF_ONLINE;
- apparentMode = szProto != NULL?cacheEntry->ApparentMode:0;
- apparentMode = szProto != NULL?cacheEntry->ApparentMode:0;
- if (apparentMode == ID_STATUS_OFFLINE) cont->subcontacts[i].flags |= CONTACTF_INVISTO;
- else if (apparentMode == ID_STATUS_ONLINE) cont->subcontacts[i].flags |= CONTACTF_VISTO;
- else if (apparentMode) cont->subcontacts[i].flags |= CONTACTF_VISTO|CONTACTF_INVISTO;
- if (cacheEntry->NotOnList) cont->subcontacts[i].flags |= CONTACTF_NOTONLIST;
- idleMode = szProto != NULL?cacheEntry->IdleTS:0;
- if (idleMode) cont->subcontacts[i].flags |= CONTACTF_IDLE;
- }
+ WORD wStatus = pdnce___GetStatus(cacheEntry);
+ if (showOfflineHereGroup || (!(db_get_b(NULL,"CLC","MetaHideOfflineSub",SETTING_METAHIDEOFFLINESUB_DEFAULT) && db_get_b(NULL,"CList","HideOffline",SETTING_HIDEOFFLINE_DEFAULT))
+ || wStatus != ID_STATUS_OFFLINE )) {
+ ClcContact& p = cont->subcontacts[i];
+ p.hContact = cacheEntry->hContact;
+
+ p.avatar_pos = AVATAR_POS_DONT_HAVE;
+ Cache_GetAvatar(dat, &p);
+
+ p.iImage = CallService(MS_CLIST_GETCONTACTICON,(WPARAM)cacheEntry->hContact,1);
+ memset(p.iExtraImage,0xFF,sizeof(p.iExtraImage));
+ memset((void*)p.iWideExtraImage,0xFF,sizeof(p.iWideExtraImage));
+ p.proto = cacheEntry->m_cache_cszProto;
+ p.type = CLCIT_CONTACT;
+ p.flags = 0;//CONTACTF_ONLINE;
+ p.isSubcontact = i+1;
+ p.lastPaintCounter = 0;
+ p.subcontacts = cont;
+ p.image_is_special = FALSE;
+ //p.status = cacheEntry->status;
+ Cache_GetTimezone(dat, (&p)->hContact);
+ Cache_GetText(dat, &p,1);
+
+ char *szProto = cacheEntry->m_cache_cszProto;
+ if (szProto != NULL && !pcli->pfnIsHiddenMode(dat,wStatus))
+ p.flags |= CONTACTF_ONLINE;
+ int apparentMode = szProto != NULL?cacheEntry->ApparentMode:0;
+ apparentMode = szProto != NULL?cacheEntry->ApparentMode:0;
+ if (apparentMode == ID_STATUS_OFFLINE) p.flags |= CONTACTF_INVISTO;
+ else if (apparentMode == ID_STATUS_ONLINE) p.flags |= CONTACTF_VISTO;
+ else if (apparentMode) p.flags |= CONTACTF_VISTO|CONTACTF_INVISTO;
+ if (cacheEntry->NotOnList) p.flags |= CONTACTF_NOTONLIST;
+ int idleMode = szProto != NULL?cacheEntry->IdleTS:0;
+ if (idleMode) p.flags |= CONTACTF_IDLE;
i++;
- } }
+ }
+ }
cont->SubAllocated = i;
if ( !i && cont->subcontacts != NULL)
mir_free_and_nil(cont->subcontacts);
}
-int cli_AddItemToGroup(struct ClcGroup *group,int iAboveItem)
+int cli_AddItemToGroup(ClcGroup *group,int iAboveItem)
{
if ( group == NULL ) return 0;
@@ -113,33 +103,25 @@ int cli_AddItemToGroup(struct ClcGroup *group,int iAboveItem) return iAboveItem;
}
-struct ClcGroup *cli_AddGroup(HWND hwnd,struct ClcData *dat,const TCHAR *szName,DWORD flags,int groupId,int calcTotalMembers)
+ClcGroup *cli_AddGroup(HWND hwnd,struct ClcData *dat,const TCHAR *szName, DWORD flags,int groupId,int calcTotalMembers)
{
- struct ClcGroup* result;
ClearRowByIndexCache();
if ( !dat->force_in_dialog && !(GetWindowLongPtr(hwnd, GWL_STYLE) & CLS_SHOWHIDDEN))
- if ( !lstrcmp(_T("-@-HIDDEN-GROUP-@-"),szName)) //group is hidden
- {
+ if ( !lstrcmp(_T("-@-HIDDEN-GROUP-@-"),szName)) { //group is hidden
ClearRowByIndexCache();
return NULL;
}
- result = corecli.pfnAddGroup( hwnd, dat, szName, flags, groupId, calcTotalMembers);
- /* ToDo: fix some times valid contact with valid group are placed to root
- if ( result == NULL )
- {
- result = &dat->list;
- }
- */
- ClearRowByIndexCache();
- return result;
+
+ ClcGroup *result = corecli.pfnAddGroup(hwnd, dat, szName, flags, groupId, calcTotalMembers);
+ ClearRowByIndexCache();
+ return result;
}
-void cli_FreeContact(struct ClcContact *p)
+void cli_FreeContact(ClcContact *p)
{
if ( p->SubAllocated) {
if ( p->subcontacts && !p->isSubcontact) {
- int i;
- for ( i=0 ; i < p->SubAllocated ; i++ ) {
+ for (int i=0 ; i < p->SubAllocated ; i++ ) {
p->subcontacts[i].ssText.DestroySmileyList();
if ( p->subcontacts[i].avatar_pos == AVATAR_POS_ANIMATED )
AniAva_RemoveAvatar( p->subcontacts[i].hContact );
@@ -155,20 +137,20 @@ void cli_FreeContact(struct ClcContact *p) corecli.pfnFreeContact( p );
}
-void cli_FreeGroup( struct ClcGroup* group )
+void cli_FreeGroup( ClcGroup* group )
{
corecli.pfnFreeGroup( group );
ClearRowByIndexCache();
}
-int cli_AddInfoItemToGroup(struct ClcGroup *group,int flags,const TCHAR *pszText)
+int cli_AddInfoItemToGroup(ClcGroup *group,int flags,const TCHAR *pszText)
{
int i = corecli.pfnAddInfoItemToGroup( group, flags, pszText );
ClearRowByIndexCache();
return i;
}
-static void _LoadDataToContact(struct ClcContact * cont, struct ClcGroup *group, struct ClcData *dat, HANDLE hContact)
+static void _LoadDataToContact(ClcContact * cont, ClcGroup *group, struct ClcData *dat, HANDLE hContact)
{
pdisplayNameCacheEntry cacheEntry = NULL;
WORD apparentMode;
@@ -232,7 +214,7 @@ static void _LoadDataToContact(struct ClcContact * cont, struct ClcGroup *group, cont->bContactRate = db_get_b(hContact, "CList", "Rate",0);
}
-static struct ClcContact * AddContactToGroup(struct ClcData *dat,struct ClcGroup *group, pdisplayNameCacheEntry cacheEntry)
+static ClcContact * AddContactToGroup(struct ClcData *dat,ClcGroup *group, pdisplayNameCacheEntry cacheEntry)
{
HANDLE hContact;
int i;
@@ -275,7 +257,7 @@ void * AddTempGroup(HWND hwnd,struct ClcData *dat,const TCHAR *szName,DWORD flag mir_sntprintf(b2,SIZEOF(b2),_T("#%s"),szName);
b2[0] = 1|GROUPF_EXPANDED;
db_set_ws(NULL,"CListGroups",buf,b2);
- pcli->pfnGetGroupName(i,&groupFlags);
+ pcli->pfnGetGroupName(i,&groupFlags);
res = cli_AddGroup(hwnd,dat,szName,groupFlags,i,0);
return res;
}
@@ -284,8 +266,8 @@ void * AddTempGroup(HWND hwnd,struct ClcData *dat,const TCHAR *szName,DWORD flag void cli_AddContactToTree(HWND hwnd,struct ClcData *dat,HANDLE hContact,int updateTotalCount,int checkHideOffline)
{
- struct ClcGroup *group;
- struct ClcContact * cont;
+ ClcGroup *group;
+ ClcContact * cont;
pdisplayNameCacheEntry cacheEntry = (pdisplayNameCacheEntry)pcli->pfnGetCacheEntry(hContact);
if (dat->IsMetaContactsEnabled && cacheEntry && cacheEntry->m_cache_nHiddenSubcontact) return; //contact should not be added
if ( !dat->IsMetaContactsEnabled && cacheEntry && g_szMetaModuleName && !mir_strcmp(cacheEntry->m_cache_cszProto,g_szMetaModuleName)) return;
@@ -309,7 +291,7 @@ void cli_DeleteItemFromTree(HWND hwnd,HANDLE hItem) }
-__inline BOOL CLCItems_IsShowOfflineGroup(struct ClcGroup* group)
+__inline BOOL CLCItems_IsShowOfflineGroup(ClcGroup* group)
{
DWORD groupFlags = 0;
if ( !group) return FALSE;
@@ -330,8 +312,8 @@ HANDLE SaveSelection( struct ClcData *dat ) int RestoreSelection( struct ClcData *dat, HANDLE hSelected )
{
- ClcContact * selcontact = NULL;
- ClcGroup * selgroup = NULL;
+ ClcContact *selcontact = NULL;
+ ClcGroup *selgroup = NULL;
if ( !hSelected || !pcli->pfnFindItem( dat->hWnd, dat, hSelected, &selcontact, &selgroup, NULL))
{
@@ -358,19 +340,19 @@ void cliRebuildEntireList(HWND hwnd,struct ClcData *dat) {
DWORD style = GetWindowLongPtr(hwnd,GWL_STYLE);
HANDLE hContact;
- struct ClcContact * cont;
- struct ClcGroup *group;
- static int rebuildCounter = 0;
+ ClcContact * cont;
+ ClcGroup *group;
+ static int rebuildCounter = 0;
- BOOL PlaceOfflineToRoot = db_get_b(NULL,"CList","PlaceOfflineToRoot",SETTING_PLACEOFFLINETOROOT_DEFAULT);
+ BOOL PlaceOfflineToRoot = db_get_b(NULL,"CList","PlaceOfflineToRoot",SETTING_PLACEOFFLINETOROOT_DEFAULT);
KillTimer(hwnd,TIMERID_REBUILDAFTER);
-
+
ClearRowByIndexCache();
ImageArray_Clear(&dat->avatar_cache);
RowHeights_Clear(dat);
RowHeights_GetMaxRowHeight(dat, hwnd);
- TRACEVAR("Rebuild Entire List %d times\n",++rebuildCounter);
-
+ TRACEVAR("Rebuild Entire List %d times\n",++rebuildCounter);
+
dat->list.expanded = 1;
dat->list.hideOffline = db_get_b(NULL,"CLC","HideOfflineRoot",SETTING_HIDEOFFLINEATROOT_DEFAULT) && style&CLS_USEGROUPS;
dat->list.cl.count = dat->list.cl.limit = 0;
@@ -381,26 +363,22 @@ void cliRebuildEntireList(HWND hwnd,struct ClcData *dat) dat->selection = -1;
dat->HiLightMode = db_get_b(NULL,"CLC","HiLightMode",SETTING_HILIGHTMODE_DEFAULT);
{
- int i;
- TCHAR *szGroupName;
- DWORD groupFlags;
-
- for (i = 1;;i++) {
- szGroupName = pcli->pfnGetGroupName(i,&groupFlags); //UNICODE
- if (szGroupName == NULL) break;
+ for (int i = 1;;i++) {
+ DWORD groupFlags;
+ TCHAR *szGroupName = pcli->pfnGetGroupName(i,&groupFlags); //UNICODE
+ if (szGroupName == NULL)
+ break;
cli_AddGroup(hwnd,dat,szGroupName,groupFlags,i,0);
}
}
hContact = db_find_first();
- while(hContact)
- {
+ while(hContact) {
pdisplayNameCacheEntry cacheEntry = NULL;
- int nHiddenStatus;
cont = NULL;
cacheEntry = (pdisplayNameCacheEntry)pcli->pfnGetCacheEntry(hContact);
- nHiddenStatus = CLVM_GetContactHiddenStatus(hContact, NULL, dat);
+ int nHiddenStatus = CLVM_GetContactHiddenStatus(hContact, NULL, dat);
if ((style&CLS_SHOWHIDDEN && nHiddenStatus != -1) || !nHiddenStatus)
{
@@ -464,7 +442,6 @@ void cliRebuildEntireList(HWND hwnd,struct ClcData *dat) pcli->pfnSortCLC(hwnd,dat,0);
RestoreSelection( dat, hSelected );
-
}
void cli_SortCLC( HWND hwnd, struct ClcData *dat, int useInsertionSort )
@@ -476,7 +453,7 @@ void cli_SortCLC( HWND hwnd, struct ClcData *dat, int useInsertionSort ) RestoreSelection( dat, hSelected );
}
-int GetNewSelection(struct ClcGroup *group, int selection, int direction)
+int GetNewSelection(ClcGroup *group, int selection, int direction)
{
int lastcount = 0, count = 0;//group->cl.count;
if (selection < 0) {
@@ -519,7 +496,7 @@ struct SavedGroupState_t { struct SavedInfoState_t {
int parentId;
- struct ClcContact contact;
+ ClcContact contact;
};
BOOL LOCK_RECALC_SCROLLBAR = FALSE;
@@ -533,8 +510,8 @@ void cli_SaveStateAndRebuildList(HWND hwnd, struct ClcData *dat) OBJLIST<SavedContactState_t> savedContact( 4 );
OBJLIST<SavedInfoState_t> savedInfo( 4 );
- struct ClcGroup *group;
- struct ClcContact *contact;
+ ClcGroup *group;
+ ClcContact *contact;
pcli->pfnHideInfoTip(hwnd, dat);
KillTimer(hwnd, TIMERID_INFOTIP);
@@ -669,9 +646,10 @@ void pdnce___SetStatus( pdisplayNameCacheEntry pdnce, WORD wStatus ) {
if (pdnce) pdnce->m_cache_nStatus = wStatus;
}
-struct ClcContact* cliCreateClcContact( void )
+
+ClcContact* cliCreateClcContact()
{
- struct ClcContact* contact = (struct ClcContact*)mir_calloc(sizeof( struct ClcContact ));
+ ClcContact* contact = (ClcContact*)mir_calloc(sizeof( ClcContact ));
memset((void*)contact->iWideExtraImage,0xFF,sizeof(contact->iWideExtraImage));
return contact;
}
@@ -679,21 +657,19 @@ struct ClcContact* cliCreateClcContact( void ) ClcCacheEntryBase* cliCreateCacheItem( HANDLE hContact )
{
pdisplayNameCacheEntry p = (pdisplayNameCacheEntry)mir_calloc(sizeof( displayNameCacheEntry ));
- if ( p )
- {
- memset(p,0,sizeof( displayNameCacheEntry ));
- p->hContact = hContact;
- InvalidateDNCEbyPointer(hContact,p,0);
- p->szSecondLineText = NULL;
- p->szThirdLineText = NULL;
- p->ssSecondLine.plText = NULL;
- p->ssThirdLine.plText = NULL;
- }
- return (ClcCacheEntryBase*)p;
+ if (p == NULL)
+ return NULL;
+
+ memset(p,0,sizeof( displayNameCacheEntry ));
+ p->hContact = hContact;
+ InvalidateDNCEbyPointer(hContact,p,0);
+ p->szSecondLineText = NULL;
+ p->szThirdLineText = NULL;
+ p->ssSecondLine.plText = NULL;
+ p->ssThirdLine.plText = NULL;
+ return p;
}
-
-
void cliInvalidateDisplayNameCacheEntry(HANDLE hContact)
{
pdisplayNameCacheEntry p;
@@ -702,7 +678,7 @@ void cliInvalidateDisplayNameCacheEntry(HANDLE hContact) return;
}
-char* cli_GetGroupCountsText(struct ClcData *dat, struct ClcContact *contact)
+char* cli_GetGroupCountsText(struct ClcData *dat, ClcContact *contact)
{
char * res;
@@ -711,10 +687,10 @@ char* cli_GetGroupCountsText(struct ClcData *dat, struct ClcContact *contact) return res;
}
-int cliGetGroupContentsCount(struct ClcGroup *group, int visibleOnly)
+int cliGetGroupContentsCount(ClcGroup *group, int visibleOnly)
{
int count = group->cl.count;
- struct ClcGroup *topgroup = group;
+ ClcGroup *topgroup = group;
group->scanIndex = 0;
for (;;) {
@@ -729,12 +705,12 @@ int cliGetGroupContentsCount(struct ClcGroup *group, int visibleOnly) count += group->cl.count;
continue;
}
- else if ((group->cl.items[group->scanIndex]->type == CLCIT_CONTACT) &&
- (group->cl.items[group->scanIndex]->subcontacts != NULL) &&
- ((group->cl.items[group->scanIndex]->SubExpanded || (!visibleOnly))))
- {
- count += group->cl.items[group->scanIndex]->SubAllocated;
- }
+ else if ((group->cl.items[group->scanIndex]->type == CLCIT_CONTACT) &&
+ (group->cl.items[group->scanIndex]->subcontacts != NULL) &&
+ ((group->cl.items[group->scanIndex]->SubExpanded || (!visibleOnly))))
+ {
+ count += group->cl.items[group->scanIndex]->SubAllocated;
+ }
group->scanIndex++;
}
return count;
diff --git a/plugins/Clist_modern/src/modern_clcmsgs.cpp b/plugins/Clist_modern/src/modern_clcmsgs.cpp index cef111c793..5b3a3aafde 100644 --- a/plugins/Clist_modern/src/modern_clcmsgs.cpp +++ b/plugins/Clist_modern/src/modern_clcmsgs.cpp @@ -184,7 +184,7 @@ LRESULT cli_ProcessExternalMessages(HWND hwnd,struct ClcData *dat,UINT msg,WPARA return 0;
case CLM_SELECTITEM:
{
- struct ClcGroup *tgroup;
+ ClcGroup *tgroup;
int index = -1;
int mainindex = -1;
if ( !pcli->pfnFindItem(hwnd, dat, (HANDLE) wParam, &contact, &group, NULL))
@@ -208,7 +208,7 @@ LRESULT cli_ProcessExternalMessages(HWND hwnd,struct ClcData *dat,UINT msg,WPARA if (k) {
for (int i=0; i < mainindex; i++)
{
- struct ClcContact *tempCont = group->cl.items[i];
+ ClcContact *tempCont = group->cl.items[i];
if (tempCont->type == CLCIT_CONTACT && tempCont->SubAllocated && tempCont->SubExpanded)
index += tempCont->SubAllocated;
}
diff --git a/plugins/Clist_modern/src/modern_clcpaint.cpp b/plugins/Clist_modern/src/modern_clcpaint.cpp index ad023adf50..cc567908cd 100644 --- a/plugins/Clist_modern/src/modern_clcpaint.cpp +++ b/plugins/Clist_modern/src/modern_clcpaint.cpp @@ -151,7 +151,7 @@ HFONT CLCPaint::ChangeToFont( HDC hdc, struct ClcData *dat, int id, int *fontHei return res;
}
-int CLCPaint::GetBasicFontID( struct ClcContact * contact )
+int CLCPaint::GetBasicFontID( ClcContact * contact )
{
PDNCE pdnce = NULL;
if ( contact->type == CLCIT_CONTACT )
@@ -388,7 +388,7 @@ int CLCPaint::_GetGeneralisedStatus() return status;
}
-int CLCPaint::_GetRealStatus( struct ClcContact * pContact, int nStatus )
+int CLCPaint::_GetRealStatus( ClcContact * pContact, int nStatus )
{
if ( !pContact->proto )
return nStatus;
@@ -577,7 +577,7 @@ void CLCPaint::_AddParamShort( MODERNMASK * mpModernMask, DWORD dwParamIndex, D }
-MODERNMASK * CLCPaint::_GetCLCContactRowBackModernMask( struct ClcGroup * group, struct ClcContact * Drawing, int indent, int index, BOOL selected, BOOL hottrack, struct ClcData * dat )
+MODERNMASK * CLCPaint::_GetCLCContactRowBackModernMask( ClcGroup * group, ClcContact * Drawing, int indent, int index, BOOL selected, BOOL hottrack, struct ClcData * dat )
{
MODERNMASK * mpModernMask = NULL;
char buf[BUF2SIZE] = {0};
@@ -596,7 +596,7 @@ MODERNMASK * CLCPaint::_GetCLCContactRowBackModernMask( struct ClcGroup * group, break;
case CLCIT_CONTACT:
{
- struct ClcContact * mCont = Drawing;
+ ClcContact * mCont = Drawing;
if ( Drawing->isSubcontact )
{
_AddParamShort( mpModernMask, hi_Type, hi_SubContact );
@@ -710,7 +710,7 @@ void CLCPaint::_RTLRect( RECT *rect, int width, int offset ) return;
}
-void CLCPaint::_PaintRowItemsEx( HWND hwnd, HDC hdcMem, struct ClcData *dat, struct ClcContact *Drawing, RECT row_rc, RECT free_row_rc, int left_pos, int right_pos, int selected, int hottrack, RECT *rcPaint )
+void CLCPaint::_PaintRowItemsEx( HWND hwnd, HDC hdcMem, struct ClcData *dat, ClcContact *Drawing, RECT row_rc, RECT free_row_rc, int left_pos, int right_pos, int selected, int hottrack, RECT *rcPaint )
{
int i=0;
int dx = free_row_rc.left;
@@ -1694,7 +1694,7 @@ void CLCPaint::_PaintRowItemsEx( HWND hwnd, HDC hdcMem, struct ClcData *dat, str -void CLCPaint::_DrawStatusIcon( struct ClcContact * Drawing, struct ClcData *dat, int iImage, HDC hdcMem, int x, int y, int cx, int cy, DWORD colorbg, DWORD colorfg, int mode )
+void CLCPaint::_DrawStatusIcon( ClcContact * Drawing, struct ClcData *dat, int iImage, HDC hdcMem, int x, int y, int cx, int cy, DWORD colorbg, DWORD colorfg, int mode )
{
if ( Drawing->type != CLCIT_CONTACT )
{
@@ -1919,8 +1919,8 @@ void CLCPaint::_DrawBackground( HWND hWnd, struct ClcData * dat, HDC hdc, int pa void CLCPaint::_DrawLines( HWND hWnd, struct ClcData * dat, HDC hdc, int paintMode, RECT* rcPaint, RECT& clRect, _PaintContext& pc )
{
- struct ClcContact *Drawing;
- struct ClcGroup *group = &dat->list;
+ ClcContact *Drawing;
+ ClcGroup *group = &dat->list;
group->scanIndex = 0;
int indent = 0;
int subident = 0;
@@ -2302,7 +2302,7 @@ void CLCPaint::_PaintClc( HWND hwnd, struct ClcData *dat, HDC hdc, RECT *_rcPain }
-void CLCPaint::_StoreItemPos( struct ClcContact *contact, int ItemType, RECT * rc )
+void CLCPaint::_StoreItemPos( ClcContact *contact, int ItemType, RECT * rc )
{
contact->ext_mpItemsDesc[contact->ext_nItemsNum].itemType = ItemType;
contact->ext_mpItemsDesc[contact->ext_nItemsNum].itemRect = *rc;
@@ -2335,7 +2335,7 @@ void CLCPaint::_StoreItemPos( struct ClcContact *contact, int ItemType, RECT * r }
-void CLCPaint::_CalcItemsPos( HWND hwnd, HDC hdcMem, struct ClcData *dat, struct ClcContact *Drawing, RECT *in_row_rc, RECT *in_free_row_rc, int left_pos, int right_pos, int selected, int hottrack )
+void CLCPaint::_CalcItemsPos( HWND hwnd, HDC hdcMem, struct ClcData *dat, ClcContact *Drawing, RECT *in_row_rc, RECT *in_free_row_rc, int left_pos, int right_pos, int selected, int hottrack )
{
int item_iterator, item, item_text, text_left_pos;
BOOL left = TRUE; //TODO remove
@@ -2957,7 +2957,7 @@ BOOL CLCPaint::__IsVisible( RECT * firtRect, RECT * secondRect ) }
-void CLCPaint::_GetBlendMode( IN struct ClcData *dat, IN struct ClcContact * Drawing, IN BOOL selected, IN BOOL hottrack, IN BOOL bFlag, OUT COLORREF * OutColourFg, OUT int * OutMode )
+void CLCPaint::_GetBlendMode( IN struct ClcData *dat, IN ClcContact * Drawing, IN BOOL selected, IN BOOL hottrack, IN BOOL bFlag, OUT COLORREF * OutColourFg, OUT int * OutMode )
{
COLORREF colourFg;
int mode;
@@ -2999,7 +2999,7 @@ void CLCPaint::_GetBlendMode( IN struct ClcData *dat, IN struct ClcContact * Dra }
}
-void CLCPaint::_DrawContactAvatar( HDC hdcMem, struct ClcData *dat, struct ClcContact *Drawing, RECT *row_rc, int& selected, int& hottrack, RECT& text_rc, RECT * prcItem )
+void CLCPaint::_DrawContactAvatar( HDC hdcMem, struct ClcData *dat, ClcContact *Drawing, RECT *row_rc, int& selected, int& hottrack, RECT& text_rc, RECT * prcItem )
{
if ( Drawing->avatar_pos == AVATAR_POS_ANIMATED )
{
@@ -3122,7 +3122,7 @@ void CLCPaint::_DrawContactAvatar( HDC hdcMem, struct ClcData *dat, struct ClcCo }
}
-void CLCPaint::_DrawContactIcon( HDC hdcMem, struct ClcData *dat, struct ClcContact *Drawing, int& selected, int& hottrack, RECT& text_rc, RECT * prcItem )
+void CLCPaint::_DrawContactIcon( HDC hdcMem, struct ClcData *dat, ClcContact *Drawing, int& selected, int& hottrack, RECT& text_rc, RECT * prcItem )
{
//Draw Icon
int iImage = -1;
@@ -3147,7 +3147,7 @@ void CLCPaint::_DrawContactIcon( HDC hdcMem, struct ClcData *dat, struct ClcCont }
}
-void CLCPaint::_DrawContactText( HDC hdcMem, struct ClcData *dat, struct ClcContact *Drawing, int& selected, int& hottrack, RECT& text_rc, RECT * prcItem, UINT uTextFormat )
+void CLCPaint::_DrawContactText( HDC hdcMem, struct ClcData *dat, ClcContact *Drawing, int& selected, int& hottrack, RECT& text_rc, RECT * prcItem, UINT uTextFormat )
{
ChangeToFont( hdcMem, dat, GetBasicFontID( Drawing ), NULL );
if ( selected )
@@ -3192,7 +3192,7 @@ void CLCPaint::_DrawContactText( HDC hdcMem, struct ClcData *dat, struct ClcCont text_rc.right = max( text_rc.right, prcItem->right );
text_rc.left = min( text_rc.left, prcItem->left );
}
-void CLCPaint::_DrawContactSubText( HDC hdcMem, struct ClcData *dat, struct ClcContact *Drawing, int& selected, int& hottrack, RECT& text_rc, RECT * prcItem, UINT uTextFormat, BYTE itemType )
+void CLCPaint::_DrawContactSubText( HDC hdcMem, struct ClcData *dat, ClcContact *Drawing, int& selected, int& hottrack, RECT& text_rc, RECT * prcItem, UINT uTextFormat, BYTE itemType )
{
if ( Drawing->type == CLCIT_GROUP )
{
@@ -3232,7 +3232,7 @@ void CLCPaint::_DrawContactSubText( HDC hdcMem, struct ClcData *dat, struct ClcC text_rc.right = max( text_rc.right, prcItem->right );
text_rc.left = min( text_rc.left, prcItem->left );
}
-void CLCPaint::_DrawContactTime( HDC hdcMem, struct ClcData *dat, struct ClcContact *Drawing, int& selected, int& hottrack, RECT& text_rc, RECT * prcItem )
+void CLCPaint::_DrawContactTime( HDC hdcMem, struct ClcData *dat, ClcContact *Drawing, int& selected, int& hottrack, RECT& text_rc, RECT * prcItem )
{
TCHAR szResult[80];
PDNCE pdnce = ( PDNCE )(( Drawing->type == CLCIT_CONTACT )?pcli->pfnGetCacheEntry( Drawing->hContact ):NULL );
@@ -3247,7 +3247,7 @@ void CLCPaint::_DrawContactTime( HDC hdcMem, struct ClcData *dat, struct ClcCont }
}
-void CLCPaint::_DrawContactSelection( HDC hdcMem, struct ClcData *dat, struct ClcContact *Drawing, int& selected, int& hottrack, RECT *rcPaint, RECT * prcItem )
+void CLCPaint::_DrawContactSelection( HDC hdcMem, struct ClcData *dat, ClcContact *Drawing, int& selected, int& hottrack, RECT *rcPaint, RECT * prcItem )
{
// Selection background
if (( selected || hottrack ) && dat->HiLightMode == 0) {
@@ -3258,7 +3258,7 @@ void CLCPaint::_DrawContactSelection( HDC hdcMem, struct ClcData *dat, struct Cl }
}
-void CLCPaint::_DrawContactExtraIcon( HDC hdcMem, struct ClcData *dat, struct ClcContact *Drawing, int& selected, int& hottrack, RECT& text_rc, RECT * rc, int iImage )
+void CLCPaint::_DrawContactExtraIcon( HDC hdcMem, struct ClcData *dat, ClcContact *Drawing, int& selected, int& hottrack, RECT& text_rc, RECT * rc, int iImage )
{
//Draw extra icon
COLORREF colourFg;
@@ -3275,7 +3275,7 @@ void CLCPaint::_DrawContactExtraIcon( HDC hdcMem, struct ClcData *dat, struct Cl }
}
-void CLCPaint::_DrawContactLine( HDC hdcMem, struct ClcData *dat, struct ClcContact *Drawing, RECT *free_row_rc, RECT *rcPaint, RECT& text_rc )
+void CLCPaint::_DrawContactLine( HDC hdcMem, struct ClcData *dat, ClcContact *Drawing, RECT *free_row_rc, RECT *rcPaint, RECT& text_rc )
{ //draw line
RECT rc1 = *free_row_rc;
RECT rc2 = *free_row_rc;
@@ -3314,7 +3314,7 @@ void CLCPaint::_DrawContactLine( HDC hdcMem, struct ClcData *dat, struct ClcCont }
}
-void CLCPaint::_DrawContactItems( HWND hwnd, HDC hdcMem, struct ClcData *dat, struct ClcContact *Drawing, RECT *row_rc, RECT *free_row_rc, int left_pos, int right_pos, int selected, int hottrack, RECT *rcPaint )
+void CLCPaint::_DrawContactItems( HWND hwnd, HDC hdcMem, struct ClcData *dat, ClcContact *Drawing, RECT *row_rc, RECT *free_row_rc, int left_pos, int right_pos, int selected, int hottrack, RECT *rcPaint )
{
int i;
RECT text_rc = {0};
@@ -3372,7 +3372,7 @@ void CLCPaint::_DrawContactItems( HWND hwnd, HDC hdcMem, struct ClcData *dat, st || ( Drawing->type == CLCIT_DIVIDER ))
_DrawContactLine( hdcMem, dat, Drawing, free_row_rc, rcPaint, text_rc );
}
-void CLCPaint::_PaintRowItems ( HWND hwnd, HDC hdcMem, struct ClcData *dat, struct ClcContact *Drawing, RECT row_rc, RECT free_row_rc, int left_pos, int right_pos, int selected, int hottrack, RECT *rcPaint )
+void CLCPaint::_PaintRowItems ( HWND hwnd, HDC hdcMem, struct ClcData *dat, ClcContact *Drawing, RECT row_rc, RECT free_row_rc, int left_pos, int right_pos, int selected, int hottrack, RECT *rcPaint )
{
//Extended LAYOUT
if ( gl_RowRoot && ( dat->hWnd == pcli->hwndContactTree ))
diff --git a/plugins/Clist_modern/src/modern_clcutils.cpp b/plugins/Clist_modern/src/modern_clcutils.cpp index ef1c374536..955cf7e5f7 100644 --- a/plugins/Clist_modern/src/modern_clcutils.cpp +++ b/plugins/Clist_modern/src/modern_clcutils.cpp @@ -33,10 +33,10 @@ BOOL RectHitTest(RECT *rc, int testx, int testy) return testx >= rc->left && testx < rc->right && testy >= rc->top && testy < rc->bottom;
}
-int cliHitTest(HWND hwnd,struct ClcData *dat,int testx,int testy,struct ClcContact **contact,struct ClcGroup **group,DWORD *flags)
+int cliHitTest(HWND hwnd,struct ClcData *dat,int testx,int testy,ClcContact **contact,ClcGroup **group,DWORD *flags)
{
- struct ClcContact *hitcontact = NULL;
- struct ClcGroup *hitgroup = NULL;
+ ClcContact *hitcontact = NULL;
+ ClcGroup *hitgroup = NULL;
int hit = -1;
RECT clRect;
if (CLUI_TestCursorOnBorders() != 0)
@@ -268,8 +268,8 @@ static LRESULT CALLBACK RenameEditSubclassProc(HWND hwnd, UINT msg, WPARAM wPara void cliBeginRenameSelection(HWND hwnd,struct ClcData *dat)
{
- struct ClcContact *contact;
- struct ClcGroup *group;
+ ClcContact *contact;
+ ClcGroup *group;
int indent,x,y,subident, h,w;
RECT clRect;
RECT r;
@@ -358,8 +358,8 @@ int GetDropTargetInformation(HWND hwnd,struct ClcData *dat,POINT pt) {
RECT clRect;
int hit;
- struct ClcContact *contact = NULL,*movecontact = NULL;
- struct ClcGroup *group,*movegroup;
+ ClcContact *contact = NULL,*movecontact = NULL;
+ ClcGroup *group,*movegroup;
DWORD hitFlags;
int nSetSelection = -1;
@@ -375,8 +375,8 @@ int GetDropTargetInformation(HWND hwnd,struct ClcData *dat,POINT pt) if (hit == -1 || hitFlags&CLCHT_ONITEMEXTRA || !movecontact) return DROPTARGET_ONNOTHING;
if (movecontact->type == CLCIT_GROUP) {
- struct ClcContact *bottomcontact = NULL,*topcontact = NULL;
- struct ClcGroup *topgroup = NULL, *bottomgroup = NULL;
+ ClcContact *bottomcontact = NULL,*topcontact = NULL;
+ ClcGroup *topgroup = NULL, *bottomgroup = NULL;
int topItem = -1,bottomItem = -1;
int ok = 0;
if (pt.y+dat->yScroll < cliGetRowTopY(dat,hit)+dat->insertionMarkHitHeight || contact->type != CLCIT_GROUP) {
@@ -413,7 +413,7 @@ int GetDropTargetInformation(HWND hwnd,struct ClcData *dat,POINT pt) }
if (bottomItem != -1 && bottomcontact->type != CLCIT_GROUP)
{
- struct ClcGroup * gr = bottomgroup;
+ ClcGroup * gr = bottomgroup;
do
{
bottomItem = cliGetRowByIndex(dat,bottomItem-1,&bottomcontact,&bottomgroup);}
@@ -790,9 +790,9 @@ void LoadCLCOptions(HWND hwnd, struct ClcData *dat ) }
-int ExpandMetaContact(HWND hwnd, struct ClcContact * contact, struct ClcData * dat, BOOL bExpand)
+int ExpandMetaContact(HWND hwnd, ClcContact * contact, struct ClcData * dat, BOOL bExpand)
{
- struct ClcContact * ht = NULL;
+ ClcContact * ht = NULL;
KillTimer(hwnd,TIMERID_SUBEXPAND);
if (contact->type != CLCIT_CONTACT || contact->SubAllocated == 0 || contact->SubExpanded == bExpand || !db_get_b(NULL,"CLC","MetaExpanding",SETTING_METAEXPANDING_DEFAULT)) return 0;
contact->SubExpanded = bExpand;
@@ -805,9 +805,9 @@ int ExpandMetaContact(HWND hwnd, struct ClcContact * contact, struct ClcData * d int cliFindRowByText(HWND hwnd, struct ClcData *dat, const TCHAR *text, int prefixOk)
{
- struct ClcGroup *group = &dat->list;
+ ClcGroup *group = &dat->list;
int testlen = lstrlen(text);
- struct ClcContact *contact = NULL;
+ ClcContact *contact = NULL;
int SubCount = 0;
group->scanIndex = 0;
@@ -831,7 +831,7 @@ int cliFindRowByText(HWND hwnd, struct ClcData *dat, const TCHAR *text, int pref found = (prefixOk && !_tcsnicmp(text, contact->szText, testlen)) || (!prefixOk && !lstrcmpi(text, contact->szText));
}
if (found) {
- struct ClcGroup *contactGroup = group;
+ ClcGroup *contactGroup = group;
int contactScanIndex = group->scanIndex;
for (; group; group = group->parent)
pcli->pfnSetGroupExpand(hwnd, dat, group, 1);
@@ -854,7 +854,7 @@ int cliFindRowByText(HWND hwnd, struct ClcData *dat, const TCHAR *text, int pref int i=0;
for (i=0; i < contact->SubAllocated; i++)
{
- struct ClcContact * subcontact = &(contact->subcontacts[i]);
+ ClcContact * subcontact = &(contact->subcontacts[i]);
bool found;
if (dat->filterSearch) {
@@ -865,7 +865,7 @@ int cliFindRowByText(HWND hwnd, struct ClcData *dat, const TCHAR *text, int pref found = (prefixOk && !_tcsnicmp(text, subcontact->szText, testlen)) || (!prefixOk && !lstrcmpi(text, subcontact->szText));
}
if (found) {
- struct ClcGroup *contactGroup = group;
+ ClcGroup *contactGroup = group;
int contactScanIndex = group->scanIndex;
for (; group; group = group->parent)
pcli->pfnSetGroupExpand(hwnd, dat, group, 1);
diff --git a/plugins/Clist_modern/src/modern_contact.cpp b/plugins/Clist_modern/src/modern_contact.cpp index 7b1ba95544..e1cc237e36 100644 --- a/plugins/Clist_modern/src/modern_contact.cpp +++ b/plugins/Clist_modern/src/modern_contact.cpp @@ -94,7 +94,7 @@ int GetProtoIndex(char * szName) return -1;
}
-int CompareContacts2(const struct ClcContact *contact1,const struct ClcContact *contact2, int by)
+int CompareContacts2(const ClcContact *contact1,const ClcContact *contact2, int by)
{
HANDLE a;
@@ -159,7 +159,7 @@ int CompareContacts2(const struct ClcContact *contact1,const struct ClcContact * return 0;
}
-int cliCompareContacts(const struct ClcContact *contact1,const struct ClcContact *contact2)
+int cliCompareContacts(const ClcContact *contact1,const ClcContact *contact2)
{
int i, r;
for (i=0; i < SIZEOF(g_CluiData.bSortByOrder); i++)
diff --git a/plugins/Clist_modern/src/modern_gettextasync.cpp b/plugins/Clist_modern/src/modern_gettextasync.cpp index 0e01838ae4..d0ba4061cb 100644 --- a/plugins/Clist_modern/src/modern_gettextasync.cpp +++ b/plugins/Clist_modern/src/modern_gettextasync.cpp @@ -152,7 +152,7 @@ BOOL gtaWakeThread() return FALSE;
}
-int gtaAddRequest(struct ClcData *dat,struct ClcContact *contact,HANDLE hContact)
+int gtaAddRequest(struct ClcData *dat,ClcContact *contact,HANDLE hContact)
{
if (MirandaExiting()) return 0;
gtalock;
diff --git a/plugins/Clist_modern/src/modern_groupmenu.cpp b/plugins/Clist_modern/src/modern_groupmenu.cpp index 33c93a10a6..2abef3c387 100644 --- a/plugins/Clist_modern/src/modern_groupmenu.cpp +++ b/plugins/Clist_modern/src/modern_groupmenu.cpp @@ -476,7 +476,7 @@ static int OnBuildSubGroupMenu(WPARAM wParam,LPARAM lParam) BOOL showOfflineinGroup = FALSE;
- struct ClcGroup *group = (struct ClcGroup *)wParam;
+ ClcGroup *group = (ClcGroup *)wParam;
if (wParam == 0) return 0;
if (MirandaExiting()) return 0;
@@ -518,7 +518,7 @@ INT_PTR BuildSubGroupMenu(WPARAM wParam,LPARAM lParam) return (INT_PTR)hMenu;
}
-HMENU cliBuildGroupPopupMenu(struct ClcGroup *group)
+HMENU cliBuildGroupPopupMenu(ClcGroup *group)
{
//HWND wnd = GetForegroundWindow();
return (HMENU)CallService(MS_CLIST_MENUBUILDSUBGROUP,(WPARAM)group,0);
diff --git a/plugins/Clist_modern/src/modern_rowheight_funcs.cpp b/plugins/Clist_modern/src/modern_rowheight_funcs.cpp index 0737505c86..7005e38d88 100644 --- a/plugins/Clist_modern/src/modern_rowheight_funcs.cpp +++ b/plugins/Clist_modern/src/modern_rowheight_funcs.cpp @@ -30,9 +30,9 @@ Created by Pescuma, modified by Artem Shpynov #include "hdr/modern_clcpaint.h"
int g_mutex_nCalcRowHeightLock = 0;
-int mod_CalcRowHeight_worker(struct ClcData *dat, HWND hwnd, struct ClcContact *contact, int item);
+int mod_CalcRowHeight_worker(struct ClcData *dat, HWND hwnd, ClcContact *contact, int item);
void RowHeights_CalcRowHeights_Worker(struct ClcData *dat, HWND hwnd);
-int RowHeights_GetRowHeight_worker(struct ClcData *dat, HWND hwnd, struct ClcContact *contact, int item);
+int RowHeights_GetRowHeight_worker(struct ClcData *dat, HWND hwnd, ClcContact *contact, int item);
/*
*
@@ -57,466 +57,410 @@ SIZE GetAvatarSize(int imageWidth, int imageHeight, int maxWidth, int maxHeight) {
float scalefactor = 0;
SIZE sz = {0};
- if (imageWidth == 0 || imageHeight == 0) return sz;
- if (maxWidth == 0) maxWidth = maxHeight;
+ if (imageWidth == 0 || imageHeight == 0)
+ return sz;
+
+ if (maxWidth == 0)
+ maxWidth = maxHeight;
scalefactor = min((float)maxWidth/imageWidth,(float)maxHeight/imageHeight);
sz.cx = (LONG)(imageWidth*scalefactor);
sz.cy = (LONG)(imageHeight*scalefactor);
return sz;
}
-int RowHeight_CalcRowHeight(struct ClcData *dat, HWND hwnd, struct ClcContact *contact, int item)
+int RowHeight_CalcRowHeight(struct ClcData *dat, HWND hwnd, ClcContact *contact, int item)
{
- int res;
- if (MirandaExiting()) return 0;
- g_mutex_nCalcRowHeightLock++;
- res = mod_CalcRowHeight_worker(dat,hwnd,contact,item);
- g_mutex_nCalcRowHeightLock--;
- return res;
+ if (MirandaExiting()) return 0;
+ g_mutex_nCalcRowHeightLock++;
+ int res = mod_CalcRowHeight_worker(dat,hwnd,contact,item);
+ g_mutex_nCalcRowHeightLock--;
+ return res;
}
-int mod_CalcRowHeight_worker(struct ClcData *dat, HWND hwnd, struct ClcContact *contact, int item)
+
+int mod_CalcRowHeight_worker(struct ClcData *dat, HWND hwnd, ClcContact *contact, int item)
{
- BYTE i=0;
- int res = 0;
- int height = 0;
- displayNameCacheEntry * pdnce;
- BOOL hasAvatar = FALSE;
- DWORD style;
- style = GetWindowLongPtr(hwnd,GWL_STYLE);
- pdnce = (displayNameCacheEntry*)pcli->pfnGetCacheEntry(contact->hContact);
- if ( !RowHeights_Alloc(dat, item + 1))
- return -1;
- if ( !pcli->hwndContactTree) return 0;
- //if ( !gl_RowRoot) RowHeight_InitModernRow();
- if (dat->hWnd != pcli->hwndContactTree || !gl_RowRoot || contact->type == CLCIT_GROUP)
- {
- int tmp = 0;
- tmp = dat->fontModernInfo[g_clcPainter.GetBasicFontID(contact)].fontHeight;
- if (dat->text_replace_smileys && dat->first_line_draw_smileys && !dat->text_resize_smileys)
- tmp = max(tmp, contact->ssText.iMaxSmileyHeight);
- if (contact->type == CLCIT_GROUP)
- {
- char * szCounts = pcli->pfnGetGroupCountsText(dat, contact);
- // Has the count?
- if (szCounts && szCounts[0])
- tmp = max(tmp,dat->fontModernInfo[contact->group->expanded?FONTID_OPENGROUPCOUNTS:FONTID_CLOSEDGROUPCOUNTS].fontHeight);
- }
- tmp = max(tmp, ICON_HEIGHT);
- tmp = max(tmp,dat->row_min_heigh);
- tmp += dat->row_border*2;
- if (contact->type == CLCIT_GROUP &&
- contact->group->parent->groupId == 0 &&
- contact->group->parent->cl.items[0] != contact)
- tmp += dat->row_before_group_space;
- if (item != -1) dat->row_heights[item] = tmp;
- return tmp;
- }
- hasAvatar = (dat->use_avatar_service && contact->avatar_data != NULL) || (!dat->use_avatar_service && contact->avatar_pos != AVATAR_POS_DONT_HAVE);
- while (gl_RowTabAccess[i] != NULL)
- {
- if (gl_RowTabAccess[i]->type != TC_SPACE)
- {
- gl_RowTabAccess[i]->h = 0;
- gl_RowTabAccess[i]->w = 0;
- SetRect(&(gl_RowTabAccess[i]->r),0,0,0,0);
- switch (gl_RowTabAccess[i]->type)
- {
- case TC_TEXT1:
- {
- int tmp = 0;
- tmp = dat->fontModernInfo[g_clcPainter.GetBasicFontID(contact)].fontHeight;
- if (dat->text_replace_smileys && dat->first_line_draw_smileys && !dat->text_resize_smileys)
- tmp = max(tmp, contact->ssText.iMaxSmileyHeight);
- if (item == -1)
- {
- //calculate text width here
- SIZE size = {0};
- RECT dummyRect = {0,0,1024,tmp};
- HDC hdc = CreateCompatibleDC(NULL);
- g_clcPainter.ChangeToFont(hdc,dat,g_clcPainter.GetBasicFontID(contact),NULL);
- g_clcPainter.GetTextSize(&size,hdc,dummyRect,contact->szText,contact->ssText.plText,0, dat->text_resize_smileys ? 0 : contact->ssText.iMaxSmileyHeight);
- if (contact->type == CLCIT_GROUP)
- {
- char * szCounts = pcli->pfnGetGroupCountsText(dat, contact);
- if (szCounts && strlen(szCounts)>0)
- {
- RECT count_rc = {0};
- // 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;
- 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;
- tmp = max(tmp,count_rc.bottom-count_rc.top);
- }
- }
- gl_RowTabAccess[i]->w = size.cx;
- SelectObject(hdc,GetStockObject(DEFAULT_GUI_FONT));
- ske_ResetTextEffect(hdc);
- mod_DeleteDC(hdc);
- }
- gl_RowTabAccess[i]->h = tmp;
-
- break;
- }
- case TC_TEXT2:
- {
- int tmp = 0;
- HANDLE hContact = pdnce->hContact;
- if (dat->second_line_show && pdnce->szSecondLineText && pdnce->szSecondLineText[0] )
- {
- tmp = dat->fontModernInfo[FONTID_SECONDLINE].fontHeight;
- if (dat->text_replace_smileys && dat->second_line_draw_smileys && !dat->text_resize_smileys)
- tmp = max(tmp, pdnce->ssSecondLine.iMaxSmileyHeight);
- if (item == -1)
- {
- //calculate text width here
-
- SIZE size = {0};
- RECT dummyRect = {0,0,1024,tmp};
- HDC hdc = CreateCompatibleDC(NULL);
- g_clcPainter.ChangeToFont(hdc,dat,FONTID_SECONDLINE,NULL);
- g_clcPainter.GetTextSize(&size,hdc,dummyRect,pdnce->szSecondLineText,pdnce->ssSecondLine.plText,0, dat->text_resize_smileys ? 0 : pdnce->ssSecondLine.iMaxSmileyHeight);
- gl_RowTabAccess[i]->w = size.cx;
- SelectObject(hdc,GetStockObject(DEFAULT_GUI_FONT));
- ske_ResetTextEffect(hdc);
- mod_DeleteDC(hdc);
- }
- }
- gl_RowTabAccess[i]->h = tmp;
- break;
- }
- case TC_TEXT3:
- {
- int tmp = 0;
- HANDLE hContact = pdnce->hContact;
- if (dat->third_line_show && pdnce->szThirdLineText && pdnce->szThirdLineText[0])
- {
- tmp = dat->fontModernInfo[FONTID_THIRDLINE].fontHeight;
- if (dat->text_replace_smileys && dat->third_line_draw_smileys && !dat->text_resize_smileys)
- tmp = max(tmp, pdnce->ssThirdLine.iMaxSmileyHeight);
- if (item == -1)
- {
- //calculate text width here
- SIZE size = {0};
- RECT dummyRect = {0,0,1024,tmp};
- HDC hdc = CreateCompatibleDC(NULL);
- g_clcPainter.ChangeToFont(hdc,dat,FONTID_THIRDLINE,NULL);
- g_clcPainter.GetTextSize(&size,hdc,dummyRect,pdnce->szThirdLineText,pdnce->ssThirdLine.plText,0, dat->text_resize_smileys ? 0 : pdnce->ssThirdLine.iMaxSmileyHeight);
- gl_RowTabAccess[i]->w = size.cx;
- SelectObject(hdc,GetStockObject(DEFAULT_GUI_FONT));
- ske_ResetTextEffect(hdc);
- mod_DeleteDC(hdc);
- }
- }
- gl_RowTabAccess[i]->h = tmp;
- break;
- }
- case TC_STATUS:
- {
- if (
- (contact->type == CLCIT_GROUP && !dat->row_hide_group_icon) ||
- ( contact->type == CLCIT_CONTACT && contact->iImage != -1 &&
- !(dat->icon_hide_on_avatar && dat->avatars_show && (hasAvatar || (!hasAvatar && dat->icon_draw_on_avatar_space && contact->iImage != -1)) && !contact->image_is_special))
- )
- {
- gl_RowTabAccess[i]->h = ICON_HEIGHT;
- gl_RowTabAccess[i]->w = ICON_HEIGHT;
- }
- break;
- }
- case TC_AVATAR:
- {
- if (dat->avatars_show &&
- contact->type == CLCIT_CONTACT &&
- (hasAvatar || (dat->icon_hide_on_avatar && dat->icon_draw_on_avatar_space && contact->iImage != -1) )
- )
- {
- SIZE sz = {0};
- int iW = 0, iH = 0;
- if (dat->use_avatar_service)
- {
- if (contact->avatar_data)
- {
- iH = contact->avatar_data->bmHeight;
- iW = contact->avatar_data->bmWidth;
- }
- }
- else if (dat->avatar_cache.nodes)
- {
- iW = dat->avatar_cache.nodes[contact->avatar_pos].width;
- iH = dat->avatar_cache.nodes[contact->avatar_pos].height;
- }
- sz = GetAvatarSize(iW,iH,dat->avatars_maxwidth_size,dat->avatars_maxheight_size);
- if ((sz.cx == 0 || sz.cy == 0) && dat->icon_hide_on_avatar && dat->icon_draw_on_avatar_space && contact->iImage != -1)
- { sz.cx = ICON_HEIGHT; sz.cy = ICON_HEIGHT; }
-
- gl_RowTabAccess[i]->h = sz.cy;
- gl_RowTabAccess[i]->w = sz.cx;
- }
-
- break;
- }
- case TC_EXTRA:
- {
- // Draw extra icons
-
- if (contact->type == CLCIT_CONTACT &&
- (!contact->isSubcontact || db_get_b(NULL,"CLC","MetaHideExtra",SETTING_METAHIDEEXTRA_DEFAULT) == 0 && dat->extraColumnsCount > 0))
- {
- BOOL hasExtra = FALSE;
- int k;
- int width = 0;
- for (k = 0; k < dat->extraColumnsCount; k++)
- if (contact->iExtraImage[k] != 0xFF || contact->iWideExtraImage[k] != 0xFFFF || !dat->MetaIgnoreEmptyExtra)
- {
- hasExtra = TRUE;
- if (item != -1) break;
- width += (width>0)?dat->extraColumnSpacing:(dat->extraColumnSpacing-2);
- }
- if (hasExtra)
- {
- gl_RowTabAccess[i]->h = ICON_HEIGHT;
- gl_RowTabAccess[i]->w = width;
- }
- }
- break;
- }
- case TC_EXTRA1:
- case TC_EXTRA2:
- case TC_EXTRA3:
- case TC_EXTRA4:
- case TC_EXTRA5:
- case TC_EXTRA6:
- case TC_EXTRA7:
- case TC_EXTRA8:
- case TC_EXTRA9:
- {
- if (contact->type == CLCIT_CONTACT &&
- (!contact->isSubcontact || db_get_b(NULL,"CLC","MetaHideExtra",SETTING_METAHIDEEXTRA_DEFAULT) == 0 && dat->extraColumnsCount > 0))
- {
- int eNum = gl_RowTabAccess[i]->type-TC_EXTRA1;
- if (eNum < dat->extraColumnsCount)
- if (contact->iExtraImage[eNum] != 255 || contact->iWideExtraImage[eNum] != 0xFFFF || !dat->MetaIgnoreEmptyExtra)
+ BYTE i=0;
+ int res = 0;
+ int height = 0;
+ displayNameCacheEntry * pdnce;
+ BOOL hasAvatar = FALSE;
+ DWORD style;
+ style = GetWindowLongPtr(hwnd,GWL_STYLE);
+ pdnce = (displayNameCacheEntry*)pcli->pfnGetCacheEntry(contact->hContact);
+ if ( !RowHeights_Alloc(dat, item + 1))
+ return -1;
+
+ if ( !pcli->hwndContactTree)
+ return 0;
+
+ if (dat->hWnd != pcli->hwndContactTree || !gl_RowRoot || contact->type == CLCIT_GROUP) {
+ int tmp = dat->fontModernInfo[g_clcPainter.GetBasicFontID(contact)].fontHeight;
+ if (dat->text_replace_smileys && dat->first_line_draw_smileys && !dat->text_resize_smileys)
+ tmp = max(tmp, contact->ssText.iMaxSmileyHeight);
+ if (contact->type == CLCIT_GROUP) {
+ char *szCounts = pcli->pfnGetGroupCountsText(dat, contact);
+ // Has the count?
+ if (szCounts && szCounts[0])
+ tmp = max(tmp,dat->fontModernInfo[contact->group->expanded?FONTID_OPENGROUPCOUNTS:FONTID_CLOSEDGROUPCOUNTS].fontHeight);
+ }
+ tmp = max(tmp, ICON_HEIGHT);
+ tmp = max(tmp,dat->row_min_heigh);
+ tmp += dat->row_border*2;
+ if (contact->type == CLCIT_GROUP &&
+ contact->group->parent->groupId == 0 &&
+ contact->group->parent->cl.items[0] != contact)
+ tmp += dat->row_before_group_space;
+ if (item != -1) dat->row_heights[item] = tmp;
+ return tmp;
+ }
+
+ hasAvatar = (dat->use_avatar_service && contact->avatar_data != NULL) || (!dat->use_avatar_service && contact->avatar_pos != AVATAR_POS_DONT_HAVE);
+ while (gl_RowTabAccess[i] != NULL) {
+ if (gl_RowTabAccess[i]->type != TC_SPACE) {
+ gl_RowTabAccess[i]->h = 0;
+ gl_RowTabAccess[i]->w = 0;
+ SetRect(&(gl_RowTabAccess[i]->r),0,0,0,0);
+ switch (gl_RowTabAccess[i]->type) {
+ case TC_TEXT1:
+ {
+ int tmp = 0;
+ tmp = dat->fontModernInfo[g_clcPainter.GetBasicFontID(contact)].fontHeight;
+ if (dat->text_replace_smileys && dat->first_line_draw_smileys && !dat->text_resize_smileys)
+ tmp = max(tmp, contact->ssText.iMaxSmileyHeight);
+ if (item == -1)
+ {
+ //calculate text width here
+ SIZE size = {0};
+ RECT dummyRect = {0,0,1024,tmp};
+ HDC hdc = CreateCompatibleDC(NULL);
+ g_clcPainter.ChangeToFont(hdc,dat,g_clcPainter.GetBasicFontID(contact),NULL);
+ g_clcPainter.GetTextSize(&size,hdc,dummyRect,contact->szText,contact->ssText.plText,0, dat->text_resize_smileys ? 0 : contact->ssText.iMaxSmileyHeight);
+ if (contact->type == CLCIT_GROUP)
+ {
+ char * szCounts = pcli->pfnGetGroupCountsText(dat, contact);
+ if (szCounts && strlen(szCounts)>0)
+ {
+ RECT count_rc = {0};
+ // 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;
+ 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;
+ tmp = max(tmp,count_rc.bottom-count_rc.top);
+ }
+ }
+ gl_RowTabAccess[i]->w = size.cx;
+ SelectObject(hdc,GetStockObject(DEFAULT_GUI_FONT));
+ ske_ResetTextEffect(hdc);
+ mod_DeleteDC(hdc);
+ }
+ gl_RowTabAccess[i]->h = tmp;
+ }
+ break;
+
+ case TC_TEXT2:
+ {
+ int tmp = 0;
+ HANDLE hContact = pdnce->hContact;
+ if (dat->second_line_show && pdnce->szSecondLineText && pdnce->szSecondLineText[0] )
{
- gl_RowTabAccess[i]->h = ICON_HEIGHT;
- gl_RowTabAccess[i]->w = ICON_HEIGHT;
+ tmp = dat->fontModernInfo[FONTID_SECONDLINE].fontHeight;
+ if (dat->text_replace_smileys && dat->second_line_draw_smileys && !dat->text_resize_smileys)
+ tmp = max(tmp, pdnce->ssSecondLine.iMaxSmileyHeight);
+ if (item == -1)
+ {
+ //calculate text width here
+
+ SIZE size = {0};
+ RECT dummyRect = {0,0,1024,tmp};
+ HDC hdc = CreateCompatibleDC(NULL);
+ g_clcPainter.ChangeToFont(hdc,dat,FONTID_SECONDLINE,NULL);
+ g_clcPainter.GetTextSize(&size,hdc,dummyRect,pdnce->szSecondLineText,pdnce->ssSecondLine.plText,0, dat->text_resize_smileys ? 0 : pdnce->ssSecondLine.iMaxSmileyHeight);
+ gl_RowTabAccess[i]->w = size.cx;
+ SelectObject(hdc,GetStockObject(DEFAULT_GUI_FONT));
+ ske_ResetTextEffect(hdc);
+ mod_DeleteDC(hdc);
+ }
}
+ gl_RowTabAccess[i]->h = tmp;
+ }
+ break;
+
+ case TC_TEXT3:
+ {
+ HANDLE hContact = pdnce->hContact;
+ int tmp = 0;
+ if (dat->third_line_show && pdnce->szThirdLineText && pdnce->szThirdLineText[0]) {
+ tmp = dat->fontModernInfo[FONTID_THIRDLINE].fontHeight;
+ if (dat->text_replace_smileys && dat->third_line_draw_smileys && !dat->text_resize_smileys)
+ tmp = max(tmp, pdnce->ssThirdLine.iMaxSmileyHeight);
+ if (item == -1) {
+ //calculate text width here
+ SIZE size = {0};
+ RECT dummyRect = {0,0,1024,tmp};
+ HDC hdc = CreateCompatibleDC(NULL);
+ g_clcPainter.ChangeToFont(hdc,dat,FONTID_THIRDLINE,NULL);
+ g_clcPainter.GetTextSize(&size,hdc,dummyRect,pdnce->szThirdLineText,pdnce->ssThirdLine.plText,0, dat->text_resize_smileys ? 0 : pdnce->ssThirdLine.iMaxSmileyHeight);
+ gl_RowTabAccess[i]->w = size.cx;
+ SelectObject(hdc,GetStockObject(DEFAULT_GUI_FONT));
+ ske_ResetTextEffect(hdc);
+ mod_DeleteDC(hdc);
+ }
+ }
+ gl_RowTabAccess[i]->h = tmp;
+ }
+ break;
+
+ case TC_STATUS:
+ if ((contact->type == CLCIT_GROUP && !dat->row_hide_group_icon) ||
+ (contact->type == CLCIT_CONTACT && contact->iImage != -1 &&
+ !(dat->icon_hide_on_avatar && dat->avatars_show && (hasAvatar || (!hasAvatar && dat->icon_draw_on_avatar_space && contact->iImage != -1)) && !contact->image_is_special)))
+ {
+ gl_RowTabAccess[i]->h = ICON_HEIGHT;
+ gl_RowTabAccess[i]->w = ICON_HEIGHT;
+ }
+ break;
+
+ case TC_AVATAR:
+ if (dat->avatars_show &&
+ contact->type == CLCIT_CONTACT &&
+ (hasAvatar || (dat->icon_hide_on_avatar && dat->icon_draw_on_avatar_space && contact->iImage != -1)))
+ {
+ SIZE sz = {0};
+ int iW = 0, iH = 0;
+ if (dat->use_avatar_service) {
+ if (contact->avatar_data) {
+ iH = contact->avatar_data->bmHeight;
+ iW = contact->avatar_data->bmWidth;
+ }
+ }
+ else if (dat->avatar_cache.nodes) {
+ iW = dat->avatar_cache.nodes[contact->avatar_pos].width;
+ iH = dat->avatar_cache.nodes[contact->avatar_pos].height;
+ }
+ sz = GetAvatarSize(iW,iH,dat->avatars_maxwidth_size,dat->avatars_maxheight_size);
+ if ((sz.cx == 0 || sz.cy == 0) && dat->icon_hide_on_avatar && dat->icon_draw_on_avatar_space && contact->iImage != -1)
+ sz.cx = ICON_HEIGHT, sz.cy = ICON_HEIGHT;
+
+ gl_RowTabAccess[i]->h = sz.cy;
+ gl_RowTabAccess[i]->w = sz.cx;
+ }
+ break;
+
+ case TC_EXTRA:
+ // Draw extra icons
+
+ if (contact->type == CLCIT_CONTACT &&
+ (!contact->isSubcontact || db_get_b(NULL,"CLC","MetaHideExtra",SETTING_METAHIDEEXTRA_DEFAULT) == 0 && dat->extraColumnsCount > 0))
+ {
+ BOOL hasExtra = FALSE;
+ int width = 0;
+ for (int k = 0; k < dat->extraColumnsCount; k++)
+ if (contact->iExtraImage[k] != 0xFF || contact->iWideExtraImage[k] != 0xFFFF || !dat->MetaIgnoreEmptyExtra) {
+ hasExtra = TRUE;
+ if (item != -1) break;
+ width += (width>0)?dat->extraColumnSpacing:(dat->extraColumnSpacing-2);
+ }
+ if (hasExtra) {
+ gl_RowTabAccess[i]->h = ICON_HEIGHT;
+ gl_RowTabAccess[i]->w = width;
+ }
+ }
+ break;
+
+ case TC_EXTRA1:
+ case TC_EXTRA2:
+ case TC_EXTRA3:
+ case TC_EXTRA4:
+ case TC_EXTRA5:
+ case TC_EXTRA6:
+ case TC_EXTRA7:
+ case TC_EXTRA8:
+ case TC_EXTRA9:
+ if (contact->type == CLCIT_CONTACT &&
+ (!contact->isSubcontact || db_get_b(NULL,"CLC","MetaHideExtra",SETTING_METAHIDEEXTRA_DEFAULT) == 0 && dat->extraColumnsCount > 0))
+ {
+ int eNum = gl_RowTabAccess[i]->type-TC_EXTRA1;
+ if (eNum < dat->extraColumnsCount)
+ if (contact->iExtraImage[eNum] != 255 || contact->iWideExtraImage[eNum] != 0xFFFF || !dat->MetaIgnoreEmptyExtra) {
+ gl_RowTabAccess[i]->h = ICON_HEIGHT;
+ gl_RowTabAccess[i]->w = ICON_HEIGHT;
+ }
+ }
+ break;
+
+ case TC_TIME:
+ if (contact->type == CLCIT_CONTACT && dat->contact_time_show && pdnce->hTimeZone) {
+ gl_RowTabAccess[i]->h = dat->fontModernInfo[FONTID_CONTACT_TIME].fontHeight;
+ if (item == -1) {
+ TCHAR szResult[80];
+
+ if ( !tmi.printDateTime(pdnce->hTimeZone, _T("t"), szResult, SIZEOF(szResult), 0)) {
+ SIZE text_size = {0};
+ RECT rc = {0};
+ // Select font
+ HDC hdc = CreateCompatibleDC(NULL);
+ g_clcPainter.ChangeToFont(hdc,dat,FONTID_CONTACT_TIME,NULL);
+
+ // Get text size
+ text_size.cy = ske_DrawText(hdc, szResult, lstrlen(szResult), &rc, DT_CALCRECT | DT_NOPREFIX | DT_SINGLELINE);
+ SelectObject(hdc,GetStockObject(DEFAULT_GUI_FONT));
+ ske_ResetTextEffect(hdc);
+ mod_DeleteDC(hdc);
+ text_size.cx = rc.right - rc.left;
+ gl_RowTabAccess[i]->w = text_size.cx;
+ }
+ }
+ }
+ break;
}
- break;
- }
- case TC_TIME:
- {
- if (contact->type == CLCIT_CONTACT && dat->contact_time_show && pdnce->hTimeZone)
- {
- gl_RowTabAccess[i]->h = dat->fontModernInfo[FONTID_CONTACT_TIME].fontHeight;
- if (item == -1)
- {
- TCHAR szResult[80];
-
- if ( !tmi.printDateTime(pdnce->hTimeZone, _T("t"), szResult, SIZEOF(szResult), 0))
- {
- SIZE text_size = {0};
- RECT rc = {0};
- // Select font
- HDC hdc = CreateCompatibleDC(NULL);
- g_clcPainter.ChangeToFont(hdc,dat,FONTID_CONTACT_TIME,NULL);
-
- // Get text size
- text_size.cy = ske_DrawText(hdc, szResult, lstrlen(szResult), &rc, DT_CALCRECT | DT_NOPREFIX | DT_SINGLELINE);
- SelectObject(hdc,GetStockObject(DEFAULT_GUI_FONT));
- ske_ResetTextEffect(hdc);
- mod_DeleteDC(hdc);
- text_size.cx = rc.right - rc.left;
- gl_RowTabAccess[i]->w = text_size.cx;
-
- }
- }
- }
- break;
- }
- }
- }
- i++;
- }
-
- height = cppCalculateRowHeight(gl_RowRoot);
- height += dat->row_border*2;
- height = max(height,dat->row_min_heigh);
- if (item != -1) dat->row_heights[item] = height;
- return height;
+ }
+ i++;
+ }
+
+ height = cppCalculateRowHeight(gl_RowRoot);
+ height += dat->row_border*2;
+ height = max(height,dat->row_min_heigh);
+ if (item != -1) dat->row_heights[item] = height;
+ return height;
}
-
-
-
/*
*
*/
-
-
-
BOOL RowHeights_Initialize(struct ClcData *dat)
{
- dat->rowHeight = 0;
- dat->row_heights_size = 0;
- dat->row_heights_allocated = 0;
- dat->row_heights = NULL;
+ dat->rowHeight = 0;
+ dat->row_heights_size = 0;
+ dat->row_heights_allocated = 0;
+ dat->row_heights = NULL;
- return TRUE;
+ return TRUE;
}
void RowHeights_Free(struct ClcData *dat)
{
- if (dat->row_heights != NULL)
- {
- free(dat->row_heights);
- dat->row_heights = NULL;
- }
-
- dat->row_heights_allocated = 0;
- dat->row_heights_size = 0;
+ if (dat->row_heights != NULL) {
+ free(dat->row_heights);
+ dat->row_heights = NULL;
+ }
+
+ dat->row_heights_allocated = 0;
+ dat->row_heights_size = 0;
}
void RowHeights_Clear(struct ClcData *dat)
{
- dat->row_heights_size = 0;
+ dat->row_heights_size = 0;
}
-
BOOL RowHeights_Alloc(struct ClcData *dat, int size)
{
- if (size > dat->row_heights_size)
- {
- if (size > dat->row_heights_allocated)
- {
- int size_grow = size;
-
- size_grow += 100 - (size_grow % 100);
-
- if (dat->row_heights != NULL)
- {
- int *tmp = (int *) realloc((void *)dat->row_heights, sizeof(int) * size_grow);
-
- if (tmp == NULL)
- {
- TRACE("Out of memory: realloc returned NULL (RowHeights_Alloc)");
- RowHeights_Free(dat);
- return FALSE;
- }
-
- dat->row_heights = tmp;
- memset(dat->row_heights+(dat->row_heights_allocated),0,sizeof(int) * (size_grow-dat->row_heights_allocated));
- }
- else
- {
- dat->row_heights = (int *) malloc(sizeof(int) * size_grow);
-
- if (dat->row_heights == NULL)
- {
- TRACE("Out of memory: alloc returned NULL (RowHeights_Alloc)");
- RowHeights_Free(dat);
- return FALSE;
- }
- memset(dat->row_heights,0,sizeof(int) * size_grow);
- }
-
- dat->row_heights_allocated = size_grow;
- }
-
- dat->row_heights_size = size;
- }
-
- return TRUE;
-}
+ if (size > dat->row_heights_size) {
+ if (size > dat->row_heights_allocated) {
+ int size_grow = size;
+
+ size_grow += 100 - (size_grow % 100);
+
+ if (dat->row_heights != NULL) {
+ int *tmp = (int *) realloc((void *)dat->row_heights, sizeof(int) * size_grow);
+ if (tmp == NULL) {
+ TRACE("Out of memory: realloc returned NULL (RowHeights_Alloc)");
+ RowHeights_Free(dat);
+ return FALSE;
+ }
+
+ dat->row_heights = tmp;
+ memset(dat->row_heights+(dat->row_heights_allocated),0,sizeof(int) * (size_grow-dat->row_heights_allocated));
+ }
+ else {
+ dat->row_heights = (int *) malloc(sizeof(int) * size_grow);
+ if (dat->row_heights == NULL) {
+ TRACE("Out of memory: alloc returned NULL (RowHeights_Alloc)");
+ RowHeights_Free(dat);
+ return FALSE;
+ }
+ memset(dat->row_heights,0,sizeof(int) * size_grow);
+ }
+ dat->row_heights_allocated = size_grow;
+ }
+ dat->row_heights_size = size;
+ }
+ return TRUE;
+}
// Calc and store max row height
+
+static int contact_fonts[] = {
+ FONTID_CONTACTS, FONTID_INVIS, FONTID_OFFLINE, FONTID_NOTONLIST, FONTID_OFFINVIS,
+ FONTID_AWAY,FONTID_DND, FONTID_NA, FONTID_OCCUPIED, FONTID_CHAT, FONTID_INVISIBLE,
+ FONTID_PHONE, FONTID_LUNCH };
+
+static int other_fonts[] = {FONTID_OPENGROUPS, FONTID_OPENGROUPCOUNTS,FONTID_CLOSEDGROUPS, FONTID_CLOSEDGROUPCOUNTS, FONTID_DIVIDERS, FONTID_CONTACT_TIME};
+
int RowHeights_GetMaxRowHeight(struct ClcData *dat, HWND hwnd)
{
- int max_height = 0, i, tmp;
- DWORD style = GetWindowLongPtr(hwnd,GWL_STYLE);
-
- if ( !dat->text_ignore_size_for_row_height)
- {
- int contact_fonts[] = {FONTID_CONTACTS, FONTID_INVIS, FONTID_OFFLINE, FONTID_NOTONLIST, FONTID_OFFINVIS,
- FONTID_AWAY,FONTID_DND, FONTID_NA, FONTID_OCCUPIED, FONTID_CHAT, FONTID_INVISIBLE,
- FONTID_PHONE, FONTID_LUNCH};
- int other_fonts[] = {FONTID_OPENGROUPS, FONTID_OPENGROUPCOUNTS,FONTID_CLOSEDGROUPS, FONTID_CLOSEDGROUPCOUNTS, FONTID_DIVIDERS, FONTID_CONTACT_TIME};
-
- // Get contact font size
- tmp = 0;
- for (i=0 ; i < MAX_REGS(contact_fonts) ; i++)
- {
- if (tmp < dat->fontModernInfo[contact_fonts[i]].fontHeight)
- tmp = dat->fontModernInfo[contact_fonts[i]].fontHeight;
- }
- if (dat->text_replace_smileys && dat->first_line_draw_smileys && !dat->text_resize_smileys)
- {
- tmp = max(tmp, dat->text_smiley_height);
- }
- max_height += tmp;
-
- if (dat->second_line_show)
- {
- tmp = dat->fontModernInfo[FONTID_SECONDLINE].fontHeight;
- if (dat->text_replace_smileys && dat->second_line_draw_smileys && !dat->text_resize_smileys)
- {
- tmp = max(tmp, dat->text_smiley_height);
- }
- max_height += dat->second_line_top_space + tmp;
- }
-
- if (dat->third_line_show)
- {
- tmp = dat->fontModernInfo[FONTID_THIRDLINE].fontHeight;
- if (dat->text_replace_smileys && dat->third_line_draw_smileys && !dat->text_resize_smileys)
- {
- tmp = max(tmp, dat->text_smiley_height);
- }
- max_height += dat->third_line_top_space + tmp;
- }
-
- // Get other font sizes
- for (i=0 ; i < MAX_REGS(other_fonts) ; i++)
- {
- if (max_height < dat->fontModernInfo[other_fonts[i]].fontHeight)
- max_height = dat->fontModernInfo[other_fonts[i]].fontHeight;
- }
- }
-
- // Avatar size
- if (dat->avatars_show && !dat->avatars_ignore_size_for_row_height)
- {
- max_height = max(max_height, dat->avatars_maxheight_size);
- }
-
- // Checkbox size
- if (style&CLS_CHECKBOXES || style&CLS_GROUPCHECKBOXES)
- {
- max_height = max(max_height, dat->checkboxSize);
- }
-
- // Icon size
- if ( !dat->icon_ignore_size_for_row_height)
- {
- max_height = max(max_height, ICON_HEIGHT);
- }
-
- max_height += 2 * dat->row_border;
-
- // Min size
- max_height = max(max_height, dat->row_min_heigh);
-
- dat->rowHeight = max_height;
-
- return max_height;
+ int max_height = 0, i, tmp;
+ DWORD style = GetWindowLongPtr(hwnd,GWL_STYLE);
+
+ if ( !dat->text_ignore_size_for_row_height) {
+ // Get contact font size
+ tmp = 0;
+ for (i=0 ; i < MAX_REGS(contact_fonts) ; i++)
+ if (tmp < dat->fontModernInfo[contact_fonts[i]].fontHeight)
+ tmp = dat->fontModernInfo[contact_fonts[i]].fontHeight;
+
+ if (dat->text_replace_smileys && dat->first_line_draw_smileys && !dat->text_resize_smileys)
+ tmp = max(tmp, dat->text_smiley_height);
+
+ max_height += tmp;
+
+ if (dat->second_line_show) {
+ tmp = dat->fontModernInfo[FONTID_SECONDLINE].fontHeight;
+ if (dat->text_replace_smileys && dat->second_line_draw_smileys && !dat->text_resize_smileys)
+ tmp = max(tmp, dat->text_smiley_height);
+ max_height += dat->second_line_top_space + tmp;
+ }
+
+ if (dat->third_line_show) {
+ tmp = dat->fontModernInfo[FONTID_THIRDLINE].fontHeight;
+ if (dat->text_replace_smileys && dat->third_line_draw_smileys && !dat->text_resize_smileys)
+ tmp = max(tmp, dat->text_smiley_height);
+ max_height += dat->third_line_top_space + tmp;
+ }
+
+ // Get other font sizes
+ for (i=0 ; i < MAX_REGS(other_fonts) ; i++)
+ if (max_height < dat->fontModernInfo[other_fonts[i]].fontHeight)
+ max_height = dat->fontModernInfo[other_fonts[i]].fontHeight;
+ }
+
+ // Avatar size
+ if (dat->avatars_show && !dat->avatars_ignore_size_for_row_height)
+ max_height = max(max_height, dat->avatars_maxheight_size);
+
+ // Checkbox size
+ if (style & CLS_CHECKBOXES || style & CLS_GROUPCHECKBOXES)
+ max_height = max(max_height, dat->checkboxSize);
+
+ // Icon size
+ if ( !dat->icon_ignore_size_for_row_height)
+ max_height = max(max_height, ICON_HEIGHT);
+
+ max_height += 2 * dat->row_border;
+
+ // Min size
+ max_height = max(max_height, dat->row_min_heigh);
+
+ dat->rowHeight = max_height;
+ return max_height;
}
-
// Calc and store row height for all items in the list
void RowHeights_CalcRowHeights(struct ClcData *dat, HWND hwnd)
{
@@ -528,269 +472,216 @@ void RowHeights_CalcRowHeights(struct ClcData *dat, HWND hwnd) void RowHeights_CalcRowHeights_Worker(struct ClcData *dat, HWND hwnd)
{
- int indent, subident, subindex, line_num;
- struct ClcContact *Drawing;
- struct ClcGroup *group;
-
- if (MirandaExiting()) return;
-
- // Draw lines
- group = &dat->list;
- group->scanIndex = 0;
- indent = 0;
- subindex = -1;
- line_num = -1;
-
- RowHeights_Clear(dat);
-
- while(TRUE)
- {
- if (subindex == -1)
- {
- if (group->scanIndex == group->cl.count)
- {
- group = group->parent;
- indent--;
- if (group == NULL) break; // Finished list
- group->scanIndex++;
- continue;
- }
-
- // Get item to draw
- Drawing = group->cl.items[group->scanIndex];
- subident = 0;
- }
- else
- {
- // Get item to draw
- Drawing = &(group->cl.items[group->scanIndex]->subcontacts[subindex]);
- subident = dat->subIndent;
- }
-
- line_num++;
-
- // Calc row height
- if ( !gl_RowRoot) RowHeights_GetRowHeight(dat, hwnd, Drawing, line_num);
- else RowHeight_CalcRowHeight(dat, hwnd, Drawing, line_num);
-
- //increment by subcontacts
- if (group->cl.items[group->scanIndex]->subcontacts != NULL && group->cl.items[group->scanIndex]->type != CLCIT_GROUP)
- {
- if (group->cl.items[group->scanIndex]->SubExpanded && dat->expandMeta)
- {
- if (subindex < group->cl.items[group->scanIndex]->SubAllocated-1)
- {
- subindex++;
- }
- else
- {
- subindex = -1;
- }
- }
- }
-
- if (subindex == -1)
- {
- if (group->cl.items[group->scanIndex]->type == CLCIT_GROUP && group->cl.items[group->scanIndex]->group->expanded)
- {
- group = group->cl.items[group->scanIndex]->group;
- indent++;
- group->scanIndex = 0;
- subindex = -1;
- continue;
- }
- group->scanIndex++;
- }
- }
-
-}
+ if (MirandaExiting()) return;
+
+ // Draw lines
+ ClcGroup *group = &dat->list;
+ ClcContact *Drawing;
+ group->scanIndex = 0;
+ int indent = 0, subident;
+ int subindex = -1;
+ int line_num = -1;
+
+ RowHeights_Clear(dat);
+
+ while(TRUE) {
+ if (subindex == -1) {
+ if (group->scanIndex == group->cl.count) {
+ group = group->parent;
+ indent--;
+ if (group == NULL) break; // Finished list
+ group->scanIndex++;
+ continue;
+ }
+ // Get item to draw
+ Drawing = group->cl.items[group->scanIndex];
+ subident = 0;
+ }
+ else {
+ // Get item to draw
+ Drawing = &(group->cl.items[group->scanIndex]->subcontacts[subindex]);
+ subident = dat->subIndent;
+ }
+
+ line_num++;
+
+ // Calc row height
+ if ( !gl_RowRoot)
+ RowHeights_GetRowHeight(dat, hwnd, Drawing, line_num);
+ else
+ RowHeight_CalcRowHeight(dat, hwnd, Drawing, line_num);
+
+ //increment by subcontacts
+ if (group->cl.items[group->scanIndex]->subcontacts != NULL && group->cl.items[group->scanIndex]->type != CLCIT_GROUP) {
+ if (group->cl.items[group->scanIndex]->SubExpanded && dat->expandMeta) {
+ if (subindex < group->cl.items[group->scanIndex]->SubAllocated-1)
+ subindex++;
+ else
+ subindex = -1;
+ }
+ }
+
+ if (subindex == -1) {
+ if (group->cl.items[group->scanIndex]->type == CLCIT_GROUP && group->cl.items[group->scanIndex]->group->expanded) {
+ group = group->cl.items[group->scanIndex]->group;
+ indent++;
+ group->scanIndex = 0;
+ subindex = -1;
+ continue;
+ }
+ group->scanIndex++;
+ }
+ }
+}
// Calc and store row height
-int RowHeights_GetRowHeight(struct ClcData *dat, HWND hwnd, struct ClcContact *contact, int item)
+int RowHeights_GetRowHeight(struct ClcData *dat, HWND hwnd, ClcContact *contact, int item)
{
- int res;
- if (MirandaExiting()) return 0;
- g_mutex_nCalcRowHeightLock++;
- res = RowHeights_GetRowHeight_worker(dat, hwnd, contact, item);
- g_mutex_nCalcRowHeightLock--;
- return res;
+ if (MirandaExiting()) return 0;
+ g_mutex_nCalcRowHeightLock++;
+ int res = RowHeights_GetRowHeight_worker(dat, hwnd, contact, item);
+ g_mutex_nCalcRowHeightLock--;
+ return res;
}
-int RowHeights_GetRowHeight_worker(struct ClcData *dat, HWND hwnd, struct ClcContact *contact, int item)
+int RowHeights_GetRowHeight_worker(struct ClcData *dat, HWND hwnd, ClcContact *contact, int item)
{
- int height = 0;
- if (MirandaExiting()) return 0;
- if (gl_RowRoot)
- return RowHeight_CalcRowHeight(dat, hwnd, contact, item);
- else
- {
- displayNameCacheEntry *pdnce = (displayNameCacheEntry *)pcli->pfnGetCacheEntry(contact->hContact);
- DWORD style = GetWindowLongPtr(hwnd,GWL_STYLE);
- //TODO replace futher code with new rowheight definition
- int tmp;
+ if (gl_RowRoot)
+ return RowHeight_CalcRowHeight(dat, hwnd, contact, item);
+
+ DWORD style = GetWindowLongPtr(hwnd, GWL_STYLE);
+ //TODO replace futher code with new rowheight definition
+ int tmp;
BOOL selected = ((item == dat->selection) && (dat->hwndRenameEdit != NULL || dat->showSelAlways || dat->exStyle&CLS_EX_SHOWSELALWAYS || g_clcPainter.IsForegroundWindow(hwnd)) && contact->type != CLCIT_DIVIDER);
BOOL hottrack = ((item == dat->iHotTrack) && (dat->hwndRenameEdit != NULL || dat->showSelAlways || dat->exStyle&CLS_EX_SHOWSELALWAYS || g_clcPainter.IsForegroundWindow(hwnd)) && contact->type != CLCIT_DIVIDER);
BOOL minimalistic = (g_clcPainter.CheckMiniMode(dat,selected,hottrack));
- if ( !RowHeights_Alloc(dat, item + 1))
- return -1;
-
- if (dat->row_variable_height)
- {
- if ( !dat->text_ignore_size_for_row_height)
- {
- HANDLE hContact = pdnce->hContact;
- tmp = dat->fontModernInfo[g_clcPainter.GetBasicFontID(contact)].fontHeight;
- if (dat->text_replace_smileys && dat->first_line_draw_smileys && !dat->text_resize_smileys)
- {
- tmp = max(tmp, contact->ssText.iMaxSmileyHeight);
- }
- height += tmp;
-
- if ( !minimalistic && dat->second_line_show && pdnce->szSecondLineText && pdnce->szSecondLineText[0])
- {
- tmp = dat->fontModernInfo[FONTID_SECONDLINE].fontHeight;
- if (dat->text_replace_smileys && dat->second_line_draw_smileys && !dat->text_resize_smileys)
- {
- tmp = max(tmp, pdnce->ssSecondLine.iMaxSmileyHeight);
- }
- height += dat->second_line_top_space + tmp;
- }
-
- if ( !minimalistic && dat->third_line_show && pdnce->szThirdLineText && pdnce->szThirdLineText[0])
- {
- tmp = dat->fontModernInfo[FONTID_THIRDLINE].fontHeight;
- if (dat->text_replace_smileys && dat->third_line_draw_smileys && !dat->text_resize_smileys)
- {
- tmp = max(tmp, pdnce->ssThirdLine.iMaxSmileyHeight);
- }
- height += dat->third_line_top_space + tmp;
- }
- }
-
- // Avatar size
- if (dat->avatars_show && !dat->avatars_ignore_size_for_row_height &&
- contact->type == CLCIT_CONTACT &&
- (
- (dat->use_avatar_service && contact->avatar_data != NULL) ||
- (!dat->use_avatar_service && contact->avatar_pos != AVATAR_POS_DONT_HAVE)
- ) && !minimalistic )
- {
- height = max(height, dat->avatars_maxheight_size);
- }
-
- // Checkbox size
- if ((style&CLS_CHECKBOXES && contact->type == CLCIT_CONTACT) ||
- (style&CLS_GROUPCHECKBOXES && contact->type == CLCIT_GROUP) ||
- (contact->type == CLCIT_INFO && contact->flags&CLCIIF_CHECKBOX))
- {
- height = max(height, dat->checkboxSize);
- }
-
- // Icon size
- if ( !dat->icon_ignore_size_for_row_height)
- {
- if (contact->type == CLCIT_GROUP
- || (contact->type == CLCIT_CONTACT && contact->iImage != -1
- && !(dat->icon_hide_on_avatar && dat->avatars_show
- && ((dat->use_avatar_service && contact->avatar_data != NULL) ||
- (!dat->use_avatar_service && contact->avatar_pos != AVATAR_POS_DONT_HAVE)
- )
- && !contact->image_is_special)))
- {
- height = max(height, ICON_HEIGHT);
- }
- }
-
- height += 2 * dat->row_border;
-
- // Min size
- height = max(height, dat->row_min_heigh);
- }
- else
- {
- height = dat->rowHeight;
- }
-
- dat->row_heights[item] = height;
-
- return height;
- }
-}
+ if ( !RowHeights_Alloc(dat, item + 1))
+ return -1;
+
+ int height = 0;
+ displayNameCacheEntry *pdnce = (contact->type == CLCIT_CONTACT) ? (displayNameCacheEntry*)pcli->pfnGetCacheEntry(contact->hContact) : NULL;
+
+ if (dat->row_variable_height) {
+ if ( !dat->text_ignore_size_for_row_height) {
+ tmp = dat->fontModernInfo[g_clcPainter.GetBasicFontID(contact)].fontHeight;
+ if (dat->text_replace_smileys && dat->first_line_draw_smileys && !dat->text_resize_smileys)
+ tmp = max(tmp, contact->ssText.iMaxSmileyHeight);
+ height += tmp;
+
+ if (pdnce) {
+ if ( !minimalistic && dat->second_line_show && pdnce->szSecondLineText && pdnce->szSecondLineText[0]) {
+ tmp = dat->fontModernInfo[FONTID_SECONDLINE].fontHeight;
+ if (dat->text_replace_smileys && dat->second_line_draw_smileys && !dat->text_resize_smileys)
+ tmp = max(tmp, pdnce->ssSecondLine.iMaxSmileyHeight);
+ height += dat->second_line_top_space + tmp;
+ }
+
+ if ( !minimalistic && dat->third_line_show && pdnce->szThirdLineText && pdnce->szThirdLineText[0]) {
+ tmp = dat->fontModernInfo[FONTID_THIRDLINE].fontHeight;
+ if (dat->text_replace_smileys && dat->third_line_draw_smileys && !dat->text_resize_smileys)
+ tmp = max(tmp, pdnce->ssThirdLine.iMaxSmileyHeight);
+ height += dat->third_line_top_space + tmp;
+ }
+ }
+ }
+
+ // Avatar size
+ if (dat->avatars_show && !dat->avatars_ignore_size_for_row_height &&
+ contact->type == CLCIT_CONTACT &&
+ ((dat->use_avatar_service && contact->avatar_data != NULL) || (!dat->use_avatar_service && contact->avatar_pos != AVATAR_POS_DONT_HAVE)) && !minimalistic )
+ {
+ height = max(height, dat->avatars_maxheight_size);
+ }
+
+ // Checkbox size
+ if ((style & CLS_CHECKBOXES && contact->type == CLCIT_CONTACT) ||
+ (style & CLS_GROUPCHECKBOXES && contact->type == CLCIT_GROUP) ||
+ (contact->type == CLCIT_INFO && contact->flags & CLCIIF_CHECKBOX))
+ {
+ height = max(height, dat->checkboxSize);
+ }
+
+ // Icon size
+ if ( !dat->icon_ignore_size_for_row_height) {
+ if (contact->type == CLCIT_GROUP
+ || (contact->type == CLCIT_CONTACT && contact->iImage != -1
+ && !(dat->icon_hide_on_avatar && dat->avatars_show
+ && ((dat->use_avatar_service && contact->avatar_data != NULL) ||
+ (!dat->use_avatar_service && contact->avatar_pos != AVATAR_POS_DONT_HAVE))
+ && !contact->image_is_special)))
+ {
+ height = max(height, ICON_HEIGHT);
+ }
+ }
+ height += 2 * dat->row_border;
+
+ // Min size
+ height = max(height, dat->row_min_heigh);
+ }
+ else height = dat->rowHeight;
+
+ dat->row_heights[item] = height;
+
+ return height;
+}
// Calc item top Y (using stored data)
int cliGetRowTopY(struct ClcData *dat, int item)
{
- int i;
- int y = 0;
- if (item >= dat->row_heights_size)
- return cliGetRowBottomY(dat,item-1);
-
- for (i=0 ; i < item ; i++)
- {
- y += dat->row_heights[i];
- }
+ if (item >= dat->row_heights_size)
+ return cliGetRowBottomY(dat,item-1);
- return y;
+ int y = 0;
+ for (int i=0 ; i < item ; i++)
+ y += dat->row_heights[i];
+ return y;
}
-
// Calc item bottom Y (using stored data)
int cliGetRowBottomY(struct ClcData *dat, int item)
{
- int i;
- int y = 0;
+ if (item >= dat->row_heights_size)
+ return -1;
- if (item >= dat->row_heights_size)
- return -1;
-
- for (i=0 ; i <= item ; i++)
- {
- y += dat->row_heights[i];
- }
-
- return y;
+ int y = 0;
+ for (int i=0 ; i <= item ; i++)
+ y += dat->row_heights[i];
+ return y;
}
// Calc total height of rows (using stored data)
int cliGetRowTotalHeight(struct ClcData *dat)
{
- int i;
- int y = 0;
-
- for (i=0 ; i < dat->row_heights_size ; i++)
- {
- y += dat->row_heights[i];
- }
+ int y = 0;
+ for (int i=0 ; i < dat->row_heights_size ; i++)
+ y += dat->row_heights[i];
- return y;
+ return y;
}
// Return the line that pos_y is at or -1 (using stored data)
int cliRowHitTest(struct ClcData *dat, int pos_y)
{
- int i;
- int y = 0;
+ if (pos_y < 0)
+ return -1;
- if (pos_y < 0)
- return -1;
+ int y = 0;
+ for (int i=0 ; i < dat->row_heights_size ; i++) {
+ y += dat->row_heights[i];
+ if (pos_y < y)
+ return i;
+ }
- for (i=0 ; i < dat->row_heights_size ; i++)
- {
- y += dat->row_heights[i];
-
- if (pos_y < y)
- return i;
- }
-
- return -1;
+ return -1;
}
int cliGetRowHeight(struct ClcData *dat, int item)
{
- if ( item >= dat->row_heights_size || item < 0 )
- return dat->rowHeight;
- return dat->row_heights[ item ];
+ if ( item >= dat->row_heights_size || item < 0 )
+ return dat->rowHeight;
+
+ return dat->row_heights[ item ];
}
|