2 #include "nlite_include.h"
7 const static SIZE commentColorBoxSize = {35,0};
9 const static LPCTSTR ANONYMOUS_MAILCOMMAND = TEXT("184");
10 const static LPCTSTR ANONYMOUS_BOTTONSTRING = ANONYMOUS_MAILCOMMAND;
11 const static LPCTSTR OWNERMODE_BOTTONSTRING = TEXT("
\8eå
\83R
\83\81");
12 const static LPCTSTR WRITE_BOTTONSTRING = TEXT("
\8f\91\82«
\8d\9e\82Ý");
13 const static LPCTSTR CHECKBUTTON_HIDDENSTRING = TEXT(" ");
16 const static COLORREF OWNEREDITCOLOR = RGB(255,192,192);
17 const static COLORREF NORMALEDITCOLOR = RGB(255,255,255);
18 const static RECT COMMENTWRITEWINDOW_SEPARATEFSIZE = {0,5,0,5};
19 const static UINT_PTR COMMENTWRITEWINDOW_SIDESEPARATESIZE = 5;
20 const static UINT_PTR INIT_COMMENTWRITE_MAXLENGTH = 60;
21 const static UINT_PTR CHECKBUTTON_SUBSCRIPT_HEIGHT = 10;
22 const static LPCTSTR DEFAULT_COMMENTCOLOR = TEXT("white");
23 const static LPCTSTR DEFAULT_COMMENTSIZE = TEXT("medium");
24 const static LPCTSTR DEFAULT_COMMENTPOS = TEXT("naka");
25 const static COLORREF MAX_COLOR = 0xFFFFFF;
29 namespace generalUser{
30 const CommentColorInfo COMMENT_COLORLIST[] = {
31 {DEFAULT_COMMENTCOLOR,PALETTERGB(0xFF,0xFF,0xFF)}, //
\94\92
32 {TEXT("red"),PALETTERGB(0xFF,0x00,0x00)}, //
\90Ô
33 {TEXT("pink"),PALETTERGB(0xFF,0x80,0x80)}, //
\83s
\83\93\83N
34 {TEXT("orange"),PALETTERGB(0xFF,0xC0,0x00)}, //
\83I
\83\8c\83\93\83W
35 {TEXT("yellow"),PALETTERGB(0xFF,0xFF,0x00)}, //
\89©
\90F
36 {TEXT("green"),PALETTERGB(0x00,0xFF,0x00)}, //
\97Î
37 {TEXT("cyan"),PALETTERGB(0x00,0xFF,0xFF)}, //
\8a¦
\90F
38 {TEXT("blue"),PALETTERGB(0x00,0x00,0xFF)}, //
\90Â
39 {TEXT("purple"),PALETTERGB(0xC0,0x00,0xFF)}, //
\8e\87
43 const CommentSizeInfo COMMENT_SIZELIST[] = {
44 {TEXT("
\95\81\92Ê
\81@"),DEFAULT_COMMENTSIZE}, //
\95\81\92Ê
\83T
\83C
\83Y
45 {TEXT("
\8f¬
\81@"),TEXT("small")} //
\8f¬
\83T
\83C
\83Y
49 const CommentPosInfo COMMENT_POSLIST[] = {
50 {TEXT("
\92Ê
\8fí
\81@"),DEFAULT_COMMENTPOS} //
\92Ê
\8fí
\95\
\8e¦
54 namespace premiumUser{
56 const CommentColorInfo COMMENT_COLORLIST[] = {
57 {TEXT("black"),PALETTERGB(0x00,0x00,0x00)}, //
\8d\95
58 {TEXT("white2"),PALETTERGB(0xCC,0xCC,0x99)}, //
\94\92\82»
\82Ì
\82Q
59 {TEXT("red2"),PALETTERGB(0xCC,0x00,0x33)}, //
\90Ô
\82»
\82Ì
\82Q
60 {TEXT("pink2"),PALETTERGB(0xFF,0x33,0xCC)}, //
\83s
\83\93\83N
\82»
\82Ì
\82Q
61 {TEXT("orange2"),PALETTERGB(0xFF,0x66,0x00)}, //
\83I
\83\8c\83\93\83W
\82»
\82Ì
\82Q
62 {TEXT("yellow2"),PALETTERGB(0x99,0x99,0x00)}, //
\89©
\90F
\82»
\82Ì
\82Q
63 {TEXT("green2"),PALETTERGB(0x00,0xCC,0x66)}, //
\97Î
\82»
\82Ì
\82Q
64 {TEXT("cyan2"),PALETTERGB(0x00,0xCC,0xCC)}, //
\8a¦
\90F
\82»
\82Ì
\82Q
65 {TEXT("blue2"),PALETTERGB(0x33,0x99,0xFF)}, //
\90Â
\82»
\82Ì
\82Q
66 {TEXT("purple2"),PALETTERGB(0x66,0x33,0xCC)} //
\8e\87\82»
\82Ì
\82Q
67 // {TEXT("black2"),PALETTERGB(0x66,0x66,0x66)} //
\8d\95\82»
\82Ì
\82Q
\82Í
\82È
\82¢
\81H
70 const CommentSizeInfo COMMENT_SIZELIST[] = {
71 {TEXT("
\91å
\81@"),TEXT("big")} //
\91å
\83T
\83C
\83Y
76 const CommentPosInfo COMMENT_POSLIST[] = {
77 {TEXT("
\89º
\81@"),TEXT("shita")}, //
\89º
\82É
\95\
\8e¦
78 {TEXT("
\8fã
\81@"),TEXT("ue")} //
\8fã
\82É
\95\
\8e¦
87 static VOID addItemList(CComboBox &combo,T * colorList,UINT_PTR length){
89 UINT_PTR startItemcount = combo.GetCount();
90 length+= startItemcount;
91 for(UINT_PTR index = startItemcount; index < length;index++){
93 combo.AddString(colorList[index - startItemcount].name);
94 combo.SetItemDataPtr(index,(LPVOID)&colorList[index - startItemcount]);
104 static UINT_PTR CalcComboBoxWidth(CComboBox &combo){
109 UINT_PTR itemCount = combo.GetCount();
111 for(UINT_PTR index = 0;index < itemCount;index++){
112 name = ((T*)combo.GetItemDataPtr(index))->name;
113 ::GetTextExtentPoint32(pdc,name,_tcslen(name),&size);
114 rslt = rslt < (UINT_PTR)size.cx ? size.cx : rslt;
120 CCommentWriteWindow::CCommentWriteWindow(CNicoLiveStream &in_nicoLiveStream):
121 commentWriteHeight(0),
122 commentWriteInternalHeight(0),
123 commentWriteMaxLength(INIT_COMMENTWRITE_MAXLENGTH),
124 nicoLiveStream(in_nicoLiveStream),
125 commentSubEdit(*this),
130 BOOL CCommentWriteWindow::IsWrighthing(){
132 return this->commentSubEdit.untilConnectingFlag;
136 UINT_PTR CCommentWriteWindow::GetHeight(){
138 return commentWriteHeight + infoDispHeight - COMMENTWRITEWINDOW_SEPARATEFSIZE.top;
142 LRESULT CCommentWriteWindow::OnCreate(LPCREATESTRUCT lpReateStruct){
144 //
\83E
\83B
\83\93\83h
\83E
\8dì
\90¬
\8f\88\97\9d
146 commentPosBox.Create(m_hWnd,0,WC_COMBOBOX,WS_CHILD | WS_VISIBLE | CBS_DROPDOWNLIST ,0,COMMENTPOS_BOX);
147 commentSizeBox.Create(m_hWnd,0,WC_COMBOBOX,WS_CHILD | WS_VISIBLE | CBS_DROPDOWNLIST,0,COMMENTSIZE_BOX);
148 commentColorBox.Create(m_hWnd,0,WC_COMBOBOX,WS_CHILD | WS_VISIBLE | CBS_DROPDOWNLIST | CBS_OWNERDRAWFIXED ,0,COMMENTCOLOR_BOX);
149 anonymousButton.Create(m_hWnd,0,WC_BUTTON,WS_CHILD | WS_VISIBLE | BS_AUTOCHECKBOX | BS_PUSHLIKE,0,ANONYMOUS_BUTTON);
150 ownerModeButton.Create(m_hWnd,0,WC_BUTTON,WS_CHILD |BS_AUTOCHECKBOX | BS_PUSHLIKE,0,OWNERMODE_BUTTON);
151 commentSubEdit.Create(m_hWnd,0,WC_EDIT,WS_CHILD | WS_VISIBLE | WS_BORDER | ES_AUTOHSCROLL,0,COMMENT_EDIT);
152 commentWriteButton.Create(m_hWnd,0,WC_BUTTON,WS_CHILD | WS_VISIBLE | BS_PUSHBUTTON,0,COMMENTWRITE_BOTTON);
153 commentPosBox.SetFont(AtlGetDefaultGuiFont());
154 commentSizeBox.SetFont(AtlGetDefaultGuiFont());
155 commentColorBox.SetFont(AtlGetDefaultGuiFont());
158 anonymousButton.SetFont(AtlGetDefaultGuiFont());
159 commentSubEdit.SetFont(AtlGetDefaultGuiFont());
160 commentSubEdit.SetLimitText(commentWriteMaxLength);
161 commentWriteButton.SetWindowTextW(WRITE_BOTTONSTRING);
162 commentWriteButton.SetFont(AtlGetDefaultGuiFont());
163 commentSubEdit.SetWindowTextW(TEXT(""));
165 addItemList(commentColorBox,generalUser::COMMENT_COLORLIST,ARRAY_LENGTH(generalUser::COMMENT_COLORLIST));
166 addItemList(commentSizeBox,generalUser::COMMENT_SIZELIST,ARRAY_LENGTH(generalUser::COMMENT_SIZELIST));
167 addItemList(commentPosBox,generalUser::COMMENT_POSLIST,ARRAY_LENGTH(generalUser::COMMENT_POSLIST));
168 commentColorBox.SetCurSel(0);
169 commentSizeBox.SetCurSel(0);
170 commentPosBox.SetCurSel(0);
172 font = AtlGetDefaultGuiFont();
175 LPCTSTR sample = TEXT(" ");
177 GetTextExtentPoint32(pdc,sample,_tcslen(sample),&thisSize);
178 commentWriteHeight = thisSize.cy + COMMENTWRITEWINDOW_SEPARATEFSIZE.top + COMMENTWRITEWINDOW_SEPARATEFSIZE.bottom;
179 infoDispHeight = commentWriteHeight;
180 commentWriteInternalHeight = commentWriteHeight - (COMMENTWRITEWINDOW_SEPARATEFSIZE.top + COMMENTWRITEWINDOW_SEPARATEFSIZE.bottom);
182 LOGFONT anonymousLogFont = {0};
183 anonymousLogFont.lfHeight = CHECKBUTTON_SUBSCRIPT_HEIGHT;
184 anonymousLogFont.lfCharSet = SHIFTJIS_CHARSET;
186 checkButtonFont.CreateFontIndirect(&anonymousLogFont);
187 anonymousButton.SetFont(checkButtonFont);
188 ownerModeButton.SetFont(checkButtonFont);
189 CFontHandle f = AtlGetDefaultGuiFont();
191 f.GetLogFont(timeLogFont);
193 timeLogFont.lfWeight = FW_BOLD;
195 timeFont.CreateFontIndirectW(&timeLogFont);
196 anonymousButton.SetWindowTextW(ANONYMOUS_MAILCOMMAND);
197 ownerModeButton.SetWindowText(OWNERMODE_BOTTONSTRING);
201 VOID CCommentWriteWindow::OnDestroy(){
202 commentPosBox.DestroyWindow();
203 commentSizeBox.DestroyWindow();
204 commentColorBox.DestroyWindow();
205 anonymousButton.DestroyWindow();
206 commentSubEdit.DestroyWindow();
207 commentWriteButton.DestroyWindow();
213 LRESULT CCommentWriteWindow::OnSize(UINT wParam,SIZE lParam){
217 VOID CCommentWriteWindow::OnPaint(HDC hdc){
221 this->GetClientRect(&clientRect);
223 pdc.FillRect(&clientRect,COLOR_BTNFACE);
228 pdc.SetBkColor(GetSysColor(COLOR_BTNFACE));
233 TCHAR timeString[LENGTH_256];
234 _tcscpy(timeString,TEXT("
\8co
\89ß
\8e\9e\8aÔ:"));
235 LPTSTR timePtr = timeString + _tcslen(timeString);
236 time_t dispTime = static_cast<time_t>(difftime(streamTime,nicoLiveStream.GetStartTime()));
238 BOOL yetStartFlag = FALSE;
241 dispTime = abs(dispTime);
244 tm dispTimeStruct = *gmtime(&dispTime);
246 if(dispTimeStruct.tm_hour > 0 && yetStartFlag == TRUE){
248 timeFormat = TEXT("-%H:%M:%S");
250 } else if(dispTimeStruct.tm_hour <= 0 && yetStartFlag == TRUE){
252 timeFormat = TEXT(" -%M:%S");
254 } else if(dispTimeStruct.tm_hour > 0){
256 timeFormat = TEXT(" %H:%M:%S");
260 timeFormat = TEXT(" %M:%S");
264 _tcsftime(timePtr,ARRAY_LENGTH(timeString) - _tcslen(timeString),timeFormat,&dispTimeStruct);
266 INT_PTR len = _tcslen(timeString);
267 pdc.SelectFont(timeFont);
270 timeStringRect.top = COMMENTWRITEWINDOW_SEPARATEFSIZE.top;
271 timeStringRect.left = COMMENTWRITEWINDOW_SIDESEPARATESIZE;
272 timeStringRect.bottom =timeStringRect.top;
273 timeStringRect.right = timeStringRect.bottom;
274 pdc.DrawTextW(timeString,len,&timeStringRect,DT_CALCRECT);
275 pdc.DrawTextW(timeString,len,&timeStringRect,0);
284 VOID CSubChatEdit::EnterChatBox(LPVOID userData){
287 auto owner = ((CSubChatEdit*)userData)->self;
288 auto &self = *((CSubChatEdit*)userData);
289 CCommentMaker commentMaker;
290 std::vector<TCHAR> chat(owner.commentSubEdit.GetWindowTextLengthW() + 1);
293 owner.commentSubEdit.GetWindowTextW(&chat[0],chat.size());
294 commentMaker.SetChatString(&chat[0]);
295 if(owner.anonymousButton.GetCheck() == BST_CHECKED){
297 commentMaker.AddMail(ANONYMOUS_MAILCOMMAND);
299 INT_PTR sizeIndex = owner.commentSizeBox.GetCurSel();
300 if(sizeIndex == CB_ERR)sizeIndex = 0;
301 auto &rCommentSizeInfo = *(CommentSizeInfo*)owner.commentSizeBox.GetItemDataPtr(sizeIndex);
303 if(_tcscmp(rCommentSizeInfo.userData,DEFAULT_COMMENTSIZE) != 0){
305 commentMaker.AddMail(rCommentSizeInfo.userData);
308 INT_PTR posIndex = owner.commentPosBox.GetCurSel();
309 if(posIndex == CB_ERR)posIndex = 0;
310 auto &rCommentPosInfo = *(CommentPosInfo*)owner.commentPosBox.GetItemDataPtr(posIndex);
312 if(_tcscmp(rCommentPosInfo.userData,DEFAULT_COMMENTPOS) != 0){
314 commentMaker.AddMail(rCommentPosInfo.userData);
317 INT_PTR colorIndex = owner.commentColorBox.GetCurSel();
318 if(colorIndex == CB_ERR)colorIndex = 0;
319 auto &rCommentColorInfo = *(CommentColorInfo*)owner.commentColorBox.GetItemDataPtr(colorIndex);
321 if(_tcscmp(rCommentColorInfo.name,DEFAULT_COMMENTCOLOR) != 0){
323 commentMaker.AddMail(rCommentColorInfo.name);
327 NLIB_RESULT code = NLIB_ERR_CODE_NOTSET;
329 if(owner.nicoLiveStream.IsOwner() ==TRUE && owner.ownerModeButton.GetCheck() == BST_CHECKED){
331 code = owner.nicoLiveStream.SendOwnerChat(commentMaker);
335 code = owner.nicoLiveStream.SendChat(commentMaker);
344 owner.commentSubEdit.SetWindowText(TEXT(""));
347 case NLIB_ERR_NOT_LIVECONNECT:
348 case NLIB_FAILED_CONNECT:
349 ::MessageBox(owner,NLIB_GetErrorMessage(code),TEXT("
\83R
\83\81\83\93\83g
\8f\91\82«
\8d\9e\82Ý
\83G
\83\89\81["),MB_ICONERROR | MB_OK);
350 owner.commentSubEdit.AgreeEnter();
358 UnexpectedErrorMessageShow(TEXT("
\83R
\83\81\83\93\83g
\8f\91\82«
\8d\9e\82Ý
\92\86\82É"),NLIB_GetErrorMessage(code),__LINE__,TEXT(__FILE__),TEXT(__FUNCTION__));
359 owner.commentSubEdit.AgreeEnter();
376 BOOL CCommentWriteWindow::SendChat(){
377 this->commentSubEdit.untilConnectingFlag = TRUE;
378 this->commentSubEdit.SetReadOnly(TRUE);
379 _beginthread(CSubChatEdit::EnterChatBox,0,&this->commentSubEdit);
391 BOOL CCommentWriteWindow::SetText(LPCTSTR lpStr){
393 BOOL rslt = this->commentSubEdit.SetWindowText(lpStr);
395 commentSubEdit.SetFocus();
396 int cursor = commentSubEdit.GetWindowTextLength();
397 commentSubEdit.SetSel(cursor,cursor);
398 //commentSubEdit.ShowCaret();
403 VOID CCommentWriteWindow::OnChatReceveStart(CNicoLiveStream &nicoLiveStream,NicoLiveThreadComment_P threadComment){
405 this->ShowWindow(SW_HIDE);
406 this->commentColorBox.ResetContent();
407 this->commentPosBox.ResetContent();
408 this->commentSizeBox.ResetContent();
410 addItemList(commentColorBox,generalUser::COMMENT_COLORLIST,ARRAY_LENGTH(generalUser::COMMENT_COLORLIST));
411 addItemList(commentSizeBox,generalUser::COMMENT_SIZELIST,ARRAY_LENGTH(generalUser::COMMENT_SIZELIST));
412 addItemList(commentPosBox,generalUser::COMMENT_POSLIST,ARRAY_LENGTH(generalUser::COMMENT_POSLIST));
415 if(nicoLiveStream.IsPremium() == TRUE){
417 addItemList(commentColorBox,premiumUser::COMMENT_COLORLIST,ARRAY_LENGTH(premiumUser::COMMENT_COLORLIST));
418 addItemList(commentSizeBox,premiumUser::COMMENT_SIZELIST,ARRAY_LENGTH(premiumUser::COMMENT_SIZELIST));
419 addItemList(commentPosBox,premiumUser::COMMENT_POSLIST,ARRAY_LENGTH(premiumUser::COMMENT_POSLIST));
422 this->commentColorBox.SetCurSel(0);
423 this->commentPosBox.SetCurSel(0);
424 this->commentSizeBox.SetCurSel(0);
428 this->ShowWindow(SW_SHOW);
429 this->streamTime = threadComment->server_time;
430 this->SetTimer(TIMER_ID,1000,NULL);
431 if(nicoLiveStream.IsOwner() == TRUE){
433 this->ownerModeButton.ShowWindow(SW_SHOW);
434 ownerModeButton.SetCheck(BST_CHECKED);
435 editBkColor = OWNEREDITCOLOR;
439 this->ownerModeButton.ShowWindow(SW_HIDE);
440 editBkColor = NORMALEDITCOLOR;
444 if(this->editBkBrush.IsNull() ==FALSE){
445 editBkBrush.DeleteObject();
448 editBkBrush.CreateSolidBrush(editBkColor);
451 this->GetClientRect(&windowRect);
452 size.cx = windowRect.right - windowRect.left;
453 size.cy = windowRect.bottom - windowRect.top;
459 VOID CCommentWriteWindow::ChangeSize(SIZE &size){
461 SIZE commentAnonymousButtonSize;
462 SIZE commentWriteButtonSize;
463 commentWriteButton.GetIdealSize(&commentWriteButtonSize);
464 anonymousButton.GetIdealSize(&commentAnonymousButtonSize);
465 UINT_PTR defwindowCount = 0;
466 RECT commentPosBoxRect;
467 RECT commentSizeBoxRect;
468 RECT commentColorBoxRect;
469 RECT anonymousButtonRect;
470 RECT commentEditRect;
471 RECT commentWriteButtonRect;
472 RECT ownerModeButtonRect;
475 UINT_PTR writeSpaceHeight = COMMENTWRITEWINDOW_SEPARATEFSIZE.top * 2 + commentWriteInternalHeight;
476 this->GetWindowRect(&thisWindowRect);
478 commentPosBoxRect.left = COMMENTWRITEWINDOW_SIDESEPARATESIZE;
479 this->commentPosBoxCS.Lock();
480 commentPosBoxRect.right = commentPosBoxRect.left + CalcComboBoxWidth<CommentPosInfo>(commentPosBox);
481 this->commentPosBoxCS.Unlock();
483 commentSizeBoxRect.left = commentPosBoxRect.right + COMMENTWRITEWINDOW_SIDESEPARATESIZE;
484 this->commentSizeBoxCS.Lock();
485 commentSizeBoxRect.right = commentSizeBoxRect.left + CalcComboBoxWidth<CommentSizeInfo>(commentSizeBox);
486 this->commentSizeBoxCS.Unlock();
488 commentColorBoxRect.left = commentSizeBoxRect.right + COMMENTWRITEWINDOW_SIDESEPARATESIZE;
489 commentColorBoxRect.right = commentColorBoxRect.left + commentColorBoxSize.cx;
493 anonymousButtonRect.left = commentColorBoxRect.right + COMMENTWRITEWINDOW_SIDESEPARATESIZE;
494 anonymousButtonRect.right = anonymousButtonRect.left + commentAnonymousButtonSize.cx;
496 if(ownerModeButton.IsWindowVisible() == TRUE){
499 SIZE ownerModeButtonSize;
500 ownerModeButton.GetIdealSize(&ownerModeButtonSize);
501 ownerModeButtonRect.left = anonymousButtonRect.right + COMMENTWRITEWINDOW_SIDESEPARATESIZE;
502 ownerModeButtonRect.right = ownerModeButtonRect.left + ownerModeButtonSize.cx;
503 commentEditRect.left = ownerModeButtonRect.right + COMMENTWRITEWINDOW_SIDESEPARATESIZE;
507 commentEditRect.left = anonymousButtonRect.right + COMMENTWRITEWINDOW_SIDESEPARATESIZE;
511 commentWriteButtonRect.right = size.cx - COMMENTWRITEWINDOW_SIDESEPARATESIZE;
512 commentWriteButtonRect.left = commentWriteButtonRect.right - commentWriteButtonSize.cx;
514 commentEditRect.right = commentWriteButtonRect.left - COMMENTWRITEWINDOW_SIDESEPARATESIZE;
518 //
\88Ú
\93®
\8f\88\97\9d
519 HDWP hDwp = BeginDeferWindowPos(defwindowCount);
521 commentPosBox.DeferWindowPos(hDwp,*this,
522 commentPosBoxRect.left,writeSpaceHeight,commentPosBoxRect.right - commentPosBoxRect.left,commentWriteInternalHeight,
525 commentSizeBox.DeferWindowPos(hDwp,*this,
526 commentSizeBoxRect.left,writeSpaceHeight,commentSizeBoxRect.right - commentSizeBoxRect.left,commentWriteInternalHeight,
529 commentColorBox.DeferWindowPos(hDwp,*this,
530 commentColorBoxRect.left,writeSpaceHeight,commentColorBoxRect.right - commentColorBoxRect.left,commentWriteInternalHeight,
533 anonymousButton.DeferWindowPos(hDwp,*this,
534 anonymousButtonRect.left,writeSpaceHeight,anonymousButtonRect.right - anonymousButtonRect.left,commentWriteInternalHeight,
537 if(ownerModeButton.IsWindowVisible() == TRUE){
538 ownerModeButton.DeferWindowPos(hDwp,*this,
539 ownerModeButtonRect.left,writeSpaceHeight,ownerModeButtonRect.right - ownerModeButtonRect.left,commentWriteInternalHeight,
543 commentSubEdit.DeferWindowPos(hDwp,*this,
544 commentEditRect.left,writeSpaceHeight,commentEditRect.right - commentEditRect.left,commentWriteInternalHeight,
547 commentWriteButton.DeferWindowPos(hDwp,*this,
548 commentWriteButtonRect.left,writeSpaceHeight,commentWriteButtonRect.right - commentWriteButtonRect.left,commentWriteInternalHeight,
551 EndDeferWindowPos(hDwp);
556 VOID CCommentWriteWindow::OnDrawItem(UINT wParam,LPDRAWITEMSTRUCT lParam){
560 if(lParam->hwndItem == commentColorBox.m_hWnd && commentColorBox.GetCount() > 0){
564 RECT drawRect = lParam->rcItem;
566 INT_PTR curselNo = commentColorBox.GetCurSel();
567 CDCHandle dcHandle = lParam->hDC;
569 const UINT_PTR width = 1;
570 drawRect.left += width;
571 drawRect.top += width;
572 drawRect.right -= width;
573 drawRect.bottom -= width;
575 if(lParam->itemID == ((UINT)-1)){
576 itemNo = curselNo == CB_ERR ? 0 : curselNo;
578 itemNo = lParam->itemID;
581 CommentInfo<COLORREF> &commentColor = *(CommentInfo<COLORREF> *)commentColorBox.GetItemDataPtr(itemNo);
584 if(lParam->itemState & (ODS_FOCUS | ODS_COMBOBOXEDIT)){
588 bkBrush.CreateSolidBrush(PALETTERGB(160,160,160));
592 bkBrush.CreateSolidBrush(PALETTERGB(255,255,255));
602 brush.CreateSolidBrush(commentColor.userData);
603 dcHandle.SelectBrush(brush);
604 dcHandle.FillRect(&lParam->rcItem,bkBrush);
605 dcHandle.SelectBrush(brush);
606 dcHandle.SelectPen((HPEN)::GetStockObject(BLACK_PEN));
607 dcHandle.Rectangle(&drawRect);
614 LRESULT CCommentWriteWindow::OnEraseBkGnd(HDC wParam){
620 LRESULT CCommentWriteWindow::OnCtlolorEdit(HDC hdc,HWND hWnd){
622 if(hWnd == this->commentSubEdit){
625 SetBkMode(hdc, TRANSPARENT); //
\94w
\8ci
\82ð
\93§
\89ß
626 SetBkColor(hdc,this->editBkColor); //
\83e
\83L
\83X
\83g
\82ª
\8f\91\82©
\82ê
\82Ä
\82¢
\82é
\95\94\95ª
\82Ì
\83e
\83L
\83X
\83g
\82Ì
\94w
\8ci
\82Ì
\90F
628 return (LRESULT)editBkBrush.m_hBrush;
634 LRESULT CCommentWriteWindow::OnButton(UINT hiWparam,INT_PTR loWparam,HWND lParam){
636 if(lParam == commentWriteButton){
640 } else if(lParam == this->ownerModeButton){
642 if(this->ownerModeButton.GetCheck() == BST_CHECKED){
644 this->editBkColor = OWNEREDITCOLOR;
648 this->editBkColor = NORMALEDITCOLOR;
651 if(this->editBkBrush.IsNull() == FALSE){
653 this->editBkBrush.DeleteObject();
657 this->editBkBrush.CreateSolidBrush(editBkColor);
658 commentSubEdit.Invalidate();
665 VOID CCommentWriteWindow::OnTimer(UINT id){
672 VOID CCommentWriteWindow::OnMeasureItem(UINT wParam,LPMEASUREITEMSTRUCT lParam){
674 switch(lParam->CtlID){
676 case COMMENTCOLOR_BOX:
680 pdc.SelectFont(AtlGetDefaultGuiFont());
681 LPCTSTR sample = TEXT(" ");
682 ::GetTextExtentPoint32(pdc,sample,_tcslen(sample),&itemSize);
683 lParam->itemHeight = itemSize.cy;
698 VOID CCommentWriteWindow::OnSendChatResult(){
700 commentSubEdit.AgreeEnter();
706 VOID CCommentWriteWindow::OnHeartBeat(NicoLiveHeartBeat_P heartBeat){
708 if(heartBeat->status == NLIB_ERR_OK){
709 streamTime = heartBeat->time;
716 VOID CCommentWriteWindow::OnDisConnect(){
718 this->KillTimer(TIMER_ID);
725 //CSubChatEdit
\83N
\83\89\83X
726 //////////////////////////////////////////////////////////////////////////////////////
728 void CSubChatEdit::OnKeyDown(TCHAR wParam, UINT upLParam,UINT loLParam){
729 if(wParam == VK_RETURN){
733 if(untilConnectingFlag == FALSE){
748 VOID CSubChatEdit::AgreeEnter(){
750 this->SetReadOnly(FALSE);
751 untilConnectingFlag = FALSE;