namespace nlite{
-//
-//\83R\83\81\83\93\83g\83r\83\85\81[\83N\83\89\83X\83\81\83\\83b\83h
-///////////////////////////////////////////////////////
-
-CCommentView::CCommentView():
- m_commentListWindow(*this)
+ //\90F\92è\90\94
+ namespace ColorList{
+ enum type{
+ selectBack = RGB(255,240,240),
+ outLineSelect = RGB(255,0,0),
+ outLineNomal = RGB(0,0,0),
+ colLine = RGB(224,224,224)
+ };
+ };
+
+ //
+ //\83R\83\81\83\93\83g\83r\83\85\81[\83N\83\89\83X\83\81\83\\83b\83h
+ ///////////////////////////////////////////////////////
+
+ CCommentView::CCommentView():
+ m_commentListWindow(*this)
{
LOGFONT lf = {0};
hHeaderFontNew = CreateFontIndirect(&lf);
-
+
return;
-}
+ }
+
+ CCommentView::~CCommentView(){
+
-CCommentView::~CCommentView(){
+ DeleteObject(hHeaderFontNew);
+
+ return;
+ }
- DeleteObject(hHeaderFontNew);
- return;
-}
+ VOID CCommentView::OnConnect(){
+ m_commentListWindow.SetRedraw(FALSE);
+ commentlist.OnConnect();
+
+ SCROLLINFO vScrollInfo = {0};
+ vScrollInfo.cbSize = sizeof(vScrollInfo);
+ vScrollInfo.fMask = SIF_ALL;
+ this->SetScrollInfo(SB_VERT,&vScrollInfo,FALSE);
+ m_commentListWindow.SetRedraw(TRUE);
-VOID CCommentView::OnConnect(){
- m_commentListWindow.SetRedraw(FALSE);
- commentlist.OnConnect();
-
- SCROLLINFO vScrollInfo = {0};
- vScrollInfo.cbSize = sizeof(vScrollInfo);
- vScrollInfo.fMask = SIF_RANGE;
- this->SetScrollInfo(SB_VERT,&vScrollInfo,TRUE);
+ }
- viewStartHeight = 0;
- m_commentListWindow.SetRedraw(TRUE);
-
-
-}
+ UINT_PTR CCommentView::GetColumnHolSizeSum(){
-UINT_PTR CCommentView::GetColumnHolSizeSum(){
+ INT_PTR nMin = 0;
+ INT_PTR nMax = 0;
+ this->GetScrollRange(SB_HORZ,&nMin,&nMax);
- INT_PTR nMin = 0;
- INT_PTR nMax = 0;
- this->GetScrollRange(SB_HORZ,&nMin,&nMax);
+ return nMax;
+ }
- return nMax;
-}
+ VOID CCommentView::SetProperty(CommentViewProperty &setProperty){
-VOID CCommentView::SetProperty(CommentViewProperty &setProperty){
+ viewproperty = setProperty;
+ return;
+ }
- viewproperty = setProperty;
- return;
-}
+ CommentViewProperty &CCommentView::GetProperty(){
-CommentViewProperty &CCommentView::GetProperty(){
+ return viewproperty;
- return viewproperty;
+ }
-}
+ HWND CCommentView::Create(HWND hWndParent){
-HWND CCommentView::Create(HWND hWndParent){
-
- HWND rslt = __super::Create(hWndParent,0,commentViewConstant::NLITE_COMMENTVIEW,WS_VISIBLE | WS_CHILD | WS_VSCROLL | WS_HSCROLL | WS_BORDER,0,commentViewConstant::MENU_OR_ID);
+ HWND rslt = __super::Create(hWndParent,0,commentViewConstant::NLITE_COMMENTVIEW,WS_VISIBLE | WS_CHILD | WS_VSCROLL | WS_HSCROLL | WS_BORDER,0,commentViewConstant::MENU_OR_ID);
- PAINTSTRUCT ps;
- HDC hdc = m_header.BeginPaint(&ps);
- SIZE size;
+ PAINTSTRUCT ps;
+ HDC hdc = m_header.BeginPaint(&ps);
+ SIZE size;
- HFONT hOld = (HFONT)SelectObject(hdc,hHeaderFontNew);
+ HFONT hOld = (HFONT)SelectObject(hdc,hHeaderFontNew);
- LPTSTR columns[] = {TEXT("\83R\83\81\94Ô"),TEXT("\83\86\81[\83U\81[\96¼"),TEXT("\83R\83\81\83\93\83g"),TEXT("\8e\9e\8aÔ"),TEXT("\8fî\95ñ")};
- UINT_PTR holizenSize[] = {0,0,100,0,0};
+ LPTSTR columns[] = {TEXT("\83R\83\81\94Ô"),TEXT("\83\86\81[\83U\81[\96¼"),TEXT("\83R\83\81\83\93\83g"),TEXT("\8e\9e\8aÔ"),TEXT("\8fî\95ñ")};
+ UINT_PTR holizenSize[] = {0,0,100,0,0};
- for(UINT_PTR index = 0;index < ARRAY_LENGTH(columns) ;++index){
+ for(UINT_PTR index = 0;index < ARRAY_LENGTH(columns) ;++index){
- GetTextExtentPoint32(hdc , columns[index] , _tcslen(columns[index]) , &size);
- UINT_PTR holsize = holizenSize[index] + size.cx + 15;
- holizenSize[index] = viewproperty.headerholSize[index] >= 0 ? viewproperty.headerholSize[index] : holsize;
+ GetTextExtentPoint32(hdc , columns[index] , _tcslen(columns[index]) , &size);
+ UINT_PTR holsize = holizenSize[index] + size.cx + 15;
+ holizenSize[index] = viewproperty.headerholSize[index] >= 0 ? viewproperty.headerholSize[index] : holsize;
+ }
+
+ SelectObject(hdc,hOld);
+
+ m_header.EndPaint(&ps);
+
+
+ HEADERSINFO headersinfo = {columns,holizenSize,ARRAY_LENGTH(columns)};
+
+ AddHeader(&headersinfo);
+
+ m_header.SetOrderArray(ARRAY_LENGTH(viewproperty.headerOraderArray),viewproperty.headerOraderArray);
+
+
+
+
+ return rslt;
}
- SelectObject(hdc,hOld);
- m_header.EndPaint(&ps);
-
-
- HEADERSINFO headersinfo = {columns,holizenSize,ARRAY_LENGTH(columns)};
- AddHeader(&headersinfo);
- m_header.SetOrderArray(ARRAY_LENGTH(viewproperty.headerOraderArray),viewproperty.headerOraderArray);
-
-
-
-
- return rslt;
-}
+ LRESULT CCommentView::OnHeaderEndTrack(LPNMHDR lParam){
+ if(lParam->hwndFrom == m_header.m_hWnd){
-LRESULT CCommentView::OnHeaderEndTrack(LPNMHDR lParam){
+ m_commentListWindow.SetRedraw(FALSE);
+ SCROLLINFO vScrollInfo = {0};
+ vScrollInfo.fMask = SIF_PAGE | SIF_POS | SIF_RANGE;
-
- if(lParam->hwndFrom == m_header.m_hWnd){
-
-
- 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.nMax);
+ vScrollInfo.fMask = SIF_PAGE;
+ this->SetScrollInfo(SB_VERT,&vScrollInfo);
- 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;
- BOOL scrollFlag = vScrollInfo.nPos + (int)vScrollInfo.nPage + 1>= vScrollInfo.nMax;
- UINT_PTR commentCount = commentlist.Size();
- LPNMHEADER lpNmHdr = (LPNMHEADER )lParam;
-
- m_header.SetItem(lpNmHdr->iItem,lpNmHdr->pitem);
+ m_header.SetItem(lpNmHdr->iItem,lpNmHdr->pitem);
-
-
-
-
- if(scrollFlag == TRUE){
- this->SendMessageW(WM_VSCROLL,MAKELONG(SB_BOTTOM,0),0);
- }
- INT_PTR itemCount = m_header.GetItemCount();
- RECT itemSizeRect;
-
- INT_PTR nMax = 0;
- for(INT_PTR itemIndex = 0;itemIndex < itemCount;itemIndex++){
- m_header.GetItemRect(itemIndex,&itemSizeRect);
- nMax += itemSizeRect.right - itemSizeRect.left;
- }
- INT_PTR nMin = 0;
- this->SetScrollRange(SB_HORZ,nMin,nMax,TRUE);
- DecisionHorzSize();
+ if(scrollFlag == TRUE){
- auto begin = commentlist.begin();
+ this->SendMessageW(WM_VSCROLL,MAKELONG(SB_BOTTOM,0),0);
+ }
- auto end = commentlist.end();
+ INT_PTR itemCount = m_header.GetItemCount();
+ RECT itemSizeRect;
- /*
- for(;begin != end;++begin){
+ INT_PTR nMax = 0;
+ for(INT_PTR itemIndex = 0;itemIndex < itemCount;itemIndex++){
+ m_header.GetItemRect(itemIndex,&itemSizeRect);
+ nMax += itemSizeRect.right - itemSizeRect.left;
+
+ }
+ INT_PTR nMin = 0;
+ this->SetScrollRange(SB_HORZ,nMin,nMax,TRUE);
+ DecisionHorzSize();
+
+
+ auto begin = commentlist.begin();
+
+ auto end = commentlist.end();
+
+ /*
+ for(;begin != end;++begin){
begin->height = m_commentListWindow.CalcItemHeight(*begin);
+ }
+ */
+ m_commentListWindow.SetRedraw(TRUE);
+ if(TryEnterCriticalSection(&m_commentListWindow.m_sec) == TRUE){
+ m_commentListWindow.Invalidate();
+ m_commentListWindow.Unlock();
+ }
+
}
- */
- m_commentListWindow.SetRedraw(TRUE);
- if(TryEnterCriticalSection(&m_commentListWindow.m_sec) == TRUE){
- m_commentListWindow.Invalidate();
- m_commentListWindow.Unlock();
- }
-
+
+ return 0;
+ }
+
+ VOID CCommentView::OnChatReceve(NicoLiveChat_P chat,UINT_PTR commnetCountSum){
+
+ commentlist.OnChatReceve(chat,commnetCountSum,this->m_commentListWindow);
+
+ return;
+ }
+
+
+ VOID CCommentView::SetStreamStatus(StreamStatus_P st){
+
+ streamStatus.SetStreamStatus(st);
}
- return 0;
-}
+ VOID CCommentView::OnChatReceveSettle(UINT_PTR chatNo,UINT_PTR commentCountSum){
-VOID CCommentView::OnChatReceve(NicoLiveChat_P chat,UINT_PTR commnetCountSum){
- commentlist.OnChatReceve(chat,commnetCountSum,this->m_commentListWindow);
+ SCROLLINFO vScrollInfo = {0};
- return;
-}
+ //vScrollCcs.Lock();
+ vScrollInfo.fMask = SIF_ALL;
-VOID CCommentView::SetStreamStatus(StreamStatus &st){
-
- streamStatus.SetStreamStatus(st);
-}
+ this->GetScrollInfo(SB_VERT,&vScrollInfo);
+ BOOL scrollFlag = vScrollInfo.nPos + (int)vScrollInfo.nPage >= vScrollInfo.nMax;
-VOID CCommentView::OnChatReceveSettle(UINT_PTR chatNo,UINT_PTR commentCountSum){
-
- SCROLLINFO vScrollInfo = {0};
-
- //vScrollCcs.Lock();
- vScrollInfo.fMask = SIF_ALL;
+ // vScrollInfo.fMask = SIF_RANGE;
+ vScrollInfo.cbSize = sizeof(vScrollInfo);
- this->GetScrollInfo(SB_VERT,&vScrollInfo);
- BOOL scrollFlag = vScrollInfo.nPos + (int)vScrollInfo.nPage >= vScrollInfo.nMax;
-
+ vScrollInfo.nMax = commentCountSum;
+ // this->SetScrollRange(SB_VERT,vScrollInfo.nMin,vScrollInfo.nMax,FALSE);
+ // this->SetScrollInfo(SB_VERT,&vScrollInfo,FALSE);
+ vScrollInfo.fMask = SIF_RANGE | SIF_PAGE;
+ vScrollInfo.nPage = m_commentListWindow.CalcScrollPage(vScrollInfo.nMax);
- vScrollInfo.fMask = SIF_RANGE | SIF_PAGE;
- vScrollInfo.cbSize = sizeof(vScrollInfo);
- vScrollInfo.nMax = commentCountSum;
- vScrollInfo.nPage = m_commentListWindow.CalcScrollPage();
-
-
- this->SetScrollInfo(SB_VERT,&vScrollInfo);
+ this->SetScrollInfo(SB_VERT,&vScrollInfo,FALSE);
-
-
- if(scrollFlag == TRUE){
- this->SendMessageW(WM_VSCROLL,MAKEWORD(SB_BOTTOM,0),0);
+
+
+ if(scrollFlag == TRUE){
+ this->SendMessageW(WM_VSCROLL,MAKEWORD(SB_BOTTOM,0),0);
+ }
+
+
+ if(vScrollInfo.nPos + static_cast<INT_PTR>(vScrollInfo.nPage) >= vScrollInfo.nMax - static_cast<INT_PTR>(vScrollInfo.nPage)&& TryEnterCriticalSection(&m_commentListWindow.m_sec) == TRUE){
+ m_commentListWindow.Invalidate();
+ m_commentListWindow.Unlock();
+ }
+
+
+ //this->SetScrollInfo(SB_VERT,NULL);
+
+ return;
}
- if(vScrollInfo.nPos + vScrollInfo.nPage >= vScrollInfo.nMax - vScrollInfo.nPage && TryEnterCriticalSection(&m_commentListWindow.m_sec) == TRUE){
- m_commentListWindow.Invalidate();
- m_commentListWindow.Unlock();
+
+ static UCHAR getrgb(){
+
+ UCHAR rgb = 160 + rand() % 92;
+ return rgb;
}
-
- return;
-}
-static UCHAR getrgb(){
- UCHAR rgb = 160 + rand() % 92;
- return rgb;
-}
+ LRESULT CCommentView::OnSize(UINT wParam,SIZE lParam){
+ ChangeSize(lParam);
+ return 0;
+ }
-LRESULT CCommentView::OnSize(UINT wParam,SIZE lParam){
- ChangeSize(lParam);
-
- return 0;
-}
+ VOID CCommentView::ChangeSize(const SIZE& client){
-VOID CCommentView::ChangeSize(const SIZE& client){
-
- SCROLLINFO hScrollInfo = {0};
- 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);
+ SCROLLINFO hScrollInfo = {0};
+ hScrollInfo.cbSize = sizeof(hScrollInfo);
+ hScrollInfo.fMask = SIF_PAGE;
+ hScrollInfo.nPage = client.cx;
-
- HDWP hDwp = BeginDeferWindowPos(2);
-
+ this->SetScrollInfo(SB_HORZ,&hScrollInfo);
+ hScrollInfo.fMask = SIF_ALL;
+ this->GetScrollInfo(SB_HORZ,&hScrollInfo);
- INT_PTR movePos = -1 * hScrollInfo.nPos;
-
- m_header.DeferWindowPos(hDwp,m_header.m_hWnd,movePos,0,0,0,SWP_NOSIZE | SWP_NOZORDER);
- m_commentListWindow.DeferWindowPos(hDwp,m_commentListWindow.m_hWnd,movePos,commentViewConstant::HEADER_HAIGHT,::GetSystemMetrics(SM_CXFULLSCREEN),client.cy - commentViewConstant::HEADER_HAIGHT,SWP_NOZORDER);
- EndDeferWindowPos(hDwp);
-
-
- RECT bkRect;
- RECT headerRectSize;
- m_header.GetWindowRect(&headerRectSize);
- bkRect.left = headerRectSize.right - headerRectSize.left - hScrollInfo.nPos;
- bkRect.top = 0;
- bkRect.right = client.cx ;
- bkRect.bottom = client.cy;
-
+ HDWP hDwp = BeginDeferWindowPos(2);
- return;
-}
+ INT_PTR movePos = -1 * hScrollInfo.nPos;
-LRESULT CCommentView::OnEraseBkgnd(HDC wParam){
+ m_header.DeferWindowPos(hDwp,m_header.m_hWnd,movePos,0,0,0,SWP_NOSIZE | SWP_NOZORDER);
+ m_commentListWindow.DeferWindowPos(hDwp,m_commentListWindow.m_hWnd,movePos,commentViewConstant::HEADER_HAIGHT,::GetSystemMetrics(SM_CXFULLSCREEN),client.cy - commentViewConstant::HEADER_HAIGHT,SWP_NOZORDER);
- return TRUE;
-}
+ EndDeferWindowPos(hDwp);
-VOID CCommentView::OnDestroy(){
- m_header.GetOrderArray(ARRAY_LENGTH(viewproperty.headerOraderArray),viewproperty.headerOraderArray);
- INT_PTR headerItemcount = m_header.GetItemCount();
- RECT headerItemRect;
- for(INT_PTR itemindex = 0;itemindex < headerItemcount;itemindex++){
-
- m_header.GetItemRect(itemindex,&headerItemRect);
- viewproperty.headerholSize[itemindex] = headerItemRect.right - headerItemRect.left;
+ RECT bkRect;
+ RECT headerRectSize;
+ m_header.GetWindowRect(&headerRectSize);
+ bkRect.left = headerRectSize.right - headerRectSize.left - hScrollInfo.nPos;
+ bkRect.top = 0;
+ bkRect.right = client.cx ;
+ bkRect.bottom = client.cy;
+
+
+ return;
}
- commentlist.OnDestroy();
- m_header.DestroyWindow();
- m_commentListWindow.DestroyWindow();
- return;
-}
-LRESULT CCommentView::OnHeaderEndDrag(LPNMHDR lParam){
+ LRESULT CCommentView::OnEraseBkgnd(HDC wParam){
- if(lParam->hwndFrom == m_header.m_hWnd){
- if(TryEnterCriticalSection(&m_commentListWindow.m_sec) == TRUE){
-
- m_commentListWindow.Invalidate();
- m_commentListWindow.Unlock();
+ return TRUE;
+ }
+
+
+ VOID CCommentView::OnDestroy(){
+ m_header.GetOrderArray(ARRAY_LENGTH(viewproperty.headerOraderArray),viewproperty.headerOraderArray);
+ INT_PTR headerItemcount = m_header.GetItemCount();
+ RECT headerItemRect;
+ for(INT_PTR itemindex = 0;itemindex < headerItemcount;itemindex++){
+
+ m_header.GetItemRect(itemindex,&headerItemRect);
+ viewproperty.headerholSize[itemindex] = headerItemRect.right - headerItemRect.left;
}
+ commentlist.OnDestroy();
+ m_header.DestroyWindow();
+ m_commentListWindow.DestroyWindow();
+ return;
}
- return 0;
-}
+ LRESULT CCommentView::OnHeaderEndDrag(LPNMHDR lParam){
+ if(lParam->hwndFrom == m_header.m_hWnd){
+ if(TryEnterCriticalSection(&m_commentListWindow.m_sec) == TRUE){
-VOID CCommentView::OnHScroll(INT_PTR loWParam,SHORT hiWParam,HWND lParam){
+ m_commentListWindow.Invalidate();
+ m_commentListWindow.Unlock();
+ }
-
- INT_PTR dy;
- SCROLLINFO hScrollInfo = {0};
- hScrollInfo.cbSize = sizeof(hScrollInfo);
- hScrollInfo.fMask = SIF_ALL;
- this->GetScrollInfo(SB_HORZ,&hScrollInfo);
- switch(loWParam){
+ }
- case SB_THUMBPOSITION:
- case SB_THUMBTRACK:
- dy = hiWParam - hScrollInfo.nPos;
- break;
+ return 0;
+ }
- case SB_LINELEFT:
- case SB_PAGELEFT:
- dy = -1 * hScrollInfo.nPage;
+ VOID CCommentView::OnHScroll(INT_PTR loWParam,SHORT hiWParam,HWND lParam){
- break;
- case SB_LINERIGHT:
- case SB_PAGERIGHT:
+ INT_PTR dy;
+ SCROLLINFO hScrollInfo = {0};
+ hScrollInfo.cbSize = sizeof(hScrollInfo);
+ hScrollInfo.fMask = SIF_ALL;
+ this->GetScrollInfo(SB_HORZ,&hScrollInfo);
+ switch(loWParam){
- dy = hScrollInfo.nPage + hScrollInfo.nPos > (UINT_PTR)hScrollInfo.nMax ? 0 :(UINT_PTR) (hScrollInfo.nMax - ( hScrollInfo.nPage + hScrollInfo.nPos)) < hScrollInfo.nPage ? (hScrollInfo.nMax - ( hScrollInfo.nPage + hScrollInfo.nPos)) : hScrollInfo.nPage;
+ case SB_THUMBPOSITION:
+ case SB_THUMBTRACK:
+ dy = hiWParam - hScrollInfo.nPos;
+ break;
- break;
+ case SB_LINELEFT:
+ case SB_PAGELEFT:
- default:
- dy = 0;
- break;
+ dy = -1 * hScrollInfo.nPage;
- }
-
- dy = max(-1 * hScrollInfo.nPos, min(dy, hScrollInfo.nMax - hScrollInfo.nPos));
+ break;
+ case SB_LINERIGHT:
+ case SB_PAGERIGHT:
- if(dy != 0){
- hScrollInfo.nPos += dy;
- INT_PTR moveRange = -(hScrollInfo.nPos);
+ dy = hScrollInfo.nPage + hScrollInfo.nPos > (UINT_PTR)hScrollInfo.nMax ? 0 :(UINT_PTR) (hScrollInfo.nMax - ( hScrollInfo.nPage + hScrollInfo.nPos)) < hScrollInfo.nPage ? (hScrollInfo.nMax - ( hScrollInfo.nPage + hScrollInfo.nPos)) : hScrollInfo.nPage;
- HDWP hDwp = BeginDeferWindowPos(2);
+ break;
- m_header.DeferWindowPos(hDwp,m_header.m_hWnd,moveRange,0,0,0,SWP_NOSIZE | SWP_NOZORDER);
- m_commentListWindow.DeferWindowPos(hDwp,m_commentListWindow.m_hWnd,moveRange,commentViewConstant::HEADER_HAIGHT,0,0,SWP_NOSIZE | SWP_NOZORDER);
+ default:
+ dy = 0;
+ break;
- EndDeferWindowPos(hDwp);
-
-
- this->SetScrollInfo(SB_HORZ,&hScrollInfo);
+ }
+
+ dy = max(-1 * hScrollInfo.nPos, min(dy, hScrollInfo.nMax - hScrollInfo.nPos));
+
+
+ if(dy != 0){
+ hScrollInfo.nPos += dy;
+ INT_PTR moveRange = -(hScrollInfo.nPos);
+
+ HDWP hDwp = BeginDeferWindowPos(2);
+
+ m_header.DeferWindowPos(hDwp,m_header.m_hWnd,moveRange,0,0,0,SWP_NOSIZE | SWP_NOZORDER);
+ m_commentListWindow.DeferWindowPos(hDwp,m_commentListWindow.m_hWnd,moveRange,commentViewConstant::HEADER_HAIGHT,0,0,SWP_NOSIZE | SWP_NOZORDER);
+
+ EndDeferWindowPos(hDwp);
+
+
+ this->SetScrollInfo(SB_HORZ,&hScrollInfo);
+ }
+
+ return;
}
-
- return;
-}
-VOID CCommentView::OnVScroll(INT_PTR loWParam,SHORT hiWParam,HWND lParam){
+ VOID CCommentView::OnVScroll(INT_PTR loWParam,SHORT hiWParam,HWND lParam){
- INT_PTR dy;
- SCROLLINFO vScrollInfo = {0};
- vScrollInfo.fMask = SIF_ALL;
+ INT_PTR dy;
+ SCROLLINFO vScrollInfo = {0};
+ vScrollInfo.fMask = SIF_ALL;
-
- this->GetScrollInfo(SB_VERT,&vScrollInfo);
- switch(loWParam){
+ this->GetScrollInfo(SB_VERT,&vScrollInfo);
+ switch(loWParam){
- case SB_THUMBPOSITION:
- case SB_THUMBTRACK:
- dy = hiWParam - vScrollInfo.nPos;
+ case SB_THUMBPOSITION:
+ case SB_THUMBTRACK:
- break;
+ dy = hiWParam - vScrollInfo.nPos;
- case SB_LINEUP:
+ break;
- dy = -1;
- break;
+ case SB_LINEUP:
- case SB_LINEDOWN:
+ dy = -1;
+ break;
- dy = 1;
+ case SB_LINEDOWN:
- break;
+ dy = 1;
- case SB_PAGEUP:
+ break;
- dy = -1 * vScrollInfo.nPage;
+ case SB_PAGEUP:
- break;
+ dy = -1 * vScrollInfo.nPage;
- case SB_PAGEDOWN:
+ break;
- dy = vScrollInfo.nPage;
+ case SB_PAGEDOWN:
- break;
+ dy = vScrollInfo.nPage;
+ break;
- case SB_TOP:
- dy = -vScrollInfo.nPos;
+ case SB_TOP:
- break;
+ dy = -vScrollInfo.nPos;
- case SB_BOTTOM:
+ break;
- dy = vScrollInfo.nMax;
+ case SB_BOTTOM:
- break;
+ dy = vScrollInfo.nMax;
- default:
+ break;
- dy = 0;
+ default:
- break;
+ dy = 0;
- }
+ break;
+
+ }
- dy = max(-1 * vScrollInfo.nPos, min(dy, vScrollInfo.nMax - (vScrollInfo.nPos + (INT_PTR)vScrollInfo.nPage)));
- if(dy != 0){
- vScrollInfo.nPos += dy;
- viewStartHeight = vScrollInfo.nPos;
- this->SetScrollInfo(SB_VERT,&vScrollInfo);
- if(TryEnterCriticalSection(&m_commentListWindow.m_sec) == TRUE){
- m_commentListWindow.Invalidate();
- m_commentListWindow.Unlock();
+ if(dy != 0){
+
+ vScrollInfo.nPos += dy;
+ // viewStartHeight = vScrollInfo.nPos;
+ this->SetScrollPos(SB_VERT,vScrollInfo.nPos);
+ //this->SetScrollInfo(SB_VERT,&vScrollInfo);
+ this->UpdateWindow();
+ if(TryEnterCriticalSection(&m_commentListWindow.m_sec) == TRUE){
+ m_commentListWindow.Invalidate();
+ m_commentListWindow.Unlock();
+ }
}
- }
-
-
- return;
-}
-LRESULT CCommentView::OnCreate(LPCREATESTRUCT lpcs){
- m_header.Create(m_hWnd,0,WC_HEADER,WS_CHILD | WS_VISIBLE | WS_CLIPCHILDREN | HDS_BUTTONS | HDS_HOTTRACK |HDS_DRAGDROP | HDS_FULLDRAG ,0,commentViewConstant::HEADER_ID);
- m_commentListWindow.Create(m_hWnd,0,commentViewConstant::NLITE_COMMENTLISTWINDOW,WS_CHILD | WS_VISIBLE | WS_CLIPCHILDREN , 0,commentViewConstant::LISTBOX_ID);
-
-
-
-
- return 0;
-}
-VOID CCommentView::AddHeader(LPHEADERSINFO infos){
+ return;
+ }
+ LRESULT CCommentView::OnCreate(LPCREATESTRUCT lpcs){
+ m_header.Create(m_hWnd,0,WC_HEADER,WS_CHILD | WS_VISIBLE | WS_CLIPCHILDREN | HDS_BUTTONS | HDS_HOTTRACK |HDS_DRAGDROP | HDS_FULLDRAG ,0,commentViewConstant::HEADER_ID);
+ m_commentListWindow.Create(m_hWnd,0,commentViewConstant::NLITE_COMMENTLISTWINDOW,WS_CHILD | WS_VISIBLE | WS_CLIPCHILDREN , 0,commentViewConstant::LISTWINDOW);
- m_header.SetFont(hHeaderFontNew);
- HDITEM item;
- item.mask = HDI_FORMAT | HDI_TEXT | HDI_WIDTH;
- item.fmt = HDF_CENTER | HDF_STRING;
-
-
- for(UINT_PTR index = 0;index < infos->count ;++index){
- item.pszText = infos->columns[index];
- item.cxy = infos->holizensize[index];
- m_header.AddItem(&item);
+ return 0;
}
- RECT itemRect;
- INT_PTR nMax = 0;
- UINT_PTR itemCount = m_header.GetItemCount();
- for(UINT_PTR u_index = 0;u_index < itemCount;++u_index){
+ VOID CCommentView::AddHeader(LPHEADERSINFO infos){
+
+
+ m_header.SetFont(hHeaderFontNew);
+
+ HDITEM item;
+ item.mask = HDI_FORMAT | HDI_TEXT | HDI_WIDTH;
+ item.fmt = HDF_CENTER | HDF_STRING;
+
+
+ for(UINT_PTR index = 0;index < infos->count ;++index){
+
+ item.pszText = infos->columns[index];
- m_header.GetItemRect(u_index,&itemRect);
- nMax += itemRect.right - itemRect.left;
+ item.cxy = infos->holizensize[index];
+ m_header.AddItem(&item);
+ }
+
+ RECT itemRect;
+ INT_PTR nMax = 0;
+ UINT_PTR itemCount = m_header.GetItemCount();
+ for(UINT_PTR u_index = 0;u_index < itemCount;++u_index){
+
+ m_header.GetItemRect(u_index,&itemRect);
+ nMax += itemRect.right - itemRect.left;
+
+ }
+
+ this->SetScrollRange(SB_HORZ,0,nMax,TRUE);
+ DecisionHorzSize();
+ return;
}
-
- this->SetScrollRange(SB_HORZ,0,nMax,TRUE);
-
- DecisionHorzSize();
- return;
-}
-VOID CCommentView::DecisionHorzSize(){
-
- HDWP hWindowPosInfo = BeginDeferWindowPos(2);
- RECT bkWindowRect;
- this->GetClientRect(&bkWindowRect);
- m_header.DeferWindowPos(hWindowPosInfo,m_header.m_hWnd,0,0,::GetSystemMetrics(SM_CXFULLSCREEN),commentViewConstant::HEADER_HAIGHT,SWP_NOZORDER | SWP_NOMOVE);
- m_commentListWindow.DeferWindowPos(hWindowPosInfo,m_header.m_hWnd,0,0,::GetSystemMetrics(SM_CXFULLSCREEN),bkWindowRect.bottom - commentViewConstant::HEADER_HAIGHT,SWP_NOZORDER | SWP_NOMOVE);
+ VOID CCommentView::DecisionHorzSize(){
- EndDeferWindowPos(hWindowPosInfo);
-
- return;
-}
+ HDWP hWindowPosInfo = BeginDeferWindowPos(2);
+ RECT bkWindowRect;
+ this->GetClientRect(&bkWindowRect);
+ m_header.DeferWindowPos(hWindowPosInfo,m_header.m_hWnd,0,0,::GetSystemMetrics(SM_CXFULLSCREEN),commentViewConstant::HEADER_HAIGHT,SWP_NOZORDER | SWP_NOMOVE);
+ m_commentListWindow.DeferWindowPos(hWindowPosInfo,m_header.m_hWnd,0,0,::GetSystemMetrics(SM_CXFULLSCREEN),bkWindowRect.bottom - commentViewConstant::HEADER_HAIGHT,SWP_NOZORDER | SWP_NOMOVE);
+
+ EndDeferWindowPos(hWindowPosInfo);
+
+ return;
+ }
-//
-//\83R\83\81\83\93\83g\83r\83\85\81[\83N\83\89\83X\93à\95\94\83\8a\83X\83g\83N\83\89\83X
-////////////////////////////////////////////////////////////////////
+ //
+ //\83R\83\81\83\93\83g\83r\83\85\81[\83N\83\89\83X\93à\95\94\83\8a\83X\83g\83N\83\89\83X
+ ////////////////////////////////////////////////////////////////////
-CCommentListWindow::CCommentListWindow(CCommentView &in_self):
+ CCommentListWindow::CCommentListWindow(CCommentView &in_self):
self(in_self)
{}
-CCommentListWindow::~CCommentListWindow(){
-}
+ CCommentListWindow::~CCommentListWindow(){
+ }
-VOID CCommentListWindow::OnPaint(HDC in_hdc){
+ VOID CCommentListWindow::OnPaint(HDC in_hdc){
-
-
- RECT windowRect;
- RECT clientRect;
-
- self.GetClientRect(&clientRect);
- clientRect.bottom -= commentViewConstant::HEADER_HAIGHT;
- this->GetWindowRect(&windowRect);
- windowRect.right -= windowRect.left;
- windowRect.bottom -= windowRect.top;
- windowRect.left = 0;
- windowRect.top = 0;
- RECT listRect = windowRect;
- listRect.right = self.GetColumnHolSizeSum();
- CPaintDC pdc(*this);
-
- {
- CMemoryDC mdc(pdc,windowRect);
- mdc.SelectFont(AtlGetDefaultGuiFont());
- mdc.FillRect(&clientRect,(HBRUSH)::GetStockObject(GRAY_BRUSH));
-
- CCommentList &commentList = self.commentlist;
-
- BOOL selectFlag = FALSE;
- CCommentList::iterator selectData;
- RECT selectRect = {0};
-
- if(commentList.Size() > (UINT_PTR)self.viewStartHeight){
-
-
-
- CCommentList::iterator chatData = commentList.begin();
- std::advance(chatData,self.viewStartHeight);
-
-
-
- CBrush baseBkBrush;
- baseBkBrush.CreateSolidBrush(self.viewproperty.backColor);
- mdc.FillRect(&listRect,baseBkBrush);
- baseBkBrush.DeleteObject();
- CCommentList::iterator endData = commentList.end();
- listRect.bottom = 0;
-
- CPen outLinePen;
- outLinePen.CreatePen(PS_SOLID,1,ColorList::outLineNomal);
- mdc.SelectPen(outLinePen);
- mdc.MoveTo(listRect.right,listRect.top);
- mdc.LineTo(listRect.right,listRect.bottom);
-
-
- for(;chatData != endData && listRect.top < clientRect.bottom;++chatData){
- listRect.bottom += CalcItemHeight(*chatData);
-
-
- if(chatData->selectFlag == TRUE){
- selectFlag = TRUE;
- selectData = chatData;
- selectRect = listRect;
- } else {
-
- this->DrawItem(mdc,listRect,*chatData);
+ RECT windowRect;
+ RECT listRect = {0};
+ RECT clientRect;
+
+ self.GetClientRect(&clientRect);
+ clientRect.bottom -= commentViewConstant::HEADER_HAIGHT;
+
+ this->GetWindowRect(&windowRect);
+ windowRect.right -= windowRect.left;
+ windowRect.bottom -= windowRect.top;
+ windowRect.left = 0;
+ windowRect.top = 0;
+
+
+ CPaintDC pdc(*this);
+
+ {
+ CMemoryDC mdc(pdc,windowRect);
+ mdc.SelectFont(AtlGetDefaultGuiFont());
+
+
+ CCommentList &commentList = self.commentlist;
+
+ BOOL selectFlag = FALSE;
+ CCommentList::iterator selectData;
+ RECT selectRect = {0};
+ UINT_PTR viewStartHeight = self.GetScrollPos(SB_VERT);
+
+
+ if(commentList.Size() > (UINT_PTR)viewStartHeight){
+
+ listRect = windowRect;
+ listRect.right = self.GetColumnHolSizeSum();
+
+ CCommentList::iterator chatData = commentList.begin();
+ std::advance(chatData,viewStartHeight);
+
+
+
+ CBrush baseBkBrush;
+ baseBkBrush.CreateSolidBrush(self.viewproperty.backColor);
+ mdc.FillRect(&listRect,baseBkBrush);
+ baseBkBrush.DeleteObject();
+ CCommentList::iterator endData = commentList.end();
+ listRect.bottom = 0;
+
+ CPen outLinePen;
+ outLinePen.CreatePen(PS_SOLID,1,ColorList::outLineNomal);
+ mdc.SelectPen(outLinePen);
+ mdc.MoveTo(listRect.right,listRect.top);
+ mdc.LineTo(listRect.right,listRect.bottom);
+
+
+ for(;chatData != endData && listRect.top < clientRect.bottom;++chatData){
+ listRect.bottom += CalcItemHeight(*chatData);
+
+
+ if(chatData->selectFlag == TRUE){
+ selectFlag = TRUE;
+ selectData = chatData;
+ selectRect = listRect;
+ } else {
+
+ this->DrawItem(mdc,listRect,*chatData);
+ }
+
+
+ listRect.top = listRect.bottom;
+ }
+
+ mdc.SelectPen(outLinePen);
+ mdc.MoveTo(listRect.left,listRect.bottom);
+ mdc.LineTo(listRect.right,listRect.bottom);
+
+ if(selectFlag == TRUE){
+ this->DrawItem(mdc,selectRect,*selectData);
}
-
-
- listRect.top = listRect.bottom;
- }
- mdc.SelectPen(outLinePen);
- mdc.MoveTo(listRect.left,listRect.bottom);
- mdc.LineTo(listRect.right,listRect.bottom);
-
- if(selectFlag == TRUE){
- this->DrawItem(mdc,selectRect,*selectData);
}
+ windowRect.left = listRect.right;
+ mdc.FillRect(&windowRect,(HBRUSH)::GetStockObject(GRAY_BRUSH));
+
+
+
}
-
-
-
+
+
+
+ return;
}
-
+ VOID CCommentListWindow::OnSize(UINT wParam, _WTYPES_NS::CSize &windowSize){
+
-
- return;
-}
+ SCROLLINFO vScrollInfo = {0};
+ vScrollInfo.fMask = SIF_ALL;
-VOID CCommentListWindow::OnSize(UINT wParam, _WTYPES_NS::CSize &windowSize){
-
- 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.nMax);
+
+ vScrollInfo.fMask = SIF_PAGE;
+ self.SetScrollInfo(SB_VERT,&vScrollInfo);
- 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);
+ if(scrollFlag == TRUE){
+ self.SendMessageW(WM_VSCROLL,MAKELONG(SB_BOTTOM,0),0);
+ }
+
+ this->Invalidate();
+
+ return;
}
- this->Invalidate();
-
- return;
-}
+ UINT_PTR CCommentListWindow::CalcScrollPage(UINT_PTR nMax){
+
+ RECT clientRect;
+ INT_PTR rslt = 0;
+ LONG height = 0;
+ this->GetClientRect(&clientRect);
+
+ SCROLLINFO vScrollInfo = {0};
+ if(self.commentlist.empty() != TRUE){
+
+ CCommentList::reverse_iterator rbegin = self.commentlist.rbegein();
+ CCommentList::reverse_iterator rend = self.commentlist.rend();
+ for(;rbegin != rend;++rbegin){
-UINT_PTR CCommentListWindow::CalcScrollPage(){
-
- RECT clientRect;
- INT_PTR rslt = 0;
- LONG height = 0;
- this->GetClientRect(&clientRect);
-
- SCROLLINFO vScrollInfo = {0};
- if(self.commentlist.empty() != TRUE){
-
- CCommentList::reverse_iterator rbegin = self.commentlist.rbegein();
- CCommentList::reverse_iterator rend = self.commentlist.rend();
- for(;rbegin != rend;++rbegin){
+ height += CalcItemHeight(*rbegin);
+ rslt++;
+ if(height > clientRect.bottom)goto overclientrect;
- height += CalcItemHeight(*rbegin);
-
- if(height > clientRect.bottom)goto overclientrect;
- rslt++;
+ }
}
- }
-
- vScrollInfo.fMask = SIF_RANGE;
- self.GetScrollInfo(SB_VERT,&vScrollInfo);
- rslt = vScrollInfo.nMax + 1;
+ /*
+ vScrollInfo.fMask = SIF_RANGE;
+ self.GetScrollInfo(SB_VERT,&vScrollInfo);
+ */
+ rslt = nMax+ 1;
+
-
overclientrect:
- return rslt;
-}
-
-VOID CCommentListWindow::DrawItem(CDC &dc,RECT &rc,CChatData &chatData){
-
-
- RECT noViewRect;
- RECT userNameViewRect;
- RECT timeViewRect;
- RECT chatViewRect;
- RECT infoViewRect;
-
- time_t chatTime = (time_t)difftime(chatData.date,self.streamStatus.start_time);
- tm ct = *gmtime(&chatTime);
-
- TCHAR noString[sizeof(chatData.no) * 8];
- TCHAR dateString[LENGTH_16];
- _stprintf(noString,TEXT("%u"),chatData.no);
-
- _tcsftime(dateString,ARRAY_LENGTH(dateString),ct.tm_hour != 0 ? TEXT("%H:%M:%S") : TEXT("%M:%S"),&ct);
-
- COLORREF bkColor;
- COLORREF outLineColor;
-
- CPen outLinePen;
- CPen colLinePen;
- CBrush bkBrush;
- colLinePen.CreatePen(PS_SOLID,1,ColorList::colLine);
-
-
- //\91I\91ð\8fó\91Ô\82©\83`\83F\83b\83N
- if (chatData.selectFlag == TRUE)
- {
- bkColor = ColorList::selectBack;
- outLineColor = ColorList::outLineSelect;
-
-
+ return rslt;
}
- else
- {
-
- outLineColor = ColorList::outLineNomal;
-
- if(chatData.listenerData->originBkFlag == TRUE){
-
- bkColor = chatData.listenerData->bkColor;
-
-
+
+ VOID CCommentListWindow::DrawItem(CDC &dc,RECT &rc,CChatData &chatData){
+
+
+ RECT noViewRect;
+ RECT userNameViewRect;
+ RECT timeViewRect;
+ RECT chatViewRect;
+ RECT infoViewRect;
+
+
+ time_t chatTime = (time_t)difftime(chatData.date,self.streamStatus.start_time);
+
+
+ BOOL beforeStartFlag = chatTime < 0 ? TRUE : FALSE;
+ TCHAR noString[sizeof(chatData.no) * 8];
+ TCHAR dateString[LENGTH_16];
+ if(chatData.no != 0)_stprintf(noString,TEXT("%u"),chatData.no);
+ else _tcscpy(noString,TEXT(""));
+ CNLiteString timeFormat;
+
+
+ if(beforeStartFlag == TRUE){
+
+ timeFormat = TEXT("-");
+ chatTime = -chatTime;
+ }
+ tm ct = *gmtime(&chatTime);
+ if(ct.tm_hour != 0 ){
+
+ timeFormat += TEXT("%H:%M:%S");
+
} else {
-
- bkColor = self.viewproperty.backColor;
-
-
-
+
+ timeFormat += TEXT("%M:%S");
}
- }
- outLinePen.CreatePen(PS_SOLID,1,outLineColor);
- bkBrush.CreateSolidBrush(bkColor);
- dc.SelectPen(outLinePen);
-
- if(chatData.selectFlag == TRUE){
-
- dc.MoveTo(rc.left,rc.bottom);
- dc.LineTo(rc.right,rc.bottom);
- }
- dc.FillRect(&rc,bkBrush);
- dc.SetBkColor(bkColor);
- dc.MoveTo(rc.left,rc.top);
- dc.LineTo(rc.right,rc.top);
-
-
-
- dc.SetTextColor(self.viewproperty.baseStringColor);
-
-
-
-
-
- //\95`\89æ\83T\83C\83Y\82ð\8cv\8eZ
-
- self.m_header.GetItemRect(CCommentView::NO,&noViewRect);
- self.m_header.GetItemRect(CCommentView::USERNAME,&userNameViewRect);
- self.m_header.GetItemRect(CCommentView::COMMENT,&chatViewRect);
- self.m_header.GetItemRect(CCommentView::TIME,&timeViewRect);
- self.m_header.GetItemRect(CCommentView::INFO,&infoViewRect);
-
- noViewRect.left += 2;
- userNameViewRect.left += 2;
- timeViewRect.left += 2;
- chatViewRect.left += 2;
- infoViewRect.left += 2;
-
- noViewRect.right -= 2;
- userNameViewRect.right -= 2;
- timeViewRect.right -= 2;
- chatViewRect.right -= 2;
- infoViewRect.right -= 2;
-
- noViewRect.top = rc.top + 2;
- userNameViewRect.top = rc.top + 2;
- timeViewRect.top = rc.top + 2;
- chatViewRect.top = rc.top + 2;
- infoViewRect.top = rc.top + 2;
-
- noViewRect.bottom = rc.bottom - 2;
- userNameViewRect.bottom = rc.bottom - 2;
- timeViewRect.bottom = rc.bottom - 2;
- chatViewRect.bottom = rc.bottom - 2;
- infoViewRect.bottom = rc.bottom - 2;
-
- dc.SelectPen(colLinePen);
-
- dc.MoveTo(noViewRect.right,rc.top);
- dc.LineTo(noViewRect.right,rc.bottom);
- dc.MoveTo(userNameViewRect.right,rc.top);
- dc.LineTo(userNameViewRect.right,rc.bottom);
- dc.MoveTo(chatViewRect.right,rc.top);
- dc.LineTo(chatViewRect.right,rc.bottom);
- dc.MoveTo(timeViewRect.right,rc.top);
- dc.LineTo(timeViewRect.right,rc.bottom);
-
- dc.DrawTextW(noString,_tcslen(noString),&noViewRect,DT_WORD_ELLIPSIS);
- dc.DrawTextW(chatData.listenerData->user_id,chatData.listenerData->user_id.length(),&userNameViewRect,DT_WORD_ELLIPSIS);
- dc.DrawTextW(chatData.chatBuf,chatData.chatBuf.length(),&chatViewRect,DT_WORDBREAK);
- dc.DrawTextW(dateString,_tcslen(dateString),&timeViewRect,DT_WORD_ELLIPSIS);
-
- return;
-}
-
-
-UINT_PTR CCommentListWindow::CalcItemHeight(CChatData &chatData){
-
- RECT drowSize;
- self.m_header.GetItemRect(CCommentView::COMMENT,&drowSize);
- drowSize.left += 2;
- drowSize.top += 2;
- drowSize.right -= 2;
- drowSize.bottom = 0;
-
- CDCHandle cdc = this->GetDC();
- cdc.SelectFont(AtlGetDefaultGuiFont());
- ::DrawTextW(cdc,chatData.chatBuf,chatData.chatBuf.length(),&drowSize, DT_CALCRECT | DT_WORDBREAK);
- this->ReleaseDC(cdc);
- drowSize.top -= 2;
- drowSize.bottom += 2;
-
- return drowSize.bottom;
-}
-
-
-LRESULT CCommentListWindow::OnCreate(LPCREATESTRUCT lpCreateStruct){
-
- return 0;
-}
-
-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();
- CCommentList::iterator end = self.commentlist.end();
- std::advance(chatData,vScrollInfo.nPos);
- for(; chatData != end;++chatData){
-
- heightSum += CalcItemHeight(*chatData);
-
- if(heightSum >= height){
-
- goto end;
+ _tcsftime(dateString,ARRAY_LENGTH(dateString),timeFormat,&ct);
+
+ COLORREF bkColor;
+ COLORREF outLineColor;
+
+ CPen outLinePen;
+ CPen colLinePen;
+ CBrush bkBrush;
+ colLinePen.CreatePen(PS_SOLID,1,ColorList::colLine);
+
+
+ //\91I\91ð\8fó\91Ô\82©\83`\83F\83b\83N
+ if (chatData.selectFlag == TRUE)
+ {
+ bkColor = ColorList::selectBack;
+ outLineColor = ColorList::outLineSelect;
+
+
}
+ else
+ {
- ++lineNo;
- }
- lineNo = -1;
-end:
+ outLineColor = ColorList::outLineNomal;
+
+ if(chatData.listenerData->originBkFlag == TRUE){
+
+ bkColor = chatData.listenerData->bkColor;
- return lineNo;
-}
+ } else {
+ bkColor = self.viewproperty.backColor;
-VOID CCommentListWindow::OnLButtonDown(UINT wParam, _WTYPES_NS::CPoint &point){
+ }
+ }
+
+ outLinePen.CreatePen(PS_SOLID,1,outLineColor);
+ bkBrush.CreateSolidBrush(bkColor);
+ dc.SelectPen(outLinePen);
+
+ if(chatData.selectFlag == TRUE){
+
+ dc.MoveTo(rc.left,rc.bottom);
+ dc.LineTo(rc.right,rc.bottom);
+ }
+ dc.FillRect(&rc,bkBrush);
+ dc.SetBkColor(bkColor);
+ dc.MoveTo(rc.left,rc.top);
+ dc.LineTo(rc.right,rc.top);
+
+
+
+ dc.SetTextColor(self.viewproperty.baseStringColor);
+
+
+
+
+
+ //\95`\89æ\83T\83C\83Y\82ð\8cv\8eZ
+
+ self.m_header.GetItemRect(CCommentView::NO,&noViewRect);
+ self.m_header.GetItemRect(CCommentView::USERNAME,&userNameViewRect);
+ self.m_header.GetItemRect(CCommentView::COMMENT,&chatViewRect);
+ self.m_header.GetItemRect(CCommentView::TIME,&timeViewRect);
+ self.m_header.GetItemRect(CCommentView::INFO,&infoViewRect);
+
+ noViewRect.left += 2;
+ userNameViewRect.left += 2;
+ timeViewRect.left += 2;
+ chatViewRect.left += 2;
+ infoViewRect.left += 2;
+
+ noViewRect.right -= 2;
+ userNameViewRect.right -= 2;
+ timeViewRect.right -= 2;
+ chatViewRect.right -= 2;
+ infoViewRect.right -= 2;
+
+ noViewRect.top = rc.top + 2;
+ userNameViewRect.top = rc.top + 2;
+ timeViewRect.top = rc.top + 2;
+ chatViewRect.top = rc.top + 2;
+ infoViewRect.top = rc.top + 2;
+
+ noViewRect.bottom = rc.bottom - 2;
+ userNameViewRect.bottom = rc.bottom - 2;
+ timeViewRect.bottom = rc.bottom - 2;
+ chatViewRect.bottom = rc.bottom - 2;
+ infoViewRect.bottom = rc.bottom - 2;
-
- this->SetFocus();
- if(self.commentlist.empty() == TRUE)return;
- auto curselItem = self.commentlist.GetCurSelItem();
- if(curselItem != self.commentlist.end()){
- curselItem->selectFlag = FALSE;
+ dc.SelectPen(colLinePen);
+
+ dc.MoveTo(noViewRect.right,rc.top);
+ dc.LineTo(noViewRect.right,rc.bottom);
+ dc.MoveTo(userNameViewRect.right,rc.top);
+ dc.LineTo(userNameViewRect.right,rc.bottom);
+ dc.MoveTo(chatViewRect.right,rc.top);
+ dc.LineTo(chatViewRect.right,rc.bottom);
+ dc.MoveTo(timeViewRect.right,rc.top);
+ dc.LineTo(timeViewRect.right,rc.bottom);
+
+ dc.DrawTextW(noString,_tcslen(noString),&noViewRect,DT_WORD_ELLIPSIS);
+ dc.DrawTextW(chatData.listenerData->user_id,chatData.listenerData->user_id.GetLength(),&userNameViewRect,DT_WORD_ELLIPSIS);
+ dc.DrawTextW(chatData.chatBuf,chatData.chatBuf.GetLength(),&chatViewRect,DT_WORDBREAK);
+ dc.DrawTextW(dateString,_tcslen(dateString),&timeViewRect,DT_WORD_ELLIPSIS);
+
+ return;
}
- self.commentlist.SetCurSel(CalcClickLine(point.y));
- if(TryEnterCriticalSection(&this->m_sec) == TRUE){
- this->Invalidate();
- this->Unlock();
+
+
+ UINT_PTR CCommentListWindow::CalcItemHeight(CChatData &chatData){
+
+ RECT drowSize;
+ self.m_header.GetItemRect(CCommentView::COMMENT,&drowSize);
+ drowSize.left += 2;
+ drowSize.top += 2;
+ drowSize.right -= 2;
+ drowSize.bottom = 0;
+
+ CPaintDC pdc(*this);
+ pdc.SelectFont(AtlGetDefaultGuiFont());
+ ::DrawTextW(pdc,chatData.chatBuf,chatData.chatBuf.GetLength(),&drowSize, DT_CALCRECT | DT_WORDBREAK);
+ drowSize.top -= 2;
+ drowSize.bottom += 2;
+
+ return drowSize.bottom;
}
- return;
-}
-VOID CCommentListWindow::OnLButtonDbClk(UINT wParam, _WTYPES_NS::CPoint &point){
+ LRESULT CCommentListWindow::OnCreate(LPCREATESTRUCT lpCreateStruct){
+
+ return 0;
+ }
+
+ 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();
+ CCommentList::iterator end = self.commentlist.end();
+ std::advance(chatData,vScrollInfo.nPos);
+ for(; chatData != end;++chatData){
+
+ heightSum += CalcItemHeight(*chatData);
+
+ if(heightSum >= height){
+
+ goto end;
+ }
+
+ ++lineNo;
+ }
+ lineNo = -1;
+end:
+
+
+ return lineNo;
+ }
+
-
-
- this->SetFocus();
- if(self.commentlist.empty() == TRUE)return;
-
- auto chatData = self.commentlist.GetChatAt(CalcClickLine(point.y));
- COLORREF bkColor;
- if(chatData.listenerData->originBkFlag == FALSE){
- CListenerColorCollector colorCollector;
- listenerList.BkColorCollect(colorCollector);
- UCHAR red;
- UCHAR green;
- UCHAR blue;
-
- srand((unsigned int)time(NULL));
- do{
+ VOID CCommentListWindow::OnLButtonDown(UINT wParam, _WTYPES_NS::CPoint &point){
- red = getrgb();
- green = getrgb();
- blue = getrgb();
- bkColor = RGB(red,green,blue);
- }while(colorCollector.Find(bkColor));
-
- chatData.listenerData->originBkFlag = TRUE;
- chatData.listenerData->SetBkColor(bkColor);
- } else {
-
- chatData.listenerData->originBkFlag = FALSE;
+ this->SetFocus();
+ if(self.commentlist.empty() == TRUE)return;
+ auto curselItem = self.commentlist.GetCurSelItem();
+ if(curselItem != self.commentlist.end()){
+ curselItem->selectFlag = FALSE;
+ }
+ self.commentlist.SetCurSel(CalcClickLine(point.y));
+ if(TryEnterCriticalSection(&this->m_sec) == TRUE){
+ this->Invalidate();
+ this->Unlock();
+ }
+ return;
}
-
-
-
+ VOID CCommentListWindow::OnLButtonDbClk(UINT wParam, _WTYPES_NS::CPoint &point){
+
+
+
+
+ this->SetFocus();
+ if(self.commentlist.empty() == TRUE)return;
+
+ auto chatData = self.commentlist.GetChatAt(CalcClickLine(point.y));
+ COLORREF bkColor;
+ if(chatData.listenerData->originBkFlag == FALSE){
+ CListenerColorCollector colorCollector;
+ listenerList.BkColorCollect(colorCollector);
+ UCHAR red;
+ UCHAR green;
+ UCHAR blue;
+
+ srand((unsigned int)time(NULL));
+ do{
+
+ red = getrgb();
+ green = getrgb();
+ blue = getrgb();
+ bkColor = RGB(red,green,blue);
+
+ }while(colorCollector.Find(bkColor));
- if(TryEnterCriticalSection(&this->m_sec) == TRUE){
- this->Invalidate(TRUE);
- this->Unlock();
+ chatData.listenerData->originBkFlag = TRUE;
+ chatData.listenerData->SetBkColor(bkColor);
+ } else {
+
+
+ chatData.listenerData->originBkFlag = FALSE;
+ }
+
+
+
+
+
+
+ if(TryEnterCriticalSection(&this->m_sec) == TRUE){
+ this->Invalidate(TRUE);
+ this->Unlock();
+ }
+
+
+
+
+ return;
}
-
-
-
-
- return;
-}
-LRESULT CCommentListWindow::OnEraseBkGnd(HDC lparam){
+ LRESULT CCommentListWindow::OnEraseBkGnd(HDC lparam){
+
+ return TRUE;
+ }
- return TRUE;
-}
+ LRESULT CCommentListWindow::OnMouseWheel(UINT loWparam,SHORT hiWparam,CPoint &point){
-LRESULT CCommentListWindow::OnMouseWheel(UINT loWparam,SHORT hiWparam,CPoint &point){
-
- self.SendMessageW(WM_VSCROLL,MAKELONG(hiWparam < 0 ? SB_PAGEDOWN : SB_PAGEUP ,0),0);
+ self.SendMessageW(WM_VSCROLL,MAKELONG(hiWparam < 0 ? SB_PAGEDOWN : SB_PAGEUP ,0),0);
- return 0;
-}
+ return 0;
+ }