OSDN Git Service

マウス計算処理改造
authorunknown <qwerty2501@users.sourceforge.jp>
Thu, 2 Feb 2012 04:06:15 +0000 (13:06 +0900)
committerunknown <qwerty2501@users.sourceforge.jp>
Thu, 2 Feb 2012 04:06:15 +0000 (13:06 +0900)
nlite.suo
nlite/nlite_chatData.cpp
nlite/nlite_chatData.h
nlite/nlite_commentview.cpp
nlite/nlite_commentview.h
nlite_stub/nlite_stub.cpp

index b43a5d7..060963e 100644 (file)
Binary files a/nlite.suo and b/nlite.suo differ
index 80a0d05..d9e41bf 100644 (file)
@@ -121,17 +121,27 @@ CCommentList::CCommentList(){}
 
 CCommentList::~CCommentList(){}
 
-INT_PTR CCommentList::GetCurSel(){
-       GetCurSelFunc_t functa;
+CCommentList::iterator CCommentList::GetCurSel(){
        auto end = this->end();
        auto ite = this->begin();
-       INT_PTR count = 0;
-       for(;ite != end && ite->viewData.selectFlag == FALSE;++ite,++count);
 
-       return ite != end ? count : ERR;
+       for(;ite != end && ite->viewData.selectFlag == FALSE;++ite);
+
+       return ite ;
 }
 
 
+INT_PTR CCommentList::GetCurSelNo(){
+
+       auto end = this->end();
+       auto ite = this->begin();
+       INT_PTR no = 0;
+       for(;ite != end && ite->viewData.selectFlag == FALSE;++ite,++no);
+
+       return ite != end ? no : -1;
+
+}
+
 
 CCommentList::iterator CCommentList::OnChatReceve(NicoLiveChat_P chatData_in, UINT_PTR commnetCountSum,CCommentListWindow &listWindow){
 
@@ -158,18 +168,19 @@ CCommentList::iterator CCommentList::GetCurSelItem(){
 }
 
 
-VOID CCommentList::SetCurSel(INT_PTR cursel){
-       if(cursel < 0)goto end;
+VOID CCommentList::SetCurSel(CCommentList::iterator cursel){
+       
+       auto end = this->end();
+       if(cursel == end)goto end;
        {
                auto curselItem = this->GetCurSelItem();
        
-               if(curselItem != this->end()){
+               if(curselItem != end){
                        curselItem->viewData.selectFlag = FALSE;
                }
        
-               iterator data = chatList.begin();
-               std::advance(data,cursel);
-               data->viewData.selectFlag = TRUE;
+               
+               cursel->viewData.selectFlag = TRUE;
        }
 end:
 
index 50897b2..7b71c49 100644 (file)
@@ -209,16 +209,17 @@ namespace nlite{
                
 
                ///
-               ///\91I\91ð\8d\80\96Ú\82Ì\94Ô\8d\86\82ð\8eæ\93¾
-               ///\8e¸\94s\82·\82é\82ÆERR\82ª\95Ô\82Á\82Ä\82­\82é
+               ///\91I\91ð\8d\80\96Ú\82ð\8eæ\93¾
                ///
-               INT_PTR GetCurSel();
+               iterator GetCurSel();
 
 
+               INT_PTR GetCurSelNo();
+
                ///
-               ///\91I\91ð\8d\80\96Ú\82Ì\94Ô\8d\86\82ð\90Ý\92è
+               ///\91I\91ð\8d\80\96Ú\82ð\90Ý\92è
                ///
-               VOID SetCurSel(INT_PTR cursel);
+               VOID SetCurSel(iterator cursel);
 
                ///
                ///\91I\91ð\8fó\91Ô\82Ì\83A\83C\83e\83\80\82ð\8eæ\93¾
@@ -278,6 +279,8 @@ namespace nlite{
                ///\83V\83\87\81[\83g\83J\83b\83g\82ð\90Ý\92è
                ///
                BOOL SetShortCut(UINT_PTR no);
+
+               
                
        };
 
index 325288b..7f3d3f9 100644 (file)
@@ -865,6 +865,18 @@ namespace nlite{
                return;
        }
 
+
+       LRESULT CCommentListWindow::OnSetCtrol(UINT uMsg,WPARAM wparam,LPARAM lparam){
+
+
+#ifdef USE_RICHEDIT
+               self.chatChildCtrlsList.ShowCntrls();
+#endif
+               dumpln(TEXT("setctrl"));
+
+               return 0;
+       }
+
        VOID CCommentListWindow::OnSize(UINT wParam, _WTYPES_NS::CSize &windowSize){
 
 
@@ -1068,14 +1080,15 @@ overclientrect:
 
        VOID CCommentListWindow::ShowCurSel(){
 
-               INT_PTR cursel = self.commentlist.GetCurSel();
-               if(cursel == CCommentList::ERR)goto end;
+               auto end = self.commentlist.end();
+               INT_PTR cursel = self.commentlist.GetCurSelNo();
+               if(cursel == -1)goto end;
 
                SCROLLINFO vScrollInfo;
                vScrollInfo.cbSize = sizeof(vScrollInfo);
                vScrollInfo.fMask = SIF_ALL;
                self.GetScrollInfo(SB_VERT,&vScrollInfo);
-
+               
                if(!(cursel >= vScrollInfo.nPos + static_cast<INT_PTR>(vScrollInfo.nPage) / 2 && cursel <= vScrollInfo.nPos + static_cast<INT_PTR>(vScrollInfo.nPage) / 2)){
                        self.SetScrollPos(SB_VERT,cursel - (vScrollInfo.nPage / 2));
                }
@@ -1119,32 +1132,26 @@ end:
                return 0;
        }
 
-       INT_PTR CCommentListWindow::CalcClickLine(INT_PTR height){
-               SCROLLINFO vScrollInfo = {0};
-               vScrollInfo.fMask = SIF_POS;
-
-               self.GetScrollInfo(SB_VERT,&vScrollInfo);
+       CCommentList::iterator CCommentListWindow::CalcClickLine(INT_PTR height){
 
                INT_PTR heightSum = 0;
-               INT_PTR lineNo = vScrollInfo.nPos;
+
                CCommentList::iterator chatData = self.commentlist.GetShortCut();
-               CCommentList::iterator end = self.commentlist.end();    
-               for(; chatData != end;++chatData){
+               CCommentList::iterator end  = self.commentlist.end();
+               dumpln(TEXT("height:%d"),height);
+       
+               for(; chatData != end ;(++chatData)){
                        CalcItemHeight(*chatData);
                        heightSum += chatData->viewData.height;
-
-                       if(heightSum >= height){
-
-                               goto end;
-                       }
-
-                       ++lineNo;
+                       dumpln(TEXT("height:%d"),heightSum);
+                       
+                       if(heightSum >= height)break;
                }
-               lineNo = -1;
-end:
+               
+
 
 
-               return lineNo;
+               return chatData;
        }
 
 
@@ -1169,9 +1176,8 @@ end:
                
 
 end:
-#ifdef USE_RICHEDIT
-               self.chatChildCtrlsList.ShowCntrls();
-#endif
+
+               this->SendMessage(UM_COMMENTVIEW_SETCTRL,NULL,NULL);
 
                return;
        }
@@ -1182,14 +1188,13 @@ end:
 
 
                if(point.x > (INT_PTR)self.GetColumnHolSizeSum()) return;
+               auto end  = self.commentlist.end();
+               auto lineIte = CalcClickLine(point.y);
+               if( lineIte == end)return;
                
-               INT_PTR lineNo = CalcClickLine(point.y);
-               if(self.commentlist.empty() == TRUE || lineNo == -1)return;
                
-
-               auto chatData = self.commentlist.GetChatAt(lineNo);
                COLORREF bkColor;
-               if(chatData.listenerData->originBkFlag == FALSE){
+               if(lineIte->listenerData->originBkFlag == FALSE){
                        CListenerColorCollector colorCollector;
                        listenerList.BkColorCollect(colorCollector);
                        UCHAR red;
@@ -1206,12 +1211,12 @@ end:
 
                        }while(colorCollector.Find(bkColor));
 
-                       chatData.listenerData->originBkFlag = TRUE;
-                       chatData.listenerData->SetBkColor(bkColor);
+                       lineIte->listenerData->originBkFlag = TRUE;
+                       lineIte->listenerData->SetBkColor(bkColor);
                } else {
 
 
-                       chatData.listenerData->originBkFlag = FALSE;
+                       lineIte->listenerData->originBkFlag = FALSE;
                }
 
 
@@ -1224,11 +1229,9 @@ end:
                        this->Unlock();
                }
 
-#ifdef USE_RICHEDIT
-               self.chatChildCtrlsList.ShowCntrls();
-#endif
 
 
+               this->SendMessage(UM_COMMENTVIEW_SETCTRL,NULL,NULL);
                return;
        }
 
@@ -1257,11 +1260,15 @@ end:
 
                }
 
-               dy += self.commentlist.GetCurSel();
                
+               
+
+               auto cursel = self.commentlist.GetCurSel();
                if(dy < 0 || dy >= static_cast<INT_PTR>(self.commentlist.Size()))goto end;
 
-               self.commentlist.SetCurSel(dy);
+               
+               std::advance(cursel,dy);
+               self.commentlist.SetCurSel(cursel);
 
                this->ShowCurSel();
 end:
index 181c4a7..dad40e0 100644 (file)
@@ -164,6 +164,7 @@ namespace nlite{
                        MSG_WM_PAINT(OnPaint)
                        MSG_WM_SIZE(OnSize)
                        MSG_WM_KEYDOWN(OnKeyDown)
+                       MESSAGE_HANDLER_EX(UM_COMMENTVIEW_SETCTRL,OnSetCtrol)
                        NOTIFY_ID_HANDLER_EX(CChatChildCtrls::CHAT_DISPCTRL_ID,OnChatControlNortify)
                        NOTIFY_HANDLER_EX(CALCEDIT_ID,EN_REQUESTRESIZE,OnCalcSellSize)
                END_MSG_MAP()
@@ -215,7 +216,7 @@ namespace nlite{
                ///
                ///\83N\83\8a\83b\83N\82µ\82½\8ds\82ð\8cv\8eZ
                ///
-               INT_PTR CalcClickLine(INT_PTR height);
+               CCommentList::iterator CalcClickLine(INT_PTR height);
 
                //\83\81\83b\83Z\81[\83W\83n\83\93\83h\83\89
        private:
@@ -235,7 +236,10 @@ namespace nlite{
                ///
                VOID OnPaint(HDC hdc);
 
-               
+               ///
+               ///\83R\83\93\83g\83\8d\81[\83\8b\83Z\83b\83g\8f\88\97\9d
+               ///
+               LRESULT OnSetCtrol(UINT uMsg,WPARAM wparam,LPARAM lparam);
 
                ///
                ///\83T\83C\83Y\95Ï\8dX
index a180120..f29ad38 100644 (file)
@@ -206,7 +206,7 @@ unsigned int WINAPI commentthread(VOID *usadata){
        
        _beginthread(commentthread_inteanal,0,self);
        HANDLE eventarray[] = {self->endEvent,self->receveEvent};
-       for(int index = 0,index2; index < 65536;index++){
+       for(int index = 0,index2; index < 1;index++){
 
 
                for(index2 = 0;index2 < 3;index2++){