OSDN Git Service

2012/01/22 23:04:23
[nlite/nlite.git] / nlite / nlite_mailframe.h
index 4a7087d..f973c2d 100644 (file)
 namespace nlite{
        
 
-       
+       ///
+       ///\83E\83B\83\93\83h\83E\96¼
+       ///
        const static LPCTSTR NLITE_MAINWINDOW = TEXT("nlite");
 
+       ///
+       ///\83E\83B\83\93\83h\83E\8dÅ\92á\83T\83C\83Y
+       ///
        const static SIZE lowestFrameSize = {300,300};
 
-       
-
-       
-
-
-
-
-
-
+       ///
+       ///\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:
+
+               ///
+               ///\95ú\91\97\94Ô\8d\86\93ü\97Í\97p
+               ///
                class CSubLiveNoComboBox:public CWindowImpl<CEdit>{
 
                        
 
                private:
-                       CNliteMainFrame &self;
-                       CComAutoCriticalSection cs;
-                       BOOL untilConnectingFlag;
+                       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è
 
                public:
-                       CSubLiveNoComboBox(CNliteMainFrame &in_self):self(in_self),untilConnectingFlag(FALSE){}
-
+                       
+                       ///
+                       ///\83R\83\93\83X\83^\83\89\83N\83^
+                       ///
+                       CSubLiveNoComboBox(CNliteMainFrame &in_self);
+                       
 
+                       //\83\81\83b\83Z\81[\83W\83\8b\81[\83v
                        BEGIN_MSG_MAP_EX(CSubLiveNoComboBox)
                                MSG_WM_KEYDOWN(OnKeyDown)
                        END_MSG_MAP()
 
-                       void OnKeyDown(TCHAR wParam, UINT upLParam,UINT loLParam){
-                               if(wParam == VK_RETURN){
-                                       
-                                       cs.Lock();
-                                       
-                                       if(untilConnectingFlag == FALSE){
-                                               untilConnectingFlag = TRUE;
-                                               std::vector<TCHAR> buffer(this->GetWindowTextLengthW() + 1); 
-                                               ::GetWindowTextW(this->m_hWnd,&buffer[0],buffer.size());
-                                               self.ConnectNicoLive(&buffer[0]);
-                                       }
-                                       
-                                       cs.Unlock();
-                                       
-                               }
-                               return;
-                       }
-
-                       VOID AgreeInputLvNo(){
-                               cs.Lock();
-                               untilConnectingFlag = FALSE;
-                               cs.Unlock();
-                       }
+
+                       ///
+                       ///\83L\81[\89\9f\89º\8e\9e\82Ì\8f\88\97\9d
+                       ///
+                       VOID OnKeyDown(TCHAR wParam, UINT upLParam,UINT loLParam);
+
+                       ///
+                       ///\95ú\91\97\94Ô\8d\86\93ü\97Í\82ð\8b\96\89Â\82·\82é
+                       ///
+                       VOID AgreeInputLvNo();
+
+                       
 
                };
 
 
+               ///
+               ///\83R\83\81\83\93\83g\8eó\90M
+               ///
                class CLiveUserData {
 
                private:
 
-                       CCommentView &commentView;
-                       CSubLiveNoComboBox &lvnocombo;
+                       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:
-                       CLiveUserData(CCommentView& cv,CSubLiveNoComboBox &combo):commentView(cv),lvnocombo(combo){}
-
-                       VOID OnConnect(){
-
-                               commentView.OnConnect();
 
-                       }
+                       ///
+                       ///\83R\83\93\83X\83g\83\89\83N\83^
+                       ///
+                       CLiveUserData(CCommentView& cv,CSubLiveNoComboBox &combo,CCommentWriteWindow &writeWindow);
+                       
 
-                       VOID OnChatReceveStart(StreamStatus &streamStatus){
-                               
-                               commentView.SetStreamStatus(streamStatus);
-                       }
-               
-                       VOID OnChatReceve(NicoLiveChat_P chat,UINT_PTR count){
+                       ///
+                       ///\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);
 
-                               commentView.OnChatReceve(chat,count);
 
-                       }
+                       ///
+                       ///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);
+                       
 
-                       VOID OnChatReceveSettle(UINT_PTR commentCount,UINT_PTR commentCountSum){
+                       ///
+                       ///\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);
 
-                               commentView.OnChatReceveSettle(commentCount,commentCountSum);
-                               lvnocombo.AgreeInputLvNo();
-                               return;
-                       }
+                       ///
+                       ///\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);
 
                };
 
@@ -108,25 +127,23 @@ namespace nlite{
                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(NLITE_MAINWINDOW, IDC_NLITE)
 
        private:
-               CCommentView commentView;
-               
-               
-               CStatusBarCtrl statusBar;
-               CLiveUserData userData;
-               CSubLiveNoComboBox subLiveNoComboBox;
-               CCommentWriteWindow commentWriteWindow;
-               CTabCtrl tabctrl;
+               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;
-               CComboBoxEx lvNoCombo;
-               INT_PTR statusBarHeight;
-               INT_PTR toolBarHeight;
-               CNicoVideoAuth nicoVideoAuth;
-               Property nliteProperty;
-               CNicoLiveStream nicoLiveStream;
+               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
@@ -143,21 +160,17 @@ namespace nlite{
 
        public:
 
-               CNliteMainFrame()
-                       :userData(commentView,subLiveNoComboBox),
-                       subLiveNoComboBox(*this)
-               {
-                       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,9 +181,8 @@ 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)
-                       MESSAGE_HANDLER_EX(WM_ERASEBKGND,OnErasekgnd);
+                       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)
@@ -179,140 +191,69 @@ namespace nlite{
                        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){
-
-                       ((LPRECT)lParam)->right = ((LPRECT)lParam)->right - ((LPRECT)lParam)->left < lowestFrameSize.cx ? lowestFrameSize.cx + ((LPRECT)lParam)->left : ((LPRECT)lParam)->right;
-                       ((LPRECT)lParam)->bottom = ((LPRECT)lParam)->bottom - ((LPRECT)lParam)->top < lowestFrameSize.cy ? lowestFrameSize.cy + ((LPRECT)lParam)->top : ((LPRECT)lParam)->bottom;
-                       RECT client;
-                       GetClientRect(&client);
-
-                       ChangeSize( _WTYPES_NS::CSize(client.right - client.left,client.bottom - client.top));
-                       
-                       
-
-                       bHandled = FALSE;
-                       
-                       return 0;
-
-               }
-
-               //\83`\83\89\83c\83L\82ð\82È\82­\82·\81B\82 \82ñ\82Ü\8cø\89Ê\82È\82¢\81H
-               LRESULT OnErasekgnd(UINT uMsg,WPARAM wParam,LPARAM lParam){
-
-                       return TRUE;
-               }
-
-
-               //\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){
-                       
-                       nicoLiveStream.DisConnect();
-                       commentView.OnConnect();
-                       nicoLiveStream.Connect(nicoVideoAuth,liveNo,LiveCallBack,&userData);
-
-               }
-
-               VOID Initialize(LPCTSTR localAppDataPath){
-
-                       nliteProperty.ReadIniFile();
-
-                       commentView.SetProperty(nliteProperty.cvp);
-
-                       if(nliteProperty.gp.browserType == BT_NOSETTING){
-                               nliteProperty.CookieSetting();
-                               while(nliteProperty.gp.browserType == BT_NOSETTING){
-                                       ::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);
-                                       nliteProperty.CookieSetting();
-                               }
-                       }
-                       
-                       nicoVideoAuth.SetBrowserType(nliteProperty.gp.browserType);
-                       
-               }
-
-               VOID Finalaize(){
-
-                       nliteProperty.WriteIniFile();
-               }
+               VOID ConnectNicoLive(LPCTSTR liveNo);
 
-               VOID OnDestroy(){
-                       commentView.DestroyWindow();
-                       nicoLiveStream.DisConnect();
-                       PostQuitMessage(0);
-                       return;
-               }
-
-               VOID OnException(){
-
-                       nicoLiveStream.DisConnect();
-
-               }
+               
+               
 
                //\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){
-               
-
-                       appInfo->show();
-               }
+               VOID OnMenuAbount(UINT uNotifyCode,int nID,HWND hWndCtl);
 
                //\83N\83b\83L\81[\82Ì\90Ý\92è
-               void OnCookie(UINT uNotifyCode,int nID,HWND hWndCtl){
-                       nliteProperty.CookieSetting();
-                       
-                       while(nliteProperty.gp.browserType == BT_NOSETTING){
-                               ::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);
-                               nliteProperty.CookieSetting();
-                       }
-                       
-
-                       nicoVideoAuth.SetBrowserType(nliteProperty.gp.browserType);
+               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);
+
+               
        };