OSDN Git Service

主コメボタンを実装
authorunknown <qwerty2501@users.sourceforge.jp>
Mon, 13 Feb 2012 02:51:20 +0000 (11:51 +0900)
committerunknown <qwerty2501@users.sourceforge.jp>
Mon, 13 Feb 2012 02:51:20 +0000 (11:51 +0900)
nlite.suo
nlite/nlite.rc
nlite/nlite_commentWrite.cpp
nlite/nlite_commentWrite.h

index e113851..130169e 100644 (file)
Binary files a/nlite.suo and b/nlite.suo differ
index a89e83b..262896b 100644 (file)
@@ -128,9 +128,9 @@ FONT 8, "Ms Shell Dlg"
     PUSHBUTTON      "OK", IDOK, 48, 131, 32, 14
     PUSHBUTTON      "\83L\83\83\83\93\83Z\83\8b", IDCANCEL, 104, 132, 33, 14
     LTEXT           "\83\86\81[\83UID", IDC_STATIC, 19, 20, 26, 8, SS_LEFT
-    CTEXT           "", IDC_USERID_STATIC, 60, 17, 110, 14, SS_CENTER
-    LTEXT           "", IDC_LT_NICKNAME_STATIC, 92, 71, 55, 12, WS_BORDER | SS_LEFT | SS_NOTIFY
-    LTEXT           "", IDC_LT_BACKCOLOR_STATIC, 91, 98, 55, 14, WS_BORDER | SS_LEFT | SS_NOTIFY
+    CTEXT           "", IDC_USERID_STATIC, 60, 17, 110, 14, SS_CENTER | SS_CENTERIMAGE
+    LTEXT           "", IDC_LT_NICKNAME_STATIC, 92, 71, 55, 12, WS_BORDER | SS_LEFT | SS_NOTIFY, WS_EX_STATICEDGE
+    LTEXT           "", IDC_LT_BACKCOLOR_STATIC, 91, 98, 55, 14, WS_BORDER | SS_LEFT | SS_NOTIFY, WS_EX_STATICEDGE
     PUSHBUTTON      "\96ß\82·", IDC_NAMECOLOR_RETURN_BUTTON, 153, 73, 18, 14
     PUSHBUTTON      "\96ß\82·", IDC_BACKCOLOR_RETURN_BUTTON, 153, 97, 18, 14
 }
index 20f02ee..33b8fb5 100644 (file)
@@ -8,7 +8,7 @@ const static SIZE commentColorBoxSize = {35,0};
 
 const static LPCTSTR ANONYMOUS_MAILCOMMAND = TEXT("184");
 const static LPCTSTR ANONYMOUS_BOTTONSTRING = ANONYMOUS_MAILCOMMAND;
-
+const static LPCTSTR OWNERMODE_BOTTONSTRING = TEXT("\8eå\83R\83\81");
 const static LPCTSTR WRITE_BOTTONSTRING = TEXT("\8f\91\82«\8d\9e\82Ý");
 const static LPCTSTR CHECKBUTTON_HIDDENSTRING = TEXT(" ");
 
