OSDN Git Service

Add TortoiseUDiff Code
[tortoisegit/TortoiseGitJp.git] / TortoiseProc / LogDlg.cpp
index b5678c3..553d5a9 100644 (file)
@@ -3789,7 +3789,7 @@ void CLogDlg::UpdateLogInfoLabel()
 \r
 void CLogDlg::ShowContextMenuForRevisions(CWnd* /*pWnd*/, CPoint point)\r
 {\r
-#if 0\r
+\r
        int selIndex = m_LogList.GetSelectionMark();\r
        if (selIndex < 0)\r
                return; // nothing selected, nothing to do with a context menu\r
@@ -3812,12 +3812,15 @@ void CLogDlg::ShowContextMenuForRevisions(CWnd* /*pWnd*/, CPoint point)
        m_bCancelled = FALSE;\r
 \r
        // calculate some information the context menu commands can use\r
-       CString pathURL = GetURLFromPath(m_path);\r
+//     CString pathURL = GetURLFromPath(m_path);\r
+\r
        POSITION pos = m_LogList.GetFirstSelectedItemPosition();\r
        int indexNext = m_LogList.GetNextSelectedItem(pos);\r
        if (indexNext < 0)\r
                return;\r
-       PLOGENTRYDATA pSelLogEntry = reinterpret_cast<PLOGENTRYDATA>(m_arShownList.GetAt(indexNext));\r
+\r
+       GitRev* pSelLogEntry = reinterpret_cast<GitRev*>(m_arShownList.GetAt(indexNext));\r
+#if 0\r
        GitRev revSelected = pSelLogEntry->Rev;\r
        GitRev revPrevious = git_revnum_t(revSelected)-1;\r
        if ((pSelLogEntry->pArChangedPaths)&&(pSelLogEntry->pArChangedPaths->GetCount() <= 2))\r
@@ -3860,14 +3863,22 @@ void CLogDlg::ShowContextMenuForRevisions(CWnd* /*pWnd*/, CPoint point)
                }\r
        }\r
 \r
+#endif\r
 \r
