3 #include "nlite_include.h"
8 static const RECT commentViewSize = {5,0,5,0};
14 IDC_COMBO_REBAR = 301,
21 ///
\83E
\83B
\83\93\83h
\83E
\8dÅ
\92á
\83T
\83C
\83Y
23 const static SIZE lowestFrameSize = {300,300};
27 CNliteMainFrame::~CNliteMainFrame(){
29 DeleteObject(hTabFont);
32 CNliteMainFrame::CNliteMainFrame()
34 subLiveNoComboBox(*this),
35 commentWriteWindow(nicoLiveStream),
36 commentView(nicoLiveStream,nicoVideoAuth)
41 lf.lfCharSet = SHIFTJIS_CHARSET;
42 hTabFont = CreateFontIndirect(&lf);
46 //
\83\81\83b
\83Z
\81[
\83W
\83t
\83B
\83\8b\83^
\8f\88\97\9d
47 BOOL CNliteMainFrame::PreTranslateMessage(MSG* pMsg){
48 //
\8aî
\92ê
\83N
\83\89\83X
\82ÌPreTranslateMessage
\82ð
\8cÄ
\82Ñ
\8fo
\82·
49 return CFrameWindowImpl<CNliteMainFrame>::PreTranslateMessage(pMsg);
52 //
\83A
\83C
\83h
\83\8b\8f\88\97\9d
53 BOOL CNliteMainFrame::OnIdle(){
57 //
\83T
\83C
\83Y
\95Ï
\8dX
\8f\88\97\9d
58 VOID CNliteMainFrame::ChangeSize(const SIZE& client){
61 UINT_PTR tabheight = client.cy - (toolBarHeight + statusBarHeight + commentWriteWindow.GetHeight());
64 RECT tabWindowRect = {0};
65 RECT commentViewRect = {0};
66 RECT commentWriteWindowRect = {0};
69 tabWindowRect.left = 0;
70 tabWindowRect.top = toolBarHeight;
71 tabWindowRect.right = client.cx - tabWindowRect.left;
72 tabWindowRect.bottom = tabWindowRect.top + tabheight;
75 commentWriteWindowRect.left = 0;
76 commentWriteWindowRect.top = tabWindowRect.bottom;
77 commentWriteWindowRect.right = commentWriteWindowRect.left + client.cx;
78 commentWriteWindowRect.bottom = commentWriteWindowRect.top + commentWriteWindow.GetHeight();
83 tabctrl.MoveWindow(tabWindowRect.left,tabWindowRect.top,tabWindowRect.right - tabWindowRect.left ,tabWindowRect.bottom - tabWindowRect.top);
86 tabctrl.GetClientRect(&commentViewRect);
87 tabctrl.AdjustRect(FALSE,&commentViewRect);
89 commentView.MoveWindow(commentViewRect.left, commentViewRect.top,commentViewRect.right - commentViewRect.left, commentViewRect.bottom - commentViewRect.top);
91 commentWriteWindow.MoveWindow(commentWriteWindowRect.left,commentWriteWindowRect.top,commentWriteWindowRect.right - commentWriteWindowRect.left ,commentWriteWindowRect.bottom - commentWriteWindowRect.top);
92 commentWriteWindow.Invalidate();
93 ::InvalidateRect(m_hWndStatusBar,NULL,TRUE);
95 // tabctrl.SetWindowPos(*this,0,0,0,0,SWP_NOSIZE | SWP_NOMOVE | SWP_SHOWWINDOW);
96 // commentWriteWindow.SetWindowPos(*this,0,0,0,0,SWP_NOSIZE | SWP_NOMOVE | SWP_SHOWWINDOW);
100 LRESULT CNliteMainFrame::OnCbSelChange(UINT hiWparam,int loWparam,HWND lParam){
102 if(lParam == this->lvNoCombo){
103 INT_PTR cursel = this->lvNoCombo.GetCurSel();
104 if(cursel == CB_ERR)goto end;
105 auto it = this->subLiveNoComboBox.liveInfoList.begin();
106 std::advance(it,cursel);
107 this->ConnectNicoLive(it->second);
116 LRESULT CNliteMainFrame::OnCreate(LPCREATESTRUCT lpcs){
119 //
\83X
\83e
\81[
\83^
\83X
\83o
\81[
\82ð
\8dì
\90¬
120 m_hWndStatusBar = m_hStatusBar.Create(*this);
121 UIAddStatusBar(m_hWndStatusBar);
122 //
\83X
\83e
\81[
\83^
\83X
\83o
\81[
\82É
\83y
\83C
\83\93\82ð
\90Ý
\92è
123 //INT_PTR nPanes[] = {ID_DEFAULT_PANE, IDS_PANE_TIME};
124 //m_hStatusBar.SetPanes(nPanes, sizeof(nPanes)/sizeof(nPanes[0]));
125 //progresBar.Create(m_hWnd,0,NULL,);
126 //m_hStatusBar.SetClipboardViewer
127 tabctrl.Create(m_hWnd,0,NULL,WS_CHILD | WS_VISIBLE | WS_CLIPCHILDREN | WS_DLGFRAME );
128 commentView.Create(tabctrl.m_hWnd);
130 commentWriteWindow.Create(m_hWnd,0,NULL,WS_CHILD | WS_VISIBLE | WS_CLIPCHILDREN );
132 HWND hWndToolBar = CreateSimpleToolBarCtrl(m_hWnd,IDC_NLITE, FALSE, ATL_SIMPLE_TOOLBAR_PANE_STYLE);
133 lvNoCombo.Create(m_hWnd, CRect(0, 0, 100, 100), NULL,WS_CHILD | WS_VISIBLE | WS_VSCROLL | CBS_DROPDOWN | CBS_AUTOHSCROLL, 0, IDC_COMBO_REBAR);
134 lvNoCombo.LimitText(LENGTH_512);
136 subLiveNoComboBox.SubclassWindow(lvNoCombo.GetEditCtrl());
137 lvNoCombo.SetFont(AtlGetDefaultGuiFont());
141 //AddSimpleReBarBand(hWndToolBar);
142 AddSimpleReBarBand(lvNoCombo,TEXT("
\95ú
\91\97URL"));
143 SizeSimpleReBarBands();
145 //tabctrl.SetWindowPos(*this,0,0,0,0,SWP_SHOWWINDOW);
147 tabctrl.SetFont(hTabFont);
148 tabctrl.AddItem(TCIF_TEXT | TCIF_PARAM, _T("
\83R
\83\81\83\93\83g
\88ê
\97\97"), 0, (DWORD)commentView.m_hWnd);
152 //
\83\81\83b
\83Z
\81[
\83W
\83\8b\81[
\83v
\82É
\83\81\83b
\83Z
\81[
\83W
\83t
\83B
\83\8b\83^
\82Æ
\83A
\83C
\83h
\83\8b\83n
\83\93\83h
\83\89\82ð
\92Ç
\89Á
153 CMessageLoop* pLoop = _Module.GetMessageLoop();
154 pLoop->AddMessageFilter(this);
155 pLoop->AddIdleHandler(this);
158 this->GetWindowRect(&wndRect);
160 LONG cyMaxImized = GetSystemMetrics (SM_CYMAXIMIZED);
161 wndRect.bottom = nliteProperty.GetMainFrameProperty().GetWindowSize().cy != 0 ? nliteProperty.GetMainFrameProperty().GetWindowSize().cy : (LONG)cyMaxImized / 2;
162 wndRect.right = nliteProperty.GetMainFrameProperty().GetWindowSize().cx != 0 ? nliteProperty.GetMainFrameProperty().GetWindowSize().cx : commentViewSize.left + commentViewSize.right + 20 + commentView.GetColumnHolSizeSum();
167 ::GetClientRect(m_hWndStatusBar,&statusbarRect);
169 statusBarHeight = statusbarRect.bottom - statusbarRect.top;
173 this->MoveWindow(wndRect.left,wndRect.top,wndRect.right,wndRect.bottom);
175 listenerSettingWindow.Create(*this);
177 this->SetMenuItemCheck(IDM_FRONT_WINDOW_CHECK,nliteProperty.GetMainFrameProperty().IsWindowFront());
178 this->SetMenuItemCheck(IDM_SPEAK_COMMENT_CHECK,nliteProperty.GetCommentReadProperty().IsCommentRead());
180 this->SetWindowPos(nliteProperty.GetMainFrameProperty().IsWindowFront() == TRUE ? HWND_TOPMOST : HWND_NOTOPMOST,0,0,0,0,SWP_NOSIZE | SWP_NOMOVE);
187 VOID CNliteMainFrame::Initialize(LPCTSTR localAppDataPath){
190 nliteProperty.ReadProperty();
193 if((nliteProperty.GetGeneralProperty().IsNCVUserSettingReaded() == FALSE) &&
194 ((PathFileExists(ncvAppSettingPath) && (!::PathIsDirectory( ncvAppSettingPath ))))){
196 if((::MessageBox(NULL,TEXT("NCV
\82Ì
\83\8a\83X
\83i
\81[
\8fî
\95ñ
\82Æ
\93¯
\8aú
\82µ
\82Ü
\82·
\82©
\81H"),TEXT("
\83\8a\83X
\83i
\81[
\8fî
\95ñ
\93Ç
\82Ý
\8d\9e\82Ý"),MB_OK | MB_OKCANCEL) == IDOK)){
197 listenerList.ReadProperty(GetNCVListenerInfoFilePath());
199 nliteProperty.GetGeneralProperty().SetNCVUSerSettingReaded(TRUE);
206 listenerList.ReadProperty(nliteProperty.GetListenerDataPath());
208 commentView.SetProperty(nliteProperty.GetCommentViewProperty(),nliteProperty.GetGeneralProperty());
209 if(nliteProperty.GetGeneralProperty().GetBrowserType() == BT_NOSETTING){
210 nliteProperty.CookieSetting();
211 while(nliteProperty.GetGeneralProperty().GetBrowserType() == BT_NOSETTING){
212 ::MessageBox(NULL,TEXT("
\83u
\83\89\83E
\83U
\83^
\83C
\83v
\82ð
\8ew
\92è
\82µ
\82Ä
\82
\82¾
\82³
\82¢
\81B
\82±
\82ê
\88È
\8aO
\82Ì
\83u
\83\89\83E
\83U
\82Í
\8c»
\8dÝ
\8eg
\97p
\82·
\82é
\82±
\82Æ
\82Í
\82Å
\82«
\82Ü
\82¹
\82ñ"),TEXT("
\83u
\83\89\83E
\83U
\83^
\83C
\83v
\8ew
\92è
\83G
\83\89\81["),MB_OK);
213 nliteProperty.CookieSetting();
217 nicoVideoAuth.SetBrowserType(nliteProperty.GetGeneralProperty().GetBrowserType());
218 nicoLiveStream.SetResFrom(200);
219 }catch(Exception &e){
221 ::MessageBox(NULL,e.what(),TEXT("
\90Ý
\92è
\83t
\83@
\83C
\83\8b\93Ç
\82Ý
\8d\9e\82Ý
\83G
\83\89\81["),MB_OK | MB_ICONERROR);
228 VOID CNliteMainFrame::OnClose(){
229 this->ShowWindow(SW_HIDE);
230 nicoLiveStream.DisConnect();
231 this->DestroyWindow();
236 VOID CNliteMainFrame::OnDestroy(){
238 commentView.DestroyWindow();
245 VOID CNliteMainFrame::OnException(){
247 nicoLiveStream.DisConnect();
252 BOOL CNliteMainFrame::IsMenuItemChecked(UINT item){
253 MENUITEMINFO menuInfo;
254 menuInfo.fMask = MIIM_STATE;
255 menuInfo.cbSize = sizeof(menuInfo);
256 ::GetMenuItemInfo(this->GetMenu(),item,FALSE,&menuInfo);
257 return menuInfo.fState == MFS_CHECKED;
261 VOID CNliteMainFrame::SetMenuItemCheck(UINT item,BOOL state){
262 MENUITEMINFO menuInfo;
263 menuInfo.cbSize = sizeof(menuInfo);
264 menuInfo.fMask = MIIM_STATE;
265 menuInfo.fState = state == TRUE ? MFS_CHECKED :MFS_UNCHECKED;
266 ::SetMenuItemInfo(this->GetMenu(),item,FALSE,&menuInfo);
270 //
\83\81\83j
\83\85\81[
\82©
\82ç
\83t
\83@
\83C
\83\8b\82ð
\8fI
\97¹
\82ð
\91I
\91ð
271 VOID CNliteMainFrame::OnMenuExit(UINT uNotifyCode, int nID, HWND hWndCtl){
272 PostMessage(WM_CLOSE);
275 //
\83\81\83j
\83\85\81[
\82Ì
\83A
\83v
\83\8a\83P
\81[
\83V
\83\87\83\93\83o
\81[
\83W
\83\87\83\93\8fî
\95ñ
\95\
\8e¦
276 VOID CNliteMainFrame::OnMenuAbount(UINT uNotifyCode,int nID,HWND hWndCtl){
280 VOID CNliteMainFrame::Finalaize(){
282 nliteProperty.SetCommentViewProperty(commentView.GetProperty());
283 nliteProperty.WriteProperty();
284 listenerList.WriteProperty(nliteProperty.GetListenerDataPath());
287 VOID CNliteMainFrame::OnViewPreference(UINT uNotifyCode,int nID,HWND hWndCtl){
289 //ViewerPropertyWindow propetyWindow(TEXT("
\83r
\83\85\81[
\83A
\90Ý
\92è"));
291 //propetyWindow.DoModal();
296 LRESULT CNliteMainFrame::OnUnlockLvNoBuffer(UINT uMsg,WPARAM wParam,LPARAM lParam){
297 this->lvNoBufCS.Unlock();
301 //
\83N
\83b
\83L
\81[
\82Ì
\90Ý
\92è
302 VOID CNliteMainFrame::OnCookie(UINT uNotifyCode,int nID,HWND hWndCtl){
303 nliteProperty.CookieSetting();
305 while(nliteProperty.GetGeneralProperty().GetBrowserType() == BT_NOSETTING){
306 ::MessageBox(NULL,TEXT("
\83u
\83\89\83E
\83U
\83^
\83C
\83v
\82ð
\8ew
\92è
\82µ
\82Ä
\82
\82¾
\82³
\82¢
\81B
\82±
\82ê
\88È
\8aO
\82Ì
\83u
\83\89\83E
\83U
\82Í
\8c»
\8dÝ
\8eg
\97p
\82·
\82é
\82±
\82Æ
\82Í
\82Å
\82«
\82Ü
\82¹
\82ñ"),TEXT("
\83u
\83\89\83E
\83U
\83^
\83C
\83v
\8ew
\92è
\83G
\83\89\81["),MB_OK);
307 nliteProperty.CookieSetting();
311 nicoVideoAuth.SetBrowserType(nliteProperty.GetGeneralProperty().GetBrowserType());
312 } catch(NLIBException &e){
314 MessageBox(e.what(),TEXT("
\83N
\83b
\83L
\81[
\8eæ
\93¾
\8e¸
\94s"),MB_OK | MB_ICONERROR);
321 VOID CNliteMainFrame::OnSpeakCommentCheck(UINT uNotifyCode,int nID,HWND hWndCtl){
324 nliteProperty.GetCommentReadProperty().SetCommentRead(!IsMenuItemChecked(IDM_SPEAK_COMMENT_CHECK));
325 SetMenuItemCheck(IDM_SPEAK_COMMENT_CHECK,nliteProperty.GetCommentReadProperty().IsCommentRead() );
330 VOID CNliteMainFrame::OnFrontWindowCheck(UINT uNotifyCode,int nID,HWND hWndCtl){
333 nliteProperty.GetMainFrameProperty().SetWindowFront(!IsMenuItemChecked(IDM_FRONT_WINDOW_CHECK));
334 SetMenuItemCheck(IDM_FRONT_WINDOW_CHECK,nliteProperty.GetMainFrameProperty().IsWindowFront() );
335 this->SetWindowPos(nliteProperty.GetMainFrameProperty().IsWindowFront() == TRUE ? HWND_TOPMOST : HWND_NOTOPMOST,0,0,0,0,SWP_NOSIZE | SWP_NOMOVE);
339 VOID CNliteMainFrame::ConnectingThread(LPVOID userData){
341 auto &self = *(CNliteMainFrame*)userData;
342 CString lvNoString = self.lvNoBuffer;
343 self.SendMessage(UM_UNLOCK_LVNOBUFFER,(WPARAM)0,(LPARAM)0);
345 self.nicoLiveStream.DisConnect();
346 self.commentView.OnConnect();
349 NLIB_RESULT code = self.nicoLiveStream.Connect(self.nicoVideoAuth,lvNoString,LiveCallBack,&self.userData);
351 //
\83G
\83\89\81[
\83R
\81[
\83h
\8f\88\97\9d
360 //
\91z
\92è
\82³
\82ê
\82½
\83G
\83\89\81[
\83R
\81[
\83h
361 case NLIB_ERR_COOKIE_FAILED:
362 case NLIB_LIVENO_FAILED_UNDEFEINE:
363 case NLIB_FAILED_CONNECT:
364 case NLIB_ERR_GETPLAYERSTATUS_INVALID_LV:
365 case NLIB_ERR_GETPLAYERSTATUS_INVALID_THREAD:
366 case NLIB_ERR_GETPLAYERSTATUS_CLOSED:
367 case NLIB_ERR_GETPLAYERSTATUS_UNKNOWN_ERROR:
368 case NLIB_ERR_GETPLAYERSTATUS_SERVER_ERROR:
369 case NLIB_ERR_GETPLAYERSTATUS_DELETED:
370 case NLIB_ERR_GETPLAYERSTATUS_FULL:
371 case NLIB_ERR_GETPLAYERSTATUS_PERMISSION_DENIED:
372 case NLIB_ERR_GETPLAYERSTATUS_ACCESS_LOCKED:
373 case NLIB_ERR_GETPLAYERSTATUS_REQUIRE_COMMUNITY_MEMBER:
374 case NLIB_ERR_GETPLAYERSTATUS_COMINGSOON:
375 case NLIB_ERR_GETPLAYERSTATUS_NOTFOUND:
376 case NLIB_ERR_GETPLAYERSTATUS_NOTLOGIN:
377 case NLIB_ERR_GETPLAYERSTATUS_UNKNOWN:
378 case NLIB_ERR_GETPLAYERSTATUS_MAINTENANCE:
379 case NLIB_ERR_GETPLAYERSTATUS_NOT_PERMITTED:
380 case NLIB_ERR_GETPLAYERSTATUS_REQUIRE_ACCEPT_PRINT_TIMESHIFT_TICKET:
381 case NLIB_ERR_GETPLAYERSTATUS_TSARCHIVE:
382 case NLIB_ERR_GETPLAYERSTATUS_USERTIMESHIFT:
383 case NLIB_ERR_GETPLAYERSTATUS_UNDEFINED:
384 case NLIB_ERR_GETPLAYERSTATUS_NOAUTH:
385 case NLIB_ERR_GETPLAYERSTATUS_CHANT_PARSE:
386 case NLIB_ERR_GETPLAYERSTATUS_BLOCK_NOW_COUNT_OVERFLOW:
390 ::MessageBox(self,NLIB_GetErrorMessage(code),TEXT("
\95ú
\91\97\90Ú
\91±
\83G
\83\89\81["),MB_ICONERROR | MB_OK);
395 //
\91z
\92è
\82³
\82ê
\82Ä
\82¢
\82È
\82¢
\83G
\83\89\81[
\83R
\81[
\83h
398 UnexpectedErrorMessageShow( TEXT("
\95ú
\91\97\90Ú
\91±
\92\86\82É"),NLIB_GetErrorMessage(code),__LINE__,TEXT(__FILE__),TEXT(__FUNCTION__));
404 self.subLiveNoComboBox.AgreeInputLvNo();
407 } catch(nlib::Exception &e){
409 UnexpectedErrorMessageShow( TEXT("
\95ú
\91\97\90Ú
\91±
\92\86\82É"),e.what(),e.getLineNo(),e.getFileName(),e.getFunctionName());
414 self.subLiveNoComboBox.AgreeInputLvNo();
420 BOOL CNliteMainFrame::ConnectNicoLive(LPCTSTR liveNo){
422 lvNoCombo.GetEditCtrl().SetReadOnly(TRUE);
423 subLiveNoComboBox.untilConnectingFlag = TRUE;
426 this->lvNoBuffer = liveNo;
427 _beginthread(CNliteMainFrame::ConnectingThread,0,this);
437 //
\83T
\83C
\83Y
\95Ï
\8dX
\8cã
438 LRESULT CNliteMainFrame::OnSize(UINT uMsg,WPARAM wParam,LPARAM lParam,BOOL& bHandled){
442 clientSize.cx = LOWORD(lParam);
443 clientSize.cy = HIWORD(lParam);
444 ChangeSize(clientSize);
455 ///
\83T
\83C
\83Y
\95Ï
\8dX
\92\86\8f\88\97\9d
457 VOID CNliteMainFrame::OnSizing(UINT wParam,LPRECT lParam){
459 if(lParam->right - lParam->left < lowestFrameSize.cx){
460 lParam->right = lParam->left + lowestFrameSize.cx;
463 if(lParam->bottom - lParam->top < lowestFrameSize.cy){
465 lParam->bottom = lParam->top + lowestFrameSize.cy;
471 //
\83c
\81[
\83\8b\83o
\81[
\8d\82\82³
\95Ï
\8dX
472 LRESULT CNliteMainFrame::OnRbnHeightChange(INT_PTR wParam,LPNMHDR lParam,BOOL &bHandled){
475 ::GetClientRect(m_hWndToolBar,&toolbarRect);
476 toolBarHeight = toolbarRect.bottom - toolbarRect.top;
479 GetClientRect(&client);
481 ChangeSize( _WTYPES_NS::CSize(client.right - client.left,client.bottom - client.top));
488 LRESULT CNliteMainFrame::OnUpDateUI(UINT uMsg,WPARAM wParam,LPARAM lParam){
491 commentView.UpDateUI();
496 LRESULT CNliteMainFrame::OnClickChatNo(UINT uMsg,WPARAM wParam,LPARAM lParam){
498 auto &chatData = *(CChatData*)wParam;
500 if(chatData.GetListnerData().GetName().Length() == 0){
501 setString.Format(TEXT(">>%d "),chatData.GetNo());
503 setString.Format(TEXT(">>%s "),chatData.GetListnerData().GetName());
506 this->commentWriteWindow.SetText(setString);
512 LRESULT CNliteMainFrame::OnClickUserName(UINT uMsg,WPARAM wParam,LPARAM lParam){
514 auto &chatData = *(CChatData*)wParam;
515 listenerSettingWindow.ShowSettingWindow(chatData.GetListnerData());
522 NLIB_RESULT CNliteMainFrame::LiveCallBack(NICOLIVE_EVENT eventType,NicoLiveStream_P pNicoLiveStream,LPVOID option,NICOLIVE_PARAM param1,NICOLIVE_PARAM param2){
524 CLiveUserData &userData = (*(CLiveUserData*)option);
531 case NICOLIVE_EVENT_RECEVE_CONNECTRESULT:
533 userData.OnChatReceveStart(userData.self.nicoLiveStream,(NicoLiveThreadComment_P)param1);
537 case NICOLIVE_EVENT_RECEVE_CHAT:
539 userData.OnChatReceve((NicoLiveChat_P) param1,param2);
543 case NICOLIVE_EVENT_RECEVE_CHATSETTLE:
545 userData.OnChatReceveSettle(param1,param2);
549 case NICOLIVE_EVENT_RECEVE_CHATSENDRESULT:
551 userData.OnChatSendResult(reinterpret_cast<NicoLiveSendResultComment_P>(param1));
555 case NICOLIVE_EVENT_SEND_HEARTBEAT:
557 userData.OnHeartBeat(reinterpret_cast<NicoLiveHeartBeat_P>(param1));
562 case NICOLIVE_EVENT_DISCONNECT:
564 userData.OnDisconnect();
568 case NICOLIVE_EVENT_ERR_CONNECT:
570 throw NLiveException(TEXT("
\90Ú
\91±
\83G
\83\89\81[
\82Å
\82·"),__LINE__,TEXT(__FILE__),TEXT(__FUNCTION__));
576 throw NLiveException(TEXT("
\97\
\8aú
\82µ
\82È
\82¢
\83\81\83b
\83Z
\81[
\83W
\82ª
\91\97\90M
\82³
\82ê
\82Ü
\82µ
\82½"),__LINE__,TEXT(__FILE__),TEXT(__FUNCTION__));
581 } catch(Exception e){
582 UnexpectedErrorMessageShow(TEXT("
\83n
\83\93\83h
\83\8b\82³
\82ê
\82Ä
\82¢
\82È
\82¢
\83G
\83\89\81["),e.what(),e.getLineNo(),e.getFileName(),e.getFunctionName());
584 } catch(std::exception e){
585 UnexpectedErrorMessageShow(TEXT("
\83n
\83\93\83h
\83\8b\82³
\82ê
\82Ä
\82¢
\82È
\82¢
\95s
\96¾
\82Ì
\83G
\83\89\81["),CComBSTR(e.what()),-1,TEXT("
\94
\90¶
\83t
\83@
\83C
\83\8b\82ª
\93Á
\92è
\8fo
\97\88\82Ü
\82¹
\82ñ"),TEXT("
\94
\90¶
\8aÖ
\90\94\82ª
\93Á
\92è
\82Å
\82«
\82Ü
\82¹
\82ñ"));
595 LRESULT CNliteMainFrame::OnSetCursor(LRESULT msg,WPARAM wParam,LPARAM lParam,BOOL &bHandled){
600 if(this->subLiveNoComboBox.untilConnectingFlag == TRUE || this->commentWriteWindow.IsWrighthing() == TRUE){
602 if(this->subLiveNoComboBox.untilConnectingFlag == TRUE){
603 ::SetCursor(::LoadCursorW(NULL,IDC_WAIT));
604 } else if(this->commentWriteWindow.IsWrighthing() == TRUE){
605 ::SetCursor(::LoadCursorW(NULL,IDC_APPSTARTING));
625 ////////////////////////////////////
627 CNliteMainFrame::CSubLiveNoComboBox::CSubLiveNoComboBox(CNliteMainFrame &in_self):self(in_self),untilConnectingFlag(FALSE){}
629 static VOID AgreeEnterKeyThread(LPVOID userData){
632 auto noCombo = (CNliteMainFrame::CSubLiveNoComboBox*) userData;
633 noCombo->AgreeInputLvNo();
638 VOID CNliteMainFrame::CSubLiveNoComboBox::OnKeyDown(TCHAR wParam, UINT upLParam,UINT loLParam){
639 if(wParam == VK_RETURN){
643 //INT_PTR no = self.lvNoCombo.GetCurSel();
644 if(untilConnectingFlag == FALSE){
646 std::vector<TCHAR> buffer(this->GetWindowTextLengthW() + 1);
647 ::GetWindowTextW(this->m_hWnd,&buffer[0],buffer.size());
650 self.ConnectNicoLive(&buffer[0]);
657 this->DefWindowProc();
663 LRESULT CNliteMainFrame::CSubLiveNoComboBox::OnMouseWheel(UINT loWparam,SHORT hiWparam,CPoint &point){
671 VOID CNliteMainFrame::CSubLiveNoComboBox::AddLiveInfo(CNicoLiveStream &stream,LvnoSearchFunctional &functional){
673 CNLiteString dispComboString;
674 dispComboString += stream.GetId();
675 dispComboString += TEXT("
\81@-");
676 dispComboString += stream.GetDefaultCommunity();
677 dispComboString += TEXT("
\81@title
\81F");
678 dispComboString += stream.GetTitle();
680 if(std::find_if(liveInfoList.begin(),liveInfoList.end(),functional) == liveInfoList.end()){
681 liveInfoList.push_back(LiveInfo(dispComboString,stream.GetId()));
683 self.lvNoCombo.InsertItem(self.lvNoCombo.GetCount(),dispComboString,0,0,0,0);
686 functional.dispData = dispComboString;
695 VOID CNliteMainFrame::CSubLiveNoComboBox::AgreeInputLvNo(){
697 self.lvNoCombo.GetEditCtrl().SetReadOnly(FALSE);
698 self.EnableWindow(TRUE);
699 untilConnectingFlag = FALSE;
701 ::GetCursorPos(&mousePoint);
702 ::SetCursorPos(mousePoint.x,mousePoint.y);
709 /////////////////////////////////////////////////////////////////////////
711 CNliteMainFrame::CLiveUserData::CLiveUserData(CNliteMainFrame &self):self(self)
716 VOID CNliteMainFrame::CLiveUserData::OnConnect(){
718 self.commentView.OnConnect();
723 VOID CNliteMainFrame::CLiveUserData::OnChatReceveStart(CNicoLiveStream &stream,NicoLiveThreadComment_P threadComment){
725 LvnoSearchFunctional functional(stream.GetId());
726 self.commentWriteWindow.OnChatReceveStart(stream,threadComment);
727 self.subLiveNoComboBox.AddLiveInfo(stream,functional);
728 self.subLiveNoComboBox.SetWindowText(functional.dispData);
729 self.subLiveNoComboBox.AgreeInputLvNo();
734 VOID CNliteMainFrame::CLiveUserData::OnChatReceve(NicoLiveChat_P chat,UINT_PTR count){
736 self.commentView.OnChatReceve(chat,count);
740 VOID CNliteMainFrame::CLiveUserData::OnChatReceveSettle(UINT_PTR commentCount,UINT_PTR commentCountSum){
742 self.commentView.OnChatReceveSettle(commentCount,commentCountSum);
747 VOID CNliteMainFrame::CLiveUserData::OnChatSendResult(NicoLiveSendResultComment_P sendResult){
748 self.commentWriteWindow.OnSendChatResult();
753 VOID CNliteMainFrame::CLiveUserData::OnHeartBeat(NicoLiveHeartBeat_P heartBeat){
755 self.commentWriteWindow.OnHeartBeat(heartBeat);
762 VOID CNliteMainFrame::CLiveUserData::OnDisconnect(){
763 self.commentWriteWindow.OnDisConnect();