OSDN Git Service

主コメ選択時にエディットの色が変わる機能を追加
authorqwerty2501 <riot313@gmail.com>
Mon, 13 Feb 2012 11:37:48 +0000 (20:37 +0900)
committerqwerty2501 <riot313@gmail.com>
Mon, 13 Feb 2012 11:37:48 +0000 (20:37 +0900)
nlite.suo
nlite/nlite_commentWrite.cpp
nlite/nlite_commentWrite.h
nlite/nlite_commentview.cpp
nlite/nlite_commentview.h

index fae7158..a63d030 100644 (file)
Binary files a/nlite.suo and b/nlite.suo differ
index 33b8fb5..50da8f8 100644 (file)
@@ -12,6 +12,9 @@ const static LPCTSTR OWNERMODE_BOTTONSTRING = TEXT("
 const static LPCTSTR WRITE_BOTTONSTRING = TEXT("\8f\91\82«\8d\9e\82Ý");
 const static LPCTSTR CHECKBUTTON_HIDDENSTRING = TEXT(" ");
 
+
+const static COLORREF OWNEREDITCOLOR = RGB(255,192,192);
+const static COLORREF NORMALEDITCOLOR = RGB(255,255,255);
 const static RECT COMMENTWRITEWINDOW_SEPARATEFSIZE = {0,5,0,5};
 const static UINT_PTR COMMENTWRITEWINDOW_SIDESEPARATESIZE = 5;
 const static UINT_PTR INIT_COMMENTWRITE_MAXLENGTH = 60;
@@ -145,7 +148,7 @@ LRESULT CCommentWriteWindow::OnCreate(LPCREATESTRUCT lpReateStruct){
        commentSizeBox.SetFont(AtlGetDefaultGuiFont());
        commentColorBox.SetFont(AtlGetDefaultGuiFont());
        
-       anonymousButton.SetWindowTextW(ANONYMOUS_MAILCOMMAND);
+       
        anonymousButton.SetFont(AtlGetDefaultGuiFont());
        commentSubEdit.SetFont(AtlGetDefaultGuiFont());
        commentSubEdit.SetLimitText(commentWriteMaxLength);
@@ -184,8 +187,8 @@ LRESULT CCommentWriteWindow::OnCreate(LPCREATESTRUCT lpReateStruct){
        timeLogFont.lfWeight = FW_BOLD;
        
        timeFont.CreateFontIndirectW(&timeLogFont);
-       
-
+       anonymousButton.SetWindowTextW(ANONYMOUS_MAILCOMMAND);
+       ownerModeButton.SetWindowText(OWNERMODE_BOTTONSTRING);
        return 0;
 }
 
@@ -403,13 +406,27 @@ VOID CCommentWriteWindow::OnChatReceveStart(CNicoLiveStream &nicoLiveStream,Nico
        if(nicoLiveStream.IsOwner() == TRUE){
 
                this->ownerModeButton.ShowWindow(SW_SHOW);
+               ownerModeButton.SetCheck(BST_CHECKED);
+               editBkColor = OWNEREDITCOLOR;
                 
        } else {
 
                this->ownerModeButton.ShowWindow(SW_HIDE);
+               editBkColor = NORMALEDITCOLOR;
 
        }
 
+       if(this->editBkBrush.IsNull() ==FALSE){
+               editBkBrush.DeleteObject();
+       }
+
+       editBkBrush.CreateSolidBrush(editBkColor);
+       SIZE size;
+       RECT windowRect;
+       this->GetClientRect(&windowRect);
+       size.cx = windowRect.right - windowRect.left;
+       size.cy = windowRect.bottom - windowRect.top;
+       ChangeSize(size);
 
        return;
 }
@@ -575,12 +592,46 @@ LRESULT CCommentWriteWindow::OnEraseBkGnd(HDC wParam){
 }
 
 
+LRESULT CCommentWriteWindow::OnCtlolorEdit(HDC hdc,HWND hWnd){
+
+       if(hWnd == this->commentSubEdit){
+
+               
+               SetBkMode(hdc, TRANSPARENT);    // \94w\8ci\82ð\93§\89ß
+               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
+       
+               return (LRESULT)editBkBrush.m_hBrush;
+       }
+
+       return 0;
+}
+
 LRESULT CCommentWriteWindow::OnButton(UINT hiWparam,INT_PTR loWparam,HWND lParam){
 
        if(lParam == commentWriteButton){
                
                this->SendChat();
 
+       } else if(lParam == this->ownerModeButton){
+
+               if(this->ownerModeButton.GetCheck() == BST_CHECKED){
+
+                       this->editBkColor = OWNEREDITCOLOR;
+
+               } else {
+
+                       this->editBkColor = NORMALEDITCOLOR;
+               }
+
+               if(this->editBkBrush.IsNull() == FALSE){
+
+                       this->editBkBrush.DeleteObject();
+
+               }
+
+               this->editBkBrush.CreateSolidBrush(editBkColor);
+               commentSubEdit.Invalidate();
+               
        }
 
        return TRUE;
index 734abb9..6d722c4 100644 (file)
@@ -112,7 +112,8 @@ namespace nlite{
                time_t streamTime;                                                                              //\95ú\91\97\8co\89ß\8e\9e\8aÔ
                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
-
+               COLORREF editBkColor;                                                                   //\83G\83f\83B\83b\83g\82Ì\94w\8ci\90F
+               CBrush editBkBrush;                                                                             //\83G\83f\83B\83b\83g\82Ì\94w\8ci\83u\83\89\83V
 
                //\83R\83\93\83g\83\8d\81[\83\8bID
                enum CONTROLID{
@@ -138,11 +139,11 @@ namespace nlite{
                        MSG_WM_PAINT(OnPaint)
                        MSG_WM_SIZE(OnSize)
                        MSG_WM_ERASEBKGND(OnEraseBkGnd)
+                       MSG_WM_CTLCOLOREDIT(OnCtlolorEdit)
                        MSG_WM_DRAWITEM(OnDrawItem)
                        MSG_WM_MEASUREITEM(OnMeasureItem)
                        MSG_WM_TIMER(OnTimer)
                        COMMAND_CODE_HANDLER_EX(BN_CLICKED,OnButton)
-
                END_MSG_MAP()
 
 
@@ -244,6 +245,11 @@ namespace nlite{
                LRESULT OnButton(UINT hiWparam,INT_PTR loWparam,HWND lParam);
 
 
+               ///
+               ///\83G\83f\83B\83b\83g\83R\83\93\83g\83\8d\81[\83\8b\83J\83X\83^\83\80\83h\83\8d\81[
+               ///
+               LRESULT OnCtlolorEdit(HDC hdc,HWND hWnd);
+
                VOID OnTimer(UINT id);
 
 
index 74ac1e8..d4a52f3 100644 (file)
@@ -1581,6 +1581,8 @@ end:
                return 0;
        }
 
+       
+
 
        LRESULT CCommentListWindow::OnChatControlNortify(LPNMHDR lParam){
 
index 6f63398..6283a58 100644 (file)
@@ -181,6 +181,7 @@ namespace nlite{
                        MSG_WM_CREATE(OnCreate)
                        MSG_WM_ERASEBKGND(OnEraseBkGnd)
                        MSG_WM_MOUSEWHEEL(OnMouseWheel)
+                       
 //                     MSG_WM_DESTROY(OnDestroy)
                        MSG_WM_PAINT(OnPaint)
                        MSG_WM_SIZE(OnSize)
@@ -320,6 +321,8 @@ namespace nlite{
                ///
                LRESULT OnChatControlNortify(LPNMHDR lParam);
 
+               
+
                LRESULT OnCalcSellSize(LPNMHDR lParam);
                
        };