-\r
+       int FirstSelect=-1, LastSelect=-1;\r
+       pos = m_LogList.GetFirstSelectedItemPosition();\r
+       FirstSelect = m_LogList.GetNextSelectedItem(pos);\r
+       while(pos)\r
+       {\r
+               LastSelect = m_LogList.GetNextSelectedItem(pos);\r
+       }\r
        //entry is selected, now show the popup menu\r
        CIconMenu popup;\r
        if (popup.CreatePopupMenu())\r
        {\r
                if (m_LogList.GetSelectedCount() == 1)\r
                {\r
+#if 0\r
                        if (!m_path.IsDirectory())\r
                        {\r
                                if (m_hasWC)\r
@@ -3885,6 +3896,7 @@ void CLogDlg::ShowContextMenuForRevisions(CWnd* /*pWnd*/, CPoint point)
                                popup.AppendMenu(MF_SEPARATOR, NULL);\r
                        }\r
                        else\r
+#endif \r
                        {\r
                                if (m_hasWC)\r
                                {\r
@@ -3902,30 +3914,31 @@ void CLogDlg::ShowContextMenuForRevisions(CWnd* /*pWnd*/, CPoint point)
                                popup.AppendMenuIcon(ID_BLAMEWITHPREVIOUS, IDS_LOG_POPUP_BLAMEWITHPREVIOUS, IDI_BLAME);\r
                                popup.AppendMenu(MF_SEPARATOR, NULL);\r
                        }\r
-                       if (!m_ProjectProperties.sWebViewerRev.IsEmpty())\r
-                       {\r
-                               popup.AppendMenuIcon(ID_VIEWREV, IDS_LOG_POPUP_VIEWREV);\r
-                       }\r
-                       if (!m_ProjectProperties.sWebViewerPathRev.IsEmpty())\r
-                       {\r
-                               popup.AppendMenuIcon(ID_VIEWPATHREV, IDS_LOG_POPUP_VIEWPATHREV);\r
-                       }\r
-                       if ((!m_ProjectProperties.sWebViewerPathRev.IsEmpty())||\r
-                               (!m_ProjectProperties.sWebViewerRev.IsEmpty()))\r
-                       {\r
-                               popup.AppendMenu(MF_SEPARATOR, NULL);\r
-                       }\r
 \r
-                       popup.AppendMenuIcon(ID_REPOBROWSE, IDS_LOG_BROWSEREPO, IDI_REPOBROWSE);\r
-                       popup.AppendMenuIcon(ID_COPY, IDS_LOG_POPUP_COPY);\r
-                       if (m_hasWC)\r
-                               popup.AppendMenuIcon(ID_UPDATE, IDS_LOG_POPUP_UPDATE, IDI_UPDATE);\r
+//                     if (!m_ProjectProperties.sWebViewerRev.IsEmpty())\r
+//                     {\r
+//                             popup.AppendMenuIcon(ID_VIEWREV, IDS_LOG_POPUP_VIEWREV);\r
+//                     }\r
+//                     if (!m_ProjectProperties.sWebViewerPathRev.IsEmpty())\r
+//                     {\r
+//                             popup.AppendMenuIcon(ID_VIEWPATHREV, IDS_LOG_POPUP_VIEWPATHREV);\r
+//                     }\r
+//                     if ((!m_ProjectProperties.sWebViewerPathRev.IsEmpty())||\r
+//                             (!m_ProjectProperties.sWebViewerRev.IsEmpty()))\r
+//                     {\r
+//                             popup.AppendMenu(MF_SEPARATOR, NULL);\r
+//                     }\r
+\r
+//                     popup.AppendMenuIcon(ID_REPOBROWSE, IDS_LOG_BROWSEREPO, IDI_REPOBROWSE);\r
+//                     popup.AppendMenuIcon(ID_COPY, IDS_LOG_POPUP_COPY);\r
+//                     if (m_hasWC)\r
+//                             popup.AppendMenuIcon(ID_UPDATE, IDS_LOG_POPUP_UPDATE, IDI_UPDATE);\r
                        if (m_hasWC)\r
                                popup.AppendMenuIcon(ID_REVERTTOREV, IDS_LOG_POPUP_REVERTTOREV, IDI_REVERT);\r
                        if (m_hasWC)\r
                                popup.AppendMenuIcon(ID_REVERTREV, IDS_LOG_POPUP_REVERTREV, IDI_REVERT);\r
-                       if (m_hasWC)\r
-                               popup.AppendMenuIcon(ID_MERGEREV, IDS_LOG_POPUP_MERGEREV, IDI_MERGE);\r
+//                     if (m_hasWC)\r
+//                             popup.AppendMenuIcon(ID_MERGEREV, IDS_LOG_POPUP_MERGEREV, IDI_MERGE);\r
                        popup.AppendMenuIcon(ID_CHECKOUT, IDS_MENUCHECKOUT, IDI_CHECKOUT);\r
                        popup.AppendMenuIcon(ID_EXPORT, IDS_MENUEXPORT, IDI_EXPORT);\r
                        popup.AppendMenu(MF_SEPARATOR, NULL);\r
@@ -3946,24 +3959,25 @@ void CLogDlg::ShowContextMenuForRevisions(CWnd* /*pWnd*/, CPoint point)
                        if (m_hasWC)\r
                        {\r
                                popup.AppendMenuIcon(ID_REVERTREV, IDS_LOG_POPUP_REVERTREVS, IDI_REVERT);\r
-                               if (m_hasWC)\r
-                                       popup.AppendMenuIcon(ID_MERGEREV, IDS_LOG_POPUP_MERGEREVS, IDI_MERGE);\r
+//                             if (m_hasWC)\r
+//                                     popup.AppendMenuIcon(ID_MERGEREV, IDS_LOG_POPUP_MERGEREVS, IDI_MERGE);\r
                                bAddSeparator = true;\r
                        }\r
                        if (bAddSeparator)\r
                                popup.AppendMenu(MF_SEPARATOR, NULL);\r
                }\r
-\r
-               if ((selEntries.size() > 0)&&(bAllFromTheSameAuthor))\r
-               {\r
-                       popup.AppendMenuIcon(ID_EDITAUTHOR, IDS_LOG_POPUP_EDITAUTHOR);\r
-               }\r
-               if (m_LogList.GetSelectedCount() == 1)\r
-               {\r
-                       popup.AppendMenuIcon(ID_EDITLOG, IDS_LOG_POPUP_EDITLOG);\r
-                       popup.AppendMenuIcon(ID_REVPROPS, IDS_REPOBROWSE_SHOWREVPROP, IDI_PROPERTIES); // "Show Revision Properties"\r
-                       popup.AppendMenu(MF_SEPARATOR, NULL);\r
-               }\r
+#if 0\r
+//             if ((selEntries.size() > 0)&&(bAllFromTheSameAuthor))\r
+//             {\r
+//                     popup.AppendMenuIcon(ID_EDITAUTHOR, IDS_LOG_POPUP_EDITAUTHOR);\r
+//             }\r
+//             if (m_LogList.GetSelectedCount() == 1)\r
+//             {\r
+//                     popup.AppendMenuIcon(ID_EDITLOG, IDS_LOG_POPUP_EDITLOG);\r
+//                     popup.AppendMenuIcon(ID_REVPROPS, IDS_REPOBROWSE_SHOWREVPROP, IDI_PROPERTIES); // "Show Revision Properties"\r
+//                     popup.AppendMenu(MF_SEPARATOR, NULL);\r
+//             }\r
+#endif\r
                if (m_LogList.GetSelectedCount() != 0)\r
                {\r
                        popup.AppendMenuIcon(ID_COPYCLIPBOARD, IDS_LOG_POPUP_COPYTOCLIPBOARD);\r
@@ -3972,11 +3986,61 @@ void CLogDlg::ShowContextMenuForRevisions(CWnd* /*pWnd*/, CPoint point)
 \r
                int cmd = popup.TrackPopupMenu(TPM_RETURNCMD | TPM_LEFTALIGN | TPM_NONOTIFY, point.x, point.y, this, 0);\r
                DialogEnableWindow(IDOK, FALSE);\r
-               SetPromptApp(&theApp);\r
+//             SetPromptApp(&theApp);\r
                theApp.DoWaitCursor(1);\r
                bool bOpenWith = false;\r
+\r
                switch (cmd)\r
                {\r
+                       case ID_GNUDIFF1:\r
+                       {\r
+//                             if (PromptShown())\r
+//                             {\r
+//                                     GitDiff diff(this, this->m_hWnd, true);\r
+//                                     diff.SetHEADPeg(m_LogRevision);\r
+//                                     diff.ShowUnifiedDiff(m_path, revPrevious, m_path, revSelected);\r
+//                             }\r
+//                             else\r
+//                                     CAppUtils::StartShowUnifiedDiff(m_hWnd, m_path, revPrevious, m_path, revSelected, GitRev(), m_LogRevision);\r
+                       }\r
+                       break;\r
+\r
+                       case ID_GNUDIFF2:\r
+                       {\r
+//                             if (PromptShown())\r
+//                             {\r
+//                                     GitDiff diff(this, this->m_hWnd, true);\r
+//                                     diff.SetHEADPeg(m_LogRevision);\r
+//                                     diff.ShowUnifiedDiff(m_path, revSelected2, m_path, revSelected);\r
+//                             }\r
+//                             else\r
+//                                     CAppUtils::StartShowUnifiedDiff(m_hWnd, m_path, revSelected2, m_path, revSelected, GitRev(), m_LogRevision);\r
+                       }\r
+                       break;\r
+\r
+               case ID_COMPARETWO:\r
+                       {\r
+                               //GitRev * r1 = reinterpret_cast<GitRev*>((*m_arShownList)[FirstSelect]);\r
+                               //GitRev * r2 = reinterpret_cast<GitRev*>((*m_arShownList)[LastSelect]);\r
+                               //if (m_LogList.GetSelectedCount() > 2)\r
+                               //{\r
+                               //      r1 = revHighest;\r
+                               //      r2 = revLowest;\r
+                               //}\r
+                               //user clicked on the menu item "compare revisions"\r
+                               //if (PromptShown())\r
+                               //{\r
+                               //      GitDiff diff(this, m_hWnd, true);\r
+                               //      diff.SetAlternativeTool(!!(GetAsyncKeyState(VK_SHIFT) & 0x8000));\r
+                               //      diff.SetHEADPeg(m_LogRevision);\r
+                               //      diff.ShowCompare(CTGitPath(pathURL), r2, CTGitPath(pathURL), r1);\r
+                               //}\r
+                               //else\r
+                               //      CAppUtils::StartShowCompare(m_hWnd, CTGitPath(pathURL), r2, CTGitPath(pathURL), r1, GitRev(), m_LogRevision, !!(GetAsyncKeyState(VK_SHIFT) & 0x8000));\r
+                       }\r
+                       break;\r
+\r
+#if 0\r
                case ID_GNUDIFF1:\r
                        {\r
                                if (PromptShown())\r
@@ -3989,6 +4053,7 @@ void CLogDlg::ShowContextMenuForRevisions(CWnd* /*pWnd*/, CPoint point)
                                        CAppUtils::StartShowUnifiedDiff(m_hWnd, m_path, revPrevious, m_path, revSelected, GitRev(), m_LogRevision);\r
                        }\r
                        break;\r
+\r
                case ID_GNUDIFF2:\r
                        {\r
                                if (PromptShown())\r
@@ -4433,18 +4498,18 @@ void CLogDlg::ShowContextMenuForRevisions(CWnd* /*pWnd*/, CPoint point)
                                        ShellExecute(this->m_hWnd, _T("open"), url, NULL, NULL, SW_SHOWDEFAULT);                                        \r
                        }\r
                        break;\r
+#endif\r
                default:\r
                        break;\r
                } // switch (cmd)\r
                theApp.DoWaitCursor(-1);\r
                EnableOKButton();\r
        } // if (popup.CreatePopupMenu())\r
-#endif\r
 }\r
 \r
 void CLogDlg::ShowContextMenuForChangedpaths(CWnd* /*pWnd*/, CPoint point)\r
 {\r
-#if 0\r
+\r
        int selIndex = m_ChangedFileListCtrl.GetSelectionMark();\r
        if ((point.x == -1) && (point.y == -1))\r
        {\r
@@ -4464,8 +4529,10 @@ void CLogDlg::ShowContextMenuForChangedpaths(CWnd* /*pWnd*/, CPoint point)
        if (pos == NULL)\r
                return; // nothing is selected, get out of here\r
 \r
-       PLOGENTRYDATA pLogEntry = reinterpret_cast<PLOGENTRYDATA>(m_arShownList.GetAt(m_LogList.GetNextSelectedItem(pos)));\r
-       git_revnum_t rev1 = pLogEntry->Rev;\r
+       bool bOneRev = true;\r
+#if 0\r
+       GitRev * pLogEntry = reinterpret_cast<GitRev *>(m_arShownList.GetAt(m_LogList.GetNextSelectedItem(pos)));\r
+       git_revnum_t rev1 = pLogEntry;\r
        git_revnum_t rev2 = rev1;\r
        bool bOneRev = true;\r
        if (pos)\r
@@ -4544,7 +4611,7 @@ void CLogDlg::ShowContextMenuForChangedpaths(CWnd* /*pWnd*/, CPoint point)
                        }\r
                }\r
        }\r
