summaryrefslogtreecommitdiff
path: root/plugins/Clist_modern/modern_clcutils.cpp
diff options
context:
space:
mode:
authorGeorge Hazan <george.hazan@gmail.com>2012-07-06 20:23:55 +0000
committerGeorge Hazan <george.hazan@gmail.com>2012-07-06 20:23:55 +0000
commit2799d3c1c54f5b4681b45b76cfdacb081312ae88 (patch)
tree7c3fcf6b8bb40fd3226e1c76ba0f70e53fa923a1 /plugins/Clist_modern/modern_clcutils.cpp
parentfd2115f98aca6fa093498cf7a24216a12b05a885 (diff)
- crash fix in Clist Modern cache
- code cleaning git-svn-id: http://svn.miranda-ng.org/main/trunk@800 1316c22d-e87f-b044-9b9b-93d7a3e3ba9c
Diffstat (limited to 'plugins/Clist_modern/modern_clcutils.cpp')
-rw-r--r--plugins/Clist_modern/modern_clcutils.cpp506
1 files changed, 253 insertions, 253 deletions
diff --git a/plugins/Clist_modern/modern_clcutils.cpp b/plugins/Clist_modern/modern_clcutils.cpp
index 6a30eefd71..cc99840039 100644
--- a/plugins/Clist_modern/modern_clcutils.cpp
+++ b/plugins/Clist_modern/modern_clcutils.cpp
@@ -30,77 +30,77 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
BOOL RectHitTest(RECT *rc, int testx, int testy)
{
- return testx >= rc->left && testx < rc->right && testy >= rc->top && testy < rc->bottom;
+ 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)
{
- struct ClcContact *hitcontact=NULL;
- struct ClcGroup *hitgroup=NULL;
- int hit=-1;
+ struct ClcContact *hitcontact = NULL;
+ struct ClcGroup *hitgroup = NULL;
+ int hit = -1;
RECT clRect;
- if (CLUI_TestCursorOnBorders()!=0)
+ if (CLUI_TestCursorOnBorders() != 0)
{
- if(flags) *flags=CLCHT_NOWHERE;
+ if (flags) *flags = CLCHT_NOWHERE;
return -1;
}
- if(flags) *flags=0;
+ if (flags) *flags = 0;
GetClientRect(hwnd,&clRect);
- if(testx<0 || testy<0 || testy>=clRect.bottom || testx>=clRect.right) {
- if(flags) {
- if(testx<0) *flags|=CLCHT_TOLEFT;
- else if(testx>=clRect.right) *flags|=CLCHT_TORIGHT;
- if(testy<0) *flags|=CLCHT_ABOVE;
- else if(testy>=clRect.bottom) *flags|=CLCHT_BELOW;
+ if (testx < 0 || testy < 0 || testy >= clRect.bottom || testx >= clRect.right) {
+ if (flags) {
+ if (testx < 0) *flags |= CLCHT_TOLEFT;
+ else if (testx >= clRect.right) *flags |= CLCHT_TORIGHT;
+ if (testy < 0) *flags |= CLCHT_ABOVE;
+ else if (testy >= clRect.bottom) *flags |= CLCHT_BELOW;
}
return -1;
}
- if(testx<dat->leftMargin) {
- if(flags) *flags|=CLCHT_INLEFTMARGIN|CLCHT_NOWHERE;
+ if (testx < dat->leftMargin) {
+ if (flags) *flags |= CLCHT_INLEFTMARGIN|CLCHT_NOWHERE;
return -1;
}
// Get hit item
hit = cliRowHitTest(dat, dat->yScroll + testy);
- if (hit != -1)
+ if (hit !=-1)
hit = cliGetRowByIndex(dat, hit, &hitcontact, &hitgroup);
- if(hit==-1) {
- if(flags) *flags|=CLCHT_NOWHERE|CLCHT_BELOWITEMS;
+ if (hit == -1) {
+ if (flags) *flags |= CLCHT_NOWHERE|CLCHT_BELOWITEMS;
return -1;
}
- if(contact) *contact=hitcontact;
- if(group) *group=hitgroup;
+ if (contact) *contact = hitcontact;
+ if (group) *group = hitgroup;
/////////
- if ( ((testx<hitcontact->pos_indent) && !dat->text_rtl) ||
+ if ( ((testx < hitcontact->pos_indent) && !dat->text_rtl) ||
((testx>clRect.right-hitcontact->pos_indent) && dat->text_rtl))
{
- if(flags) *flags|=CLCHT_ONITEMINDENT;
+ if (flags) *flags |= CLCHT_ONITEMINDENT;
return hit;
}
if (RectHitTest(&hitcontact->pos_check, testx, testy))
{
- if(flags) *flags|=CLCHT_ONITEMCHECK;
+ if (flags) *flags |= CLCHT_ONITEMCHECK;
return hit;
}
if (RectHitTest(&hitcontact->pos_avatar, testx, testy))
{
- if(flags) *flags|=CLCHT_ONITEMICON;
+ if (flags) *flags |= CLCHT_ONITEMICON;
return hit;
}
if (RectHitTest(&hitcontact->pos_icon, testx, testy))
{
- if(flags) *flags|=CLCHT_ONITEMICON;
+ if (flags) *flags |= CLCHT_ONITEMICON;
return hit;
}
// if (testx>hitcontact->pos_extra) {
- // if(flags)
+ // if (flags)
{
// int c = -1;
int i;
@@ -108,49 +108,49 @@ int cliHitTest(HWND hwnd,struct ClcData *dat,int testx,int testy,struct ClcConta
{
if (RectHitTest(&hitcontact->pos_extra[i], testx, testy))
{
- if(flags) *flags|=CLCHT_ONITEMEXTRA|(i<<24);
+ if (flags) *flags |= CLCHT_ONITEMEXTRA|(i << 24);
return hit;
}
}
}
- if (dat->HiLightMode==1)
+ if (dat->HiLightMode == 1)
{
- if(flags) *flags|=CLCHT_ONITEMLABEL;
+ if (flags) *flags |= CLCHT_ONITEMLABEL;
return hit;
}
if (RectHitTest(&hitcontact->pos_label, testx, testy))
{
- if(flags) *flags|=CLCHT_ONITEMLABEL;
+ if (flags) *flags |= CLCHT_ONITEMLABEL;
return hit;
}
- if(flags) *flags|=CLCHT_NOWHERE;
+ if (flags) *flags |= CLCHT_NOWHERE;
return hit;
}
void cliScrollTo(HWND hwnd,struct ClcData *dat,int desty,int noSmooth)
{
DWORD startTick,nowTick;
- int oldy=dat->yScroll;
+ int oldy = dat->yScroll;
RECT clRect,rcInvalidate;
int maxy,previousy;
- if(dat->iHotTrack!=-1 && dat->yScroll != desty) {
+ if (dat->iHotTrack != -1 && dat->yScroll !=desty) {
pcli->pfnInvalidateItem(hwnd,dat,dat->iHotTrack);
- dat->iHotTrack=-1;
+ dat->iHotTrack = -1;
ReleaseCapture();
}
GetClientRect(hwnd,&clRect);
- rcInvalidate=clRect;
- //maxy=dat->rowHeight*GetGroupContentsCount(&dat->list,2)-clRect.bottom;
- maxy=cliGetRowTotalHeight(dat)-clRect.bottom;
- if(desty>maxy) desty=maxy;
- if(desty<0) desty=0;
- if(abs(desty-dat->yScroll)<4) noSmooth=1;
- if (!noSmooth && dat->exStyle&CLS_EX_NOSMOOTHSCROLLING) noSmooth=1;
- previousy=dat->yScroll;
+ rcInvalidate = clRect;
+ //maxy = dat->rowHeight*GetGroupContentsCount(&dat->list,2)-clRect.bottom;
+ maxy = cliGetRowTotalHeight(dat)-clRect.bottom;
+ if (desty>maxy) desty = maxy;
+ if (desty < 0) desty = 0;
+ if (abs(desty-dat->yScroll) < 4) noSmooth = 1;
+ if (!noSmooth && dat->exStyle&CLS_EX_NOSMOOTHSCROLLING) noSmooth = 1;
+ previousy = dat->yScroll;
BOOL keyDown = ( ( GetKeyState( VK_UP )
| GetKeyState( VK_DOWN )
@@ -163,26 +163,26 @@ void cliScrollTo(HWND hwnd,struct ClcData *dat,int desty,int noSmooth)
if (!noSmooth && !keyDown)
{
- startTick=GetTickCount();
+ startTick = GetTickCount();
for (;;) {
- nowTick=GetTickCount();
- if(nowTick>=startTick+dat->scrollTime) break;
- dat->yScroll=oldy+(desty-oldy)*(int)(nowTick-startTick)/dat->scrollTime;
- if (/*dat->backgroundBmpUse&CLBF_SCROLL || dat->hBmpBackground==NULL &&*/FALSE)
+ nowTick = GetTickCount();
+ if (nowTick >= startTick+dat->scrollTime) break;
+ dat->yScroll = oldy+(desty-oldy)*(int)(nowTick-startTick)/dat->scrollTime;
+ if (/*dat->backgroundBmpUse&CLBF_SCROLL || dat->hBmpBackground == NULL &&*/FALSE)
ScrollWindowEx(hwnd,0,previousy-dat->yScroll,NULL,NULL,NULL,NULL,SW_INVALIDATE);
else
{
CallService(MS_SKINENG_UPTATEFRAMEIMAGE,(WPARAM) hwnd, (LPARAM) 0);
//InvalidateRectZ(hwnd,NULL,FALSE);
}
- previousy=dat->yScroll;
+ previousy = dat->yScroll;
SetScrollPos(hwnd,SB_VERT,dat->yScroll,TRUE);
CallService(MS_SKINENG_UPTATEFRAMEIMAGE,(WPARAM) hwnd, (LPARAM) 0);
UpdateWindow(hwnd);
}
}
- dat->yScroll=desty;
- if ((dat->backgroundBmpUse&CLBF_SCROLL || dat->hBmpBackground==NULL) && FALSE)
+ dat->yScroll = desty;
+ if ((dat->backgroundBmpUse&CLBF_SCROLL || dat->hBmpBackground == NULL) && FALSE)
ScrollWindowEx(hwnd,0,previousy-dat->yScroll,NULL,NULL,NULL,NULL,SW_INVALIDATE);
else
CLUI__cliInvalidateRect(hwnd,NULL,FALSE);
@@ -192,7 +192,7 @@ void cliScrollTo(HWND hwnd,struct ClcData *dat,int desty,int noSmooth)
void cliRecalcScrollBar(HWND hwnd,struct ClcData *dat)
{
- SCROLLINFO si={0};
+ SCROLLINFO si = {0};
RECT clRect;
NMCLISTCONTROL nm;
if (LOCK_RECALC_SCROLLBAR) return;
@@ -200,37 +200,37 @@ void cliRecalcScrollBar(HWND hwnd,struct ClcData *dat)
RowHeights_CalcRowHeights(dat, hwnd);
GetClientRect(hwnd,&clRect);
- si.cbSize=sizeof(si);
- si.fMask=SIF_ALL;
- si.nMin=0;
- si.nMax=cliGetRowTotalHeight(dat)-1;
- si.nPage=clRect.bottom;
- si.nPos=dat->yScroll;
-
- nm.hdr.code=CLN_LISTSIZECHANGE;
- nm.hdr.hwndFrom=hwnd;
- nm.hdr.idFrom=0;//GetDlgCtrlID(hwnd);
- nm.pt.y=si.nMax;
+ si.cbSize = sizeof(si);
+ si.fMask = SIF_ALL;
+ si.nMin = 0;
+ si.nMax = cliGetRowTotalHeight(dat)-1;
+ si.nPage = clRect.bottom;
+ si.nPos = dat->yScroll;
+
+ nm.hdr.code = CLN_LISTSIZECHANGE;
+ nm.hdr.hwndFrom = hwnd;
+ nm.hdr.idFrom = 0;//GetDlgCtrlID(hwnd);
+ nm.pt.y = si.nMax;
SendMessage(GetParent(hwnd),WM_NOTIFY,0,(LPARAM)&nm); //post
GetClientRect(hwnd,&clRect);
- si.cbSize=sizeof(si);
- si.fMask=SIF_ALL;
- si.nMin=0;
- si.nMax=cliGetRowTotalHeight(dat)-1;
- si.nPage=clRect.bottom;
- si.nPos=dat->yScroll;
+ si.cbSize = sizeof(si);
+ si.fMask = SIF_ALL;
+ si.nMin = 0;
+ si.nMax = cliGetRowTotalHeight(dat)-1;
+ si.nPage = clRect.bottom;
+ si.nPos = dat->yScroll;
if ( GetWindowLongPtr(hwnd,GWL_STYLE)&CLS_CONTACTLIST ) {
- if ( dat->noVScrollbar==0 ) SetScrollInfo(hwnd,SB_VERT,&si,TRUE);
+ if ( dat->noVScrollbar == 0 ) SetScrollInfo(hwnd,SB_VERT,&si,TRUE);
//else SetScrollInfo(hwnd,SB_VERT,&si,FALSE);
}
else
SetScrollInfo(hwnd,SB_VERT,&si,TRUE);
- g_mutex_bSizing=1;
+ g_mutex_bSizing = 1;
cliScrollTo(hwnd,dat,dat->yScroll,1);
- g_mutex_bSizing=0;
+ g_mutex_bSizing = 0;
}
@@ -251,11 +251,11 @@ static LRESULT CALLBACK RenameEditSubclassProc(HWND hwnd, UINT msg, WPARAM wPara
}
break;
case WM_GETDLGCODE:
- if(lParam)
+ if (lParam)
{
- MSG *msg=(MSG*)lParam;
- if(msg->message==WM_KEYDOWN && msg->wParam==VK_TAB) return 0;
- if(msg->message==WM_CHAR && msg->wParam=='\t') return 0;
+ MSG *msg = (MSG*)lParam;
+ if (msg->message == WM_KEYDOWN && msg->wParam == VK_TAB) return 0;
+ if (msg->message == WM_CHAR && msg->wParam == '\t') return 0;
}
return DLGC_WANTMESSAGE;
case WM_KILLFOCUS:
@@ -277,26 +277,26 @@ void cliBeginRenameSelection(HWND hwnd,struct ClcData *dat)
KillTimer(hwnd,TIMERID_RENAME);
ReleaseCapture();
- dat->iHotTrack=-1;
- dat->selection=cliGetRowByIndex(dat,dat->selection,&contact,&group);
- if(dat->selection==-1) return;
- if(contact->type!=CLCIT_CONTACT && contact->type!=CLCIT_GROUP) return;
+ dat->iHotTrack = -1;
+ dat->selection = cliGetRowByIndex(dat,dat->selection,&contact,&group);
+ if (dat->selection == -1) return;
+ if (contact->type != CLCIT_CONTACT && contact->type != CLCIT_GROUP) return;
- if (contact->type==CLCIT_CONTACT && contact->isSubcontact)
- subident=dat->subIndent;
+ if (contact->type == CLCIT_CONTACT && contact->isSubcontact)
+ subident = dat->subIndent;
else
- subident=0;
+ subident = 0;
- for(indent=0;group->parent;indent++,group=group->parent);
+ for(indent = 0;group->parent;indent++,group = group->parent);
GetClientRect(hwnd,&clRect);
- x=indent*dat->groupIndent+dat->iconXSpace-2+subident;
- w=clRect.right-x;
- y=cliGetRowTopY(dat, dat->selection)-dat->yScroll;
- h=dat->row_heights[dat->selection];
+ x = indent*dat->groupIndent+dat->iconXSpace-2+subident;
+ w = clRect.right-x;
+ y = cliGetRowTopY(dat, dat->selection)-dat->yScroll;
+ h = dat->row_heights[dat->selection];
{
int i;
- for (i=0; i<=FONTID_MODERN_MAX; i++)
- if (h<dat->fontModernInfo[i].fontHeight+4) h=dat->fontModernInfo[i].fontHeight+4;
+ for (i = 0; i <= FONTID_MODERN_MAX; i++)
+ if (h < dat->fontModernInfo[i].fontHeight+4) h = dat->fontModernInfo[i].fontHeight+4;
}
//TODO contact->pos_label
@@ -306,44 +306,44 @@ void cliBeginRenameSelection(HWND hwnd,struct ClcData *dat)
RECT rectW;
int h2;
GetWindowRect(hwnd,&rectW);
- // w=contact->pos_full_first_row.right-contact->pos_full_first_row.left;
- // h=contact->pos_full_first_row.bottom-contact->pos_full_first_row.top;
- //w=clRect.right-x;
- //w=clRect.right-x;
- //x+=rectW.left;//+contact->pos_full_first_row.left;
- //y+=rectW.top;//+contact->pos_full_first_row.top;
- x=contact->pos_rename_rect.left+rectW.left;
- y=contact->pos_label.top+rectW.top;
- w=contact->pos_rename_rect.right-contact->pos_rename_rect.left;
- h2=contact->pos_label.bottom-contact->pos_label.top+4;
- h=h2;//max(h,h2);
+ // w = contact->pos_full_first_row.right-contact->pos_full_first_row.left;
+ // h = contact->pos_full_first_row.bottom-contact->pos_full_first_row.top;
+ //w = clRect.right-x;
+ //w = clRect.right-x;
+ //x += rectW.left;//+contact->pos_full_first_row.left;
+ //y += rectW.top;//+contact->pos_full_first_row.top;
+ x = contact->pos_rename_rect.left+rectW.left;
+ y = contact->pos_label.top+rectW.top;
+ w = contact->pos_rename_rect.right-contact->pos_rename_rect.left;
+ h2 = contact->pos_label.bottom-contact->pos_label.top+4;
+ h = h2;//max(h,h2);
}
{
- int a=0;
- if (contact->type==CLCIT_GROUP)
+ int a = 0;
+ if (contact->type == CLCIT_GROUP)
{
- if (dat->row_align_group_mode==1) a|=ES_CENTER;
- else if (dat->row_align_group_mode==2) a|=ES_RIGHT;
+ if (dat->row_align_group_mode == 1) a |= ES_CENTER;
+ else if (dat->row_align_group_mode == 2) a |= ES_RIGHT;
}
- if (dat->text_rtl) a|=EN_ALIGN_RTL_EC;
- if (contact->type==CLCIT_GROUP)
- dat->hwndRenameEdit=CreateWindow(TEXT("EDIT"),contact->szText,WS_POPUP|WS_BORDER|ES_AUTOHSCROLL|a,x,y,w,h,hwnd,NULL,g_hInst,NULL);
+ if (dat->text_rtl) a |= EN_ALIGN_RTL_EC;
+ if (contact->type == CLCIT_GROUP)
+ dat->hwndRenameEdit = CreateWindow(TEXT("EDIT"),contact->szText,WS_POPUP|WS_BORDER|ES_AUTOHSCROLL|a,x,y,w,h,hwnd,NULL,g_hInst,NULL);
else
- dat->hwndRenameEdit=CreateWindow(TEXT("EDIT"),pcli->pfnGetContactDisplayName(contact->hContact,0),WS_POPUP|WS_BORDER|ES_AUTOHSCROLL|a,x,y,w,h,hwnd,NULL,g_hInst,NULL);
+ dat->hwndRenameEdit = CreateWindow(TEXT("EDIT"),pcli->pfnGetContactDisplayName(contact->hContact,0),WS_POPUP|WS_BORDER|ES_AUTOHSCROLL|a,x,y,w,h,hwnd,NULL,g_hInst,NULL);
}
SetWindowLongPtr(dat->hwndRenameEdit,GWL_STYLE,GetWindowLongPtr(dat->hwndRenameEdit,GWL_STYLE)&(~WS_CAPTION)|WS_BORDER);
SetWindowLongPtr(dat->hwndRenameEdit,GWLP_USERDATA,(LONG_PTR)dat);
- OldRenameEditWndProc=(WNDPROC)SetWindowLongPtr(dat->hwndRenameEdit,GWLP_WNDPROC,(LONG_PTR)RenameEditSubclassProc);
- SendMessage(dat->hwndRenameEdit,WM_SETFONT,(WPARAM)(contact->type==CLCIT_GROUP?dat->fontModernInfo[FONTID_OPENGROUPS].hFont:dat->fontModernInfo[FONTID_CONTACTS].hFont),0);
+ OldRenameEditWndProc = (WNDPROC)SetWindowLongPtr(dat->hwndRenameEdit,GWLP_WNDPROC,(LONG_PTR)RenameEditSubclassProc);
+ SendMessage(dat->hwndRenameEdit,WM_SETFONT,(WPARAM)(contact->type == CLCIT_GROUP?dat->fontModernInfo[FONTID_OPENGROUPS].hFont:dat->fontModernInfo[FONTID_CONTACTS].hFont),0);
SendMessage(dat->hwndRenameEdit,EM_SETMARGINS,EC_LEFTMARGIN|EC_RIGHTMARGIN|EC_USEFONTINFO,0);
SendMessage(dat->hwndRenameEdit,EM_SETSEL,0,(LPARAM)(-1));
// SetWindowLongPtr(dat->hwndRenameEdit,GWLP_USERDATA,(LONG_PTR)hwnd);
- r.top=1;
- r.bottom=h-1;
- r.left=0;
- r.right=w;
+ r.top = 1;
+ r.bottom = h-1;
+ r.left = 0;
+ r.right = w;
//ES_MULTILINE
@@ -358,109 +358,109 @@ int GetDropTargetInformation(HWND hwnd,struct ClcData *dat,POINT pt)
{
RECT clRect;
int hit;
- struct ClcContact *contact=NULL,*movecontact=NULL;
+ struct ClcContact *contact = NULL,*movecontact = NULL;
struct ClcGroup *group,*movegroup;
DWORD hitFlags;
- int nSetSelection=-1;
+ int nSetSelection = -1;
GetClientRect(hwnd,&clRect);
- dat->selection=dat->iDragItem;
- dat->iInsertionMark=-1;
- dat->nInsertionLevel=0;
+ dat->selection = dat->iDragItem;
+ dat->iInsertionMark = -1;
+ dat->nInsertionLevel = 0;
if (!PtInRect(&clRect,pt)) return DROPTARGET_OUTSIDE;
- hit=cliHitTest(hwnd,dat,pt.x,pt.y,&contact,&group,&hitFlags);
+ hit = cliHitTest(hwnd,dat,pt.x,pt.y,&contact,&group,&hitFlags);
cliGetRowByIndex(dat,dat->iDragItem,&movecontact,&movegroup);
- if(hit==dat->iDragItem) return DROPTARGET_ONSELF;
- 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;
- int topItem=-1,bottomItem=-1;
- int ok=0;
- if(pt.y+dat->yScroll<cliGetRowTopY(dat,hit)+dat->insertionMarkHitHeight || contact->type!=CLCIT_GROUP) {
+ if (hit == dat->iDragItem) return DROPTARGET_ONSELF;
+ 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;
+ int topItem = -1,bottomItem = -1;
+ int ok = 0;
+ if (pt.y+dat->yScroll < cliGetRowTopY(dat,hit)+dat->insertionMarkHitHeight || contact->type != CLCIT_GROUP) {
//could be insertion mark (above)
- topItem=hit-1; bottomItem=hit;
- bottomcontact=contact;
- bottomgroup=group;
- topItem=cliGetRowByIndex(dat,topItem,&topcontact,&topgroup);
- ok=1;
- } else if ((pt.y+dat->yScroll>=cliGetRowTopY(dat,hit+1)-dat->insertionMarkHitHeight)
- ||(contact->type==CLCIT_GROUP && contact->group->expanded && contact->group->cl.count>0))
+ topItem = hit-1; bottomItem = hit;
+ bottomcontact = contact;
+ bottomgroup = group;
+ topItem = cliGetRowByIndex(dat,topItem,&topcontact,&topgroup);
+ ok = 1;
+ } else if ((pt.y+dat->yScroll >= cliGetRowTopY(dat,hit+1)-dat->insertionMarkHitHeight)
+ ||(contact->type == CLCIT_GROUP && contact->group->expanded && contact->group->cl.count>0))
{
//could be insertion mark (below)
- topItem=hit; bottomItem=hit+1;
- topcontact=contact; topgroup=group;
- bottomItem=cliGetRowByIndex(dat,bottomItem,&bottomcontact,&bottomgroup);
- ok=1;
+ topItem = hit; bottomItem = hit+1;
+ topcontact = contact; topgroup = group;
+ bottomItem = cliGetRowByIndex(dat,bottomItem,&bottomcontact,&bottomgroup);
+ ok = 1;
}
if (ok)
{
- if (bottomItem==-1 && contact->type==CLCIT_GROUP)
+ if (bottomItem == -1 && contact->type == CLCIT_GROUP)
{
- bottomItem=topItem+1;
+ bottomItem = topItem+1;
}
else
{
- if (bottomItem==-1 && contact->type!=CLCIT_GROUP && contact->groupId==0)
+ if (bottomItem == -1 && contact->type != CLCIT_GROUP && contact->groupId == 0)
{
- if (contact->type!=CLCIT_GROUP && contact->groupId==0)
+ if (contact->type != CLCIT_GROUP && contact->groupId == 0)
{
- bottomItem=topItem;
+ bottomItem = topItem;
cliGetRowByIndex(dat,bottomItem,&bottomcontact,&bottomgroup);
}
}
- if (bottomItem!=-1 && bottomcontact->type!=CLCIT_GROUP)
+ if (bottomItem != -1 && bottomcontact->type != CLCIT_GROUP)
{
- struct ClcGroup * gr=bottomgroup;
+ struct ClcGroup * gr = bottomgroup;
do
{
- bottomItem=cliGetRowByIndex(dat,bottomItem-1,&bottomcontact,&bottomgroup);}
- while (bottomItem>=0 && bottomcontact->type!=CLCIT_GROUP && bottomgroup==gr);
- nSetSelection=bottomItem;
- bottomItem=cliGetRowByIndex(dat,bottomItem+1,&bottomcontact,&bottomgroup);
+ bottomItem = cliGetRowByIndex(dat,bottomItem-1,&bottomcontact,&bottomgroup);}
+ while (bottomItem >= 0 && bottomcontact->type != CLCIT_GROUP && bottomgroup == gr);
+ nSetSelection = bottomItem;
+ bottomItem = cliGetRowByIndex(dat,bottomItem+1,&bottomcontact,&bottomgroup);
}
}
- if (bottomItem==-1) bottomItem=topItem+1;
+ if (bottomItem == -1) bottomItem = topItem+1;
{
- int bi=cliGetRowByIndex(dat,bottomItem,&bottomcontact,&bottomgroup);
- if (bi!=-1)
+ int bi = cliGetRowByIndex(dat,bottomItem,&bottomcontact,&bottomgroup);
+ if (bi != -1)
{
- group=bottomgroup;
- if (bottomcontact==movecontact || group==movecontact->group) return DROPTARGET_ONSELF;
- dat->nInsertionLevel=-1; // decreasing here
- for (;group;group=group->parent)
+ group = bottomgroup;
+ if (bottomcontact == movecontact || group == movecontact->group) return DROPTARGET_ONSELF;
+ dat->nInsertionLevel = -1; // decreasing here
+ for (;group;group = group->parent)
{
dat->nInsertionLevel++;
- if (group==movecontact->group) return DROPTARGET_ONSELF;
+ if (group == movecontact->group) return DROPTARGET_ONSELF;
}
}
}
- dat->iInsertionMark=bottomItem;
- dat->selection=nSetSelection;
+ dat->iInsertionMark = bottomItem;
+ dat->selection = nSetSelection;
return DROPTARGET_INSERTION;
}
}
- if(contact->type==CLCIT_GROUP)
+ if (contact->type == CLCIT_GROUP)
{
- if(dat->iInsertionMark==-1)
+ if (dat->iInsertionMark == -1)
{
- if(movecontact->type==CLCIT_GROUP)
+ if (movecontact->type == CLCIT_GROUP)
{ //check not moving onto its own subgroup
- dat->iInsertionMark=hit+1;
- for (;group;group=group->parent)
+ dat->iInsertionMark = hit+1;
+ for (;group;group = group->parent)
{
dat->nInsertionLevel++;
- if(group==movecontact->group) return DROPTARGET_ONSELF;
+ if (group == movecontact->group) return DROPTARGET_ONSELF;
}
}
- dat->selection=hit;
+ dat->selection = hit;
return DROPTARGET_ONGROUP;
}
}
- dat->selection=hit;
+ dat->selection = hit;
if (g_szMetaModuleName && !mir_strcmp(contact->proto,g_szMetaModuleName)&& (ServiceExists(MS_MC_ADDTOMETA))) return DROPTARGET_ONMETACONTACT;
if (contact->isSubcontact && (ServiceExists(MS_MC_ADDTOMETA))) return DROPTARGET_ONSUBCONTACT;
@@ -468,7 +468,7 @@ int GetDropTargetInformation(HWND hwnd,struct ClcData *dat,POINT pt)
}
COLORREF sttGetColor(char * module, char * color, COLORREF defColor)
{
- BOOL useWinColor=db_get_b(NULL, module, "UseWinColours",CLCDEFAULT_USEWINDOWSCOLOURS);
+ BOOL useWinColor = db_get_b(NULL, module, "UseWinColours",CLCDEFAULT_USEWINDOWSCOLOURS);
if (useWinColor) return defColor;
else return db_get_dw(NULL, module, color, defColor);
}
@@ -477,7 +477,7 @@ void LoadCLCFonts( HWND hwnd, struct ClcData *dat )
{
RegisterCLUIFonts();
- HDC hdc=GetDC(hwnd);
+ HDC hdc = GetDC(hwnd);
HFONT holdfont = (HFONT)GetCurrentObject( hdc, OBJ_FONT );
for ( int i = 0 ; i <= FONTID_MODERN_MAX; i++ )
@@ -507,27 +507,27 @@ void LoadCLCOptions(HWND hwnd, struct ClcData *dat )
{
int i;
- g_CluiData.fDisableSkinEngine=db_get_b(NULL,"ModernData","DisableEngine", SETTING_DISABLESKIN_DEFAULT);
+ g_CluiData.fDisableSkinEngine = db_get_b(NULL,"ModernData","DisableEngine", SETTING_DISABLESKIN_DEFAULT);
LoadCLCFonts( hwnd, dat );
- g_CluiData.bSortByOrder[0]=db_get_b(NULL,"CList","SortBy1",SETTING_SORTBY1_DEFAULT);
- g_CluiData.bSortByOrder[1]=db_get_b(NULL,"CList","SortBy2",SETTING_SORTBY2_DEFAULT);
- g_CluiData.bSortByOrder[2]=db_get_b(NULL,"CList","SortBy3",SETTING_SORTBY3_DEFAULT);
- g_CluiData.fSortNoOfflineBottom=db_get_b(NULL,"CList","NoOfflineBottom",SETTING_NOOFFLINEBOTTOM_DEFAULT);
+ g_CluiData.bSortByOrder[0] = db_get_b(NULL,"CList","SortBy1",SETTING_SORTBY1_DEFAULT);
+ g_CluiData.bSortByOrder[1] = db_get_b(NULL,"CList","SortBy2",SETTING_SORTBY2_DEFAULT);
+ g_CluiData.bSortByOrder[2] = db_get_b(NULL,"CList","SortBy3",SETTING_SORTBY3_DEFAULT);
+ g_CluiData.fSortNoOfflineBottom = db_get_b(NULL,"CList","NoOfflineBottom",SETTING_NOOFFLINEBOTTOM_DEFAULT);
// Row
dat->row_min_heigh = db_get_w(NULL,"CList","MinRowHeight",CLCDEFAULT_ROWHEIGHT);
dat->row_border = db_get_w(NULL,"CList","RowBorder",SETTING_ROWBORDER_DEFAULT);
- dat->row_before_group_space =((hwnd!=pcli->hwndContactTree&&pcli->hwndContactTree!=NULL)
+ dat->row_before_group_space = ((hwnd != pcli->hwndContactTree&&pcli->hwndContactTree != NULL)
|| !db_get_b(NULL,"ModernData","UseAdvancedRowLayout",SETTING_ROW_ADVANCEDLAYOUT_DEFAULT))?0:db_get_w(NULL,"ModernSkin","SpaceBeforeGroup",SKIN_SPACEBEFOREGROUP_DEFAULT);
dat->row_variable_height = db_get_b(NULL,"CList","VariableRowHeight",SETTING_VARIABLEROWHEIGHT_DEFAULT);
dat->row_align_left_items_to_left = db_get_b(NULL,"CList","AlignLeftItemsToLeft",SETTING_ALIGNLEFTTOLEFT_DEFAULT);
dat->row_hide_group_icon = db_get_b(NULL,"CList","HideGroupsIcon",SETTING_HIDEGROUPSICON_DEFAULT);
dat->row_align_right_items_to_right = db_get_b(NULL,"CList","AlignRightItemsToRight",SETTING_ALIGNRIGHTORIGHT_DEFAULT);
//TODO: Add to settings
- dat->row_align_group_mode=db_get_b(NULL,"CList","AlignGroupCaptions",SETTING_ALIGNGROPCAPTION_DEFAULT);
- if (pcli->hwndContactTree==NULL || dat->hWnd==pcli->hwndContactTree)
+ dat->row_align_group_mode = db_get_b(NULL,"CList","AlignGroupCaptions",SETTING_ALIGNGROPCAPTION_DEFAULT);
+ if (pcli->hwndContactTree == NULL || dat->hWnd == pcli->hwndContactTree)
{
int defItemsOrder[NUM_ITEM_TYPE] = SETTINS_ROWITEMORDER_DEFAULT;
@@ -540,13 +540,13 @@ void LoadCLCOptions(HWND hwnd, struct ClcData *dat )
}
else
{
- int defItems[]= {ITEM_ICON, ITEM_TEXT, ITEM_EXTRA_ICONS,};
+ int defItems[] = {ITEM_ICON, ITEM_TEXT, ITEM_EXTRA_ICONS,};
for (i = 0 ; i < NUM_ITEM_TYPE; i++)
- dat->row_items[i]=(i<SIZEOF(defItems)) ? defItems[i] : -1;
+ dat->row_items[i] = (i < SIZEOF(defItems)) ? defItems[i] : -1;
}
// Avatar
- if (pcli->hwndContactTree == hwnd || pcli->hwndContactTree==NULL)
+ if (pcli->hwndContactTree == hwnd || pcli->hwndContactTree == NULL)
{
dat->avatars_show = db_get_b(NULL,"CList","AvatarsShow",SETTINGS_SHOWAVATARS_DEFAULT);
dat->avatars_draw_border = db_get_b(NULL,"CList","AvatarsDrawBorders",SETTINGS_AVATARDRAWBORDER_DEFAULT);
@@ -576,7 +576,7 @@ void LoadCLCOptions(HWND hwnd, struct ClcData *dat )
}
// Icon
- if (pcli->hwndContactTree == hwnd|| pcli->hwndContactTree==NULL)
+ if (pcli->hwndContactTree == hwnd|| pcli->hwndContactTree == NULL)
{
dat->icon_hide_on_avatar = db_get_b(NULL,"CList","IconHideOnAvatar",SETTING_HIDEICONONAVATAR_DEFAULT);
dat->icon_draw_on_avatar_space = db_get_b(NULL,"CList","IconDrawOnAvatarSpace",SETTING_ICONONAVATARPLACE_DEFAULT);
@@ -590,7 +590,7 @@ void LoadCLCOptions(HWND hwnd, struct ClcData *dat )
}
// Contact time
- if (pcli->hwndContactTree == hwnd|| pcli->hwndContactTree==NULL)
+ if (pcli->hwndContactTree == hwnd|| pcli->hwndContactTree == NULL)
{
dat->contact_time_show = db_get_b(NULL,"CList","ContactTimeShow",SETTING_SHOWTIME_DEFAULT);
dat->contact_time_show_only_if_different = db_get_b(NULL,"CList","ContactTimeShowOnlyIfDifferent",SETTING_SHOWTIMEIFDIFF_DEFAULT);
@@ -609,7 +609,7 @@ void LoadCLCOptions(HWND hwnd, struct ClcData *dat )
dat->text_smiley_height = 0;
dat->text_use_protocol_smileys = db_get_b(NULL,"CList","TextUseProtocolSmileys",SETTING_TEXT_PROTOSMILEY_DEFAULT);
- if (pcli->hwndContactTree == hwnd|| pcli->hwndContactTree==NULL)
+ if (pcli->hwndContactTree == hwnd|| pcli->hwndContactTree == NULL)
{
dat->text_ignore_size_for_row_height = db_get_b(NULL,"CList","TextIgnoreSizeForRownHeight",SETTING_TEXT_IGNORESIZE_DEFAULT);
}
@@ -621,17 +621,17 @@ void LoadCLCOptions(HWND hwnd, struct ClcData *dat )
// First line
dat->first_line_draw_smileys = db_get_b(NULL,"CList","FirstLineDrawSmileys",SETTING_FIRSTLINE_SMILEYS_DEFAULT);
dat->first_line_append_nick = db_get_b(NULL,"CList","FirstLineAppendNick",SETTING_FIRSTLINE_APPENDNICK_DEFAULT);
- gl_TrimText=db_get_b(NULL,"CList","TrimText",SETTING_FIRSTLINE_TRIMTEXT_DEFAULT);
+ gl_TrimText = db_get_b(NULL,"CList","TrimText",SETTING_FIRSTLINE_TRIMTEXT_DEFAULT);
// Second line
- if (pcli->hwndContactTree == hwnd || pcli->hwndContactTree==NULL)
+ if (pcli->hwndContactTree == hwnd || pcli->hwndContactTree == NULL)
{
dat->second_line_show = db_get_b(NULL,"CList","SecondLineShow",SETTING_SECONDLINE_SHOW_DEFAULT);
dat->second_line_top_space = db_get_w(NULL,"CList","SecondLineTopSpace",SETTING_SECONDLINE_TOPSPACE_DEFAULT);
dat->second_line_draw_smileys = db_get_b(NULL,"CList","SecondLineDrawSmileys",SETTING_SECONDLINE_SMILEYS_DEFAULT);
dat->second_line_type = db_get_w(NULL,"CList","SecondLineType",SETTING_SECONDLINE_TYPE_DEFAULT);
{
- DBVARIANT dbv={0};
+ DBVARIANT dbv = {0};
if (!DBGetContactSettingTString(NULL, "CList","SecondLineText", &dbv))
{
@@ -645,8 +645,8 @@ void LoadCLCOptions(HWND hwnd, struct ClcData *dat )
}
}
dat->second_line_xstatus_has_priority = db_get_b(NULL,"CList","SecondLineXStatusHasPriority",SETTING_SECONDLINE_XSTATUS_DEFAULT);
- dat->second_line_show_status_if_no_away=db_get_b(NULL,"CList","SecondLineShowStatusIfNoAway",SETTING_SECONDLINE_STATUSIFNOAWAY_DEFAULT);
- dat->second_line_show_listening_if_no_away=db_get_b(NULL,"CList","SecondLineShowListeningIfNoAway",SETTING_SECONDLINE_LISTENINGIFNOAWAY_DEFAULT);
+ dat->second_line_show_status_if_no_away = db_get_b(NULL,"CList","SecondLineShowStatusIfNoAway",SETTING_SECONDLINE_STATUSIFNOAWAY_DEFAULT);
+ dat->second_line_show_listening_if_no_away = db_get_b(NULL,"CList","SecondLineShowListeningIfNoAway",SETTING_SECONDLINE_LISTENINGIFNOAWAY_DEFAULT);
dat->second_line_use_name_and_message_for_xstatus = db_get_b(NULL,"CList","SecondLineUseNameAndMessageForXStatus",SETTING_SECONDLINE_XSTATUSNAMETEXT_DEFAULT);
}
else
@@ -662,14 +662,14 @@ void LoadCLCOptions(HWND hwnd, struct ClcData *dat )
// Third line
- if (pcli->hwndContactTree == hwnd || pcli->hwndContactTree==NULL)
+ if (pcli->hwndContactTree == hwnd || pcli->hwndContactTree == NULL)
{
dat->third_line_show = db_get_b(NULL,"CList","ThirdLineShow",SETTING_THIRDLINE_SHOW_DEFAULT);
dat->third_line_top_space = db_get_w(NULL,"CList","ThirdLineTopSpace",SETTING_THIRDLINE_TOPSPACE_DEFAULT);
dat->third_line_draw_smileys = db_get_b(NULL,"CList","ThirdLineDrawSmileys",SETTING_THIRDLINE_SMILEYS_DEFAULT);
dat->third_line_type = db_get_w(NULL,"CList","ThirdLineType",SETTING_THIRDLINE_TYPE_DEFAULT);
{
- DBVARIANT dbv={0};
+ DBVARIANT dbv = {0};
if (!DBGetContactSettingTString(NULL, "CList","ThirdLineText", &dbv))
{
@@ -683,8 +683,8 @@ void LoadCLCOptions(HWND hwnd, struct ClcData *dat )
}
}
dat->third_line_xstatus_has_priority = db_get_b(NULL,"CList","ThirdLineXStatusHasPriority",SETTING_THIRDLINE_XSTATUS_DEFAULT);
- dat->third_line_show_status_if_no_away=db_get_b(NULL,"CList","ThirdLineShowStatusIfNoAway",SETTING_THIRDLINE_STATUSIFNOAWAY_DEFAULT);
- dat->third_line_show_listening_if_no_away=db_get_b(NULL,"CList","ThirdLineShowListeningIfNoAway",SETTING_THIRDLINE_LISTENINGIFNOAWAY_DEFAULT);
+ dat->third_line_show_status_if_no_away = db_get_b(NULL,"CList","ThirdLineShowStatusIfNoAway",SETTING_THIRDLINE_STATUSIFNOAWAY_DEFAULT);
+ dat->third_line_show_listening_if_no_away = db_get_b(NULL,"CList","ThirdLineShowListeningIfNoAway",SETTING_THIRDLINE_LISTENINGIFNOAWAY_DEFAULT);
dat->third_line_use_name_and_message_for_xstatus = db_get_b(NULL,"CList","ThirdLineUseNameAndMessageForXStatus",SETTING_THIRDLINE_XSTATUSNAMETEXT_DEFAULT);
}
else
@@ -698,20 +698,20 @@ void LoadCLCOptions(HWND hwnd, struct ClcData *dat )
dat->third_line_use_name_and_message_for_xstatus = 0;
}
- dat->leftMargin=db_get_b(NULL,"CLC","LeftMargin",CLCDEFAULT_LEFTMARGIN);
- dat->rightMargin=db_get_b(NULL,"CLC","RightMargin",CLCDEFAULT_RIGHTMARGIN);
- dat->exStyle=db_get_dw(NULL,"CLC","ExStyle",GetDefaultExStyle());
- dat->scrollTime=db_get_w(NULL,"CLC","ScrollTime",CLCDEFAULT_SCROLLTIME);
- dat->force_in_dialog=(pcli->hwndContactTree)?(hwnd!=pcli->hwndContactTree):0;
- dat->groupIndent=db_get_b(NULL,"CLC","GroupIndent",CLCDEFAULT_GROUPINDENT);
- dat->subIndent=db_get_b(NULL,"CLC","SubIndent",CLCDEFAULT_GROUPINDENT);
- dat->gammaCorrection=db_get_b(NULL,"CLC","GammaCorrect",CLCDEFAULT_GAMMACORRECT);
- dat->showIdle=db_get_b(NULL,"CLC","ShowIdle",CLCDEFAULT_SHOWIDLE);
- dat->noVScrollbar=db_get_b(NULL,"CLC","NoVScrollBar",CLCDEFAULT_NOVSCROLL);
+ dat->leftMargin = db_get_b(NULL,"CLC","LeftMargin",CLCDEFAULT_LEFTMARGIN);
+ dat->rightMargin = db_get_b(NULL,"CLC","RightMargin",CLCDEFAULT_RIGHTMARGIN);
+ dat->exStyle = db_get_dw(NULL,"CLC","ExStyle",GetDefaultExStyle());
+ dat->scrollTime = db_get_w(NULL,"CLC","ScrollTime",CLCDEFAULT_SCROLLTIME);
+ dat->force_in_dialog = (pcli->hwndContactTree)?(hwnd != pcli->hwndContactTree):0;
+ dat->groupIndent = db_get_b(NULL,"CLC","GroupIndent",CLCDEFAULT_GROUPINDENT);
+ dat->subIndent = db_get_b(NULL,"CLC","SubIndent",CLCDEFAULT_GROUPINDENT);
+ dat->gammaCorrection = db_get_b(NULL,"CLC","GammaCorrect",CLCDEFAULT_GAMMACORRECT);
+ dat->showIdle = db_get_b(NULL,"CLC","ShowIdle",CLCDEFAULT_SHOWIDLE);
+ dat->noVScrollbar = db_get_b(NULL,"CLC","NoVScrollBar",CLCDEFAULT_NOVSCROLL);
SendMessage(hwnd,INTM_SCROLLBARCHANGED,0,0);
- if (dat->hBmpBackground) {DeleteObject(dat->hBmpBackground); dat->hBmpBackground=NULL;}
- if (dat->hMenuBackground) {DeleteObject(dat->hMenuBackground); dat->hMenuBackground=NULL;}
+ if (dat->hBmpBackground) {DeleteObject(dat->hBmpBackground); dat->hBmpBackground = NULL;}
+ if (dat->hMenuBackground) {DeleteObject(dat->hMenuBackground); dat->hMenuBackground = NULL;}
dat->useWindowsColours = db_get_b(NULL, "CLC", "UseWinColours", CLCDEFAULT_USEWINDOWSCOLOURS);
@@ -720,60 +720,60 @@ void LoadCLCOptions(HWND hwnd, struct ClcData *dat )
DBVARIANT dbv;
if (!dat->bkChanged)
{
- dat->bkColour=sttGetColor("CLC","BkColour",GetSysColor(COLOR_3DFACE));
+ dat->bkColour = sttGetColor("CLC","BkColour",GetSysColor(COLOR_3DFACE));
{
- if(db_get_b(NULL,"CLC","UseBitmap",CLCDEFAULT_USEBITMAP))
+ if (db_get_b(NULL,"CLC","UseBitmap",CLCDEFAULT_USEBITMAP))
{
if (!DBGetContactSettingString(NULL,"CLC","BkBitmap",&dbv))
{
- dat->hBmpBackground=(HBITMAP)CallService(MS_UTILS_LOADBITMAP,0,(LPARAM)dbv.pszVal);
+ dat->hBmpBackground = (HBITMAP)CallService(MS_UTILS_LOADBITMAP,0,(LPARAM)dbv.pszVal);
db_free(&dbv);
}
}
}
- dat->backgroundBmpUse=db_get_w(NULL,"CLC","BkBmpUse",CLCDEFAULT_BKBMPUSE);
+ dat->backgroundBmpUse = db_get_w(NULL,"CLC","BkBmpUse",CLCDEFAULT_BKBMPUSE);
}
- dat->MenuBkColor=sttGetColor("Menu","BkColour",CLCDEFAULT_BKCOLOUR);
- dat->MenuBkHiColor=sttGetColor("Menu","SelBkColour",CLCDEFAULT_SELBKCOLOUR);
+ dat->MenuBkColor = sttGetColor("Menu","BkColour",CLCDEFAULT_BKCOLOUR);
+ dat->MenuBkHiColor = sttGetColor("Menu","SelBkColour",CLCDEFAULT_SELBKCOLOUR);
- dat->MenuTextColor=sttGetColor("Menu","TextColour",CLCDEFAULT_TEXTCOLOUR);
- dat->MenuTextHiColor=sttGetColor("Menu","SelTextColour",CLCDEFAULT_MODERN_SELTEXTCOLOUR);
+ dat->MenuTextColor = sttGetColor("Menu","TextColour",CLCDEFAULT_TEXTCOLOUR);
+ dat->MenuTextHiColor = sttGetColor("Menu","SelTextColour",CLCDEFAULT_MODERN_SELTEXTCOLOUR);
- if(db_get_b(NULL,"Menu","UseBitmap",CLCDEFAULT_USEBITMAP)) {
+ if (db_get_b(NULL,"Menu","UseBitmap",CLCDEFAULT_USEBITMAP)) {
if (!DBGetContactSettingString(NULL,"Menu","BkBitmap",&dbv)) {
- dat->hMenuBackground=(HBITMAP)CallService(MS_UTILS_LOADBITMAP,0,(LPARAM)dbv.pszVal);
+ dat->hMenuBackground = (HBITMAP)CallService(MS_UTILS_LOADBITMAP,0,(LPARAM)dbv.pszVal);
//mir_free_and_nill(dbv.pszVal);
db_free(&dbv);
}
}
- dat->MenuBmpUse=db_get_w(NULL,"Menu","BkBmpUse",CLCDEFAULT_BKBMPUSE);
+ dat->MenuBmpUse = db_get_w(NULL,"Menu","BkBmpUse",CLCDEFAULT_BKBMPUSE);
}
- dat->greyoutFlags=db_get_dw(NULL,"CLC","GreyoutFlags",CLCDEFAULT_GREYOUTFLAGS);
- dat->offlineModes=db_get_dw(NULL,"CLC","OfflineModes",CLCDEFAULT_OFFLINEMODES);
- dat->selBkColour=sttGetColor("CLC","SelBkColour",CLCDEFAULT_SELBKCOLOUR);
- dat->selTextColour=db_get_dw(NULL,"CLC","SelTextColour",CLCDEFAULT_MODERN_SELTEXTCOLOUR);
- dat->hotTextColour=db_get_dw(NULL,"CLC","HotTextColour",CLCDEFAULT_MODERN_HOTTEXTCOLOUR);
- dat->quickSearchColour=db_get_dw(NULL,"CLC","QuickSearchColour",CLCDEFAULT_MODERN_QUICKSEARCHCOLOUR);
+ dat->greyoutFlags = db_get_dw(NULL,"CLC","GreyoutFlags",CLCDEFAULT_GREYOUTFLAGS);
+ dat->offlineModes = db_get_dw(NULL,"CLC","OfflineModes",CLCDEFAULT_OFFLINEMODES);
+ dat->selBkColour = sttGetColor("CLC","SelBkColour",CLCDEFAULT_SELBKCOLOUR);
+ dat->selTextColour = db_get_dw(NULL,"CLC","SelTextColour",CLCDEFAULT_MODERN_SELTEXTCOLOUR);
+ dat->hotTextColour = db_get_dw(NULL,"CLC","HotTextColour",CLCDEFAULT_MODERN_HOTTEXTCOLOUR);
+ dat->quickSearchColour = db_get_dw(NULL,"CLC","QuickSearchColour",CLCDEFAULT_MODERN_QUICKSEARCHCOLOUR);
if (!g_szMetaModuleName && ServiceExists(MS_MC_GETPROTOCOLNAME)) g_szMetaModuleName = (char *)CallService(MS_MC_GETPROTOCOLNAME, 0, 0);
- dat->IsMetaContactsEnabled=(!(GetWindowLongPtr(hwnd,GWL_STYLE)&CLS_MANUALUPDATE)) &&
+ dat->IsMetaContactsEnabled = (!(GetWindowLongPtr(hwnd,GWL_STYLE)&CLS_MANUALUPDATE)) &&
g_szMetaModuleName && db_get_b(NULL,g_szMetaModuleName,"Enabled",1) && ServiceExists(MS_MC_GETDEFAULTCONTACT);
- if (pcli->hwndContactTree==NULL || dat->hWnd==pcli->hwndContactTree)
- dat->MetaIgnoreEmptyExtra=db_get_b(NULL,"CLC","MetaIgnoreEmptyExtra",SETTING_METAIGNOREEMPTYEXTRA_DEFAULT);
+ if (pcli->hwndContactTree == NULL || dat->hWnd == pcli->hwndContactTree)
+ dat->MetaIgnoreEmptyExtra = db_get_b(NULL,"CLC","MetaIgnoreEmptyExtra",SETTING_METAIGNOREEMPTYEXTRA_DEFAULT);
else
- dat->MetaIgnoreEmptyExtra=FALSE;
+ dat->MetaIgnoreEmptyExtra = FALSE;
- dat->expandMeta=db_get_b(NULL,"CLC","MetaExpanding",SETTING_METAEXPANDING_DEFAULT);
- dat->useMetaIcon=db_get_b(NULL,"CLC","Meta",SETTING_USEMETAICON_DEFAULT);
+ dat->expandMeta = db_get_b(NULL,"CLC","MetaExpanding",SETTING_METAEXPANDING_DEFAULT);
+ dat->useMetaIcon = db_get_b(NULL,"CLC","Meta",SETTING_USEMETAICON_DEFAULT);
- dat->drawOverlayedStatus=db_get_b(NULL,"CLC","DrawOverlayedStatus",SETTING_DRAWOVERLAYEDSTATUS_DEFAULT);
+ dat->drawOverlayedStatus = db_get_b(NULL,"CLC","DrawOverlayedStatus",SETTING_DRAWOVERLAYEDSTATUS_DEFAULT);
- dat->dbbMetaHideExtra=db_get_b(NULL,"CLC","MetaHideExtra",SETTING_METAHIDEEXTRA_DEFAULT);
- dat->dbbBlendInActiveState=db_get_b(NULL,"CLC","BlendInActiveState",SETTING_BLENDINACTIVESTATE_DEFAULT);
- dat->dbbBlend25=db_get_b(NULL,"CLC","Blend25%",SETTING_BLENDINACTIVESTATE_DEFAULT);
- dat->bCompactMode=db_get_b(NULL,"CLC","CompactMode",SETTING_COMPACTMODE_DEFAULT);
- if ((pcli->hwndContactTree == hwnd || pcli->hwndContactTree==NULL))
+ dat->dbbMetaHideExtra = db_get_b(NULL,"CLC","MetaHideExtra",SETTING_METAHIDEEXTRA_DEFAULT);
+ dat->dbbBlendInActiveState = db_get_b(NULL,"CLC","BlendInActiveState",SETTING_BLENDINACTIVESTATE_DEFAULT);
+ dat->dbbBlend25 = db_get_b(NULL,"CLC","Blend25%",SETTING_BLENDINACTIVESTATE_DEFAULT);
+ dat->bCompactMode = db_get_b(NULL,"CLC","CompactMode",SETTING_COMPACTMODE_DEFAULT);
+ if ((pcli->hwndContactTree == hwnd || pcli->hwndContactTree == NULL))
{
IvalidateDisplayNameCache(16);
@@ -781,9 +781,9 @@ void LoadCLCOptions(HWND hwnd, struct ClcData *dat )
{
NMHDR hdr;
- hdr.code=CLN_OPTIONSCHANGED;
- hdr.hwndFrom=hwnd;
- hdr.idFrom=0;//GetDlgCtrlID(hwnd);
+ hdr.code = CLN_OPTIONSCHANGED;
+ hdr.hwndFrom = hwnd;
+ hdr.idFrom = 0;//GetDlgCtrlID(hwnd);
SendMessage(GetParent(hwnd),WM_NOTIFY,0,(LPARAM)&hdr);
}
SendMessage(hwnd,WM_SIZE,0,0);
@@ -792,12 +792,12 @@ void LoadCLCOptions(HWND hwnd, struct ClcData *dat )
int ExpandMetaContact(HWND hwnd, struct ClcContact * contact, struct ClcData * dat, BOOL bExpand)
{
- struct ClcContact * ht=NULL;
+ struct 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;
+ 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;
db_set_b(contact->hContact,"CList","Expanded",contact->SubExpanded);
- dat->NeedResort=1;
+ dat->NeedResort = 1;
pcli->pfnSortCLC(hwnd,dat,1);
cliRecalcScrollBar(hwnd,dat);
return contact->SubExpanded;
@@ -807,8 +807,8 @@ int cliFindRowByText(HWND hwnd, struct ClcData *dat, const TCHAR *text, int pref
{
struct ClcGroup *group = &dat->list;
int testlen = lstrlen(text);
- struct ClcContact *contact=NULL;
- int SubCount=0;
+ struct ClcContact *contact = NULL;
+ int SubCount = 0;
group->scanIndex = 0;
for (;;) {
@@ -819,8 +819,8 @@ int cliFindRowByText(HWND hwnd, struct ClcData *dat, const TCHAR *text, int pref
group->scanIndex++;
continue;
}
- contact=group->cl.items[group->scanIndex];
- if (contact->type != CLCIT_DIVIDER)
+ contact = group->cl.items[group->scanIndex];
+ if (contact->type !=CLCIT_DIVIDER)
{
if ((prefixOk && !_tcsnicmp(text, contact->szText, testlen)) ||
(!prefixOk && !lstrcmpi(text, contact->szText)))
@@ -836,19 +836,19 @@ int cliFindRowByText(HWND hwnd, struct ClcData *dat, const TCHAR *text, int pref
if (!(dat->exStyle & CLS_EX_QUICKSEARCHVISONLY) || group->cl.items[group->scanIndex]->group->expanded) {
group = group->cl.items[group->scanIndex]->group;
group->scanIndex = 0;
- SubCount=0;
+ SubCount = 0;
continue;
}
}
}
- if (contact->type==CLCIT_CONTACT && contact->SubAllocated)
+ if (contact->type == CLCIT_CONTACT && contact->SubAllocated)
{
if (!(dat->exStyle & CLS_EX_QUICKSEARCHVISONLY) || contact->SubExpanded )
{
- int i=0;
- for (i=0; i<contact->SubAllocated; i++)
+ int i = 0;
+ for (i = 0; i < contact->SubAllocated; i++)
{
- struct ClcContact * subcontact=&(contact->subcontacts[i]);
+ struct ClcContact * subcontact = &(contact->subcontacts[i]);
if ((prefixOk && !_tcsnicmp(text, subcontact->szText, testlen)) ||
(!prefixOk && !lstrcmpi(text, subcontact->szText)))
{
@@ -863,8 +863,8 @@ int cliFindRowByText(HWND hwnd, struct ClcData *dat, const TCHAR *text, int pref
}
}
}
- if (contact->type==CLCIT_CONTACT && contact->SubAllocated && contact->SubExpanded)
- SubCount+=contact->SubAllocated;
+ if (contact->type == CLCIT_CONTACT && contact->SubAllocated && contact->SubExpanded)
+ SubCount += contact->SubAllocated;
group->scanIndex++;
}
return -1;