OSDN Git Service

Add Diff with work copy and file list
[tortoisegit/TortoiseGitJp.git] / src / Git / GitStatusListCtrl.h
index 7fda321..04856f3 100644 (file)
@@ -55,8 +55,8 @@
                \r
 #define SVNSLC_SHOWUNVERSIONED CTGitPath::LOGACTIONS_UNVER\r
 #define SVNSLC_SHOWNORMAL              0x000000000\r
-#define SVNSLC_SHOWMODIFIED            CTGitPath::LOGACTIONS_MODIFIED\r
-#define SVNSLC_SHOWADDED               CTGitPath::LOGACTIONS_ADDED\r
+#define SVNSLC_SHOWMODIFIED            (CTGitPath::LOGACTIONS_MODIFIED)\r
+#define SVNSLC_SHOWADDED               (CTGitPath::LOGACTIONS_ADDED|CTGitPath::LOGACTIONS_COPY)\r
 #define SVNSLC_SHOWREMOVED             CTGitPath::LOGACTIONS_DELETED\r
 #define SVNSLC_SHOWCONFLICTED  CTGitPath::LOGACTIONS_UNMERGED\r
 #define SVNSLC_SHOWMISSING             0x00000000\r
@@ -102,28 +102,28 @@ SVNSLC_SHOWINCOMPLETE|SVNSLC_SHOWEXTERNAL|SVNSLC_SHOWINEXTERNALS)
 \r
 #define SVNSLC_SHOWALL (SVNSLC_SHOWVERSIONED|SVNSLC_SHOWUNVERSIONED)\r
 \r
