OSDN Git Service

2012/01/11 22:31:33
[nlite/nlite.git] / nlite / nlite_commentview.cpp
1 #include "stdafx.h"
2 #include "nlite_include.h"
3
4
5
6
7 //
8 //\83R\83\81\83\93\83g\83r\83\85\81[\83N\83\89\83X\83\81\83\\83b\83h
9 ///////////////////////////////////////////////////////
10
11 CCommentView::CCommentView():
12                 hScrollInfo(),
13                 m_commentListWindow(*this)
14         {
15                 hScrollInfo.fMask = SIF_ALL;
16                 hScrollInfo.cbSize = sizeof(hScrollInfo);
17                 LOGFONT lf = {0};
18                 lf.lfHeight = 10;
19                 lf.lfCharSet = SHIFTJIS_CHARSET;
20
21
22                 hHeaderFontNew = CreateFontIndirect(&lf);
23
24                 colLinePen.CreatePen(PS_SOLID,1,RGB(224,224,224));
25                 outLinePenNomal.CreatePen(PS_SOLID,1,RGB(127,127,127));
26                 outLinePenSelect.CreatePen(PS_SOLID,1,RGB(255,0,0));
27                 bkBurushSelect.CreateSolidBrush(RGB(255,240,240));
28                 return;
29
30 }
31
32 CCommentView::~CCommentView(){
33
34         colLinePen.DeleteObject();
35         outLinePenNomal.DeleteObject();
36         outLinePenSelect.DeleteObject();
37         bkBurushSelect.DeleteObject();
38         DeleteObject(hHeaderFontNew);
39
40         return;
41 }
42
43
44
45 VOID CCommentView::Lock(){
46         ccs.Lock();
47 }
48
49 VOID CCommentView::Unlock(){
50         ccs.Unlock();
51 }
52
53
54 VOID CCommentView::OnConnect(){
55         commentlist.OnConnect();
56 //      m_commentListWindow.SetRedraw(FALSE);
57         
58 }
59
60
61 UINT_PTR CCommentView::GetColumnHolSizeSum(){
62
63         return hScrollInfo.nMax;
64 }
65
66 VOID CCommentView::SetProperty(CommentViewProperty &setProperty){
67
68         viewproperty = setProperty;
69
70         if(bkBurushNomal.IsNull() == FALSE){
71                 bkBurushNomal.DeleteObject();
72         }
73         bkBurushNomal.CreateSolidBrush(viewproperty.backColor);
74         return;
75 }
76
77 CommentViewProperty &CCommentView::GetProperty(){
78
79         return viewproperty;
80
81 }
82
83 VOID CCommentView::OnMeasureItem(UINT wParam,LPMEASUREITEMSTRUCT lpMersureItemStruct){
84
85         if(lpMersureItemStruct->CtlID == commentViewConstant::LISTBOX_ID){
86
87                 auto &chat = *(CChatData*)lpMersureItemStruct->itemData;
88
89                 CDC cdc = this->GetDC();
90         
91                 RECT drowSize;
92                 m_header.GetItemRect(COMMENT,&drowSize);
93                 drowSize.left += 2;
94                 drowSize.top +=  2;
95                 drowSize.right -= 2;
96                 drowSize.bottom = 0;
97         
98                 SelectObject(cdc,AtlGetDefaultGuiFont());
99
100         
101                 cdc.DrawTextW(chat.chatBuf.c_str(),chat.chatBuf.length(),&drowSize, DT_CALCRECT | DT_WORDBREAK);
102         
103                 drowSize.top -= 2;
104                 drowSize.bottom += 2;
105
106                 lpMersureItemStruct->itemHeight = drowSize.bottom - drowSize.top;
107
108         }
109         
110
111         return;
112 }
113
114
115
116 HWND CCommentView::Create(HWND hWndParent){
117
118         
119
120         HWND rslt = __super::Create(hWndParent,0,commentViewConstant::NLITE_COMMENTVIEW,WS_VISIBLE | WS_CHILD | WS_HSCROLL | WS_BORDER,0,commentViewConstant::MENU_OR_ID);
121
122         PAINTSTRUCT ps;
123         HDC hdc = m_header.BeginPaint(&ps);
124         SIZE size;
125
126         HFONT hOld = (HFONT)SelectObject(hdc,hHeaderFontNew);
127
128         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ñ")};
129         UINT_PTR holizenSize[] = {0,0,100,0,0};
130
131         for(UINT_PTR index = 0;index < ARRAY_LENGTH(columns) ;++index){
132
133                 GetTextExtentPoint32(hdc , columns[index] , _tcslen(columns[index]) , &size);
134                 UINT_PTR holsize = holizenSize[index] + size.cx + 15;
135                 holizenSize[index] = viewproperty.headerholSize[index] >= 0 ? viewproperty.headerholSize[index] : holsize;
136         }
137
138         SelectObject(hdc,hOld);
139
140         m_header.EndPaint(&ps);
141                         
142                         
143         HEADERSINFO headersinfo = {columns,holizenSize,ARRAY_LENGTH(columns)};
144
145         AddHeader(&headersinfo);
146
147         m_header.SetOrderArray(ARRAY_LENGTH(viewproperty.headerOraderArray),viewproperty.headerOraderArray);
148                 
149                         
150         
151                         
152         return rslt;
153 }
154
155
156
157
158 LRESULT CCommentView::OnheaderItemChanged(LPNMHDR lParam){
159
160         
161         if(lParam->hwndFrom == m_header.m_hWnd){
162
163                 //INT_PTR curSel = commentlist.GetCurSel();
164
165                 SCROLLINFO scrollInfo = {0};
166                 scrollInfo.fMask = SIF_PAGE | SIF_POS | SIF_RANGE;
167                 this->GetScrollInfo(SB_VERT,&scrollInfo);
168                 scrollInfo.nPos++;
169                 BOOL scrollFlag = scrollInfo.nPos + (int)scrollInfo.nPage >= scrollInfo.nMax;
170                 UINT_PTR commentCount = commentlist.Size();
171
172         
173 //              m_commentListWindow.SetRedraw(FALSE);
174                 //m_commentListWindow.ResetContent();
175                 /*
176                 for(UINT_PTR index =0;index < commentCount;index++){
177                         m_commentListWindow.AddString((LPCTSTR)&commentlist.GetChatAt(index));
178                 }
179                 */
180
181         
182
183                 //m_commentListWindow.SetCurSel(curSel);
184
185         
186
187 //              m_commentListWindow.SetRedraw(TRUE);
188 //              m_commentListWindow.Invalidate();
189         
190
191                 if(scrollFlag == TRUE){
192
193 //                      m_commentListWindow.SendMessageW(WM_VSCROLL,SB_BOTTOM,0);
194                 }
195
196                 INT_PTR itemCount = m_header.GetItemCount();
197                 RECT itemSizeRect;
198                 hScrollInfo.nMax = 0;
199                 for(INT_PTR imtemIndex = 0;imtemIndex < itemCount;imtemIndex++){
200                         m_header.GetItemRect(imtemIndex,&itemSizeRect);
201                         hScrollInfo.nMax += itemSizeRect.right - itemSizeRect.left;
202
203                 }
204
205                 this->SetScrollInfo(SB_HORZ,&hScrollInfo,TRUE);
206                 DecisionHorzSize();
207                                 
208         }
209
210         return 0;
211 }
212
213 VOID CCommentView::OnChatReceve(NicoLiveChat_P chat,UINT_PTR count){
214         
215
216         
217         Lock();
218 //      m_commentListWindow.SetRedraw(FALSE);
219         commentlist.OnChatReceve(chat,count);
220         //m_commentListWindow.AddString((LPCTSTR)&commentlist.back());
221
222         SCROLLINFO scrollInfo = {0};
223         scrollInfo.fMask = SIF_PAGE | SIF_POS | SIF_RANGE;
224 //      m_commentListWindow.GetScrollInfo(SB_VERT,&scrollInfo);
225         scrollInfo.nPos++;
226         
227         
228         if(scrollInfo.nPos + (int)scrollInfo.nPage >= scrollInfo.nMax == TRUE){
229 //              m_commentListWindow.SendMessageW(WM_VSCROLL,MAKEWORD(SB_BOTTOM,0),0);   
230         }
231         Unlock();
232 }
233
234
235 VOID CCommentView::SetStreamStatus(StreamStatus &st){
236         
237         streamStatus.SetStreamStatus(st);
238 }
239
240 VOID CCommentView::OnChatReceveSettle(UINT_PTR commentCount,UINT_PTR commentCountSum){
241
242 //      m_commentListWindow.SetRedraw(TRUE);
243         
244
245         return;
246 }
247
248 static UCHAR getrgb(){
249
250         UCHAR rgb = 160 + rand() % 92;
251         return rgb;
252 }
253
254 LRESULT CCommentView::OnListBoxDoubleClick(UINT uNotifyCode, int nID, CWindow wndCtl){
255         
256
257         /*
258         if(wndCtl.m_hWnd == m_commentListWindow.m_hWnd){
259
260                 //INT_PTR cursel = m_commentListWindow.GetCurSel();
261                 INT_PTR cursel = 0;
262                 if(cursel == LB_ERR)return 0;
263         
264                 auto chatData = commentlist.GetChatAt(cursel);
265                 COLORREF bkColor;
266                 if(chatData.listenerData->originBkFlag == FALSE){
267                         CListenerColorCollector colorCollector;
268                         listenerList.BkColorCollect(colorCollector);
269                         UCHAR red;
270                         UCHAR green;
271                         UCHAR blue;
272                 
273                         srand((unsigned int)time(NULL));
274                         do{
275
276                                 red = getrgb();
277                                 green = getrgb();
278                                 blue = getrgb();
279                                 bkColor = RGB(red,green,blue);
280
281                         }while(colorCollector.Find(bkColor));
282
283                         chatData.listenerData->originBkFlag = TRUE;
284
285                 } else {
286
287                         bkColor = viewproperty.backColor;
288                         chatData.listenerData->originBkFlag = FALSE;
289                 }
290
291         
292         
293
294                 chatData.listenerData->SetBkColor(bkColor);
295
296                 m_commentListWindow.Invalidate(TRUE);
297         }
298         */
299         return 0;
300 }
301
302 VOID CCommentView::OnDrawItem(UINT wParam,LPDRAWITEMSTRUCT lpDrawItemStruct){
303
304         //if((lpDrawItemStruct->hwndItem  == m_commentListWindow.m_hWnd)/* &&/* ((UINT)m_commentListWindow.GetCount() > lpDrawItemStruct->itemID)*/){
305                                         
306                 RECT noViewRect;
307                 RECT userNameViewRect;
308                 RECT timeViewRect;
309                 RECT chatViewRect;
310                 RECT infoViewRect;
311
312         
313
314                 CChatData &chatData = *(CChatData*)lpDrawItemStruct->itemData;
315
316         
317
318                 time_t chatTime = (time_t)difftime(chatData.date,streamStatus.start_time);
319                 tm ct = *gmtime(&chatTime);
320                 
321                 
322                 TCHAR noString[sizeof(chatData.no) * 8]; 
323                 TCHAR dateString[LENGTH_16];
324                 _stprintf(noString,TEXT("%u"),chatData.no);
325
326                 _tcsftime(dateString,ARRAY_LENGTH(dateString),ct.tm_hour != 0 ? TEXT("%H:%M:%S") : TEXT("%M:%S"),&ct);
327
328         
329         
330                 //\91I\91ð\8fó\91Ô\82©\83`\83F\83b\83N
331                 if ((lpDrawItemStruct->itemState) & (ODS_SELECTED))
332                 {
333
334                         SelectObject(lpDrawItemStruct->hDC,bkBurushSelect);
335                         SelectObject(lpDrawItemStruct->hDC,outLinePenSelect);   
336                         SetBkColor(lpDrawItemStruct->hDC,RGB(255,240,240)) ;
337                 }
338                 else  
339                 {
340                         SelectObject(lpDrawItemStruct->hDC,outLinePenNomal);
341
342                         if(chatData.listenerData->originBkFlag == TRUE){
343                         
344                                 SelectObject(lpDrawItemStruct->hDC,chatData.listenerData->baseBkBrush);
345                                 SetBkColor(lpDrawItemStruct->hDC,chatData.listenerData->bkColor) ;
346
347                         } else {
348
349                                 SelectObject(lpDrawItemStruct->hDC,bkBurushNomal);
350                                 SetBkColor(lpDrawItemStruct->hDC,viewproperty.backColor) ;
351                         
352                         }
353                 }
354                 
355         
356                 //\83e\83L\83X\83g\82Ì\83J\83\89\81[\82ð\90Ý\92è
357                 SetTextColor(lpDrawItemStruct->hDC,viewproperty.baseStringColor);
358
359         
360         
361                 Rectangle(lpDrawItemStruct->hDC,lpDrawItemStruct->rcItem.left,lpDrawItemStruct->rcItem.top,lpDrawItemStruct->rcItem.right,lpDrawItemStruct->rcItem.bottom);
362
363
364
365
366
367
368
369                 //\95`\89æ\83T\83C\83Y\82ð\8cv\8eZ
370
371                 m_header.GetItemRect(NO,&noViewRect);
372                 m_header.GetItemRect(USERNAME,&userNameViewRect);
373                 m_header.GetItemRect(COMMENT,&chatViewRect);
374                 m_header.GetItemRect(TIME,&timeViewRect);
375                 m_header.GetItemRect(INFO,&infoViewRect);
376
377                 SelectObject(lpDrawItemStruct->hDC,colLinePen);
378         
379                 MoveToEx(lpDrawItemStruct->hDC,noViewRect.right,lpDrawItemStruct->rcItem.top,NULL);
380                 LineTo(lpDrawItemStruct->hDC,noViewRect.right,lpDrawItemStruct->rcItem.bottom);
381                 MoveToEx(lpDrawItemStruct->hDC,userNameViewRect.right,lpDrawItemStruct->rcItem.top,NULL);
382                 LineTo(lpDrawItemStruct->hDC,userNameViewRect.right,lpDrawItemStruct->rcItem.bottom);
383                 MoveToEx(lpDrawItemStruct->hDC,chatViewRect.right,lpDrawItemStruct->rcItem.top,NULL);
384                 LineTo(lpDrawItemStruct->hDC,chatViewRect.right,lpDrawItemStruct->rcItem.bottom);
385                 MoveToEx(lpDrawItemStruct->hDC,timeViewRect.right,lpDrawItemStruct->rcItem.top,NULL);
386                 LineTo(lpDrawItemStruct->hDC,timeViewRect.right,lpDrawItemStruct->rcItem.bottom);
387                 MoveToEx(lpDrawItemStruct->hDC,infoViewRect.right,lpDrawItemStruct->rcItem.top,NULL);
388                 LineTo(lpDrawItemStruct->hDC,infoViewRect.right,lpDrawItemStruct->rcItem.bottom);
389
390                 noViewRect.left += 2;
391                 userNameViewRect.left += 2;
392                 timeViewRect.left += 2;
393                 chatViewRect.left += 2;
394                 infoViewRect.left += 2;
395
396                 noViewRect.right += 2;
397                 userNameViewRect.right += 2;
398                 timeViewRect.right += 2;
399                 chatViewRect.right += 2;
400                 infoViewRect.right += 2;
401
402                 noViewRect.top = lpDrawItemStruct->rcItem.top + 2;
403                 userNameViewRect.top = lpDrawItemStruct->rcItem.top + 2;
404                 timeViewRect.top = lpDrawItemStruct->rcItem.top + 2;
405                 chatViewRect.top = lpDrawItemStruct->rcItem.top + 2;
406                 infoViewRect.top = lpDrawItemStruct->rcItem.top + 2;
407
408                 noViewRect.bottom = lpDrawItemStruct->rcItem.bottom - 2;
409                 userNameViewRect.bottom = lpDrawItemStruct->rcItem.bottom - 2;
410                 timeViewRect.bottom = lpDrawItemStruct->rcItem.bottom - 2;
411                 chatViewRect.bottom = lpDrawItemStruct->rcItem.bottom - 2;
412                 infoViewRect.bottom = lpDrawItemStruct->rcItem.bottom - 2;
413
414
415
416         
417
418                 ::DrawText(lpDrawItemStruct->hDC,noString,_tcslen(noString),&noViewRect,DT_WORD_ELLIPSIS);
419
420                 ::DrawText(lpDrawItemStruct->hDC,chatData.listenerData->user_id.c_str(),chatData.listenerData->user_id.length(),&userNameViewRect,DT_WORD_ELLIPSIS);
421
422                 ::DrawText(lpDrawItemStruct->hDC,chatData.chatBuf.c_str(),chatData.chatBuf.length(),&chatViewRect,DT_WORDBREAK);
423
424                 ::DrawText(lpDrawItemStruct->hDC,dateString,_tcslen(dateString),&timeViewRect,DT_WORD_ELLIPSIS);
425                                         
426         //}
427
428         return;
429 }
430
431
432
433
434 VOID CCommentView::OnSizing(UINT wParam,LPRECT lParam){
435
436
437         ChangeSize( _WTYPES_NS::CSize(lParam->right - lParam->left,lParam->bottom - lParam->top));
438
439                         
440         return;
441
442 }
443
444
445
446 LRESULT CCommentView::OnSize(UINT wParam,SIZE lParam){
447         ChangeSize(lParam);
448                         
449         return 0;
450 }
451
452
453 VOID CCommentView::ChangeSize(const SIZE& client){
454         
455         SCROLLINFO scrollInfoTmp = {0};
456         scrollInfoTmp.cbSize = sizeof(scrollInfoTmp);
457         scrollInfoTmp.fMask = SIF_PAGE;
458         scrollInfoTmp.nPage = client.cx;
459         this->SetScrollInfo(SB_HORZ,&scrollInfoTmp);
460
461         this->GetScrollInfo(SB_HORZ,&hScrollInfo);
462
463         HDWP hDwp = BeginDeferWindowPos(2);
464         
465
466         INT_PTR movePos =  -1 * hScrollInfo.nPos;
467         
468         m_header.DeferWindowPos(hDwp,m_header.m_hWnd,movePos,0,0,0,SWP_NOSIZE | SWP_NOZORDER);
469         m_commentListWindow.DeferWindowPos(hDwp,m_commentListWindow.m_hWnd,movePos,commentViewConstant::HEADER_HAIGHT,::GetSystemMetrics(SM_CXFULLSCREEN),client.cy - commentViewConstant::HEADER_HAIGHT,SWP_NOZORDER);         
470
471         EndDeferWindowPos(hDwp);
472         
473         
474         RECT bkRect;
475         RECT headerRectSize;
476         m_header.GetWindowRect(&headerRectSize);
477         bkRect.left = headerRectSize.right - headerRectSize.left - hScrollInfo.nPos;
478         bkRect.top = 0;
479         bkRect.right = client.cx ;
480         bkRect.bottom = client.cy;
481         this->InvalidateRect(&bkRect);
482
483         return;
484 }
485
486
487 LRESULT CCommentView::OnEraseBkgnd(HDC wParam){
488
489         return TRUE;
490 }
491
492
493 VOID CCommentView::OnDestroy(){
494         m_header.GetOrderArray(ARRAY_LENGTH(viewproperty.headerOraderArray),viewproperty.headerOraderArray);
495         INT_PTR headerItemcount = m_header.GetItemCount();
496         RECT headerItemRect;
497         for(INT_PTR itemindex = 0;itemindex < headerItemcount;itemindex++){
498                                 
499                 m_header.GetItemRect(itemindex,&headerItemRect);
500                 viewproperty.headerholSize[itemindex] = headerItemRect.right - headerItemRect.left;
501         }
502         commentlist.OnDestroy();
503         m_header.DestroyWindow();
504 //      m_commentListWindow.DestroyWindow();
505         return;
506
507 }
508
509 LRESULT CCommentView::OnHeaderEndDrag(LPNMHDR lParam){
510
511         if(lParam->hwndFrom == m_header.m_hWnd){
512
513 //              m_commentListWindow.Invalidate();
514
515         }
516
517         return 0;
518 }
519
520
521 VOID CCommentView::OnHScroll(INT_PTR loWParam,SHORT hiWParam,HWND lParam){
522
523                         
524         INT_PTR dy;
525         switch(loWParam){
526
527         case SB_THUMBPOSITION:
528         case SB_THUMBTRACK:
529                 dy = hiWParam - hScrollInfo.nPos;
530                 break;
531
532         case SB_LINELEFT:
533         case SB_PAGELEFT:
534
535                 dy = -1 * hScrollInfo.nPage;
536
537                 break;
538
539         case SB_LINERIGHT:
540         case SB_PAGERIGHT:
541
542                 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;
543
544                 break;
545
546         default:
547                 dy = 0;
548                 break;
549
550         }
551         
552         dy = max(-1 * hScrollInfo.nPos, min(dy, hScrollInfo.nMax - hScrollInfo.nPos));
553
554
555         if(dy != 0){
556                 hScrollInfo.nPos += dy;
557                 //RECT headerPosRect;
558                 //RECT listBoxPosRect;
559                 //m_header.GetWindowRect(&headerPosRect);
560                 //m_commentListWindow.GetWindowRect(&listBoxPosRect);
561                 INT_PTR moveRange = -(hScrollInfo.nPos);
562
563                 /*
564                 headerPosRect.bottom -= headerPosRect.top;
565                 headerPosRect.top = 0;
566                 headerPosRect.right += moveRange - headerPosRect.left;
567                 headerPosRect.left = moveRange;
568                                         
569                 listBoxPosRect.bottom -= (listBoxPosRect.top - commentViewConstant::HEADER_HAIGHT);
570                 listBoxPosRect.top = commentViewConstant::HEADER_HAIGHT;
571                 listBoxPosRect.right += moveRange - listBoxPosRect.left;
572                 listBoxPosRect.left = moveRange;
573                         
574                 m_header.MoveWindow(&headerPosRect);
575                 m_commentListWindow.MoveWindow(&listBoxPosRect);
576                                         
577                 */
578                                         
579
580                 HDWP hDwp = BeginDeferWindowPos(2);
581
582                 m_header.DeferWindowPos(hDwp,m_header.m_hWnd,moveRange,0,0,0,SWP_NOSIZE | SWP_NOZORDER);
583                 m_commentListWindow.DeferWindowPos(hDwp,m_commentListWindow.m_hWnd,moveRange,commentViewConstant::HEADER_HAIGHT,0,0,SWP_NOSIZE | SWP_NOZORDER);         
584
585                 EndDeferWindowPos(hDwp);
586                                         
587                                         
588                 this->SetScrollInfo(SB_HORZ,&hScrollInfo);
589         }
590                         
591         return;
592 }
593
594 LRESULT CCommentView::OnCreate(LPCREATESTRUCT lpcs){
595         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);
596         m_commentListWindow.Create(m_hWnd,0,WC_LISTBOX,WS_CHILD | WS_VISIBLE  | WS_CLIPCHILDREN  , 0,commentViewConstant::LISTBOX_ID);
597         m_commentListWindow.SetFont(AtlGetDefaultGuiFont());
598         
599         
600         /*
601         m_subListBox.SubclassWindow(m_commentListWindow);
602         m_subListBox.CreateMemoryDC();
603         */              
604         return 0;
605 }
606
607 VOID CCommentView::AddHeader(LPHEADERSINFO infos){
608
609
610         m_header.SetFont(hHeaderFontNew);
611
612         HDITEM item;
613         item.mask = HDI_FORMAT | HDI_TEXT | HDI_WIDTH;
614         item.fmt = HDF_CENTER | HDF_STRING;
615                         
616                         
617         for(UINT_PTR index = 0;index < infos->count ;++index){
618
619                 item.pszText = infos->columns[index];
620
621                 item.cxy =  infos->holizensize[index];
622                 m_header.AddItem(&item);
623         }
624
625         RECT itemRect;
626         hScrollInfo.nMax = 0;
627         UINT_PTR itemCount = m_header.GetItemCount();
628         for(UINT_PTR u_index = 0;u_index < itemCount;++u_index){
629
630                 m_header.GetItemRect(u_index,&itemRect);
631                 hScrollInfo.nMax += itemRect.right - itemRect.left;
632
633         }
634                         
635         this->SetScrollInfo(SB_HORZ,&hScrollInfo,TRUE); 
636         DecisionHorzSize();
637         return;
638 }
639
640 VOID CCommentView::DecisionHorzSize(){
641         
642         HDWP hWindowPosInfo = BeginDeferWindowPos(2);
643         RECT bkWindowRect;
644         this->GetClientRect(&bkWindowRect);
645         m_header.DeferWindowPos(hWindowPosInfo,m_header.m_hWnd,0,0,::GetSystemMetrics(SM_CXFULLSCREEN),commentViewConstant::HEADER_HAIGHT,SWP_NOZORDER | SWP_NOMOVE);
646         m_commentListWindow.DeferWindowPos(hWindowPosInfo,m_header.m_hWnd,0,0,::GetSystemMetrics(SM_CXFULLSCREEN),bkWindowRect.bottom - commentViewConstant::HEADER_HAIGHT,SWP_NOZORDER | SWP_NOMOVE);
647
648         EndDeferWindowPos(hWindowPosInfo);
649         bkWindowRect.left = hScrollInfo.nMax;
650                         
651         this->InvalidateRect(&bkWindowRect);
652                         
653         return;
654 }
655
656
657 //
658 //\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
659 ////////////////////////////////////////////////////////////////////
660
661 CCommentListWindow::CCommentListWindow(CCommentView &in_self):self(in_self){}
662
663
664
665 VOID CCommentListWindow::OnPaint(HDC hdc){
666
667
668         SIZE bitmapSize;
669         m_bitmap.GetSize(bitmapSize);
670         RECT bitmapRect = {0};
671         RECT windowRect;
672         bitmapRect.right = bitmapSize.cx;
673         bitmapRect.bottom = bitmapSize.cy;
674         this->GetWindowRect(&windowRect);
675         m_memoryDC.FillRect(&bitmapRect,self.viewproperty.backColor);
676
677         PAINTSTRUCT ps;
678         HDC selfDC = this->BeginPaint(&ps);
679         ::BitBlt(selfDC,0,0,windowRect.right - windowRect.left,windowRect.bottom - windowRect.top,m_memoryDC,0,0,SRCCOPY);
680         this->EndPaint(&ps);
681         
682         return;
683 }
684
685
686
687 LRESULT CCommentListWindow::OnCreate(LPCREATESTRUCT lpCreateStruct){
688         LRESULT lRet = this->DefWindowProc();
689
690         HDC hdc = this->GetDC();
691         m_memoryDC.CreateCompatibleDC(hdc);
692         
693         m_bitmap.CreateCompatibleBitmap(hdc,::GetSystemMetrics(SM_CXFULLSCREEN),::GetSystemMetrics(SM_CYFULLSCREEN));
694         m_memoryDC.SelectBitmap(m_bitmap);
695         this->ReleaseDC(hdc);
696         
697         return lRet;
698 }
699
700 VOID CCommentListWindow::OnLButtonDown(UINT wParam, _WTYPES_NS::CPoint &point){
701
702         return;
703 }
704
705
706 VOID CCommentListWindow::OnLButtonDbClk(UINT wParam, _WTYPES_NS::CPoint &point){
707
708         return;
709 }
710
711 LRESULT CCommentListWindow::OnEraseBkGnd(HDC lparam){
712
713         return TRUE;
714 }