From: unknown Date: Mon, 13 Feb 2012 02:51:20 +0000 (+0900) Subject: 主コメボタンを実装 X-Git-Tag: v0.100~32 X-Git-Url: http://git.osdn.net/view?a=commitdiff_plain;h=7ee4eb727bff4a08f6e73892b64926d70263e5f1;p=nlite%2Fnlite.git 主コメボタンを実装 --- diff --git a/nlite.suo b/nlite.suo index e113851..130169e 100644 Binary files a/nlite.suo and b/nlite.suo differ diff --git a/nlite/nlite.rc b/nlite/nlite.rc index a89e83b..262896b 100644 --- a/nlite/nlite.rc +++ b/nlite/nlite.rc @@ -128,9 +128,9 @@ FONT 8, "Ms Shell Dlg" PUSHBUTTON "OK", IDOK, 48, 131, 32, 14 PUSHBUTTON "ƒLƒƒƒ“ƒZƒ‹", IDCANCEL, 104, 132, 33, 14 LTEXT "ƒ†[ƒUID", 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 "–ß‚·", IDC_NAMECOLOR_RETURN_BUTTON, 153, 73, 18, 14 PUSHBUTTON "–ß‚·", IDC_BACKCOLOR_RETURN_BUTTON, 153, 97, 18, 14 } diff --git a/nlite/nlite_commentWrite.cpp b/nlite/nlite_commentWrite.cpp index 20f02ee..33b8fb5 100644 --- a/nlite/nlite_commentWrite.cpp +++ b/nlite/nlite_commentWrite.cpp @@ -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("ŽåƒRƒ"); const static LPCTSTR WRITE_BOTTONSTRING = TEXT("‘‚«ž‚Ý"); 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){ //ˆÚ“®ˆ— - 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); diff --git a/nlite/nlite_commentWrite.h b/nlite/nlite_commentWrite.h index f3b14f4..734abb9 100644 --- a/nlite/nlite_commentWrite.h +++ b/nlite/nlite_commentWrite.h @@ -101,6 +101,7 @@ namespace nlite{ CComAutoCriticalSection commentSizeBoxCS; //ƒRƒƒ“ƒg‚Ì‘å‚«‚³‘I‘ðƒRƒ“ƒ{ƒ{ƒbƒNƒXƒNƒŠƒeƒBƒJƒ‹ƒZƒNƒVƒ‡ƒ“ CComboBox commentColorBox; //ƒRƒƒ“ƒgF‘I‘ðƒRƒ“ƒ{ƒ{ƒbƒNƒX CButton anonymousButton; //184‘I‘ðƒ{ƒ^ƒ“ + CButton ownerModeButton; //ŽåƒRƒ‘I‘ðƒ{ƒ^ƒ“ CSubChatEdit commentSubEdit; //ƒRƒƒ“ƒg‘‚«ž‚Ý—pƒGƒfƒBƒbƒgƒTƒuƒNƒ‰ƒX CButton commentWriteButton; //ƒRƒƒ“ƒg‘‚«ž‚݃{ƒ^ƒ“ UINT_PTR commentWriteMaxLength; //ƒRƒƒ“ƒg‘‚«ž‚Ý’·Å‘å’l @@ -109,7 +110,7 @@ namespace nlite{ UINT_PTR commentWriteInternalHeight; //ƒRƒƒ“ƒg‘‚«ž‚݃Rƒ“ƒgƒ[ƒ‹”z’u—̈æ‚̍‚‚³(“à•”) CNicoLiveStream &nicoLiveStream; //•ú‘—ƒIƒuƒWƒFƒNƒg‚ÌŽQÆ time_t streamTime; //•ú‘—Œo‰ßŽžŠÔ - CFont anonymousFont; //184•\Ž¦—pƒtƒHƒ“ƒg + CFont checkButtonFont; //184•\Ž¦—pƒtƒHƒ“ƒg CFont timeFont; //Œo‰ßŽžŠÔ•\Ž¦—pƒtƒHƒ“ƒg @@ -121,7 +122,8 @@ namespace nlite{ ANONYMOUS_BUTTON = 4, COMMENT_EDIT = 5, COMMENTWRITE_BOTTON = 6, - TIMER_ID = 7 + TIMER_ID = 7, + OWNERMODE_BUTTON = 5 };