OSDN Git Service

am patch dialog use CPatchListCtrl
authorFrank Li <lznuaa@gmail.com>
Fri, 24 Apr 2009 14:57:53 +0000 (22:57 +0800)
committerFrank Li <lznuaa@gmail.com>
Fri, 24 Apr 2009 14:57:53 +0000 (22:57 +0800)
Signed-off-by: Frank Li <lznuaa@gmail.com>
src/TortoiseProc/Commands/ImportPatchCommand.cpp
src/TortoiseProc/ImportPatchDlg.cpp
src/TortoiseProc/ImportPatchDlg.h

index f289e73..6fbd9ed 100644 (file)
@@ -34,7 +34,7 @@ bool ImportPatchCommand::Execute()
        CString cmd;\r
        CString output;\r
 \r
-       if(!this->orgCmdLinePath.IsAdminDir())\r
+       if(!this->orgCmdLinePath.HasAdminDir())\r
        {\r
                CString str=CAppUtils::ChooseRepository((CString*)&orgCmdLinePath.GetWinPathString());\r
                CTGitPath path;\r
@@ -52,11 +52,11 @@ bool ImportPatchCommand::Execute()
                g_Git.m_CurrentDir=str;\r
        }\r
 \r
-       for(int i=0;i<this->pathList.GetCount();i++)\r
+       for(int i=0;i<this->orgPathList.GetCount();i++)\r
        {\r
-               if(!pathList[i].IsDirectory())\r
+               if(!orgPathList[i].IsDirectory())\r
                {\r
-                       dlg.m_PathList.AddPath(pathList[i]);\r
+                       dlg.m_PathList.AddPath(orgPathList[i]);\r
                }\r
        }\r
 \r
index 99c5527..93312e8 100644 (file)
@@ -13,7 +13,7 @@ IMPLEMENT_DYNAMIC(CImportPatchDlg, CResizableStandAloneDialog)
 CImportPatchDlg::CImportPatchDlg(CWnd* pParent /*=NULL*/)\r
        : CResizableStandAloneDialog(CImportPatchDlg::IDD, pParent)\r
 {\r
-\r
+       m_cList.m_ContextMenuMask &=~ m_cList.GetMenuMask(CPatchListCtrl::MENU_APPLY);\r
 }\r
 \r
 CImportPatchDlg::~CImportPatchDlg()\r
@@ -43,12 +43,16 @@ BOOL CImportPatchDlg::OnInitDialog()
        this->AddOthersToAnchor();\r
 \r
        m_PathList.SortByPathname(true);\r
+       m_cList.SetExtendedStyle( m_cList.GetExtendedStyle()| LVS_EX_CHECKBOXES );\r
 \r
        for(int i=0;i<m_PathList.GetCount();i++)\r
        {\r
                m_cList.InsertItem(0,m_PathList[i].GetWinPath());\r
+               m_cList.SetCheck(0,true);\r
        }\r
 \r
+       \r
+\r
        //CAppUtils::SetListCtrlBackgroundImage(m_cList.GetSafeHwnd(), nID);\r
 \r
        CString title;\r
@@ -102,7 +106,13 @@ void CImportPatchDlg::OnBnClickedButtonAdd()
                pos=dlg.GetStartPosition();\r
                while(pos)\r
                {\r
-                       m_cList.InsertItem(0,dlg.GetNextPathName(pos));\r
+                       CString file=dlg.GetNextPathName(pos);\r
+                       file.Trim();\r
+                       if(!file.IsEmpty())\r
+                       {\r
+                               m_cList.InsertItem(0,file);\r
+                               m_cList.SetCheck(0,true);\r
+                       }\r
                }\r
        }\r
 \r
index ceab47e..52d7509 100644 (file)
@@ -3,6 +3,7 @@
 #include "StandAloneDlg.h"\r
 // CImportPatchDlg dialog\r
 #include "TGitPath.h"\r
+#include "PatchListCtrl.h"\r
 \r
 class CImportPatchDlg : public CResizableStandAloneDialog\r
 {\r
@@ -19,7 +20,7 @@ protected:
        virtual void DoDataExchange(CDataExchange* pDX);    // DDX/DDV support\r
        virtual BOOL OnInitDialog();\r
 \r
-       CListCtrl m_cList;\r
+       CPatchListCtrl m_cList;\r
        DECLARE_MESSAGE_MAP()\r
 public:\r
        afx_msg void OnLbnSelchangeListPatch();\r