OSDN Git Service

Patch view stick to commit dialog okay
authorFrank Li <lznuaa@gmail.com>
Sun, 23 Aug 2009 14:54:13 +0000 (22:54 +0800)
committerFrank Li <lznuaa@gmail.com>
Sun, 23 Aug 2009 14:54:13 +0000 (22:54 +0800)
Signed-off-by: Frank Li <lznuaa@gmail.com>
src/Resources/TortoiseProcENG.rc
src/TortoiseProc/CommitDlg.cpp
src/TortoiseProc/CommitDlg.h
src/TortoiseProc/TortoiseProc.vcproj

index b983ce3..0386943 100644 (file)
Binary files a/src/Resources/TortoiseProcENG.rc and b/src/Resources/TortoiseProcENG.rc differ
index e1779b1..1ceab7c 100644 (file)
@@ -35,6 +35,7 @@
 #include "ProgressDlg.h"\r
 #include "ShellUpdater.h"\r
 #include "Commands/PushCommand.h"\r
+#include "PatchViewDlg.h"\r
 \r
 #ifdef _DEBUG\r
 #define new DEBUG_NEW\r
@@ -108,6 +109,9 @@ BEGIN_MESSAGE_MAP(CCommitDlg, CResizableStandAloneDialog)
        ON_STN_CLICKED(IDC_BUGIDLABEL, &CCommitDlg::OnStnClickedBugidlabel)\r
        ON_COMMAND(ID_FOCUS_MESSAGE,&CCommitDlg::OnFocusMessage)\r
        ON_STN_CLICKED(IDC_VIEW_PATCH, &CCommitDlg::OnStnClickedViewPatch)\r
+       ON_WM_MOVE()\r
+       ON_WM_MOVING()\r
+       ON_WM_SIZING()\r
 END_MESSAGE_MAP()\r
 \r
 BOOL CCommitDlg::OnInitDialog()\r
@@ -1614,6 +1618,7 @@ void CCommitDlg::OnSize(UINT nType, int cx, int cy)
 \r
     //set range\r
     SetSplitterRange();\r
+\r
 }\r
 \r
 \r
@@ -1718,5 +1723,84 @@ void CCommitDlg::OnScnUpdateUI(NMHDR *pNMHDR, LRESULT *pResult)
 void CCommitDlg::OnStnClickedViewPatch()\r
 {\r
        // TODO: Add your control notification handler code here\r
-       this->m_ctrlShowPatch.SetWindowText(_T("Hide Patch<<"));\r
+       \r
+       m_patchViewdlg.m_pProjectProperties = &this->m_ProjectProperties;\r
+       m_patchViewdlg.m_ParentCommitDlg = this;\r
+       if(!IsWindow(this->m_patchViewdlg.m_hWnd))\r
+       {\r
+               m_patchViewdlg.Create(IDD_PATCH_VIEW,this);\r
+               CRect rect;\r
+               this->GetWindowRect(&rect);\r
+               rect.left=rect.right;\r
+               rect.right=rect.left+200;\r
+               m_patchViewdlg.MoveWindow(rect);\r
+               m_patchViewdlg.ShowWindow(SW_SHOW);\r
+               m_patchViewdlg.MoveWindow(rect);\r
+               ShowViewPatchText(false);\r
+       }\r
+       else\r
+       {\r
+               m_patchViewdlg.ShowWindow(SW_HIDE);\r
+               m_patchViewdlg.DestroyWindow();\r
+               ShowViewPatchText(true);\r
+       }\r
+}\r
+\r
+void CCommitDlg::OnMove(int x, int y)\r
+{\r
+       __super::OnMove(x, y);\r
+\r
+       // TODO: Add your message handler code here\r
+}\r
+\r
+void CCommitDlg::OnMoving(UINT fwSide, LPRECT pRect)\r
+{\r
+       __super::OnMoving(fwSide, pRect);\r
+\r
+       // TODO: Add your message handler code here\r
+       if (::IsWindow(m_patchViewdlg.m_hWnd))\r
+       {\r
+               RECT patchrect;\r
+               m_patchViewdlg.GetWindowRect(&patchrect);\r
+               if (::IsWindow(m_hWnd))\r
+               {\r
+                       RECT thisrect;\r
+                       GetWindowRect(&thisrect);\r
+                       if (patchrect.left == thisrect.right)\r
+                       {\r
+                               m_patchViewdlg.SetWindowPos(NULL, patchrect.left - (thisrect.left - pRect->left), patchrect.top - (thisrect.top - pRect->top), \r
+                                       0, 0, SWP_NOACTIVATE | SWP_NOOWNERZORDER | SWP_NOSIZE | SWP_NOZORDER);\r
+                       }\r
+               }\r
+       }\r
+\r
+}\r
+\r
+void CCommitDlg::OnSizing(UINT fwSide, LPRECT pRect)\r
+{\r
+       __super::OnSizing(fwSide, pRect);\r
+\r
+       if(::IsWindow(this->m_patchViewdlg.m_hWnd))\r
+       {\r
+               CRect thisrect, patchrect;\r
+               this->GetWindowRect(thisrect);\r
+               this->m_patchViewdlg.GetWindowRect(patchrect);\r
+               if(thisrect.right==patchrect.left)\r
+               {\r
+                       int width = patchrect.Width();\r
+                       patchrect.left -= (thisrect.right - pRect->right);\r
+                       patchrect.right-= (thisrect.right - pRect->right);\r
+\r
+                       if(     patchrect.bottom == thisrect.bottom)\r
+                       {\r
+                               patchrect.bottom -= (thisrect.bottom - pRect->bottom);\r
+                       }\r
+                       if(     patchrect.top == thisrect.top)\r
+                       {\r
+                               patchrect.top -=  thisrect.top-pRect->top;\r
+                       }\r
+                       m_patchViewdlg.MoveWindow(patchrect);\r
+               }\r
+       }\r
+       // TODO: Add your message handler code here\r
 }\r