-\r
+#endif\r
        //entry is selected, now show the popup menu\r
        CIconMenu popup;\r
        if (popup.CreatePopupMenu())\r
@@ -4552,7 +4619,7 @@ void CLogDlg::ShowContextMenuForChangedpaths(CWnd* /*pWnd*/, CPoint point)
                bool bEntryAdded = false;\r
                if (m_ChangedFileListCtrl.GetSelectedCount() == 1)\r
                {\r
-                       if ((!bOneRev)||(IsDiffPossible(changedlogpaths[0], rev1)))\r
+//                     if ((!bOneRev)||(IsDiffPossible(changedlogpaths[0], rev1)))\r
                        {\r
                                popup.AppendMenuIcon(ID_DIFF, IDS_LOG_POPUP_DIFF, IDI_DIFF);\r
                                popup.AppendMenuIcon(ID_BLAMEDIFF, IDS_LOG_POPUP_BLAMEDIFF, IDI_BLAME);\r
@@ -4560,7 +4627,7 @@ void CLogDlg::ShowContextMenuForChangedpaths(CWnd* /*pWnd*/, CPoint point)
                                popup.AppendMenuIcon(ID_GNUDIFF1, IDS_LOG_POPUP_GNUDIFF_CH, IDI_DIFF);\r
                                bEntryAdded = true;\r
                        }\r
-                       if (rev2 == rev1-1)\r
+//                     if (rev2 == rev1-1)\r
                        {\r
                                if (bEntryAdded)\r
                                        popup.AppendMenu(MF_SEPARATOR, NULL);\r
@@ -4597,6 +4664,7 @@ void CLogDlg::ShowContextMenuForChangedpaths(CWnd* /*pWnd*/, CPoint point)
                bool bOpenWith = false;\r
                bool bMergeLog = false;\r
                m_bCancelled = false;\r
+#if 0\r
                switch (cmd)\r
                {\r
                case ID_DIFF:\r
@@ -4968,8 +5036,8 @@ void CLogDlg::ShowContextMenuForChangedpaths(CWnd* /*pWnd*/, CPoint point)
                default:\r
                        break;\r
                } // switch (cmd)\r
-       } // if (popup.CreatePopupMenu())\r
 #endif\r
+       } // if (popup.CreatePopupMenu())\r
 }\r
 \r
 void CLogDlg::OnDtnDropdownDatefrom(NMHDR * /*pNMHDR*/, LRESULT *pResult)\r