OSDN Git Service

2012/01/22 23:04:23
[nlite/nlite.git] / nlite / nlite_mailframe.h
index 4720a08..f973c2d 100644 (file)
 namespace nlite{
        
 
-       
+       ///
+       ///\83E\83B\83\93\83h\83E\96¼
+       ///
        const static LPCTSTR NLITE_MAINWINDOW = TEXT("nlite");
 
-       class CLiveUserData {
-
-       public:
-
-               CCommentView &commentView;
-
-       
-               CLiveUserData(CCommentView& cv):commentView(cv){}
-               
-
-       };
-
-       class CNicoVideoAuth{
+       ///
+       ///\83E\83B\83\93\83h\83E\8dÅ\92á\83T\83C\83Y
+       ///
+       const static SIZE lowestFrameSize = {300,300};
 
-       private:
-               NicoVideoAuth_P nicoVideoAuth;
+       ///
+       ///\83\81\83C\83\93\83t\83\8c\81[\83\80\83N\83\89\83X
+       ///
+       class CNliteMainFrame : public CFrameWindowImpl<CNliteMainFrame>,
+               public CUpdateUI<CNliteMainFrame>,public CMessageFilter, public CIdleHandler
+       {
 
+               ///
+               ///\92è\90\94
+               ///
+               enum{
+                       IDC_COMBO_REBAR = 301,
+                       IDC_COMBO_TITLE = 302
+               };
 
        public:
-               CNicoVideoAuth()
-                       :nicoVideoAuth(NicoVideoAuth_new()){}
 
-               ~CNicoVideoAuth(){
+               ///
+               ///\95ú\91\97\94Ô\8d\86\93ü\97Í\97p
+               ///
+               class CSubLiveNoComboBox:public CWindowImpl<CEdit>{
 
-                       NicoVideoAuth_delete(&nicoVideoAuth);
-               }
+                       
 
-               VOID SetBrowserType(BROWSERTYPE bt){
-                       NLIB_RESULT rslt;
+               private:
+                       CNliteMainFrame &self;                          //\83\81\83C\83\93\83t\83\8c\81[\83\80\83E\83B\83\93\83h\83E
+                       CComAutoCriticalSection cs;                     //\83N\83\8a\83e\83B\83J\83\8b\83Z\83N\83V\83\87\83\93\83I\83u\83W\83F\83N\83g
+                       BOOL untilConnectingFlag;                       //\90Ú\91±\8f\88\97\9d\92\86\82©\82Ì\83t\83\89\83O\94»\92è
 
-                       rslt = NicoVideoAuth_getNicoVideoAuth(nicoVideoAuth,bt);
-                       if(rslt != NLIB_ERR_OK){
+               public:
+                       
+                       ///
+                       ///\83R\83\93\83X\83^\83\89\83N\83^
+                       ///
+                       CSubLiveNoComboBox(CNliteMainFrame &in_self);
+                       
 
-                               throw NLIBException(rslt);
-                       }
+                       //\83\81\83b\83Z\81[\83W\83\8b\81[\83v
+                       BEGIN_MSG_MAP_EX(CSubLiveNoComboBox)
+                               MSG_WM_KEYDOWN(OnKeyDown)
+                       END_MSG_MAP()
 
-               }
 
-               NicoVideoAuth_P GetAuth(){
+                       ///
+                       ///\83L\81[\89\9f\89º\8e\9e\82Ì\8f\88\97\9d
+                       ///
+                       VOID OnKeyDown(TCHAR wParam, UINT upLParam,UINT loLParam);
 
-                       return this->nicoVideoAuth;
-               }
+                       ///
+                       ///\95ú\91\97\94Ô\8d\86\93ü\97Í\82ð\8b\96\89Â\82·\82é
+                       ///
+                       VOID AgreeInputLvNo();
 
-       };
+                       
 
-       class CNicoLiveStream{
+               };
 
-       private:
-               NicoLiveStream_P nicoLiveStream;
 
-       public:
-               CNicoLiveStream()
-                       :nicoLiveStream(NicoLiveStream_new())
+               ///
+               ///\83R\83\81\83\93\83g\8eó\90M
+               ///
+               class CLiveUserData {
 
-               {}
-               ~CNicoLiveStream(){
+               private:
 
-                       NicoLiveStream_delete(&nicoLiveStream);
-                       
-               }
+                       CCommentView &commentView;                              //\83R\83\81\83\93\83g\95\\8e¦\83E\83B\83\93\83h\83E
+                       CCommentWriteWindow &writeWindow;               //\83R\83\81\83\93\83g\8f\91\82«\8d\9e\82Ý\97p\82Ì\83E\83B\83\93\83h\83E
+                       CSubLiveNoComboBox &lvnocombo;                  //\95ú\91\97\94Ô\8d\86\93ü\97Í\83R\83\93\83{\83{\83b\83N\83X
 
-               
+               public:
 
-               VOID Connect(CLiveUserData &userData,CNicoVideoAuth &nicoVideoAuth,LPCTSTR url){
+                       ///
+                       ///\83R\83\93\83X\83g\83\89\83N\83^
+                       ///
+                       CLiveUserData(CCommentView& cv,CSubLiveNoComboBox &combo,CCommentWriteWindow &writeWindow);
+                       
 
-                       NLIB_RESULT rslt;
+                       ///
+                       ///\90Ú\91±\8aJ\8en\8e\9e\8f\88\97\9d
+                       ///
+                       VOID OnConnect();
+                       
+                       ///
+                       ///\83R\83\81\83\93\83g\8eó\90M\8aJ\8en\8e\9e\82Ì\83R\81[\83\8b\83o\83b\83N\8f\88\97\9d
+                       ///
+                       VOID OnChatReceveStart(StreamStatus &streamStatus);
 
-                       rslt = NicoLiveStream_connect(nicoLiveStream,nicoVideoAuth.GetAuth(),url,LiveCallBack,&userData);
 
-                       if(rslt != NLIB_ERR_OK){
+                       ///
+                       ///1\83R\83\81\83\93\83g\8eó\90M\82µ\82½\8e\9e\82Ì\83R\81[\83\8b\83o\83b\83N\8f\88\97\9d
+                       ///\8eó\90M\82µ\82½\83R\83\81\83\93\83g\82ð\83o\83b\83t\83@\82É\8ai\94[
+                       ///
+                       VOID OnChatReceve(NicoLiveChat_P chat,UINT_PTR count);
+                       
 
-                               throw NLIBException(rslt);
-                       }
-               }
-               
+                       ///
+                       ///\83`\83\83\83b\83g\8eó\90M\8am\92è\8e\9e\82Ì\83R\81[\83\8b\83o\83b\83N\8f\88\97\9d
+                       ///\8eå\82É\8eó\90M\82µ\82½\83R\83\81\83\93\83g\82Ì\95`\89æ\8f\88\97\9d\82ð\8ds\82¤
+                       ///
+                       VOID OnChatReceveSettle(UINT_PTR commentCount,UINT_PTR commentCountSum);
 
-               VOID DisConnect(){
+                       ///
+                       ///\83R\83\81\83\93\83g\91\97\90M\8c\8b\89Ê\8eó\90M\8e\9e\82Ì\83R\81[\83\8b\83o\83b\83N\8f\88\97\9d
+                       ///
+                       VOID OnChatSendResult(NicoLiveSendResultComment_P sendResult);
 
-                       NicoLiveStream_disConnect(nicoLiveStream);
-               }
-               
-               VOID SendChat(LPCTSTR chatBuf,std::vector<LPCTSTR> mails,std::vector<LPCTSTR> extends){
-                       NLIB_RESULT rslt;
-                       mails.insert( mails.end(),(LPCTSTR)NULL);
-                       extends.insert(extends.end(),(LPCTSTR)NULL);
-                       rslt = NicoLiveStream_sendChat(nicoLiveStream,chatBuf,&mails[0],&extends[0]);
-
-                       if(rslt != NLIB_ERR_OK){
-                               throw NLIBException(rslt);
-                       }
-               }
+               };
 
-               static NLIB_RESULT LiveCallBack(NICOLIVE_EVENT eventType,NicoLiveStream_P pNicoLiveStream,LPVOID option,NICOLIVE_PARAM param1,NICOLIVE_PARAM param2);
                
-
-       };
-
-       class CNliteMainFrame : public CFrameWindowImpl<CNliteMainFrame>,
-               public CUpdateUI<CNliteMainFrame>,public CMessageFilter, public CIdleHandler
-       {
        public:
 
                typedef CFrameWindowImpl<CNliteMainFrame> baseWindow;
 
                // \83E\83B\83\93\83h\83E\83N\83\89\83X\96¼\81A\8b¤\92Ê\83\8a\83\\81[\83XID\81A\83X\83^\83C\83\8b\81A\94w\8ci\90F\82ð\93o\98^
-               DECLARE_FRAME_WND_CLASS_EX(NLITE_MAINWINDOW, IDC_NLITE,CS_HREDRAW | CS_VREDRAW | CS_DBLCLKS, COLOR_WINDOW)
-               //DECLARE_FRAME_WND_CLASS_EX(NLITE_MAINWINDOW, IDC_NLITE,CS_HREDRAW | CS_VREDRAW | CS_DBLCLKS, COLOR_WINDOW)
-               //DECLARE_FRAME_WND_CLASS(NULL,IDC_NLITE);
+               DECLARE_FRAME_WND_CLASS(NLITE_MAINWINDOW, IDC_NLITE)
+
        private:
-               CCommentView commentView;
-               CNicoLiveStream nicoLiveStream;
-               CNicoVideoAuth nicoVideoAuth;
-               CStatusBarCtrl statusBar;
-               CLiveUserData userData;
-               CTabCtrl tabctrl;
-               CProperty nliteProperty;
-               HFONT hTabFont;
-               CComboBox lvNoCombo;
-               INT_PTR statusBarHeight;
-               INT_PTR toolBarHeight;
+               CCommentView commentView;                                       //\83R\83\81\83\93\83g\95\\8e¦\83E\83B\83\93\83h\83E
+               CStatusBarCtrl statusBar;                                       //\83X\83e\81[\83^\83X\83o\81[
+               CLiveUserData userData;                                         //\83C\83x\83\93\83g\83n\83\93\83h\83\89\97p\83N\83\89\83X
+               CSubLiveNoComboBox subLiveNoComboBox;           //\90\95ú\91\97\94Ô\8d\86\93ü\97Í\97p\83R\83\93\83{\83{\83b\83N\83X(\83T\83u\83N\83\89\83X)
+               CCommentWriteWindow commentWriteWindow;         //\83R\83\81\83\93\83g\8f\91\82«\8d\9e\82Ý\97p\83N\83\89\83X
+               CTabCtrl tabctrl;                                                       //\83^\83u\83R\83\93\83g\83\8d\81[\83\8b
+               
+               HFONT hTabFont;                                                         //\83^\83u\83E\83B\83\93\83h\83E\97p\82Ì\83t\83H\83\93\83g                            
+               CComboBoxEx lvNoCombo;                                          //\90\95ú\91\97\94Ô\8d\86\93ü\97Í\97p\83R\83\93\83{\83{\83b\83N\83X
+               INT_PTR statusBarHeight;                                        //\83X\83e\81[\83^\83X\83o\81[\82Ì\8d\82\82³
+               INT_PTR toolBarHeight;                                          //\83c\81[\83\8b\83o\81[\82Ì\8d\82\82³
+               CNicoVideoAuth nicoVideoAuth;                           //\83j\83R\83j\83R\93®\89æ\94F\8fØ\97p\83I\83u\83W\83F\83N\83g
+               Property nliteProperty;                                         //\83A\83v\83\8a\83P\81[\83V\83\87\83\93\83v\83\8d\83p\83e\83B
+               CNicoLiveStream nicoLiveStream;                         //\83j\83R\83j\83R\90\95ú\91\97\83I\83u\83W\83F\83N\83g
        private:
 
                // \83\81\83b\83Z\81[\83W\83t\83B\83\8b\83^\8f\88\97\9d
@@ -142,22 +160,17 @@ namespace nlite{
 
        public:
 
-               CNliteMainFrame()
-                       :userData(commentView),
-                       nicoLiveStream()
-               {
-                       LOGFONT lf = {0};
-
-                       lf.lfHeight = 12;
-                       lf.lfCharSet = SHIFTJIS_CHARSET;
-                       hTabFont = CreateFontIndirect(&lf);
-
-               }
-
-               ~CNliteMainFrame(){
+               ///
+               ///\83R\83\93\83X\83g\83\89\83N\83^
+               ///
+               CNliteMainFrame();
+               
 
-                       DeleteObject(hTabFont);
-               }
+               ///
+               ///\83f\83X\83g\83\89\83N\83^
+               ///
+               ~CNliteMainFrame();
+               
 
                
                BEGIN_UPDATE_UI_MAP(CNliteMainFrame)
@@ -168,95 +181,79 @@ namespace nlite{
                BEGIN_MSG_MAP_EX(CNliteMainFrame)
                        MSG_WM_CREATE(OnCreate)
                        MSG_WM_DESTROY(OnDestroy)
-                       MESSAGE_HANDLER(WM_SIZING,OnSizing)
                        MESSAGE_HANDLER(WM_SIZE,OnSize)
-                       
+                       MSG_WM_SIZING(OnSizing)
                        COMMAND_ID_HANDLER_EX(IDM_EXIT, OnMenuExit)
                        COMMAND_ID_HANDLER_EX(IDM_ABOUT,OnMenuAbount)
+                       COMMAND_ID_HANDLER_EX(IDM_COOKIE,OnCookie)
                        NOTIFY_HANDLER(ATL_IDW_TOOLBAR,RBN_HEIGHTCHANGE,OnRbnHeightChange)
                        // CFrameWindowImpl\83N\83\89\83X\82Ö\83`\83F\81[\83\93
-//                     CHAIN_MSG_MAP(CUpdateUI<CNliteMainFrame>)
                        CHAIN_MSG_MAP(CFrameWindowImpl<CNliteMainFrame>)
                END_MSG_MAP()
 
-               //\83T\83C\83Y\95Ï\8dX\92\86
-               LRESULT OnSizing(UINT uMsg,WPARAM wParam,LPARAM lParam,BOOL& bHandled){
-
-                       
-                       RECT client;
-                       GetClientRect(&client);
-
-                       ChangeSize( _WTYPES_NS::CSize(client.right - client.left,client.bottom - client.top));
-                       
-                       
-
-                       bHandled = FALSE;
-                       
-                       return 0;
-
-               }
-
-
-               //\83c\81[\83\8b\83o\81[\8d\82\82³\95Ï\8dX
-               LRESULT OnRbnHeightChange(INT_PTR wParam,LPNMHDR lParam,BOOL &bHandled){
-
-                       RECT toolbarRect;
-                       ::GetClientRect(m_hWndToolBar,&toolbarRect);
-                       toolBarHeight = toolbarRect.bottom - toolbarRect.top;
-
-                       RECT client;
-                       GetClientRect(&client);
-
-                       ChangeSize( _WTYPES_NS::CSize(client.right - client.left,client.bottom - client.top));
-
-
-
-                       return 0;
-               }
                
+               ///
+               ///\8f\89\8aú\89»\8f\88\97\9d
+               ///
+               VOID Initialize(LPCTSTR localAppDataPath);
                
-               //\83T\83C\83Y\95Ï\8dX\8cã
-               LRESULT OnSize(UINT uMsg,WPARAM wParam,LPARAM lParam,BOOL& bHandled){
-
-
-                       SIZE clientSize;
-                       clientSize.cx = LOWORD(lParam);
-                       clientSize.cy = HIWORD(lParam);
-                       ChangeSize(clientSize);
+               ///
+               ///\8fI\97¹\8f\88\97\9d
+               ///
+               VOID Finalaize();
+               
+               VOID OnDestroy();
 
-                       bHandled = FALSE;
-                       
-                       
+               VOID OnException();
 
-                       return 0;
-               }
+       private:
 
+               ///
+               ///\83c\81[\83\8b\83o\81[\8d\82\82³\95Ï\8dX
+               ///
+               LRESULT OnRbnHeightChange(INT_PTR wParam,LPNMHDR lParam,BOOL &bHandled);
+               
+               
+               ///
+               ///\83T\83C\83Y\95Ï\8dX\92\86\8f\88\97\9d
+               ///
+               VOID OnSizing(UINT wParam,LPRECT lParam);
+               
+               ///
+               ///\83T\83C\83Y\95Ï\8dX\8cã
+               ///
+               LRESULT OnSize(UINT uMsg,WPARAM wParam,LPARAM lParam,BOOL& bHandled);
+               
+               
+               ///
+               ///\8eq\83E\83B\83\93\83h\83E\83T\83C\83Y\95Ï\8dX\8f\88\97\9d
+               ///
                VOID ChangeSize(const SIZE& client);
 
 
+               ///
+               ///\83E\83B\83\93\83h\83E\8dì\90¬\8e\9e\82Ì\8f\88\97\9d
+               ///
                LRESULT OnCreate(LPCREATESTRUCT lpcs);
 
-
+               VOID ConnectNicoLive(LPCTSTR liveNo);
 
                
-               VOID OnDestroy(){
-
-                       commentView.DestroyWindow();
-                       PostQuitMessage(0);
-                       return;
-               }
+               
 
                //\83\81\83j\83\85\81[\82©\82ç\83t\83@\83C\83\8b\82ð\8fI\97¹\82ð\91I\91ð
-               void OnMenuExit(UINT uNotifyCode, int nID, HWND hWndCtl){
-                       PostMessage(WM_CLOSE);
-               }
+               VOID OnMenuExit(UINT uNotifyCode, int nID, HWND hWndCtl);
 
                //\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¦
-               void OnMenuAbount(UINT uNotifyCode,int nID,HWND hWndCtl){
+               VOID OnMenuAbount(UINT uNotifyCode,int nID,HWND hWndCtl);
+
+               //\83N\83b\83L\81[\82Ì\90Ý\92è
+               VOID OnCookie(UINT uNotifyCode,int nID,HWND hWndCtl);
+
                
+               static NLIB_RESULT LiveCallBack(NICOLIVE_EVENT eventType,NicoLiveStream_P pNicoLiveStream,LPVOID option,NICOLIVE_PARAM param1,NICOLIVE_PARAM param2);
 
-                       appInfo->show();
-               }
+               
        };