index 1e9baed..ed9c886 100644 (file)
@@ -31,6 +31,7 @@
 #include "..\IBugTraqProvider\IBugTraqProvider_h.h"\r
 #include "Git.h"\r
 #include "HyperLink.h"\r
+#include "PatchViewDlg.h"\r
 \r
 #include <regex>\r
 using namespace std;\r
@@ -55,6 +56,13 @@ public:
        virtual void            InsertMenuItems(CMenu& mPopup, int& nCmd);\r
        virtual bool            HandleMenuItemClick(int cmd, CSciEdit * pSciEdit);\r
 \r
+       void ShowViewPatchText(bool b=true)\r
+       {\r
+               if(b)\r
+                       this->m_ctrlShowPatch.SetWindowText(_T("View Patch>>"));\r
+               else\r
+                       this->m_ctrlShowPatch.SetWindowText(_T("Hide Patch<<"));\r
+       }\r
 private:\r
        static UINT StatusThreadEntry(LPVOID pVoid);\r
        UINT StatusThread();\r
@@ -143,6 +151,7 @@ private:
        CRect                           m_LogMsgOrigRect;\r
        CPathWatcher            m_pathwatcher;\r
        CHyperLink                      m_ctrlShowPatch;\r
+       CPatchViewDlg           m_patchViewdlg;\r
 \r
        CBugTraqAssociation m_bugtraq_association;\r
        HACCEL                          m_hAccel;\r
@@ -155,4 +164,7 @@ public:
        afx_msg void OnStnClickedBugidlabel();\r
        afx_msg void OnScnUpdateUI(NMHDR *pNMHDR, LRESULT *pResult);\r
        afx_msg void OnStnClickedViewPatch();\r
+       afx_msg void OnMove(int x, int y);\r
+       afx_msg void OnMoving(UINT fwSide, LPRECT pRect);\r
+       afx_msg void OnSizing(UINT fwSide, LPRECT pRect);\r
 };\r
index cf3d55a..599812f 100644 (file)
                                >\r
                        </File>\r
                        <File\r
-                               RelativePath=".\PatchViewDlg.cpp"\r
-                               >\r
-                       </File>\r
-                       <File\r
-                               RelativePath=".\PatchViewDlg.h"\r
-                               >\r
-                       </File>\r
-                       <File\r
                                RelativePath=".\ProjectProperties.cpp"\r
                                >\r
                        </File>\r
                                        RelativePath=".\Commands\CreateRepositoryCommand.h"\r
                                        >\r
                                </File>\r
+                               <File\r
+                                       RelativePath=".\PatchViewDlg.cpp"\r
+                                       >\r
+                               </File>\r
+                               <File\r
+                                       RelativePath=".\PatchViewDlg.h"\r
+                                       >\r
+                               </File>\r
                        </Filter>\r
                        <Filter\r
                                Name="About"\r