OSDN Git Service

2012/01/19 23:07:47
authorqwerty2501 <riot313@gmail.com>
Thu, 19 Jan 2012 14:07:47 +0000 (23:07 +0900)
committerqwerty2501 <riot313@gmail.com>
Thu, 19 Jan 2012 14:07:47 +0000 (23:07 +0900)
nlite.suo
nlite/nlite_commentWrite.cpp
nlite/nlite_commentWrite.h
nlite/nlite_commentview.cpp
nlite/nlite_commentview.h
nlite/nlite_mailframe.h
nlite/nlite_mainframe.cpp

index 153fc8a..6278d42 100644 (file)
Binary files a/nlite.suo and b/nlite.suo differ
index d7b3178..1469730 100644 (file)
@@ -4,18 +4,16 @@
 namespace nlite{
 
 
-const static SIZE commentColorBoxSize = {33,0};
+const static SIZE commentColorBoxSize = {35,0};
 
 const static LPCTSTR ANONYMOUS_BOTTONSTRING = TEXT("184");
 const static LPCTSTR WRITE_BOTTONSTRING = TEXT("\8f\91\82«\8d\9e\82Ý");
-
+const static LPCTSTR CHECKBUTTON_HIDDENSTRING = TEXT(" ");
 
 const static RECT COMMENTWRITEWINDOW_SEPARATEFSIZE = {0,5,0,5};
 const static UINT_PTR COMMENTWRITEWINDOW_SIDESEPARATESIZE = 5;
 const static UINT_PTR INIT_COMMENTWRITE_MAXLENGTH = 60;
-//const static UINT_PTR COMBOBOX_BUTTON_WIDTH = 15;
-
-//const static COLORREF MAX_COLOR = ((COLORREF)-1);
+const static UINT_PTR CHECKBUTTON_SUBSCRIPT_HEIGHT = 10;
 
 const static COLORREF MAX_COLOR = 0xFFFFFF;
 
@@ -29,10 +27,11 @@ const CommentColorInfo generalUser::COMMENT_COLORLIST[] = {
        {TEXT("cyan"),RGB(0x00,0xFF,0xFF)},
        {TEXT("blue"),RGB(0x00,0x00,0xFF)},
        {TEXT("purple"),RGB(0xC0,0x00,0xFF)},
-       {TEXT("black"),RGB(0x00,0x00,0x00)}
+       
 };
 
 const CommentColorInfo premiumUser::COMMENT_COLORLIST[] = {
+       {TEXT("black"),RGB(0x00,0x00,0x00)},
        {TEXT("white2"),RGB(0xCC,0xCC,0x99)},
        {TEXT("red2"),RGB(0xCC,0x00,0x33)},
        {TEXT("pink2"),RGB(0xFF,0x33,0xCC)},
@@ -41,8 +40,8 @@ const CommentColorInfo premiumUser::COMMENT_COLORLIST[] = {
        {TEXT("green2"),RGB(0x00,0xCC,0x66)},
        {TEXT("cyan2"),RGB(0x00,0xCC,0xCC)},
        {TEXT("blue2"),RGB(0x33,0x99,0xFF)},
-       {TEXT("purple2"),RGB(0x66,0x33,0xCC)},
-       {TEXT("black2"),RGB(0x66,0x66,0x66)}
+       {TEXT("purple2"),RGB(0x66,0x33,0xCC)}
+//     {TEXT("black2"),RGB(0x66,0x66,0x66)}
 };
 
 const CommentSizeInfo generalUser::COMMENT_SIZELIST[] = {
@@ -100,8 +99,9 @@ static UINT_PTR CalcComboBoxWidth(CComboBox &combo){
 CCommentWriteWindow::CCommentWriteWindow():
 commentWriteHeight(0),
 commentWriteInternalHeight(0),
-commentWriteMaxLength(INIT_COMMENTWRITE_MAXLENGTH)
-{}
+commentWriteMaxLength(INIT_COMMENTWRITE_MAXLENGTH){
+
+}
 
 
 
@@ -118,7 +118,7 @@ LRESULT CCommentWriteWindow::OnCreate(LPCREATESTRUCT lpReateStruct){
        commentColorBox.SetFont(AtlGetDefaultGuiFont());
 
        
-       anonymousButton.SetWindowTextW(ANONYMOUS_BOTTONSTRING);
+       anonymousButton.SetWindowTextW(CHECKBUTTON_HIDDENSTRING);
        anonymousButton.SetFont(AtlGetDefaultGuiFont());
        commentEdit.SetFont(AtlGetDefaultGuiFont());
        commentEdit.SetLimitText(commentWriteMaxLength);
@@ -138,7 +138,7 @@ LRESULT CCommentWriteWindow::OnCreate(LPCREATESTRUCT lpReateStruct){
        SIZE thisSize;
        LPCTSTR sample = TEXT(" ");
        GetTextExtentPoint32(pdc,sample,_tcslen(sample),&thisSize);
-       commentWriteHeight = thisSize.cy + COMMENTWRITEWINDOW_SEPARATEFSIZE.top + COMMENTWRITEWINDOW_SEPARATEFSIZE.bottom;
+       commentWriteHeight = thisSize.cy + (CHECKBUTTON_SUBSCRIPT_HEIGHT / 2) + COMMENTWRITEWINDOW_SEPARATEFSIZE.top + COMMENTWRITEWINDOW_SEPARATEFSIZE.bottom;
        commentWriteInternalHeight = commentWriteHeight - (COMMENTWRITEWINDOW_SEPARATEFSIZE.top + COMMENTWRITEWINDOW_SEPARATEFSIZE.bottom);
        return 0;
 }
@@ -169,9 +169,36 @@ LRESULT CCommentWriteWindow::OnSize(UINT wParam,SIZE lParam){
 VOID CCommentWriteWindow::OnPaint(HDC hdc){
 
        CPaintDC pdc(*this);
+       RECT clientRect;
+       this->GetClientRect(&clientRect);
+
+       pdc.FillRect(&clientRect,COLOR_BTNFACE);
+
+       
+       RECT anonymousRect;
+       SIZE anonymousStringSize;
 
-       pdc.FillRect(&pdc.m_ps.rcPaint,COLOR_BTNFACE);
+       anonymousButton.GetWindowRect(&anonymousRect);
+       CPoint anonymousPoint(anonymousRect.left,anonymousRect.top);
+       ::ScreenToClient(*this,&anonymousPoint);
+       anonymousRect.right -= anonymousRect.left;
+       anonymousRect.bottom -= anonymousRect.top;
+       anonymousRect.left = anonymousPoint.x;
+       anonymousRect.top = anonymousPoint.y + anonymousRect.bottom;
 
+
+       ::GetTextExtentPoint32(pdc,ANONYMOUS_BOTTONSTRING,_tcslen(ANONYMOUS_BOTTONSTRING),&anonymousStringSize);
+       anonymousRect.right = anonymousRect.left + anonymousStringSize.cx;
+       anonymousRect.bottom = anonymousRect.top + anonymousStringSize.cy;
+
+       LOGFONT anonymousLogFont = {0};
+       anonymousLogFont.lfHeight = CHECKBUTTON_SUBSCRIPT_HEIGHT;
+       anonymousLogFont.lfCharSet = SHIFTJIS_CHARSET;
+
+       CFont anonymousFont = CreateFontIndirect(&anonymousLogFont);
+       pdc.SelectFont(anonymousFont);
+       pdc.DrawText(ANONYMOUS_BOTTONSTRING,_tcslen(ANONYMOUS_BOTTONSTRING),&anonymousRect,0);
+       
        return;
 }
 
@@ -191,9 +218,8 @@ VOID CCommentWriteWindow::ChangeSize(SIZE &size){
        RECT commentEditRect;
        RECT commentWriteButtonRect;
 
-
-       
-
+       RECT thisWindowRect;
+       this->GetWindowRect(&thisWindowRect);
 
        commentPosBoxRect.left = COMMENTWRITEWINDOW_SIDESEPARATESIZE;
        this->commentPosBoxCS.Lock();
@@ -208,8 +234,12 @@ VOID CCommentWriteWindow::ChangeSize(SIZE &size){
        commentColorBoxRect.left = commentSizeBoxRect.right + COMMENTWRITEWINDOW_SIDESEPARATESIZE;
        commentColorBoxRect.right = commentColorBoxRect.left + commentColorBoxSize.cx;
 
+       CDC cdc(anonymousButton.GetDC());
+       SIZE anonymousStringSize;
+       ::GetTextExtentPoint32(cdc,CHECKBUTTON_HIDDENSTRING,_tcslen(CHECKBUTTON_HIDDENSTRING),&anonymousStringSize);
+       
        anonymousButtonRect.left = commentColorBoxRect.right + COMMENTWRITEWINDOW_SIDESEPARATESIZE;
-       anonymousButtonRect.right = anonymousButtonRect.left + commentAnonymousButtonSize.cx;
+       anonymousButtonRect.right = anonymousButtonRect.left + commentAnonymousButtonSize.cx - anonymousStringSize.cx;
 
        commentEditRect.left = anonymousButtonRect.right + COMMENTWRITEWINDOW_SIDESEPARATESIZE;
        
@@ -223,27 +253,27 @@ VOID CCommentWriteWindow::ChangeSize(SIZE &size){
        //\88Ú\93®\8f\88\97\9d
        HDWP hDwp = BeginDeferWindowPos(6);
        
-       commentPosBox.DeferWindowPos(hDwp,NULL,
+       commentPosBox.DeferWindowPos(hDwp,*this,
                commentPosBoxRect.left,COMMENTWRITEWINDOW_SEPARATEFSIZE.top,commentPosBoxRect.right - commentPosBoxRect.left,commentWriteInternalHeight,
                SWP_NOZORDER);
-       commentSizeBox.DeferWindowPos(hDwp,NULL,
+
+       commentSizeBox.DeferWindowPos(hDwp,*this,
                commentSizeBoxRect.left,COMMENTWRITEWINDOW_SEPARATEFSIZE.top,commentSizeBoxRect.right - commentSizeBoxRect.left,commentWriteInternalHeight,
                SWP_NOZORDER);
 
-       commentColorBox.DeferWindowPos(hDwp,NULL,
+       commentColorBox.DeferWindowPos(hDwp,*this,
                commentColorBoxRect.left,COMMENTWRITEWINDOW_SEPARATEFSIZE.top,commentColorBoxRect.right - commentColorBoxRect.left,commentWriteInternalHeight,
                SWP_NOZORDER);
 
-       anonymousButton.DeferWindowPos(hDwp,NULL,
-               anonymousButtonRect.left,COMMENTWRITEWINDOW_SEPARATEFSIZE.top,anonymousButtonRect.right - anonymousButtonRect.left,commentWriteInternalHeight,
+       anonymousButton.DeferWindowPos(hDwp,*this,
+               anonymousButtonRect.left,COMMENTWRITEWINDOW_SEPARATEFSIZE.top,anonymousButtonRect.right - anonymousButtonRect.left,commentWriteInternalHeight - CHECKBUTTON_SUBSCRIPT_HEIGHT,
                SWP_NOZORDER);
 
-
-       commentEdit.DeferWindowPos(hDwp,NULL,
+       commentEdit.DeferWindowPos(hDwp,*this,
                commentEditRect.left,COMMENTWRITEWINDOW_SEPARATEFSIZE.top,commentEditRect.right - commentEditRect.left,commentWriteInternalHeight,
                SWP_NOZORDER);
 
-       commentWriteButton.DeferWindowPos(hDwp,NULL,
+       commentWriteButton.DeferWindowPos(hDwp,*this,
                commentWriteButtonRect.left,COMMENTWRITEWINDOW_SEPARATEFSIZE.top,commentWriteButtonRect.right - commentWriteButtonRect.left,commentWriteInternalHeight,
                SWP_NOZORDER);
 
@@ -265,25 +295,16 @@ VOID CCommentWriteWindow::OnDrawItem(UINT wParam,LPDRAWITEMSTRUCT lParam){
                INT_PTR curselNo = commentColorBox.GetCurSel();
                CDCHandle dcHandle = lParam->hDC;
                CBrush bkBrush;
+               const UINT_PTR width = 1;
+               drawRect.left += width;
+               drawRect.top += width;
+               drawRect.right -= width;
+               drawRect.bottom -= width;
 
-               drawRect.left += 2;
-               drawRect.top += 2;
-               drawRect.right -= 2;
-               drawRect.bottom -= 2;
                if(lParam->itemID == ((UINT)-1)){
-                       
-
                        itemNo = curselNo == CB_ERR ? 0 : curselNo;
-                       
-
                } else {
                        itemNo = lParam->itemID;
-                       
-                       
-                       
-
-                       
-
                }
                
                CommentInfo<COLORREF> &commentColor = *(CommentInfo<COLORREF> *)commentColorBox.GetItemDataPtr(itemNo);
@@ -308,16 +329,22 @@ VOID CCommentWriteWindow::OnDrawItem(UINT wParam,LPDRAWITEMSTRUCT lParam){
                CPen cpen;
 
                brush.CreateSolidBrush(commentColor.userData);
+               dcHandle.SelectBrush(brush);
                dcHandle.FillRect(&lParam->rcItem,bkBrush);
                dcHandle.SelectBrush(brush);
                dcHandle.SelectPen((HPEN)::GetStockObject(BLACK_PEN));
-               dcHandle.FillRect(&drawRect,brush);
+               dcHandle.Rectangle(&drawRect);
                
        }
 
        return;
 }
 
+LRESULT CCommentWriteWindow::OnEraseBkGnd(HDC wParam){
+
+       return TRUE;
+}
+
 VOID CCommentWriteWindow::OnMeasureItem(UINT wParam,LPMEASUREITEMSTRUCT lParam){
 
        switch(lParam->CtlID){
index c1689dd..964933b 100644 (file)
@@ -97,6 +97,7 @@ namespace nlite{
                        MSG_WM_SIZING(OnSizing)
                        MSG_WM_PAINT(OnPaint)
                        MSG_WM_SIZE(OnSize)
+                       MSG_WM_ERASEBKGND(OnEraseBkGnd)
                        MSG_WM_DRAWITEM(OnDrawItem)
                        MSG_WM_MEASUREITEM(OnMeasureItem)
                END_MSG_MAP()
@@ -125,6 +126,7 @@ namespace nlite{
 
                VOID OnMeasureItem(UINT wParam,LPMEASUREITEMSTRUCT lParam);
 
+               LRESULT OnEraseBkGnd(HDC wParam);
        };
 
 }
\ No newline at end of file
index 2d08d1d..cc8e9e1 100644 (file)
@@ -569,14 +569,14 @@ VOID CCommentListWindow::OnPaint(HDC in_hdc){
 
                CCommentList &commentList = self.commentlist;
 
-
-
-       
+               BOOL selectFlag = FALSE;
+               CCommentList::iterator selectData;
+               RECT selectRect = {0};
        
                if(commentList.Size() > (UINT_PTR)self.viewStartHeight){
 
        
-                       clock_t start,sum = 0;;
+                       
                        CCommentList::iterator chatData = commentList.begin();
                        std::advance(chatData,self.viewStartHeight);
                
@@ -588,18 +588,39 @@ VOID CCommentListWindow::OnPaint(HDC in_hdc){
                        baseBkBrush.DeleteObject();
                        CCommentList::iterator endData = commentList.end();
                        listRect.bottom = 0;
+
+                       CPen outLinePen;
+                       outLinePen.CreatePen(PS_SOLID,1,ColorList::outLineNomal);
+                       mdc.SelectPen(outLinePen);
+                       mdc.MoveTo(listRect.right,listRect.top);
+                       mdc.LineTo(listRect.right,listRect.bottom);
+
+
                        for(;chatData != endData && listRect.top < clientRect.bottom;++chatData){
                                listRect.bottom +=      CalcItemHeight(*chatData);
 
-                               start = clock();
-                               this->DrawItem(mdc,listRect,*chatData);
-                               sum += clock() - start;
+                               
+                               if(chatData->selectFlag == TRUE){
+                                       selectFlag = TRUE;
+                                       selectData = chatData;
+                                       selectRect = listRect;
+                               } else {
+                               
+                                       this->DrawItem(mdc,listRect,*chatData);
+                               }
                        
                        
                                listRect.top = listRect.bottom;
                        }
 
-               
+                       mdc.SelectPen(outLinePen);
+                       mdc.MoveTo(listRect.left,listRect.bottom);
+                       mdc.LineTo(listRect.right,listRect.bottom);
+                       
+                       if(selectFlag == TRUE){
+                               this->DrawItem(mdc,selectRect,*selectData);
+                       }
+
                }
 
        
@@ -726,14 +747,22 @@ VOID CCommentListWindow::DrawItem(CDC &dc,RECT &rc,CChatData &chatData){
 
        outLinePen.CreatePen(PS_SOLID,1,outLineColor);
        bkBrush.CreateSolidBrush(bkColor);
-       dc.SelectBrush(bkBrush);
        dc.SelectPen(outLinePen);
-       dc.Rectangle(&rc);
+       
+       if(chatData.selectFlag == TRUE){
+               
+               dc.MoveTo(rc.left,rc.bottom);
+               dc.LineTo(rc.right,rc.bottom);
+       }
+       dc.FillRect(&rc,bkBrush);
        dc.SetBkColor(bkColor);
-       //\83e\83L\83X\83g\82Ì\83J\83\89\81[\82ð\90Ý\92è        
-       dc.SetTextColor(self.viewproperty.baseStringColor);
+       dc.MoveTo(rc.left,rc.top);
+       dc.LineTo(rc.right,rc.top);
+       
        
        
+       dc.SetTextColor(self.viewproperty.baseStringColor);
+       
        
        
        
index 6803d51..01e010f 100644 (file)
@@ -31,7 +31,7 @@ namespace nlite{
                        enum type{
                                selectBack = RGB(255,240,240),
                                outLineSelect = RGB(255,0,0),
-                               outLineNomal = RGB(127,127,127),
+                               outLineNomal = RGB(0,0,0),
                                colLine = RGB(224,224,224)
                        };
                };
index 9d8fd79..d7f3838 100644 (file)
@@ -179,7 +179,7 @@ namespace nlite{
                        MSG_WM_DESTROY(OnDestroy)
                        MESSAGE_HANDLER(WM_SIZE,OnSize)
                        MSG_WM_SIZING(OnSizing)
-                       MESSAGE_HANDLER_EX(WM_ERASEBKGND,OnErasekgnd);
+                       MESSAGE_HANDLER_EX(WM_ERASEBKGND,OnErasekgnd)
                        COMMAND_ID_HANDLER_EX(IDM_EXIT, OnMenuExit)
                        COMMAND_ID_HANDLER_EX(IDM_ABOUT,OnMenuAbount)
                        COMMAND_ID_HANDLER_EX(IDM_COOKIE,OnCookie)
index a4926ca..2b20239 100644 (file)
@@ -36,15 +36,16 @@ VOID CNliteMainFrame::ChangeSize(const SIZE& client){
        
 
        tabctrl.MoveWindow(tabWindowRect.left,tabWindowRect.top,tabWindowRect.right - tabWindowRect.left ,tabWindowRect.bottom - tabWindowRect.top);
-       commentWriteWindow.MoveWindow(commentWriteWindowRect.left,commentWriteWindowRect.top,commentWriteWindowRect.right - commentWriteWindowRect.left ,commentWriteWindowRect.bottom - commentWriteWindowRect.top);
+       
        
        tabctrl.GetClientRect(&commentViewRect);
        tabctrl.AdjustRect(FALSE,&commentViewRect);
 
        commentView.MoveWindow(commentViewRect.left, commentViewRect.top,commentViewRect.right - commentViewRect.left, commentViewRect.bottom - commentViewRect.top);
 
-       
-
+       commentWriteWindow.MoveWindow(commentWriteWindowRect.left,commentWriteWindowRect.top,commentWriteWindowRect.right - commentWriteWindowRect.left ,commentWriteWindowRect.bottom - commentWriteWindowRect.top);
+       tabctrl.SetWindowPos(*this,0,0,0,0,SWP_NOSIZE | SWP_NOMOVE | SWP_SHOWWINDOW);
+       commentWriteWindow.SetWindowPos(*this,0,0,0,0,SWP_NOSIZE | SWP_NOMOVE | SWP_SHOWWINDOW);
        return;
 }
 
@@ -56,7 +57,7 @@ LRESULT CNliteMainFrame::OnCreate(LPCREATESTRUCT lpcs){
        tabctrl.Create(m_hWnd,0,NULL,WS_CHILD | WS_VISIBLE | WS_CLIPCHILDREN | WS_DLGFRAME );
        commentView.Create(tabctrl.m_hWnd);
        
-       commentWriteWindow.Create(m_hWnd,0,COMMENTWRITEWINDOW,WS_CHILD | WS_VISIBLE  );
+       commentWriteWindow.Create(m_hWnd,0,NULL,WS_CHILD | WS_VISIBLE | WS_CLIPCHILDREN  );
        CreateSimpleReBar();
        HWND hWndToolBar = CreateSimpleToolBarCtrl(m_hWnd,IDC_NLITE, FALSE, ATL_SIMPLE_TOOLBAR_PANE_STYLE);
        lvNoCombo.Create(m_hWnd, CRect(0, 0, 100, 100), NULL,WS_CHILD | WS_VISIBLE | WS_VSCROLL  | CBS_DROPDOWN , 0, IDC_COMBO_REBAR);
@@ -71,7 +72,7 @@ LRESULT CNliteMainFrame::OnCreate(LPCREATESTRUCT lpcs){
        AddSimpleReBarBand(lvNoCombo,TEXT("\95ú\91\97URL"));
        SizeSimpleReBarBands();
        
-       //tabctrl.SetWindowPos(HWND_BOTTOM,0,0,0,0,SWP_SHOWWINDOW);
+       //tabctrl.SetWindowPos(*this,0,0,0,0,SWP_SHOWWINDOW);
        
        tabctrl.SetFont(hTabFont);
        tabctrl.AddItem(TCIF_TEXT | TCIF_PARAM, _T("\83R\83\81\83\93\83g\88ê\97\97"), 0, (DWORD)commentView.m_hWnd);