From: qwerty2501 Date: Sun, 26 Feb 2012 10:17:24 +0000 (+0900) Subject: チャットクラスのアクセス修飾子を変更 X-Git-Tag: v0.100~3 X-Git-Url: http://git.osdn.net/view?a=commitdiff_plain;h=ddd88b4e891e77a6daf7e75270751670973486ec;p=nlite%2Fnlite.git チャットクラスのアクセス修飾子を変更 --- diff --git a/nlite.suo b/nlite.suo index 5eb3415..75ff014 100644 Binary files a/nlite.suo and b/nlite.suo differ diff --git a/nlite/nlite.h b/nlite/nlite.h index 293b314..cca12e9 100644 --- a/nlite/nlite.h +++ b/nlite/nlite.h @@ -9,7 +9,7 @@ namespace nlite{ class CListenerList; struct Property; struct GeneralProperty; - struct ListenerData; + class CListenerData; diff --git a/nlite/nlite_chatData.cpp b/nlite/nlite_chatData.cpp index 4b14fbe..c496aae 100644 --- a/nlite/nlite_chatData.cpp +++ b/nlite/nlite_chatData.cpp @@ -9,16 +9,16 @@ namespace nlite{ //ƒŠƒXƒi[ŒŸõƒIƒuƒWƒFƒNƒg struct ListenerPre{ - ListenerData &user; + CListenerData &user; - ListenerPre(ListenerData &in_user): + ListenerPre(CListenerData &in_user): user(in_user) {} bool operator()(CListenerList::reference listenerData){ - return (user.user_id == listenerData.user_id)/* && (user.community == listenerData.community)*/; + return (user.GetUserID() == listenerData.GetUserID())/* && (user.community == listenerData.community)*/; } }; @@ -29,7 +29,7 @@ struct ListenerPre{ ///////////////////////////////////////////////////////////////////////////////////////////////// -ListenerData::ListenerData(): +CListenerData::CListenerData(): user_id(TEXT("")), name(TEXT("")), community(TEXT("")), @@ -39,26 +39,51 @@ onlyCommunityFlag(FALSE), nameColor(INIT_COLOR) {} -VOID ListenerData::SetNameColor(COLORREF nameColor_in){ +VOID CListenerData::SetNameColor(COLORREF nameColor_in){ nameColor = nameColor_in; return; } -VOID ListenerData::SetBkColor(COLORREF bkColor_in){ +VOID CListenerData::SetBkColor(COLORREF bkColor_in){ bgcolor = bkColor_in; return; } -VOID ListenerData::SetUserName(LPCTSTR name){ +VOID CListenerData::SetUserName(LPCTSTR name){ this->name = name; } +COLORREF CListenerData::GetBackColor()const { + + return this->bgcolor; + +} + +COLORREF CListenerData::GetNameColor()const{ + + return this->nameColor; +} + + +const CNLiteString &CListenerData::GetUserID()const{ + + return this->user_id; + +} + + + +const CNLiteString &CListenerData::GetName()const{ + + return this->name; + +} CChatData::ViewData::ViewData(): sellLineColor(INIT_COLOR), @@ -68,7 +93,7 @@ CChatData::ViewData::ViewData(): height(0) {} -VOID CChatData::SetChat(NicoLiveChat &chat_in,ListenerData &listener){ +VOID CChatData::SetChat(NicoLiveChat &chat_in,CListenerData &listener){ this->anonymity = _ttol(chat_in.anonymity); @@ -115,6 +140,66 @@ VOID CChatData::SetChat(NicoLiveChat &chat_in,ListenerData &listener){ } +VOID CChatData::SetHeight(UINT_PTR height){ + + this->viewData.height = height; + +} + +CListenerData &CChatData::GetListnerData() { + + + return *this->listenerData; +} + +const CNLiteString &CChatData::GetChatBuff()const{ + + return this->chatBuf; +} + +BOOL CChatData::IsSelect()const{ + + return this->viewData.selectFlag; +} + +COLORREF CChatData::GetBackColor()const{ + + return this->viewData.backColor; +} + +UINT_PTR CChatData::GetPremium()const{ + + return this->premium; + +} + +time_t CChatData::GetDate()const{ + + return this->date; + +} + +UINT_PTR CChatData::GetNo()const{ + + return this->no; +} + +COLORREF CChatData::GetStringColor()const{ + + return this->viewData.stringColor; + +} + +COLORREF CChatData::GetSellLineColor()const{ + + return this->viewData.sellLineColor; +} + +UINT_PTR CChatData::GetHeight()const{ + + return this->viewData.height; +} + // // //ƒRƒƒ“ƒgƒŠƒXƒgƒNƒ‰ƒX @@ -131,7 +216,7 @@ struct GetCurSelFunc_t{ BOOL operator() (const CChatData &target){ count++; - return target.viewData.selectFlag; + return target.IsSelect(); } }; @@ -144,7 +229,7 @@ struct SeartchSetPos_t{ bool operator()(const CChatData &target){ - return time > target.date; + return time > target.GetDate(); } }; @@ -177,7 +262,7 @@ INT_PTR CCommentList::GetCurSelNo(){ CCommentList::iterator CCommentList::OnChatReceve(NicoLiveChat_P chatData_in,LPCTSTR communityID, UINT_PTR commnetCountSum,CCommentListWindow &listWindow){ CChatData chatData; - ListenerData listenerData; + CListenerData listenerData; listenerData.user_id = chatData_in->user_id; listenerData.time = time(NULL); listenerData.community = communityID; @@ -319,7 +404,7 @@ VOID CListenerList::BkColorCollect(CListenerColorCollector &target){ std::for_each(m_listenerList.begin(), end,target); } -CListenerList::reference CListenerList::Register(ListenerData &listener,BOOL bUpdate){ +CListenerList::reference CListenerList::Register(CListenerData &listener,BOOL bUpdate){ //ŠÖ”ƒIƒuƒWƒFƒNƒg¶¬ ListenerPre listenerPre(listener); @@ -368,7 +453,7 @@ BOOL CListenerList::ReadProperty(LPCTSTR fileName){ userSettingFile.Read(&userSettingBuf[0],userSettingBuf.size()); LPSTR userSettingStart = strstr(&userSettingBuf[0],"<"); if(userSettingStart != NULL){ - ReadUserSettingXML rusx(nlite::listenerList); + CReadUserSettingXML rusx(nlite::listenerList); rusx.Parse(userSettingStart); } @@ -408,13 +493,13 @@ BOOL CListenerList::WriteProperty(LPCTSTR fileName){ //ƒŠƒXƒi[ƒŠƒXƒg‚©‚ç•Û‘¶‘Ώۂ̃f[ƒ^‚Ì‚ÝxmlŒ`Ž®‚Å•Û‘¶ for(;begin != end;++begin){ - if(begin->name.Length() > 0 || begin->nameColor != ListenerData::INIT_COLOR || begin->bgcolor != ListenerData::INIT_COLOR){ + if(begin->name.Length() > 0 || begin->nameColor != CListenerData::INIT_COLOR || begin->bgcolor != CListenerData::INIT_COLOR){ pWriter->WriteStartElement(NULL,TEXT("user"),NULL); if(begin->name.Length() > 0) NLITE_ATTRIBUTE_WRITE_STR(pWriter,(*begin).name); 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); + if(begin->bgcolor != CListenerData::INIT_COLOR)NLITE_ATTRIBUTE_WRITE_INT(pWriter,(*begin).bgcolor); + if(begin->nameColor != CListenerData::INIT_COLOR)NLITE_ATTRIBUTE_WRITE_INT(pWriter,(*begin).nameColor); pWriter->WriteString(begin->user_id); pWriter->WriteEndElement(); } @@ -425,12 +510,12 @@ BOOL CListenerList::WriteProperty(LPCTSTR fileName){ } -ReadUserSettingXML::ReadUserSettingXML(CListenerList &in_listenerList):m_listenerList(in_listenerList),userNodeFlag(FALSE){} +CReadUserSettingXML::CReadUserSettingXML(CListenerList &in_listenerList):m_listenerList(in_listenerList),userNodeFlag(FALSE){} #define NLITE_READ_USER_STRING(at,l,t) if(_tcscmp(at[0],TEXT(#t)) == 0)l.t = at[1] #define NLITE_READ_USER_INT(at,l,t) if(_tcscmp(at[0],TEXT(#t))==0)l.t = _tcstol((const wchar_t*)at[1],NULL,10) - void ReadUserSettingXML::OnStartElement (const XML_Char *pszName, const XML_Char **papszAttrs){ + void CReadUserSettingXML::OnStartElement (const XML_Char *pszName, const XML_Char **papszAttrs){ if(_tcscmp(pszName,TEXT("user")) == 0){ @@ -452,21 +537,21 @@ ReadUserSettingXML::ReadUserSettingXML(CListenerList &in_listenerList):m_listene return; } - void ReadUserSettingXML::OnEndElement (const XML_Char *pszName){ + void CReadUserSettingXML::OnEndElement (const XML_Char *pszName){ if(_tcscmp(pszName,TEXT("user")) == 0){ listenerList.Register(listenerBuff,TRUE); this->userNodeFlag = FALSE; - this->listenerBuff.~ListenerData(); - new(&listenerBuff) ListenerData(); + this->listenerBuff.~CListenerData(); + new(&listenerBuff) CListenerData(); } return; } - void ReadUserSettingXML::OnCharacterData (const XML_Char *pszData, int nLength){ + void CReadUserSettingXML::OnCharacterData (const XML_Char *pszData, int nLength){ if(this->userNodeFlag == TRUE){ diff --git a/nlite/nlite_chatData.h b/nlite/nlite_chatData.h index a61cca0..dbc88ea 100644 --- a/nlite/nlite_chatData.h +++ b/nlite/nlite_chatData.h @@ -4,6 +4,10 @@ namespace nlite{ //‘O•ûéŒ¾ class CCommentListWindow; + class CListenerColorCollector; + class CCommentList; + class CListenerList; + class CReadUserSettingXML; //‘ƒR[ƒh namespace cuntry{ @@ -19,10 +23,13 @@ namespace nlite{ /// ///ƒŠƒXƒi[ƒf[ƒ^ /// - struct ListenerData{ + class CListenerData{ private: + friend CListenerColorCollector; + friend CCommentList; + friend CListenerList; + friend CReadUserSettingXML; - public: CNLiteString user_id; //ƒ†[ƒU[ID CNLiteString name; //ƒ†[ƒU[–¼ CNLiteString community; //“o˜^‚µ‚½ƒRƒ~ƒ…ƒjƒeƒB @@ -36,11 +43,15 @@ namespace nlite{ INIT_COLOR = -1 }; + + + //ƒZƒbƒ^[ + public: /// ///ƒRƒ“ƒXƒgƒ‰ƒNƒ^ /// - ListenerData(); + CListenerData(); /// ///”wŒiFÝ’è @@ -56,6 +67,32 @@ namespace nlite{ ///ƒ†[ƒU–¼Ý’è /// VOID SetUserName(LPCTSTR name); + + + //ƒQƒbƒ^[ + public: + + /// + ///”wŒiF‚ðŽæ“¾ + /// + COLORREF GetBackColor() const; + + + /// + ///ƒjƒbƒNƒl[ƒ€‚̐F‚ðŽæ“¾ + /// + COLORREF GetNameColor() const; + + /// + ///ƒ†[ƒU–¼‚ðŽæ“¾ + /// + const CNLiteString &GetUserID() const; + + + /// + ///ƒ†[ƒU–¼‚ðŽæ“¾ + /// + const CNLiteString &GetName() const; }; // @@ -79,9 +116,9 @@ namespace nlite{ } //ƒtƒ@ƒ“ƒNƒVƒ‡ƒiƒ‹ - void operator()(ListenerData &target){ + void operator()(CListenerData &target){ - if(target.bgcolor != ListenerData::INIT_COLOR){ + if(target.bgcolor != CListenerData::INIT_COLOR){ colorlist.push_back(target.bgcolor); } @@ -97,7 +134,7 @@ namespace nlite{ class CListenerList{ private: - typedef ListenerData InternalType; + typedef CListenerData InternalType; typedef std::list ListenerList_Internal; ListenerList_Internal m_listenerList; @@ -112,7 +149,7 @@ namespace nlite{ /// ///ƒ†[ƒU[“o˜^ /// - reference Register(ListenerData &listener,BOOL bUpdate); + reference Register(CListenerData &listener,BOOL bUpdate); /// @@ -136,7 +173,7 @@ namespace nlite{ class CChatData{ - + friend CCommentList; public: struct ViewData{ @@ -155,6 +192,7 @@ namespace nlite{ ViewData(); }; + private: ViewData viewData; //•\Ž¦—pƒf[ƒ^ UINT_PTR premium; //ƒvƒŒƒ~ƒAƒ€Ží•Ê BOOL anonymity; //“½–¼ƒtƒ‰ƒO @@ -162,19 +200,79 @@ namespace nlite{ UINT_PTR vpos; //ƒRƒƒ“ƒg•\Ž¦ˆÊ’u time_t date; //ŽžŠÔ cuntry::LOCALE locale; //‘ƒR[ƒh - ListenerData *listenerData; //ƒ†[ƒUî•ñ + CListenerData *listenerData; //ƒ†[ƒUî•ñ CNLiteString name; //–¼‘OB‚‚¢‚Ä‚±‚È‚¢Žž‚à‚ ‚é CNLiteString chatBuf; //ƒ`ƒƒƒbƒg–{•¶ std::vector mail; //ƒ[ƒ‹ƒRƒ}ƒ“ƒh ULONG_PTR thread; //ƒXƒŒƒbƒh”ԍ† - public: + //ƒZƒbƒ^[ + public: /// ///nlib‚̃`ƒƒƒbƒgƒf[ƒ^‚ðƒZƒbƒg /// - VOID SetChat(NicoLiveChat &chat_in,ListenerData &listener); + VOID SetChat(NicoLiveChat &chat_in,CListenerData &listener); + + /// + ///•\Ž¦—p‚‚³‚ðÝ’è + /// + VOID SetHeight(UINT_PTR height); + + //ƒQƒbƒ^[ + public: + + /// + ///ƒŠƒXƒi[î•ñƒNƒ‰ƒX‚ÌŽQÆ‚ðŽæ“¾ + /// + CListenerData &GetListnerData(); + + /// + ///ƒ`ƒƒƒbƒg–{•¶Žæ“¾ + /// + const CNLiteString &GetChatBuff()const; + + /// + ///‘I‘ðó‘Ô”»’èƒtƒ‰ƒOŽæ“¾ + /// + BOOL IsSelect()const; + + /// + ///”wŒiF‚ðŽæ“¾ + /// + COLORREF GetBackColor()const; + + /// + ///ƒvƒŒƒ~ƒAƒ€Ží•ÊŽæ“¾ + /// + UINT_PTR GetPremium()const; + + /// + ///ƒRƒƒ“ƒgŽžŠÔŽæ“¾ + /// + time_t GetDate()const; + + /// + ///ƒRƒƒ“ƒg”ԍ†Žæ“¾ + /// + UINT_PTR GetNo()const; + + /// + ///•¶Žš—ñ•\Ž¦Žž‚̐F‚ðŽæ“¾ + /// + COLORREF GetStringColor()const; + + /// + ///˜güFŽæ“¾ + /// + COLORREF GetSellLineColor()const; + + /// + ///•\Ž¦—p‚̍‚‚³Žæ“¾ + /// + UINT_PTR GetHeight()const; + }; @@ -320,10 +418,10 @@ namespace nlite{ /// ///ƒ†[ƒUÝ’èƒtƒ@ƒCƒ‹“ÇŽæƒNƒ‰ƒX /// - class ReadUserSettingXML:public CXmlParser{ + class CReadUserSettingXML:public CXmlParser{ private: - ListenerData listenerBuff; + CListenerData listenerBuff; CListenerList &m_listenerList; BOOL userNodeFlag; @@ -333,7 +431,7 @@ namespace nlite{ public: - ReadUserSettingXML(CListenerList &in_listenerList); + CReadUserSettingXML(CListenerList &in_listenerList); void OnStartElement (const XML_Char *pszName, const XML_Char **papszAttrs); diff --git a/nlite/nlite_commentview.cpp b/nlite/nlite_commentview.cpp index 1f0e4c8..8313163 100644 --- a/nlite/nlite_commentview.cpp +++ b/nlite/nlite_commentview.cpp @@ -22,13 +22,13 @@ namespace nlite{ BOOL rslt = FALSE; try{ - tstring viewString(regex_replace(tstring(chat.chatBuf),nliteregex::TAGSTRING,nliteregex::text::NUTHINGSTRING)); + tstring viewString(regex_replace(tstring(chat.GetChatBuff()),nliteregex::TAGSTRING,nliteregex::text::NUTHINGSTRING)); rslt = __super::SetWindowText(viewString.c_str()); CHARFORMAT2 defaultFormat; this->GetDefaultCharFormat(defaultFormat); defaultFormat.dwMask |= CFM_COLOR; - if(chat.premium == 2 || chat.premium == 3){ + if(chat.GetPremium() == 2 || chat.GetPremium() == 3){ defaultFormat.crTextColor = m_master.viewproperty.ownerStringColor; } @@ -160,7 +160,7 @@ namespace nlite{ COLORREF bkColor; - if (comment.viewData.selectFlag == TRUE) + if (comment.IsSelect() == TRUE) { bkColor = m_master.viewproperty.selectBackColor; @@ -169,13 +169,13 @@ namespace nlite{ { - if(comment.viewData.backColor != CChatData::ViewData::INIT_COLOR){ + if(comment.GetBackColor() != CChatData::ViewData::INIT_COLOR){ - bkColor = comment.viewData.backColor; + bkColor = comment.GetBackColor(); - }else if(comment.listenerData->bgcolor != ListenerData::INIT_COLOR){ + }else if(comment.GetListnerData().GetBackColor() != CListenerData::INIT_COLOR){ - bkColor = comment.listenerData->bgcolor; + bkColor = comment.GetListnerData().GetBackColor(); } else { @@ -245,7 +245,7 @@ namespace nlite{ for(;chatDataBegin != chatDataEnd && heightSum < listRect.bottom;++chatDataBegin){ m_hMaster.m_commentListWindow.CalcItemHeight(*chatDataBegin); counter++; - heightSum += chatDataBegin->viewData.height; + heightSum += chatDataBegin->GetHeight(); } @@ -258,7 +258,7 @@ namespace nlite{ tmpRect = headerRect; tmpRect.top += heightSum; - tmpRect.bottom += heightSum + chatDataBegin->viewData.height; + tmpRect.bottom += heightSum + chatDataBegin->GetHeight(); if(ctrlsBegin == ctrlsEnd)ctrlsBegin = Extend(); @@ -459,7 +459,7 @@ namespace nlite{ for(;begin != end;++begin){ - begin->viewData.height = 0; + begin->SetHeight(0); } @@ -994,7 +994,7 @@ namespace nlite{ for(;chatData != endData && listRect.top < clientRect.bottom;++chatData){ CalcItemHeight(*chatData); - listRect.bottom += chatData->viewData.height; + listRect.bottom += chatData->GetHeight(); headerRects[CCommentView::NO].top = listRect.top + SELL_SPACE_LENGTH; headerRects[CCommentView::USERNAME].top = listRect.top + SELL_SPACE_LENGTH; @@ -1008,7 +1008,7 @@ namespace nlite{ headerRects[CCommentView::TIME].bottom = listRect.bottom - SELL_SPACE_LENGTH; headerRects[CCommentView::INFO].bottom = listRect.bottom - SELL_SPACE_LENGTH; - if(chatData->viewData.selectFlag == TRUE){ + if(chatData->IsSelect() == TRUE){ selectFlag = TRUE; selectData = chatData; selectRect = listRect; @@ -1114,7 +1114,7 @@ namespace nlite{ CCommentList::reverse_iterator rend = self.commentlist.rend(); for(;rbegin != rend;++rbegin){ CalcItemHeight(*rbegin); - height += rbegin->viewData.height; + height += rbegin->GetHeight(); rslt++; if(height > clientRect.bottom)goto overclientrect; @@ -1141,13 +1141,13 @@ overclientrect: // //ƒRƒƒ“ƒgŽžŠÔ•\Ž¦—p•¶Žš—ñì¬ // - time_t chatTime = (time_t)difftime(chatData.date,self.stream.GetStartTime()); + time_t chatTime = (time_t)difftime(chatData.GetDate(),self.stream.GetStartTime()); BOOL beforeStartFlag = chatTime < 0 ? TRUE : FALSE; - TCHAR noString[sizeof(chatData.no) * 8]; + TCHAR noString[sizeof(UINT_PTR) * 8]; TCHAR dateString[LENGTH_16]; - if(chatData.no != 0)_stprintf(noString,TEXT("%u"),chatData.no); + if(chatData.GetNo() != 0)_stprintf(noString,TEXT("%u"),chatData.GetNo()); else _tcscpy(noString,TEXT("")); CNLiteString timeFormat; @@ -1175,7 +1175,7 @@ overclientrect: CBrush originBkBrush; //”wŒi•`‰æ—pƒuƒ‰ƒV //‘I‘ðó‘Ô‚©ƒ`ƒFƒbƒN - if (chatData.viewData.selectFlag == TRUE) + if (chatData.IsSelect() == TRUE) { bkColor = self.viewproperty.selectBackColor; @@ -1185,27 +1185,27 @@ overclientrect: else { - if(chatData.viewData.sellLineColor == CChatData::ViewData::INIT_COLOR){ + if(chatData.GetSellLineColor() == CChatData::ViewData::INIT_COLOR){ dc.SelectPen(this->normalSellLinePen); } else { - originSellLinePen.CreatePen(PS_SOLID,1,chatData.viewData.sellLineColor); + originSellLinePen.CreatePen(PS_SOLID,1,chatData.GetSellLineColor()); dc.SelectPen(originSellLinePen); } - if(chatData.viewData.backColor != CChatData::ViewData::INIT_COLOR || chatData.listenerData->bgcolor != ListenerData::INIT_COLOR){ + if(chatData.GetBackColor() != CChatData::ViewData::INIT_COLOR || chatData.GetListnerData().GetBackColor() != CListenerData::INIT_COLOR){ - if(chatData.viewData.backColor != CChatData::ViewData::INIT_COLOR){ - bkColor = chatData.viewData.backColor; - originBkBrush.CreateSolidBrush(chatData.viewData.backColor); + if(chatData.GetBackColor() != CChatData::ViewData::INIT_COLOR){ + bkColor = chatData.GetBackColor(); + originBkBrush.CreateSolidBrush(chatData.GetBackColor()); - }else if(chatData.listenerData->bgcolor != ListenerData::INIT_COLOR){ + }else if(chatData.GetListnerData().GetBackColor() != CListenerData::INIT_COLOR){ - bkColor = chatData.listenerData->bgcolor; - originBkBrush.CreateSolidBrush(chatData.listenerData->bgcolor); + bkColor = chatData.GetListnerData().GetBackColor(); + originBkBrush.CreateSolidBrush(chatData.GetListnerData().GetBackColor()); } @@ -1232,16 +1232,16 @@ overclientrect: - CComBSTR &viewUserName = chatData.listenerData->name.Length() == 0 ? chatData.listenerData->user_id : chatData.listenerData->name; + const CNLiteString &viewUserName = chatData.GetListnerData().GetName().Length() == 0 ? chatData.GetListnerData().GetUserID() : chatData.GetListnerData().GetName(); dc.SelectFont(linkFont); - dc.SetTextColor(chatData.listenerData->nameColor != ListenerData::INIT_COLOR ? chatData.listenerData->nameColor : self.viewproperty.linkStringColor); + dc.SetTextColor(chatData.GetListnerData().GetNameColor() != CListenerData::INIT_COLOR ? chatData.GetListnerData().GetNameColor() : 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); + dc.SetTextColor(chatData.GetStringColor() == CChatData::ViewData::INIT_COLOR ? chatData.GetStringColor() :self.viewproperty.baseStringColor); dc.DrawTextW(dateString,_tcslen(dateString),&timeViewRect,DT_WORD_ELLIPSIS); return; @@ -1284,7 +1284,7 @@ end: VOID CCommentListWindow::CalcItemHeight(CChatData &chatData){ - if(chatData.viewData.height == 0){ + if(chatData.GetHeight() == 0){ RECT drowSize; self.m_header.GetItemRect(CCommentView::COMMENT,&drowSize); @@ -1300,7 +1300,7 @@ end: cedit.DestroyWindow(); drowSize.bottom += 12; if(drowSize.bottom - drowSize.top > 120)drowSize.bottom = drowSize.top + 120; - chatData.viewData.height = drowSize.bottom - drowSize.top; + chatData.SetHeight(drowSize.bottom - drowSize.top); } return ; @@ -1324,7 +1324,7 @@ end: for(; chatData != end ;(++chatData)){ CalcItemHeight(*chatData); - heightSum += chatData->viewData.height; + heightSum += chatData->GetHeight(); if(heightSum >= height)break; @@ -1351,24 +1351,24 @@ end: auto endData = self.commentlist.end(); for(;clickData != endData;++clickData){ - heightsum += clickData->viewData.height; + heightsum += clickData->GetHeight(); if(heightsum > point.y){ CDC cdc = this->GetDC(); - rc.top = heightsum -= clickData->viewData.height; + rc.top = heightsum -= clickData->GetHeight(); RECT calcRect = {0}; cdc.SelectFont(linkFont); if(index == CCommentView::USERNAME){ - LPCTSTR viewStr = clickData->listenerData->name.Length() == 0 ? clickData->listenerData->user_id : clickData->listenerData->name; + LPCTSTR viewStr = clickData->GetListnerData().GetName().Length() == 0 ? clickData->GetListnerData().GetUserID() : clickData->GetListnerData().GetName(); cdc.DrawTextW(viewStr ,_tcslen(viewStr),&calcRect,DT_CALCRECT); } else if(index == CCommentView::NO){ TCHAR viewStr[sizeof(UINT_PTR) * 8]; - _stprintf(viewStr,TEXT("%d"),clickData->no); + _stprintf(viewStr,TEXT("%d"),clickData->GetNo()); cdc.DrawTextW(viewStr,_tcslen(viewStr),&calcRect,DT_CALCRECT); } @@ -1377,7 +1377,7 @@ end: //À•W‚ªƒŠƒ“ƒN‘Ώە¶Žš—ñ“à‚É‚ ‚éê‡‚Ítrue‚ðÝ’è‚·‚é rslt = (point.y >= rc.top && point.y <= rc.bottom && point.x >= rc.left && point.x <= rc.right) && - ((index ==CCommentView::NO && clickData->no != 0) ||index ==CCommentView::USERNAME); + ((index ==CCommentView::NO && clickData->GetNo() != 0) ||index ==CCommentView::USERNAME); break; @@ -1441,7 +1441,7 @@ end: COLORREF bkColor; - if(lineIte->listenerData->bgcolor == ListenerData::INIT_COLOR){ + if(lineIte->GetListnerData().GetBackColor() == CListenerData::INIT_COLOR){ CListenerColorCollector colorCollector; listenerList.BkColorCollect(colorCollector); UCHAR red; @@ -1459,11 +1459,11 @@ end: }while(colorCollector.Find(bkColor)); - lineIte->listenerData->SetBkColor(bkColor); + lineIte->GetListnerData().SetBkColor(bkColor); } else { - - lineIte->listenerData->bgcolor = ListenerData::INIT_COLOR; + lineIte->GetListnerData().SetBkColor(CListenerData::INIT_COLOR); + } } diff --git a/nlite/nlite_mainframe.cpp b/nlite/nlite_mainframe.cpp index 1de1c28..9ef4a78 100644 --- a/nlite/nlite_mainframe.cpp +++ b/nlite/nlite_mainframe.cpp @@ -497,10 +497,10 @@ LRESULT CNliteMainFrame::OnClickChatNo(UINT uMsg,WPARAM wParam,LPARAM lParam){ auto &chatData = *(CChatData*)wParam; CString setString; - if(chatData.listenerData->name.Length() == 0){ - setString.Format(TEXT(">>%d "),chatData.no); + if(chatData.GetListnerData().GetName().Length() == 0){ + setString.Format(TEXT(">>%d "),chatData.GetNo()); }else{ - setString.Format(TEXT(">>%s "),chatData.listenerData->name); + setString.Format(TEXT(">>%s "),chatData.GetListnerData().GetName()); } this->commentWriteWindow.SetText(setString); @@ -512,7 +512,7 @@ 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); + listenerSettingWindow.ShowSettingWindow(chatData.GetListnerData()); return 0; diff --git a/nlite/nlite_propertyWindow.cpp b/nlite/nlite_propertyWindow.cpp index 7348706..badb605 100644 --- a/nlite/nlite_propertyWindow.cpp +++ b/nlite/nlite_propertyWindow.cpp @@ -144,7 +144,7 @@ VOID CColorSettingButton::SetColor(COLORREF in_color){ if(brush.IsNull() != TRUE){ brush.DeleteObject(); } - if(color != ListenerData::INIT_COLOR){ + if(color != CListenerData::INIT_COLOR){ brush.CreateSolidBrush(color); this->SetWindowText(TEXT("")); @@ -164,17 +164,18 @@ LRESULT CColorSettingButton::OnSetCursor(HWND wparam,UINT loLparam,UINT hiLparam } -VOID CListenerSettingWindow::ShowSettingWindow(ListenerData &listenerData){ +VOID CListenerSettingWindow::ShowSettingWindow(CListenerData &listenerData){ this->ShowWindow(SW_HIDE); this->listenerData = &listenerData; - backColorButton.SetColor(this->listenerData->bgcolor); - nameColorButton.SetColor(this->listenerData->nameColor); + backColorButton.SetColor(this->listenerData->GetBackColor()); + nameColorButton.SetColor(this->listenerData->GetNameColor()); + + idField.SetWindowText(listenerData.GetUserID()); + nameEdit.SetWindowText(listenerData.GetName()); - idField.SetWindowText(listenerData.user_id); - nameEdit.SetWindowText(listenerData.name); this->ShowWindow(SW_SHOW); return; @@ -243,11 +244,11 @@ VOID CListenerSettingWindow::OnButton(UINT hiWParam,INT_PTR loWParam,HWND lParam if(this->backColorReturnButton == lParam){ - backColorButton.SetColor(ListenerData::INIT_COLOR); + backColorButton.SetColor(CListenerData::INIT_COLOR); } else if(this->nameColorReturnButton == lParam){ - nameColorButton.SetColor(ListenerData::INIT_COLOR); + nameColorButton.SetColor(CListenerData::INIT_COLOR); } return; diff --git a/nlite/nlite_propertyWindow.h b/nlite/nlite_propertyWindow.h index d5d5876..c1d7478 100644 --- a/nlite/nlite_propertyWindow.h +++ b/nlite/nlite_propertyWindow.h @@ -88,7 +88,7 @@ namespace nlite{ CColorSettingButton backColorButton; //”wŒiF•ÒWƒ{ƒ^ƒ“ CButton backColorReturnButton; //”wŒiF‚ð–ß‚·ƒ{ƒ^ƒ“ CStatic idField; //ID•\Ž¦—̈æ - ListenerData *listenerData; //‘Ώۂ̃ŠƒXƒi[ƒf[ƒ^ + CListenerData *listenerData; //‘Ώۂ̃ŠƒXƒi[ƒf[ƒ^ public: enum { IDD = IDD_LISTENER_SETTING_DIALOG }; @@ -104,7 +104,7 @@ namespace nlite{ /// ///Ý’èƒEƒBƒ“ƒhƒE•\Ž¦ /// - VOID ShowSettingWindow(ListenerData &listenerData); + VOID ShowSettingWindow(CListenerData &listenerData); private: ///