-#define SVNSLC_POPALL                                  0xFFFFFFFF\r
-#define SVNSLC_POPCOMPAREWITHBASE              0x00000001\r
-#define SVNSLC_POPCOMPARE                              0x00000002\r
-#define SVNSLC_POPGNUDIFF                              0x00000004\r
-#define SVNSLC_POPREVERT                               0x00000008\r
-#define SVNSLC_POPUPDATE                               0x00000010\r
-#define SVNSLC_POPSHOWLOG                              0x00000020\r
-#define SVNSLC_POPOPEN                                 0x00000040\r
-#define SVNSLC_POPDELETE                               0x00000080\r
-#define SVNSLC_POPADD                                  0x00000100\r
-#define SVNSLC_POPIGNORE                               0x00000200\r
-#define SVNSLC_POPCONFLICT                             0x00000400\r
-#define SVNSLC_POPRESOLVE                              0x00000800\r
-#define SVNSLC_POPLOCK                                 0x00001000\r
-#define SVNSLC_POPUNLOCK                               0x00002000\r
-#define SVNSLC_POPUNLOCKFORCE                  0x00004000\r
-#define SVNSLC_POPEXPLORE                              0x00008000\r
-#define SVNSLC_POPCOMMIT                               0x00010000\r
-#define SVNSLC_POPPROPERTIES                   0x00020000\r
-#define SVNSLC_POPREPAIRMOVE                   0x00040000\r
-#define SVNSLC_POPCHANGELISTS                  0x00080000\r
-#define SVNSLC_POPBLAME                                        0x00100000\r
+#define SVNSLC_POPALL                                  0xFFFFFFFFFFFFFFFF\r
+#define SVNSLC_POPCOMPAREWITHBASE              CGitStatusListCtrl::GetContextMenuBit(CGitStatusListCtrl::IDSVNLC_COMPARE) \r
+#define SVNSLC_POPCOMPARE                              CGitStatusListCtrl::GetContextMenuBit(CGitStatusListCtrl::IDSVNLC_COMPAREWC) \r
+#define SVNSLC_POPGNUDIFF                              CGitStatusListCtrl::GetContextMenuBit(CGitStatusListCtrl::IDSVNLC_GNUDIFF1) \r
+#define SVNSLC_POPREVERT                               CGitStatusListCtrl::GetContextMenuBit(CGitStatusListCtrl::IDSVNLC_REVERT) \r
+#define SVNSLC_POPUPDATE                               CGitStatusListCtrl::GetContextMenuBit(CGitStatusListCtrl::IDSVNLC_UPDATE)\r
+#define SVNSLC_POPSHOWLOG                              CGitStatusListCtrl::GetContextMenuBit(CGitStatusListCtrl::IDSVNLC_LOG)\r
+#define SVNSLC_POPOPEN                                 CGitStatusListCtrl::GetContextMenuBit(CGitStatusListCtrl::IDSVNLC_OPEN)\r
+#define SVNSLC_POPDELETE                               CGitStatusListCtrl::GetContextMenuBit(CGitStatusListCtrl::IDSVNLC_DELETE)\r
+#define SVNSLC_POPADD                                  CGitStatusListCtrl::GetContextMenuBit(CGitStatusListCtrl::IDSVNLC_ADD)\r
+#define SVNSLC_POPIGNORE                               CGitStatusListCtrl::GetContextMenuBit(CGitStatusListCtrl::IDSVNLC_IGNORE)\r
+#define SVNSLC_POPCONFLICT                             CGitStatusListCtrl::GetContextMenuBit(CGitStatusListCtrl::IDSVNLC_EDITCONFLICT)\r
+#define SVNSLC_POPRESOLVE                              CGitStatusListCtrl::GetContextMenuBit(CGitStatusListCtrl::IDSVNLC_RESOLVECONFLICT)\r
+#define SVNSLC_POPLOCK                                 CGitStatusListCtrl::GetContextMenuBit(CGitStatusListCtrl::IDSVNLC_LOCK)\r
+#define SVNSLC_POPUNLOCK                               CGitStatusListCtrl::GetContextMenuBit(CGitStatusListCtrl::IDSVNLC_UNLOCK)\r
+#define SVNSLC_POPUNLOCKFORCE                  CGitStatusListCtrl::GetContextMenuBit(CGitStatusListCtrl::IDSVNLC_UNLOCKFORCE)\r
+#define SVNSLC_POPEXPLORE                              CGitStatusListCtrl::GetContextMenuBit(CGitStatusListCtrl::IDSVNLC_EXPLORE)\r
+#define SVNSLC_POPCOMMIT                               CGitStatusListCtrl::GetContextMenuBit(CGitStatusListCtrl::IDSVNLC_COMMIT)\r
+#define SVNSLC_POPPROPERTIES                   CGitStatusListCtrl::GetContextMenuBit(CGitStatusListCtrl::IDSVNLC_PROPERTIES)\r
+#define SVNSLC_POPREPAIRMOVE                   CGitStatusListCtrl::GetContextMenuBit(CGitStatusListCtrl::IDSVNLC_REPAIRMOVE)\r
+#define SVNSLC_POPCHANGELISTS                  CGitStatusListCtrl::GetContextMenuBit(CGitStatusListCtrl::IDSVNLC_CHECKGROUP)\r
+#define SVNSLC_POPBLAME                                        CGitStatusListCtrl::GetContextMenuBit(CGitStatusListCtrl::IDSVNLC_BLAME)\r
 \r
 #define SVNSLC_IGNORECHANGELIST                        _T("ignore-on-commit")\r
 \r