@@ -136,17 +136,16 @@ LRESULT CCommentWriteWindow::OnCreate(LPCREATESTRUCT lpReateStruct){
 
        commentPosBox.Create(m_hWnd,0,WC_COMBOBOX,WS_CHILD | WS_VISIBLE | CBS_DROPDOWNLIST ,0,COMMENTPOS_BOX);
        commentSizeBox.Create(m_hWnd,0,WC_COMBOBOX,WS_CHILD | WS_VISIBLE | CBS_DROPDOWNLIST,0,COMMENTSIZE_BOX);
-       commentColorBox.Create(m_hWnd,0,WC_COMBOBOX,WS_CHILD | WS_VISIBLE  | CBS_DROPDOWNLIST | CBS_OWNERDRAWFIXED        ,0,COMMENTCOLOR_BOX);
-       anonymousButton.Create(m_hWnd,0,WC_BUTTON,WS_CHILD | WS_VISIBLE | BS_CHECKBOX | BS_AUTOCHECKBOX ,0,ANONYMOUS_BUTTON);
+       commentColorBox.Create(m_hWnd,0,WC_COMBOBOX,WS_CHILD | WS_VISIBLE  | CBS_DROPDOWNLIST | CBS_OWNERDRAWFIXED ,0,COMMENTCOLOR_BOX);
+       anonymousButton.Create(m_hWnd,0,WC_BUTTON,WS_CHILD | WS_VISIBLE |  BS_AUTOCHECKBOX | BS_PUSHLIKE,0,ANONYMOUS_BUTTON);
+       ownerModeButton.Create(m_hWnd,0,WC_BUTTON,WS_CHILD |BS_AUTOCHECKBOX | BS_PUSHLIKE,0,OWNERMODE_BUTTON);
        commentSubEdit.Create(m_hWnd,0,WC_EDIT,WS_CHILD | WS_VISIBLE | WS_BORDER | ES_AUTOHSCROLL,0,COMMENT_EDIT);
-       
        commentWriteButton.Create(m_hWnd,0,WC_BUTTON,WS_CHILD | WS_VISIBLE | BS_PUSHBUTTON,0,COMMENTWRITE_BOTTON);
        commentPosBox.SetFont(AtlGetDefaultGuiFont());
        commentSizeBox.SetFont(AtlGetDefaultGuiFont());
        commentColorBox.SetFont(AtlGetDefaultGuiFont());
-
        
-       anonymousButton.SetWindowTextW(CHECKBUTTON_HIDDENSTRING);
+       anonymousButton.SetWindowTextW(ANONYMOUS_MAILCOMMAND);
        anonymousButton.SetFont(AtlGetDefaultGuiFont());
        commentSubEdit.SetFont(AtlGetDefaultGuiFont());
        commentSubEdit.SetLimitText(commentWriteMaxLength);
@@ -167,7 +166,7 @@ LRESULT CCommentWriteWindow::OnCreate(LPCREATESTRUCT lpReateStruct){
        LPCTSTR sample = TEXT(" ");
 
        GetTextExtentPoint32(pdc,sample,_tcslen(sample),&thisSize);
-       commentWriteHeight = thisSize.cy + (CHECKBUTTON_SUBSCRIPT_HEIGHT / 2) + COMMENTWRITEWINDOW_SEPARATEFSIZE.top + COMMENTWRITEWINDOW_SEPARATEFSIZE.bottom;
+       commentWriteHeight = thisSize.cy  + COMMENTWRITEWINDOW_SEPARATEFSIZE.top + COMMENTWRITEWINDOW_SEPARATEFSIZE.bottom;
        infoDispHeight = commentWriteHeight;
        commentWriteInternalHeight = commentWriteHeight - (COMMENTWRITEWINDOW_SEPARATEFSIZE.top + COMMENTWRITEWINDOW_SEPARATEFSIZE.bottom);
 
@@ -175,8 +174,9 @@ LRESULT CCommentWriteWindow::OnCreate(LPCREATESTRUCT lpReateStruct){
        anonymousLogFont.lfHeight = CHECKBUTTON_SUBSCRIPT_HEIGHT;
        anonymousLogFont.lfCharSet = SHIFTJIS_CHARSET;
 
-       anonymousFont.CreateFontIndirect(&anonymousLogFont);
-
+       checkButtonFont.CreateFontIndirect(&anonymousLogFont);
+       anonymousButton.SetFont(checkButtonFont);
+       ownerModeButton.SetFont(checkButtonFont);
        CFontHandle f = AtlGetDefaultGuiFont();
        LOGFONT timeLogFont;
        f.GetLogFont(timeLogFont);
@@ -184,7 +184,7 @@ LRESULT CCommentWriteWindow::OnCreate(LPCREATESTRUCT lpReateStruct){
        timeLogFont.lfWeight = FW_BOLD;
        
        timeFont.CreateFontIndirectW(&timeLogFont);
-
+       
 
        return 0;
 }
@@ -267,26 +267,7 @@ VOID CCommentWriteWindow::OnPaint(HDC hdc){
        }
 
 
-       RECT anonymousRect;
-       SIZE anonymousStringSize;
-
-       anonymousButton.GetWindowRect(&anonymousRect);
-       CPoint anonymousPoint(anonymousRect.left,anonymousRect.top);
-       ::ScreenToClient(*this,&anonymousPoint);
-       anonymousRect.right -= anonymousRect.left;
-       anonymousRect.bottom -= anonymousRect.top;
-       anonymousRect.left = anonymousPoint.x;
-       anonymousRect.top = anonymousPoint.y + anonymousRect.bottom;
-
-
-       ::GetTextExtentPoint32(pdc,ANONYMOUS_BOTTONSTRING,_tcslen(ANONYMOUS_BOTTONSTRING),&anonymousStringSize);
-       anonymousRect.right = anonymousRect.left + anonymousStringSize.cx;
-       anonymousRect.bottom = anonymousRect.top + anonymousStringSize.cy;
-
        
-       pdc.SelectFont(anonymousFont);
-       
-       pdc.DrawText(ANONYMOUS_BOTTONSTRING,_tcslen(ANONYMOUS_BOTTONSTRING),&anonymousRect,0);
        
        return;
 }
@@ -419,7 +400,15 @@ VOID CCommentWriteWindow::OnChatReceveStart(CNicoLiveStream &nicoLiveStream,Nico
        this->ShowWindow(SW_SHOW);
        this->streamTime = threadComment->server_time;
        this->SetTimer(TIMER_ID,1000,NULL);
-       
+       if(nicoLiveStream.IsOwner() == TRUE){
+
+               this->ownerModeButton.ShowWindow(SW_SHOW);
+                
+       } else {
+
+               this->ownerModeButton.ShowWindow(SW_HIDE);
+
+       }
 
 
        return;
@@ -431,14 +420,14 @@ VOID CCommentWriteWindow::ChangeSize(SIZE &size){
        SIZE commentWriteButtonSize;
        commentWriteButton.GetIdealSize(&commentWriteButtonSize);
        anonymousButton.GetIdealSize(&commentAnonymousButtonSize);
-
+       UINT_PTR defwindowCount = 0;
        RECT commentPosBoxRect;
        RECT commentSizeBoxRect;
        RECT commentColorBoxRect;
        RECT anonymousButtonRect;
        RECT commentEditRect;
        RECT commentWriteButtonRect;
-
+       RECT ownerModeButtonRect;
        RECT thisWindowRect;
 
        UINT_PTR writeSpaceHeight = COMMENTWRITEWINDOW_SEPARATEFSIZE.top * 2 + commentWriteInternalHeight;
@@ -457,14 +446,25 @@ VOID CCommentWriteWindow::ChangeSize(SIZE &size){
        commentColorBoxRect.left = commentSizeBoxRect.right + COMMENTWRITEWINDOW_SIDESEPARATESIZE;
        commentColorBoxRect.right = commentColorBoxRect.left + commentColorBoxSize.cx;
 
-       CDC cdc(anonymousButton.GetDC());
-       SIZE anonymousStringSize;
-       ::GetTextExtentPoint32(cdc,CHECKBUTTON_HIDDENSTRING,_tcslen(CHECKBUTTON_HIDDENSTRING),&anonymousStringSize);
+
        
        anonymousButtonRect.left = commentColorBoxRect.right + COMMENTWRITEWINDOW_SIDESEPARATESIZE;
-       anonymousButtonRect.right = anonymousButtonRect.left + commentAnonymousButtonSize.cx - anonymousStringSize.cx;
+       anonymousButtonRect.right = anonymousButtonRect.left + commentAnonymousButtonSize.cx;
 
-       commentEditRect.left = anonymousButtonRect.right + COMMENTWRITEWINDOW_SIDESEPARATESIZE;
+       if(ownerModeButton.IsWindowVisible() == TRUE){
+
+               
+               SIZE ownerModeButtonSize;
+               ownerModeButton.GetIdealSize(&ownerModeButtonSize);
+               ownerModeButtonRect.left = anonymousButtonRect.right + COMMENTWRITEWINDOW_SIDESEPARATESIZE;
+               ownerModeButtonRect.right = ownerModeButtonRect.left + ownerModeButtonSize.cx;
+               commentEditRect.left = ownerModeButtonRect.right + COMMENTWRITEWINDOW_SIDESEPARATESIZE;
+               defwindowCount = 7;
+       } else {
+
+               commentEditRect.left = anonymousButtonRect.right + COMMENTWRITEWINDOW_SIDESEPARATESIZE;
+               defwindowCount = 6;
+       }
        
        commentWriteButtonRect.right = size.cx - COMMENTWRITEWINDOW_SIDESEPARATESIZE;
        commentWriteButtonRect.left = commentWriteButtonRect.right - commentWriteButtonSize.cx;
@@ -474,7 +474,7 @@ VOID CCommentWriteWindow::ChangeSize(SIZE &size){
        
 
        //\88Ú\93®\8f\88\97\9d
-       HDWP hDwp = BeginDeferWindowPos(6);
+       HDWP hDwp = BeginDeferWindowPos(defwindowCount);
        
        commentPosBox.DeferWindowPos(hDwp,*this,
                commentPosBoxRect.left,writeSpaceHeight,commentPosBoxRect.right - commentPosBoxRect.left,commentWriteInternalHeight,
@@ -489,9 +489,15 @@ VOID CCommentWriteWindow::ChangeSize(SIZE &size){
                SWP_NOZORDER);
 
        anonymousButton.DeferWindowPos(hDwp,*this,
-               anonymousButtonRect.left,writeSpaceHeight,anonymousButtonRect.right - anonymousButtonRect.left,commentWriteInternalHeight - CHECKBUTTON_SUBSCRIPT_HEIGHT,
+               anonymousButtonRect.left,writeSpaceHeight,anonymousButtonRect.right - anonymousButtonRect.left,commentWriteInternalHeight,
                SWP_NOZORDER);
 
+       if(ownerModeButton.IsWindowVisible() == TRUE){
+               ownerModeButton.DeferWindowPos(hDwp,*this,
+                       ownerModeButtonRect.left,writeSpaceHeight,ownerModeButtonRect.right - ownerModeButtonRect.left,commentWriteInternalHeight,
+               SWP_NOZORDER);
+
+       }
        commentSubEdit.DeferWindowPos(hDwp,*this,
                commentEditRect.left,writeSpaceHeight,commentEditRect.right - commentEditRect.left,commentWriteInternalHeight,
                SWP_NOZORDER);
index f3b14f4..734abb9 100644 (file)
@@ -101,6 +101,7 @@ namespace nlite{
                CComAutoCriticalSection commentSizeBoxCS;                               //\83R\83\81\83\93\83g\82Ì\91å\82«\82³\91I\91ð\83R\83\93\83{\83{\83b\83N\83X\83N\83\8a\83e\83B\83J\83\8b\83Z\83N\83V\83\87\83\93
                CComboBox commentColorBox;                                                              //\83R\83\81\83\93\83g\90F\91I\91ð\83R\83\93\83{\83{\83b\83N\83X
                CButton anonymousButton;                                                                //184\91I\91ð\83{\83^\83\93
+               CButton ownerModeButton;                                                                //\8eå\83R\83\81\91I\91ð\83{\83^\83\93
                CSubChatEdit commentSubEdit;                                                    //\83R\83\81\83\93\83g\8f\91\82«\8d\9e\82Ý\97p\83G\83f\83B\83b\83g\83T\83u\83N\83\89\83X
                CButton commentWriteButton;                                                             //\83R\83\81\83\93\83g\8f\91\82«\8d\9e\82Ý\83{\83^\83\93
                UINT_PTR commentWriteMaxLength;                                                 //\83R\83\81\83\93\83g\8f\91\82«\8d\9e\82Ý\92·\8dÅ\91å\92l
@@ -109,7 +110,7 @@ namespace nlite{
                UINT_PTR commentWriteInternalHeight;                                    //\83R\83\81\83\93\83g\8f\91\82«\8d\9e\82Ý\83R\83\93\83g\83\8d\81[\83\8b\94z\92u\97Ì\88æ\82Ì\8d\82\82³(\93à\95\94)
                CNicoLiveStream &nicoLiveStream;                                                //\95ú\91\97\83I\83u\83W\83F\83N\83g\82Ì\8eQ\8fÆ
                time_t streamTime;                                                                              //\95ú\91\97\8co\89ß\8e\9e\8aÔ
-               CFont anonymousFont;                                                                    //184\95\\8e¦\97p\83t\83H\83\93\83g
+               CFont checkButtonFont;                                                                  //184\95\\8e¦\97p\83t\83H\83\93\83g
                CFont timeFont;                                                                                 //\8co\89ß\8e\9e\8aÔ\95\\8e¦\97p\83t\83H\83\93\83g
 
 
@@ -121,7 +122,8 @@ namespace nlite{
                        ANONYMOUS_BUTTON = 4,
                        COMMENT_EDIT = 5,
                        COMMENTWRITE_BOTTON = 6,
-                       TIMER_ID = 7
+                       TIMER_ID = 7,
+                       OWNERMODE_BUTTON = 5
                };