OSDN Git Service

ショートカット機能実装
authorqwerty2501 <riot313@gmail.com>
Wed, 1 Feb 2012 13:08:23 +0000 (22:08 +0900)
committerqwerty2501 <riot313@gmail.com>
Wed, 1 Feb 2012 13:08:23 +0000 (22:08 +0900)
nlite.suo
nlite/nlite_chatData.cpp
nlite/nlite_chatData.h
nlite/nlite_commentview.cpp

index 3ba9630..0ad530a 100644 (file)
Binary files a/nlite.suo and b/nlite.suo differ
index 75b9439..55a823c 100644 (file)
@@ -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();
 }
 
+///
+///\83V\83\87\81[\83g\83J\83b\83g\83C\83e\83\8c\81[\83^\82ð\8eæ\93¾
+///
+CCommentList::iterator CCommentList::GetShortCut(){
+
+       return shortcut;
+}
+               
+///
+///\83V\83\87\81[\83g\83J\83b\83g\82ð\90Ý\92è
+///
+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();
index 00fcbfa..41c2286 100644 (file)
@@ -155,8 +155,13 @@ namespace nlite{
 
        private:
                typedef std::list<CChatData> 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{
 
 
                //\8c^\92è\8b`
-       public:
-               typedef ChatList::iterator iterator;
-               typedef ChatList::reference reference;
-               typedef ChatList::reverse_iterator reverse_iterator;
+       
 
        public:
 
@@ -266,7 +268,15 @@ namespace nlite{
                ///
                reference back();
 
+               ///
+               ///\83V\83\87\81[\83g\83J\83b\83g\83C\83e\83\8c\81[\83^\82ð\8eæ\93¾
+               ///
+               iterator GetShortCut();
                
+               ///
+               ///\83V\83\87\81[\83g\83J\83b\83g\82ð\90Ý\92è
+               ///
+               BOOL SetShortCut(UINT_PTR no);
                
        };
 
index a708c4a..46fb2fc 100644 (file)
@@ -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<INT_PTR>(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 <REQRESIZE *>(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;