OSDN Git Service

Only apply checked patch
[tortoisegit/TortoiseGitJp.git] / src / TortoiseProc / ImportPatchDlg.cpp
index 611ed08..c0f4544 100644 (file)
@@ -4,7 +4,7 @@
 #include "stdafx.h"\r
 #include "TortoiseProc.h"\r
 #include "ImportPatchDlg.h"\r
-\r
+#include "git.h"\r
 \r
 // CImportPatchDlg dialog\r
 \r
@@ -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,14 +43,21 @@ 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
+       this->GetWindowText(title);\r
+       this->SetWindowText(title+_T(" - ")+g_Git.m_CurrentDir);\r
        EnableSaveRestore(_T("ImportDlg"));\r
 \r
        return TRUE;\r
@@ -99,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
@@ -161,9 +174,12 @@ void CImportPatchDlg::OnBnClickedOk()
 \r
        for(int i=0;i<m_cList.GetItemCount();i++)\r
        {\r
-               CTGitPath path;\r
-               path.SetFromWin(m_cList.GetItemText(i,0));\r
-               m_PathList.AddPath(path);\r
+               if(m_cList.GetCheck(i))\r
+               {\r
+                       CTGitPath path;\r
+                       path.SetFromWin(m_cList.GetItemText(i,0));\r
+                       m_PathList.AddPath(path);\r
+               }\r
        }\r
        OnOK();\r
 }\r