From: qwerty2501 Date: Wed, 1 Feb 2012 13:08:23 +0000 (+0900) Subject: ショートカット機能実装 X-Git-Tag: v0.002~2^2~51 X-Git-Url: http://git.osdn.net/view?a=commitdiff_plain;h=b755b53e0d01a25eb280af404d4f46d8d70c7492;p=nlite%2Fnlite.git ショートカット機能実装 --- diff --git a/nlite.suo b/nlite.suo index 3ba9630..0ad530a 100644 Binary files a/nlite.suo and b/nlite.suo differ diff --git a/nlite/nlite_chatData.cpp b/nlite/nlite_chatData.cpp index 75b9439..55a823c 100644 --- a/nlite/nlite_chatData.cpp +++ b/nlite/nlite_chatData.cpp @@ -227,6 +227,7 @@ VOID CCommentList::OnDestroy(){ VOID CCommentList::OnConnect(){ OnDestroy(); + shortcut = chatList.begin(); } CCommentList::reference CCommentList::back(){ @@ -234,6 +235,31 @@ CCommentList::reference CCommentList::back(){ return chatList.back(); } +/// +///ƒVƒ‡[ƒgƒJƒbƒgƒCƒeƒŒ[ƒ^‚ðŽæ“¾ +/// +CCommentList::iterator CCommentList::GetShortCut(){ + + return shortcut; +} + +/// +///ƒVƒ‡[ƒgƒJƒbƒg‚ðÝ’è +/// +BOOL CCommentList::SetShortCut(UINT_PTR no){ + + dumpln(TEXT("no%d"),no); + if(chatList.size() <= no)return FALSE; + dumpln(TEXT("no%dtrue"),no); + shortcut = chatList.begin(); + std::advance(shortcut,no); + + return TRUE; + +} + + + VOID CListenerList::BkColorCollect(CListenerColorCollector &target){ iterator end = m_listenerList.end(); diff --git a/nlite/nlite_chatData.h b/nlite/nlite_chatData.h index 00fcbfa..41c2286 100644 --- a/nlite/nlite_chatData.h +++ b/nlite/nlite_chatData.h @@ -155,8 +155,13 @@ namespace nlite{ private: typedef std::list ChatList; + public: + typedef ChatList::iterator iterator; + typedef ChatList::reference reference; + typedef ChatList::reverse_iterator reverse_iterator; + private: ChatList chatList; - + iterator shortcut; @@ -171,10 +176,7 @@ namespace nlite{ //Œ^’è‹` - public: - typedef ChatList::iterator iterator; - typedef ChatList::reference reference; - typedef ChatList::reverse_iterator reverse_iterator; + public: @@ -266,7 +268,15 @@ namespace nlite{ /// reference back(); + /// + ///ƒVƒ‡[ƒgƒJƒbƒgƒCƒeƒŒ[ƒ^‚ðŽæ“¾ + /// + iterator GetShortCut(); + /// + ///ƒVƒ‡[ƒgƒJƒbƒg‚ðÝ’è + /// + BOOL SetShortCut(UINT_PTR no); }; diff --git a/nlite/nlite_commentview.cpp b/nlite/nlite_commentview.cpp index a708c4a..46fb2fc 100644 --- a/nlite/nlite_commentview.cpp +++ b/nlite/nlite_commentview.cpp @@ -132,12 +132,12 @@ namespace nlite{ auto ctrlsBegin = m_list.begin(); auto ctrlsEnd = m_list.end(); - INT_PTR scrollPos = m_hMaster.GetScrollPos(SB_VERT); - if(!(scrollPos == -1 || static_cast(m_hMaster.commentlist.Size()) <= scrollPos)){ + + if(m_hMaster.commentlist.Size() > 0){ - auto chatDataBigin = m_hMaster.commentlist.begin(); - dumpln(TEXT("scrollPos%d"),scrollPos); - std::advance(chatDataBigin,scrollPos); + auto chatDataBigin = m_hMaster.commentlist.GetShortCut(); + + for(; chatDataBigin != m_hMaster.commentlist.end() && heightSum < listRect.bottom;++ctrlsBegin,dumpln(TEXT("++ctrlsBegin")),++chatDataBigin,dumpln(TEXT("++chatDataBigin"))){ tmpRect = headerRect; @@ -646,6 +646,7 @@ namespace nlite{ vScrollInfo.nPos += dy; // viewStartHeight = vScrollInfo.nPos; this->SetScrollPos(SB_VERT,vScrollInfo.nPos); + this->commentlist.SetShortCut(this->GetScrollPos(SB_VERT)); //this->SetScrollInfo(SB_VERT,&vScrollInfo); this->UpdateWindow(); if(TryEnterCriticalSection(&m_commentListWindow.m_sec) == TRUE){ @@ -760,16 +761,16 @@ namespace nlite{ BOOL selectFlag = FALSE; CCommentList::iterator selectData; RECT selectRect = {0}; - UINT_PTR viewStartHeight = self.GetScrollPos(SB_VERT); + - if(commentList.Size() > (UINT_PTR)viewStartHeight){ + if(commentList.Size() > 0){ listRect = windowRect; listRect.right = self.GetColumnHolSizeSum(); - CCommentList::iterator chatData = commentList.begin(); - std::advance(chatData,viewStartHeight); + CCommentList::iterator chatData = commentList.GetShortCut(); + //std::advance(chatData,viewStartHeight); @@ -1276,7 +1277,6 @@ end: LRESULT CCommentListWindow::OnCalcSellSize(LPNMHDR lParam){ auto pReqResize = reinterpret_cast (lParam); - dumpln(TEXT("calcsell")); ::SetWindowPos(pReqResize->nmhdr.hwndFrom,NULL,0,0,pReqResize->rc.right - pReqResize->rc.left,pReqResize->rc.bottom - pReqResize->rc.top,SWP_NOZORDER | SWP_NOMOVE | SWP_HIDEWINDOW); //calcRc = pReqResize->rc; return 0;