CCommentView::~CCommentView(){
-
+
DeleteObject(hHeaderFontNew);
return;
SCROLLINFO vScrollInfo = {0};
vScrollInfo.cbSize = sizeof(vScrollInfo);
vScrollInfo.fMask = SIF_RANGE;
+
this->SetScrollInfo(SB_VERT,&vScrollInfo,TRUE);
+
viewStartHeight = 0;
m_commentListWindow.SetRedraw(TRUE);
m_commentListWindow.SetRedraw(FALSE);
SCROLLINFO vScrollInfo = {0};
vScrollInfo.fMask = SIF_PAGE | SIF_POS | SIF_RANGE;
+
this->GetScrollInfo(SB_VERT,&vScrollInfo);
vScrollInfo.nPage = m_commentListWindow.CalcScrollPage();
vScrollInfo.fMask = SIF_PAGE;
this->SetScrollInfo(SB_VERT,&vScrollInfo);
+
BOOL scrollFlag = vScrollInfo.nPos + (int)vScrollInfo.nPage + 1>= vScrollInfo.nMax;
UINT_PTR commentCount = commentlist.Size();
LPNMHEADER lpNmHdr = (LPNMHEADER )lParam;
}
m_commentListWindow.SetRedraw(TRUE);
- m_commentListWindow.Invalidate();
+ if(TryEnterCriticalSection(&m_commentListWindow.m_sec) == TRUE){
+ m_commentListWindow.Invalidate();
+ m_commentListWindow.Unlock();
+ }
}
}
VOID CCommentView::OnChatReceve(NicoLiveChat_P chat,UINT_PTR commnetCountSum){
+
commentlist.OnChatReceve(chat,commnetCountSum,this->m_commentListWindow);
+
return;
}
//vScrollCcs.Lock();
vScrollInfo.fMask = SIF_ALL;
+
this->GetScrollInfo(SB_VERT,&vScrollInfo);
BOOL scrollFlag = vScrollInfo.nPos + (int)vScrollInfo.nPage >= vScrollInfo.nMax;
this->SetScrollInfo(SB_VERT,&vScrollInfo);
-
+
+
if(scrollFlag == TRUE){
this->SendMessageW(WM_VSCROLL,MAKEWORD(SB_BOTTOM,0),0);
}
- m_commentListWindow.Invalidate();
+ if(TryEnterCriticalSection(&m_commentListWindow.m_sec) == TRUE){
+ m_commentListWindow.Invalidate();
+ m_commentListWindow.Unlock();
+ }
return;
}
hScrollInfo.cbSize = sizeof(hScrollInfo);
hScrollInfo.fMask = SIF_PAGE;
hScrollInfo.nPage = client.cx;
+
this->SetScrollInfo(SB_HORZ,&hScrollInfo);
hScrollInfo.fMask = SIF_ALL;
this->GetScrollInfo(SB_HORZ,&hScrollInfo);
+
+
HDWP hDwp = BeginDeferWindowPos(2);
bkRect.top = 0;
bkRect.right = client.cx ;
bkRect.bottom = client.cy;
- this->InvalidateRect(&bkRect);
+
return;
}
LRESULT CCommentView::OnHeaderEndDrag(LPNMHDR lParam){
if(lParam->hwndFrom == m_header.m_hWnd){
-
- m_commentListWindow.Invalidate();
+ if(TryEnterCriticalSection(&m_commentListWindow.m_sec) == TRUE){
+
+ m_commentListWindow.Invalidate();
+ m_commentListWindow.Unlock();
+ }
}
vScrollInfo.fMask = SIF_ALL;
-
this->GetScrollInfo(SB_VERT,&vScrollInfo);
switch(loWParam){
case SB_BOTTOM:
- dy = vScrollInfo.nMax + 1;
+ dy = vScrollInfo.nMax;
break;
if(dy != 0){
vScrollInfo.nPos += dy;
- viewStartHeight = vScrollInfo.nPos + 1;
+ viewStartHeight = vScrollInfo.nPos;
this->SetScrollInfo(SB_VERT,&vScrollInfo);
-
- m_commentListWindow.Invalidate();
+ if(TryEnterCriticalSection(&m_commentListWindow.m_sec) == TRUE){
+ m_commentListWindow.Invalidate();
+ m_commentListWindow.Unlock();
+ }
}
+
return;
}
}
+
VOID CCommentListWindow::OnPaint(HDC hdc){
if(commentList.Size() > (UINT_PTR)self.viewStartHeight){
- CCommentList::iterator chatData = commentList.begin();
+
+ CCommentList::iterator chatData = commentList.begin();
std::advance(chatData,self.viewStartHeight);
+
+
+
CBrush baseBkBrush;
baseBkBrush.CreateSolidBrush(self.viewproperty.backColor);
m_memoryDC.FillRect(&listRect,baseBkBrush);
baseBkBrush.DeleteObject();
CCommentList::iterator endData = commentList.end();
listRect.bottom = 0;
- for(;chatData != endData;++chatData){
- listRect.bottom += this->CalcItemHeight(*chatData);
+ for(;chatData != endData && listRect.top < clientRect.bottom;++chatData){
+ listRect.bottom += chatData->height;
+
this->DrawItem(m_memoryDC,listRect,*chatData);
- listRect.top = listRect.bottom;
-
- if(listRect.top >= clientRect.bottom)break;
+
+
+ listRect.top = listRect.bottom;
}
-
}
- //\83R\83\81\83\93\83g\83\8a\83X\83g\83\8d\83b\83N\89ð\8f\9c
-// commentList.Unlock();
+
PAINTSTRUCT ps;
HDC selfDC = this->BeginPaint(&ps);
- ::BitBlt(selfDC,0,0,windowRect.right,windowRect.bottom,m_memoryDC,0,0,SRCCOPY);
+ BOOL rslt = ::BitBlt(selfDC,0,0,windowRect.right,windowRect.bottom,m_memoryDC,0,0,SRCCOPY);
this->EndPaint(&ps);
SCROLLINFO vScrollInfo = {0};
vScrollInfo.fMask = SIF_ALL;
+
+
self.GetScrollInfo(SB_VERT,&vScrollInfo);
BOOL scrollFlag = (UINT)(vScrollInfo.nPage + vScrollInfo.nPos + 1) >= (UINT)vScrollInfo.nMax;
vScrollInfo.nPage = CalcScrollPage();
vScrollInfo.fMask = SIF_PAGE;
self.SetScrollInfo(SB_VERT,&vScrollInfo);
+
+
if(scrollFlag == TRUE){
self.SendMessageW(WM_VSCROLL,MAKELONG(SB_BOTTOM,0),0);
}
+
return;
}
for(;rbegin != rend;++rbegin){
height += rbegin->height;
- rslt++;
- if(height > clientRect.bottom)goto overclientrect;
+ if(height > clientRect.bottom)goto overclientrect;
+ rslt++;
}
}
- vScrollInfo.fMask = SIF_ALL;
+ vScrollInfo.fMask = SIF_RANGE;
self.GetScrollInfo(SB_VERT,&vScrollInfo);
rslt = vScrollInfo.nMax + 1;
INT_PTR CCommentListWindow::CalcClickLine(INT_PTR height){
SCROLLINFO vScrollInfo = {0};
vScrollInfo.fMask = SIF_POS;
+
self.GetScrollInfo(SB_VERT,&vScrollInfo);
+
INT_PTR heightSum = 0;
INT_PTR lineNo = vScrollInfo.nPos;
CCommentList::iterator chatData = self.commentlist.begin();
VOID CCommentListWindow::OnLButtonDown(UINT wParam, _WTYPES_NS::CPoint &point){
-
-
-
this->SetFocus();
curselItem->selectFlag = FALSE;
}
self.commentlist.SetCurSel(CalcClickLine(point.y));
-
- this->Invalidate();
+ if(TryEnterCriticalSection(&this->m_sec) == TRUE){
+ this->Invalidate();
+ this->Unlock();
+ }
return;
}
chatData.listenerData->SetBkColor(bkColor);
- this->Invalidate(TRUE);
-
+ if(TryEnterCriticalSection(&this->m_sec) == TRUE){
+ this->Invalidate(TRUE);
+ this->Unlock();
+ }
self.SendMessageW(WM_VSCROLL,MAKELONG(hiWparam < 0 ? SB_PAGEDOWN : SB_PAGEUP ,0),0);
-
+
+
return 0;
}