From: qwerty2501 Date: Fri, 10 Feb 2012 16:39:13 +0000 (+0900) Subject: リスナー情報編集機能追加 X-Git-Tag: v0.002~2^2~3 X-Git-Url: http://git.osdn.net/view?a=commitdiff_plain;h=e4a04f89620955d514d2cac02bfa0a5c428abf67;p=nlite%2Fnlite.git リスナー情報編集機能追加 コメント送信機能がバグっていたので修正 --- diff --git a/nlite.suo b/nlite.suo index 8ef494f..c52d4aa 100644 Binary files a/nlite.suo and b/nlite.suo differ diff --git a/nlite/Resource.h b/nlite/Resource.h index ccd8d20..002f65d 100644 --- a/nlite/Resource.h +++ b/nlite/Resource.h @@ -12,13 +12,16 @@ #define IDD_DIALOG_GENERAL_PAGE 216 #define IDD_ADDMYLISTDIALOG 219 #define IDD_LISTENER_SETTING_DIALOG 220 -#define IDC_BUTTON1 1000 #define IDC_EDIT1 1000 -#define IDC_BUTTON2 1001 #define IDC_BUTTON_COOKIE_OK 1001 -#define IDC_EDIT2 1002 +#define IDC_LT_BACKCOLOR_STATIC 1001 +#define IDC_USERID_STATIC 1002 #define IDC_APPLY 1003 +#define IDC_NICKNAME_EDIT 1003 +#define IDC_LT_NICKNAME_STATIC 1004 #define IDC_RADIO_IE 1005 +#define IDC_BACKCOLOR_RETURN_BUTTON 1006 +#define IDC_NAMECOLOR_RETURN_BUTTON 1007 #define IDM_COOKIE 30000 #define IDM_VIEW_PREFERENCE 30001 #define IDR_COMMAND1 40000 diff --git a/nlite/nlite.rc b/nlite/nlite.rc index b2885ad..4768c49 100644 --- a/nlite/nlite.rc +++ b/nlite/nlite.rc @@ -115,21 +115,24 @@ FONT 8, "Ms Shell Dlg" LANGUAGE LANG_NEUTRAL, SUBLANG_NEUTRAL -IDD_LISTENER_SETTING_DIALOG DIALOG 0, 0, 119, 113 -STYLE DS_3DLOOK | DS_CENTER | DS_MODALFRAME | DS_SHELLFONT | WS_CAPTION | WS_VISIBLE | WS_POPUP | WS_SYSMENU +IDD_LISTENER_SETTING_DIALOG DIALOG 0, 0, 175, 151 +STYLE DS_3DLOOK | DS_CENTER | DS_MODALFRAME | DS_SHELLFONT | WS_CAPTION | WS_POPUP | WS_SYSMENU EXSTYLE WS_EX_WINDOWEDGE +CAPTION "ƒŠƒXƒi[Ý’è" FONT 8, "Ms Shell Dlg" { - LTEXT "ƒjƒbƒNƒl[ƒ€", IDC_STATIC, 13, 31, 34, 8, SS_LEFT - LTEXT "”wŒiF", IDC_STATIC, 14, 69, 23, 8, SS_LEFT - LTEXT "ƒjƒbƒNƒl[ƒ€‚̐F", IDC_STATIC, 13, 49, 47, 8, SS_LEFT - PUSHBUTTON "", IDC_BUTTON1, 69, 47, 35, 14 - PUSHBUTTON "", IDC_BUTTON2, 70, 70, 34, 14 - EDITTEXT IDC_EDIT2, 69, 27, 35, 14, ES_AUTOHSCROLL - PUSHBUTTON "OK", IDOK, 25, 88, 32, 14 - PUSHBUTTON "ƒLƒƒƒ“ƒZƒ‹", IDCANCEL, 67, 89, 33, 14 - LTEXT "ƒ†[ƒUID", IDC_STATIC, 13, 10, 26, 8, SS_LEFT - LTEXT "", IDC_STATIC, 69, 10, 34, 8, SS_LEFT + LTEXT "ƒjƒbƒNƒl[ƒ€", IDC_STATIC, 17, 49, 34, 8, SS_LEFT + LTEXT "”wŒiF", IDC_STATIC, 19, 99, 31, 9, SS_LEFT + LTEXT "ƒjƒbƒNƒl[ƒ€‚̐F", IDC_STATIC, 15, 72, 47, 8, SS_LEFT + EDITTEXT IDC_NICKNAME_EDIT, 92, 44, 56, 14, ES_AUTOHSCROLL + 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 + PUSHBUTTON "–ß‚·", IDC_NAMECOLOR_RETURN_BUTTON, 153, 73, 18, 14 + PUSHBUTTON "–ß‚·", IDC_BACKCOLOR_RETURN_BUTTON, 153, 97, 18, 14 } diff --git a/nlite/nlite_chatData.cpp b/nlite/nlite_chatData.cpp index bc2d1b8..5cf136b 100644 --- a/nlite/nlite_chatData.cpp +++ b/nlite/nlite_chatData.cpp @@ -36,9 +36,16 @@ community(TEXT("")), bgcolor(INIT_COLOR), writePropertyFlag(FALSE), time(0), -onlyCommunityFlag(FALSE) +onlyCommunityFlag(FALSE), +nameColor(INIT_COLOR) {} +VOID ListenerData::SetNameColor(COLORREF nameColor_in){ + nameColor = nameColor_in; + writePropertyFlag = TRUE; + return; +} + VOID ListenerData::SetBkColor(COLORREF bkColor_in){ bgcolor = bkColor_in; writePropertyFlag = TRUE; @@ -397,6 +404,7 @@ BOOL CListenerList::WriteProperty(LPCTSTR fileName){ if(begin->community.Length()> 0) NLITE_ATTRIBUTE_WRITE_STR(pWriter,(*begin).community); NLITE_ATTRIBUTE_WRITE_INT(pWriter,(*begin).time); if(begin->bgcolor != ListenerData::INIT_COLOR)NLITE_ATTRIBUTE_WRITE_INT(pWriter,(*begin).bgcolor); + if(begin->nameColor != ListenerData::INIT_COLOR)NLITE_ATTRIBUTE_WRITE_INT(pWriter,(*begin).nameColor); pWriter->WriteString(begin->user_id); pWriter->WriteEndElement(); } @@ -424,6 +432,7 @@ ReadUserSettingXML::ReadUserSettingXML(CListenerList &in_listenerList):m_listene NLITE_READ_USER_STRING(papszAttrs,listenerBuff,name); NLITE_READ_USER_STRING(papszAttrs,listenerBuff,community); NLITE_READ_USER_INT(papszAttrs,listenerBuff,bgcolor); + NLITE_READ_USER_INT(papszAttrs,listenerBuff,nameColor); NLITE_READ_USER_INT(papszAttrs,listenerBuff,time); } diff --git a/nlite/nlite_chatData.h b/nlite/nlite_chatData.h index ab6e1a6..6ecfc5f 100644 --- a/nlite/nlite_chatData.h +++ b/nlite/nlite_chatData.h @@ -27,6 +27,7 @@ namespace nlite{ CNLiteString name; //ƒ†[ƒU[–¼ CNLiteString community; //“o˜^‚µ‚½ƒRƒ~ƒ…ƒjƒeƒB COLORREF bgcolor; //”wŒiF + COLORREF nameColor; //–¼‘OF time_t time; //“o˜^ŽžŠÔ BOOL writePropertyFlag; //ƒvƒƒpƒeƒB‘‚«ž‚݃tƒ‰ƒO BOOL onlyCommunityFlag; @@ -46,6 +47,11 @@ namespace nlite{ ///”wŒiFÝ’è /// VOID SetBkColor(COLORREF bkColor_in); + + /// + ///–¼‘OHÝ’è + /// + VOID SetNameColor(COLORREF nameColor_in); /// ///ƒ†[ƒU–¼Ý’è diff --git a/nlite/nlite_commentWrite.cpp b/nlite/nlite_commentWrite.cpp index e7ca9c6..20f02ee 100644 --- a/nlite/nlite_commentWrite.cpp +++ b/nlite/nlite_commentWrite.cpp @@ -304,7 +304,7 @@ static VOID EnterChatBox(LPVOID userData){ BOOL CCommentWriteWindow::SendChat(){ - _beginthread(EnterChatBox,0,this); + _beginthread(EnterChatBox,0,&this->commentSubEdit); CCommentMaker commentMaker; std::vector chat(commentSubEdit.GetWindowTextLengthW() + 1); diff --git a/nlite/nlite_commentview.cpp b/nlite/nlite_commentview.cpp index 8e08708..c5af3e7 100644 --- a/nlite/nlite_commentview.cpp +++ b/nlite/nlite_commentview.cpp @@ -1246,9 +1246,11 @@ overclientrect: CComBSTR &viewUserName = chatData.listenerData->name.Length() == 0 ? chatData.listenerData->user_id : chatData.listenerData->name; dc.SelectFont(linkFont); - dc.SetTextColor(self.viewproperty.linkStringColor); + dc.SetTextColor(chatData.listenerData->nameColor != ListenerData::INIT_COLOR ? chatData.listenerData->nameColor : self.viewproperty.linkStringColor); //ƒeƒLƒXƒg•`‰æ dc.DrawTextW(noString,_tcslen(noString),&noViewRect,DT_WORD_ELLIPSIS); + + dc.DrawTextW(viewUserName,viewUserName.Length(),&userNameViewRect,DT_WORD_ELLIPSIS); dc.SelectFont(::AtlGetDefaultGuiFont()); dc.SetTextColor(chatData.viewData.stringColor == CChatData::ViewData::INIT_COLOR ? chatData.viewData.stringColor :self.viewproperty.baseStringColor); diff --git a/nlite/nlite_mainframe.cpp b/nlite/nlite_mainframe.cpp index 5e725d6..ec67ece 100644 --- a/nlite/nlite_mainframe.cpp +++ b/nlite/nlite_mainframe.cpp @@ -172,7 +172,7 @@ LRESULT CNliteMainFrame::OnCreate(LPCREATESTRUCT lpcs){ this->MoveWindow(wndRect.left,wndRect.top,wndRect.right,wndRect.bottom); - + listenerSettingWindow.Create(*this); return 0; @@ -449,6 +449,9 @@ LRESULT CNliteMainFrame::OnClickChatNo(UINT uMsg,WPARAM wParam,LPARAM lParam){ LRESULT CNliteMainFrame::OnClickUserName(UINT uMsg,WPARAM wParam,LPARAM lParam){ + auto &chatData = *(CChatData*)wParam; + listenerSettingWindow.ShowSettingWindow(*chatData.listenerData); + return 0; } diff --git a/nlite/nlite_mainframe.h b/nlite/nlite_mainframe.h index 56fd5ce..0cc379a 100644 --- a/nlite/nlite_mainframe.h +++ b/nlite/nlite_mainframe.h @@ -185,7 +185,7 @@ namespace nlite{ CNicoLiveStream nicoLiveStream; //ƒjƒRƒjƒR¶•ú‘—ƒIƒuƒWƒFƒNƒg CMultiPaneStatusBarCtrl m_hStatusBar; //ƒ}ƒ‹ƒ`ƒyƒCƒ“ƒXƒe[ƒ^ƒXƒo[ CProgressBarCtrl m_progresBar; //ƒvƒƒOƒŒƒXƒo[ - + CListenerSettingWindow listenerSettingWindow; //ƒŠƒXƒi[Ý’èƒEƒBƒ“ƒhƒE private: // ƒƒbƒZ[ƒWƒtƒBƒ‹ƒ^ˆ— diff --git a/nlite/nlite_propertyWindow.cpp b/nlite/nlite_propertyWindow.cpp index 574bfb1..447c4fc 100644 --- a/nlite/nlite_propertyWindow.cpp +++ b/nlite/nlite_propertyWindow.cpp @@ -85,7 +85,7 @@ VOID CCookieSettingWindow::OnCancel(UINT uNotifyCode, int nID, CWindow wndCtl){ } VOID CCookieSettingWindow::SetBrowserType(BROWSERTYPE browserType){ - + this->browserType = browserType; @@ -96,10 +96,121 @@ BROWSERTYPE CCookieSettingWindow::GetBrowserType(){ return this->browserType; } +VOID CColorSettingButton::OnLButtonDown(UINT wParam,CPoint &point){ + + CColorDialog dlg(color); + + if(dlg.DoModal() == IDOK){ + this->SetColor(dlg.GetColor()); + } + + + return; +} + +VOID CColorSettingButton::SetColor(COLORREF in_color){ + + color = in_color; + if(brush.IsNull() != TRUE){ + brush.DeleteObject(); + } + if(color != ListenerData::INIT_COLOR){ + + brush.CreateSolidBrush(color); + this->SetWindowText(TEXT("")); + } else { + brush.CreateSolidBrush(RGB(255,255,255)); + this->SetWindowText(TEXT("FÝ’è‚È‚µ")); + } + + return; +} + +VOID CListenerSettingWindow::ShowSettingWindow(ListenerData &listenerData){ + + this->ShowWindow(SW_HIDE); + this->listenerData = &listenerData; + + + backColorButton.SetColor(this->listenerData->bgcolor); + nameColorButton.SetColor(this->listenerData->nameColor); + + idField.SetWindowText(listenerData.user_id); + nameEdit.SetWindowText(listenerData.name); + + this->ShowWindow(SW_SHOW); + return; +} + + +BOOL CListenerSettingWindow::OnInitDialog(CWindow wndFocus, LPARAM lInitParam){ + CenterWindow(); + nameEdit = GetDlgItem(IDC_NICKNAME_EDIT); + + nameColorButton.SubclassWindow(GetDlgItem(IDC_LT_NICKNAME_STATIC)); + backColorButton.SubclassWindow(GetDlgItem(IDC_LT_BACKCOLOR_STATIC)); + backColorReturnButton = GetDlgItem(IDC_BACKCOLOR_RETURN_BUTTON); + nameColorReturnButton = GetDlgItem(IDC_NAMECOLOR_RETURN_BUTTON); + idField = GetDlgItem(IDC_USERID_STATIC); + return TRUE; +} + +LRESULT CListenerSettingWindow::OnCtlColorStatic(HDC hdc,HWND hWnd){ + if(hWnd == nameColorButton){ + return (LRESULT)(HBRUSH)nameColorButton.brush; + } else if(hWnd == backColorButton){ + + + return (LRESULT)(HBRUSH)backColorButton.brush; + + } + + return 0; +} + + + + + +VOID CListenerSettingWindow::OnOK(UINT uNotifyCode, int nID, CWindow wndCtl){ + + std::vector nameBuf(nameEdit.GetWindowTextLength() + 1); + nameEdit.GetWindowText(&nameBuf[0],nameBuf.size()); + this->listenerData->SetUserName(&nameBuf[0]); + this->listenerData->SetBkColor( backColorButton.color); + this->listenerData->SetNameColor( nameColorButton.color); + + ::ShowWindow(::GetAncestor(*this,GA_ROOTOWNER),SW_HIDE); + ::ShowWindow(::GetAncestor(*this,GA_ROOTOWNER),SW_SHOW); + + this->ShowWindow(SW_HIDE); + return; +} + +VOID CListenerSettingWindow::OnCancel(UINT uNotifyCode, int nID, CWindow wndCtl){ + + this->ShowWindow(SW_HIDE); + return; +} + + +VOID CListenerSettingWindow::OnButton(UINT hiWParam,INT_PTR loWParam,HWND lParam){ + + if(this->backColorReturnButton == lParam){ + + backColorButton.SetColor(ListenerData::INIT_COLOR); + + } else if(this->nameColorReturnButton == lParam){ + + nameColorButton.SetColor(ListenerData::INIT_COLOR); + } + + return; +} diff --git a/nlite/nlite_propertyWindow.h b/nlite/nlite_propertyWindow.h index 70ecec3..b9c92ff 100644 --- a/nlite/nlite_propertyWindow.h +++ b/nlite/nlite_propertyWindow.h @@ -2,6 +2,8 @@ namespace nlite{ + + class CListenerSettingWindow; /// ///ƒNƒbƒL[Ý’è—pƒEƒBƒ“ƒhƒE /// @@ -43,5 +45,86 @@ namespace nlite{ }; + /// + ///FÝ’èƒ{ƒ^ƒ“ + /// + class CColorSettingButton:public CWindowImpl{ + friend CListenerSettingWindow; + + CBrush brush; + COLORREF color; + + BEGIN_MSG_MAP(CColorSettingButton) + MSG_WM_LBUTTONDOWN(OnLButtonDown) + END_MSG_MAP() + + + /// + ///¶ƒNƒŠƒbƒNŽž‚̏ˆ— + /// + VOID OnLButtonDown(UINT wParam,CPoint &point); + + /// + ///F‚ðÝ’è + /// + VOID SetColor(COLORREF in_color); + + }; + + /// + ///ƒŠƒXƒi[Ý’è—pƒEƒBƒ“ƒhƒE + /// + class CListenerSettingWindow:public CDialogImpl{ + + CEdit nameEdit; + CColorSettingButton nameColorButton; + CButton nameColorReturnButton; + CColorSettingButton backColorButton; + CButton backColorReturnButton; + CStatic idField; + ListenerData *listenerData; + public: + enum { IDD = IDD_LISTENER_SETTING_DIALOG }; + + BEGIN_MSG_MAP(CListenerSettingWindow) + MSG_WM_INITDIALOG(OnInitDialog) + MSG_WM_CTLCOLORSTATIC(OnCtlColorStatic) + COMMAND_ID_HANDLER_EX(IDOK, OnOK) + COMMAND_ID_HANDLER_EX(IDCANCEL, OnCancel) + COMMAND_CODE_HANDLER_EX(BN_CLICKED,OnButton) + END_MSG_MAP() + + VOID ShowSettingWindow(ListenerData &listenerData); + + private: + /// + ///ƒ_ƒCƒAƒƒO‰Šú‰»Žž‚ɌĂ΂ê‚é + /// + BOOL OnInitDialog(CWindow wndFocus, LPARAM lInitParam); + + /// + ///ƒXƒ^ƒeƒBƒbƒNƒEƒBƒ“ƒhƒE‚̐Fˆ— + /// + LRESULT OnCtlColorStatic(HDC hdc,HWND hWnd); + + /// + ///OKƒ{ƒ^ƒ“‰Ÿ‰ºŽž‚Ì“®ì + /// + VOID OnOK(UINT uNotifyCode, int nID, CWindow wndCtl); + + + /// + ///ƒLƒƒƒ“ƒZƒ‹ƒ{ƒ^ƒ“‰Ÿ‰ºŽž‚Ì“®ì + /// + VOID OnCancel(UINT uNotifyCode, int nID, CWindow wndCtl); + + + /// + ///ƒ{ƒ^ƒ“ƒNƒŠƒbƒNŽž‚Ì“®ì + /// + VOID OnButton(UINT hiWParam,INT_PTR loWParam,HWND lParam); + + }; + } \ No newline at end of file