@@ -159,7 +159,52 @@ class CGitStatusListCtrl :
        public CListCtrl\r
 {\r
 public:\r
+       enum\r
+       {\r
+               IDSVNLC_REVERT = 1,\r
+               IDSVNLC_COMPARE,\r
+               IDSVNLC_OPEN,   \r
+               IDSVNLC_DELETE,\r
+               IDSVNLC_IGNORE,\r
+               IDSVNLC_GNUDIFF1                 ,\r
+               IDSVNLC_UPDATE          ,\r
+               IDSVNLC_LOG              ,\r
+               IDSVNLC_EDITCONFLICT     ,\r
+               IDSVNLC_IGNOREMASK          ,\r
+               IDSVNLC_ADD                         ,\r
+               IDSVNLC_RESOLVECONFLICT ,\r
+               IDSVNLC_LOCK                    ,\r
+               IDSVNLC_LOCKFORCE               ,\r
+               IDSVNLC_UNLOCK                  ,\r
+               IDSVNLC_UNLOCKFORCE             ,\r
+               IDSVNLC_OPENWITH                ,\r
+               IDSVNLC_EXPLORE                 ,\r
+               IDSVNLC_RESOLVETHEIRS   ,\r
+               IDSVNLC_RESOLVEMINE             ,\r
+               IDSVNLC_REMOVE                  ,\r
+               IDSVNLC_COMMIT                  ,\r
+               IDSVNLC_PROPERTIES              ,\r
+               IDSVNLC_COPY                    ,\r
+               IDSVNLC_COPYEXT                 ,\r
+               IDSVNLC_REPAIRMOVE              ,\r
+               IDSVNLC_REMOVEFROMCS    ,\r
+               IDSVNLC_CREATECS                ,\r
+               IDSVNLC_CREATEIGNORECS  ,\r
+               IDSVNLC_CHECKGROUP              ,\r
+               IDSVNLC_UNCHECKGROUP    ,\r
+               IDSVNLC_ADD_RECURSIVE   ,\r
+               IDSVNLC_COMPAREWC               ,\r
+               IDSVNLC_BLAME                   ,\r
+               IDSVNLC_SAVEAS                  ,\r
+               IDSVNLC_REVERTTOREV             ,\r
+               IDSVNLC_VIEWREV                 ,\r
+               IDSVNLC_FINDENTRY       ,\r
+// the IDSVNLC_MOVETOCS *must* be the last index, because it contains a dynamic submenu where \r
+// the submenu items get command ID's sequent to this number\r
+               IDSVNLC_MOVETOCS                ,\r
+       };\r
        int GetColumnIndex(int colmask);\r
+       static inline unsigned __int64 GetContextMenuBit(int i){ return ((unsigned __int64 )0x1)<<i ;}\r
        /**\r
         * Sent to the parent window (using ::SendMessage) after a context menu\r
         * command has finished if the item count has changed.\r
@@ -487,7 +532,7 @@ public:
         *                       Use the GitSLC_POPxxx defines.\r
         * \param bHasCheckboxes TRUE if the control should show check boxes on the left of each file entry.\r
         */\r
-       void Init(DWORD dwColumns, const CString& sColumnInfoContainer, DWORD dwContextMenus = (SVNSLC_POPALL ^ SVNSLC_POPCOMMIT), bool bHasCheckboxes = true);\r
+       void Init(DWORD dwColumns, const CString& sColumnInfoContainer, unsigned __int64 dwContextMenus = (SVNSLC_POPALL ^ SVNSLC_POPCOMMIT), bool bHasCheckboxes = true);\r
        /**\r
         * Sets a background image for the list control.\r
         * The image is shown in the right bottom corner.\r
@@ -514,7 +559,7 @@ public:
         * \param bUpdate TRUE if the remote status is requested too.\r
         * \return TRUE on success.\r
         */\r
-       BOOL GetStatus ( const CTGitPathList& pathList\r
+       BOOL GetStatus ( const CTGitPathList* pathList=NULL\r
                    , bool bUpdate = false\r
                    , bool bShowIgnores = false\r
                                   , bool bShowUnRev=false\r
@@ -735,6 +780,7 @@ private:
        void RemoveListEntry(int index);        ///< removes an entry from the listcontrol and both arrays\r
        bool BuildStatistics(); ///< build the statistics and correct the case of files/folders\r
        void StartDiff(int fileindex);  ///< start the external diff program\r
+       void StartDiffWC(int fileindex);        ///< start the external diff program\r
 \r
     /// fetch all user properties for all items\r
     void FetchUserProperties();\r
@@ -828,6 +874,10 @@ private:
        afx_msg void OnHdnItemchanging(NMHDR *pNMHDR, LRESULT *pResult);\r
        afx_msg void OnDestroy();\r
 \r
+\r
+       void FileSaveAs(CTGitPath *path);\r
+       int RevertSelectedItemToVersion();\r
+\r
 private:\r
        bool *                                          m_pbCanceled;\r
        bool                                        m_bAscending;               ///< sort direction\r
@@ -866,7 +916,7 @@ private:
        bool                                            m_bShowFolders;\r
        bool                                            m_bShowIgnores;\r
        bool                                            m_bUpdate;\r
-       DWORD                                           m_dwContextMenus;\r
+       unsigned __int64                        m_dwContextMenus;\r
        BOOL                                            m_bBlock;\r
        BOOL                                            m_bBlockUI;\r
        bool                                            m_bBusy;\r
@@ -914,6 +964,7 @@ public:
        int UpdateWithGitPathList(CTGitPathList &list);\r
 \r
        void AddEntry(CTGitPath* path, WORD langID, int ListIndex);\r
+       void Clear();\r
        int m_FileLoaded;\r
        git_revnum_t m_CurrentVersion;\r
 public:\r