From aa2c52e9e541cfc54c05aa385616334a1da94c95 Mon Sep 17 00:00:00 2001 From: Sven Strickroth Date: Sat, 1 Oct 2011 01:54:16 +0200 Subject: [PATCH] drop repositorybrowser Signed-off-by: Sven Strickroth --- src/Resources/TortoiseProcENG.rc | 99 - src/TortoiseGitBlame/LogListBlameAction.cpp | 10 - src/TortoiseGitSetup/StructureFragment.wxi | 21 - src/TortoiseProc/Commands/Command.cpp | 4 - src/TortoiseProc/GitLogListAction.cpp | 10 - src/TortoiseProc/RepoDrags.cpp | 360 --- src/TortoiseProc/RepoDrags.h | 65 - src/TortoiseProc/RepositoryBar.cpp | 404 --- src/TortoiseProc/RepositoryBar.h | 163 -- src/TortoiseProc/RepositoryBrowser.cpp | 2935 -------------------- src/TortoiseProc/RepositoryBrowser.h | 302 -- .../RevisionGraph/RevisionGraphWnd.cpp | 1481 ---------- src/TortoiseProc/TortoiseProc.vcproj | 4 - src/TortoiseProc/resource.h | 46 - src/TortoiseShell/resource.h | 2 - src/TortoiseShell/resourceshell.rc | 2 - 16 files changed, 5908 deletions(-) delete mode 100644 src/TortoiseProc/RepoDrags.cpp delete mode 100644 src/TortoiseProc/RepoDrags.h delete mode 100644 src/TortoiseProc/RepositoryBar.cpp delete mode 100644 src/TortoiseProc/RepositoryBar.h delete mode 100644 src/TortoiseProc/RepositoryBrowser.cpp delete mode 100644 src/TortoiseProc/RepositoryBrowser.h delete mode 100644 src/TortoiseProc/RevisionGraph/RevisionGraphWnd.cpp diff --git a/src/Resources/TortoiseProcENG.rc b/src/Resources/TortoiseProcENG.rc index 2e61bb5cd..9f35b950d 100644 --- a/src/Resources/TortoiseProcENG.rc +++ b/src/Resources/TortoiseProcENG.rc @@ -426,20 +426,6 @@ BEGIN PUSHBUTTON "Cancel",IDCANCEL,177,34,50,14 END -IDD_REPOSITORY_BROWSER DIALOGEX 0, 0, 415, 279 -STYLE DS_SETFONT | DS_FIXEDSYS | WS_MINIMIZEBOX | WS_MAXIMIZEBOX | WS_POPUP | WS_CAPTION | WS_SYSMENU | WS_THICKFRAME -CAPTION "Repository Browser" -FONT 8, "MS Shell Dlg", 400, 0, 0x1 -BEGIN - CONTROL "",IDC_REPOS_BAR_CNR,"Static",SS_OWNERDRAW | WS_TABSTOP,7,6,401,16 - CONTROL "",IDC_REPOTREE,"SysTreeView32",TVS_HASBUTTONS | TVS_HASLINES | TVS_LINESATROOT | TVS_EDITLABELS | TVS_SHOWSELALWAYS | WS_BORDER | WS_TABSTOP,7,22,160,227,WS_EX_CLIENTEDGE - CONTROL "",IDC_REPOLIST,"SysListView32",LVS_REPORT | LVS_SHOWSELALWAYS | LVS_SHAREIMAGELISTS | LVS_EDITLABELS | LVS_ALIGNLEFT | WS_BORDER | WS_TABSTOP,170,22,238,227,WS_EX_ACCEPTFILES | WS_EX_CLIENTEDGE - LTEXT "Hint: Press F5 to refresh the selected subtree and Ctrl-F5 to load all children too",IDC_F5HINT,7,255,217,17 - DEFPUSHBUTTON "OK",IDOK,246,258,50,14 - PUSHBUTTON "Cancel",IDCANCEL,302,258,50,14 - PUSHBUTTON "Help",IDHELP,358,258,50,14 -END - IDD_SETTINGSMAIN DIALOGEX 0, 0, 300, 217 STYLE DS_SETFONT | DS_FIXEDSYS | WS_CHILD | WS_DISABLED | WS_CAPTION CAPTION "General" @@ -2256,18 +2242,6 @@ BEGIN BOTTOMMARGIN, 48 END - IDD_REPOSITORY_BROWSER, DIALOG - BEGIN - LEFTMARGIN, 7 - RIGHTMARGIN, 408 - VERTGUIDE, 224 - VERTGUIDE, 352 - TOPMARGIN, 6 - BOTTOMMARGIN, 272 - HORZGUIDE, 22 - HORZGUIDE, 249 - END - IDD_SETTINGSMAIN, DIALOG BEGIN LEFTMARGIN, 7 @@ -3265,19 +3239,6 @@ BEGIN "F", ID_VIEW_FILTER, VIRTKEY, CONTROL, NOINVERT END -IDR_ACC_REPOBROWSER ACCELERATORS -BEGIN - VK_DELETE, ID_DELETEBROWSERITEM, VIRTKEY, NOINVERT - "C", ID_EDIT_COPY, VIRTKEY, CONTROL, NOINVERT - VK_INSERT, ID_EDIT_COPY, VIRTKEY, CONTROL, NOINVERT - VK_F2, ID_INLINEEDIT, VIRTKEY, NOINVERT - VK_F5, ID_REFRESHBROWSER, VIRTKEY, NOINVERT - VK_F5, ID_REFRESHBROWSER, VIRTKEY, CONTROL, NOINVERT - "D", ID_URL_FOCUS, VIRTKEY, ALT, NOINVERT - "L", ID_URL_FOCUS, VIRTKEY, CONTROL, NOINVERT - VK_BACK, ID_URL_UP, VIRTKEY, NOINVERT -END - IDR_ACC_COMMITDLG ACCELERATORS BEGIN "M", ID_FOCUS_MESSAGE, VIRTKEY, ALT, NOINVERT @@ -3547,19 +3508,6 @@ BEGIN IDS_REPOBROWSE_SAVEAS "Save &as..." IDS_REPOBROWSE_SHOWLOG "Show &log" IDS_REPOBROWSE_OPEN "&Open" - IDS_REPOBROWSE_COPY "&Copy to..." - IDS_REPOBROWSE_DELETE "&Delete..." - IDS_REPOBROWSE_IMPORT "Add &file..." - IDS_REPOBROWSE_RENAME "&Rename" - IDS_REPOBROWSE_MKDIR "C&reate folder..." - IDS_REPOBROWSE_IMPORTFOLDER "A&dd folder..." - IDS_REPOBROWSE_REFRESH "Refresh" - IDS_REPOBROWSE_SHOWPROP "Sho&w properties" - IDS_REPOBROWSE_COPYTOWC "Copy to working copy..." - IDS_REPOBROWSE_URLTOCLIPBOARD "Copy URL to clipboard" - IDS_REPOBROWSE_COPYERROR "Copy error message to clipboard" - IDS_REPOBROWSE_SHOWDIFF "&Compare URLs" - IDS_REPOBROWSE_PREPAREDIFF "Mark for comparison" END STRINGTABLE @@ -3661,7 +3609,6 @@ END STRINGTABLE BEGIN IDS_LOG_COMPAREWITHBASE "Compare with b&ase" - IDS_LOG_BROWSEREPO "&Browse repository" END STRINGTABLE @@ -3680,12 +3627,6 @@ END STRINGTABLE BEGIN - IDS_REPO_BROWSEREV "Revision: " - IDS_REPO_BROWSEURL "URL: " -END - -STRINGTABLE -BEGIN IDS_DIFF_WCNAME "%s : Working Copy" IDS_DIFF_BASENAME "%s : Working Base" IDS_DIFF_WORKINGCOPY ": working copy" @@ -4079,26 +4020,6 @@ END STRINGTABLE BEGIN - IDS_REPOBROWSE_SAVEASPROGTITLE "Saving files" - IDS_REPOBROWSE_SAVEAS_LINE1 "Saving file %s" - IDS_REPOBROWSE_SAVEAS_LINE2 "to %s" - IDS_REPOBROWSE_COPYTOWCPROGTITLE "Copy to working copy" - IDS_REPOBROWSE_COPYTOWC_LINE1 "Copy %s" - IDS_REPOBROWSE_COPYTOWC_LINE2 "to %s" - IDS_REPOBROWSE_COPYDROP "Copy items to here" - IDS_REPOBROWSE_MOVEDROP "Move items to here" -END - -STRINGTABLE -BEGIN - IDS_REPOBROWSE_COPYRENAMEDROP "Copy and rename item to here" - IDS_REPOBROWSE_MOVERENAMEDROP "Move and rename item to here" - IDS_REPOBROWSE_INITWAIT "Please wait while the repository browser is initializing..." - IDS_REPOBROWSE_WAIT "Please wait..." -END - -STRINGTABLE -BEGIN IDS_REVGRAPH_POPUP_COMPAREREVS "&Compare revisions" IDS_REVGRAPH_POPUP_COMPAREHEADS "Compare &HEAD revisions" IDS_REVGRAPH_POPUP_UNIDIFFREVS "&Unified diff" @@ -4107,20 +4028,6 @@ END STRINGTABLE BEGIN - IDS_REPOBROWSE_MULTIIMPORT - "You dropped more than one file or folder to add to the repository.\nIt's not possible to do that in one step, so TortoiseGit will add each file/folder\nindividually, creating a new revision for every added item.\n\nDo you still want to do this?" - IDS_REPOBROWSE_MOVETRUNK - "You are trying to move the trunk folder!\nAre you absolutely sure that you want to move\nthe trunk folder?" -END - -STRINGTABLE -BEGIN - IDS_REPOBROWSE_URLALREADYEXISTS "The target URL\n%s\nalready exists!" - IDS_REPOBROWSE_INVALIDDROPDATA "Invalid data object dropped!" -END - -STRINGTABLE -BEGIN IDS_FILEDIFF_FILE "File" IDS_FILEDIFF_ACTION "Action" IDS_FILEDIFF_WAIT "Please wait while differences are obtained..." @@ -4652,12 +4559,6 @@ END STRINGTABLE BEGIN - IDS_REPOBROWSE_TT_HEADREV "Head revision is %s" - IDS_REPOBROWSE_TT_UPFOLDER "Up one folder" -END - -STRINGTABLE -BEGIN IDS_PROGRS_CMD_UNLOCK "Unlock" IDS_PROGRS_CMD_UPDATE "Update" IDS_PROGRS_CMD_MERGEREINTEGRATE "Reintegrate merge %s into %s" diff --git a/src/TortoiseGitBlame/LogListBlameAction.cpp b/src/TortoiseGitBlame/LogListBlameAction.cpp index 356a0c4fc..1970024f5 100644 --- a/src/TortoiseGitBlame/LogListBlameAction.cpp +++ b/src/TortoiseGitBlame/LogListBlameAction.cpp @@ -401,16 +401,6 @@ void CGitBlameLogList::ContextMenuAction(int cmd,int FirstSelect, int LastSelect } } break; - case ID_REPOBROWSE: - { - CString sCmd; - sCmd.Format(_T("%s /command:repobrowser /path:\"%s\" /rev:%s"), - (LPCTSTR)(CPathUtils::GetAppDirectory()+_T("TortoiseProc.exe")), - (LPCTSTR)pathURL, (LPCTSTR)revSelected.ToString()); - - CAppUtils::LaunchApplication(sCmd, NULL, false); - } - break; case ID_EDITLOG: { EditLogMessage(selIndex); diff --git a/src/TortoiseGitSetup/StructureFragment.wxi b/src/TortoiseGitSetup/StructureFragment.wxi index 4ba402efa..219b524f9 100644 --- a/src/TortoiseGitSetup/StructureFragment.wxi +++ b/src/TortoiseGitSetup/StructureFragment.wxi @@ -747,27 +747,6 @@ - - diff --git a/src/TortoiseProc/Commands/Command.cpp b/src/TortoiseProc/Commands/Command.cpp index 9c229fe8e..86c358696 100644 --- a/src/TortoiseProc/Commands/Command.cpp +++ b/src/TortoiseProc/Commands/Command.cpp @@ -153,7 +153,6 @@ typedef enum cmdRemove, cmdRebase, cmdRename, - cmdRepoBrowser, cmdRepoCreate, cmdRepoStatus, cmdResolve, @@ -231,7 +230,6 @@ static const struct CommandInfo { cmdRemove, _T("remove") }, { cmdRebase, _T("rebase") }, { cmdRename, _T("rename") }, - { cmdRepoBrowser, _T("repobrowser") }, { cmdRepoCreate, _T("repocreate") }, { cmdRepoStatus, _T("repostatus") }, { cmdResolve, _T("resolve") }, @@ -417,8 +415,6 @@ Command * CommandServer::GetCommand(const CString& sCmd) return new RebuildIconCacheCommand; case cmdRelocate: return new RelocateCommand; - case cmdRepoBrowser: - return new RepositoryBrowserCommand; case cmdRevisionGraph: return new RevisionGraphCommand; case cmdShowCompare: diff --git a/src/TortoiseProc/GitLogListAction.cpp b/src/TortoiseProc/GitLogListAction.cpp index da584f9c1..8a529a71e 100644 --- a/src/TortoiseProc/GitLogListAction.cpp +++ b/src/TortoiseProc/GitLogListAction.cpp @@ -928,16 +928,6 @@ void CGitLogList::ContextMenuAction(int cmd,int FirstSelect, int LastSelect, CMe } break; - case ID_REPOBROWSE: - { - CString sCmd; - sCmd.Format(_T("%s /command:repobrowser /path:\"%s\" /rev:%s"), - (LPCTSTR)(CPathUtils::GetAppDirectory()+_T("TortoiseProc.exe")), - (LPCTSTR)pathURL, (LPCTSTR)revSelected.ToString()); - - CAppUtils::LaunchApplication(sCmd, NULL, false); - } - break; case ID_EDITLOG: { EditLogMessage(selIndex); diff --git a/src/TortoiseProc/RepoDrags.cpp b/src/TortoiseProc/RepoDrags.cpp deleted file mode 100644 index 37acf61b8..000000000 --- a/src/TortoiseProc/RepoDrags.cpp +++ /dev/null @@ -1,360 +0,0 @@ -// TortoiseSVN - a Windows shell extension for easy version control - -// Copyright (C) 2003-2008 - TortoiseSVN - -// This program is free software; you can redistribute it and/or -// modify it under the terms of the GNU General Public License -// as published by the Free Software Foundation; either version 2 -// of the License, or (at your option) any later version. - -// This program is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// GNU General Public License for more details. - -// You should have received a copy of the GNU General Public License -// along with this program; if not, write to the Free Software Foundation, -// 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. -// -#include "StdAfx.h" -#include "RepoDrags.h" -#include "RepositoryBrowser.h" -#include "SVNDataObject.h" - -CTreeDropTarget::CTreeDropTarget(CRepositoryBrowser * pRepoBrowser) : CIDropTarget(pRepoBrowser->m_RepoTree.GetSafeHwnd()) - , m_pRepoBrowser(pRepoBrowser) - , m_bFiles(false) -{ -} - -bool CTreeDropTarget::OnDrop(FORMATETC* pFmtEtc, STGMEDIUM& medium, DWORD *pdwEffect, POINTL pt) -{ - // find the target - CString targetUrl; - HTREEITEM hDropTarget = m_pRepoBrowser->m_RepoTree.GetNextItem(TVI_ROOT, TVGN_DROPHILITE); - if (hDropTarget) - { - CTreeItem * pItem = (CTreeItem*)m_pRepoBrowser->m_RepoTree.GetItemData(hDropTarget); - if (pItem == NULL) - return false; - targetUrl = pItem->url; - } - if (pFmtEtc->cfFormat == CF_UNICODETEXT && medium.tymed == TYMED_HGLOBAL) - { - TCHAR* pStr = (TCHAR*)GlobalLock(medium.hGlobal); - CString urls; - if(pStr != NULL) - { - urls = pStr; - } - GlobalUnlock(medium.hGlobal); - urls.Replace(_T("\r\n"), _T("*")); - CTSVNPathList urlList; - urlList.LoadFromAsteriskSeparatedString(urls); - - m_pRepoBrowser->OnDrop(CTSVNPath(targetUrl), urlList, m_pRepoBrowser->GetRevision(), *pdwEffect, pt); - } - - if (pFmtEtc->cfFormat == CF_SVNURL && medium.tymed == TYMED_HGLOBAL) - { - TCHAR* pStr = (TCHAR*)GlobalLock(medium.hGlobal); - CString urls; - if(pStr != NULL) - { - urls = pStr; - } - GlobalUnlock(medium.hGlobal); - urls.Replace(_T("\r\n"), _T("*")); - CTSVNPathList urlListRevs; - urlListRevs.LoadFromAsteriskSeparatedString(urls); - CTSVNPathList urlList; - SVNRev srcRev; - for (int i=0; i 0) - { - if (!srcRev.IsValid()) - srcRev = SVNRev(urlListRevs[i].GetSVNPathString().Mid(pos+1)); - urlList.AddPath(CTSVNPath(urlListRevs[i].GetSVNPathString().Left(pos))); - } - else - urlList.AddPath(urlListRevs[i]); - } - - m_pRepoBrowser->OnDrop(CTSVNPath(targetUrl), urlList, srcRev, *pdwEffect, pt); - } - - if(pFmtEtc->cfFormat == CF_HDROP && medium.tymed == TYMED_HGLOBAL) - { - HDROP hDrop = (HDROP)GlobalLock(medium.hGlobal); - if(hDrop != NULL) - { - CTSVNPathList urlList; - TCHAR szFileName[MAX_PATH]; - - UINT cFiles = DragQueryFile(hDrop, 0xFFFFFFFF, NULL, 0); - for(UINT i = 0; i < cFiles; ++i) - { - DragQueryFile(hDrop, i, szFileName, sizeof(szFileName)); - urlList.AddPath(CTSVNPath(szFileName)); - } - m_pRepoBrowser->OnDrop(CTSVNPath(targetUrl), urlList, m_pRepoBrowser->GetRevision(), *pdwEffect, pt); - } - GlobalUnlock(medium.hGlobal); - } - TreeView_SelectDropTarget(m_hTargetWnd, NULL); - return true; -} - -HRESULT CTreeDropTarget::DragEnter(IDataObject __RPC_FAR *pDataObj, DWORD grfKeyState, POINTL pt, DWORD __RPC_FAR *pdwEffect) -{ - FORMATETC ftetc={0}; - ftetc.dwAspect = DVASPECT_CONTENT; - ftetc.lindex = -1; - ftetc.tymed = TYMED_HGLOBAL; - ftetc.cfFormat=CF_HDROP; - if (pDataObj->QueryGetData(&ftetc) == S_OK) - m_bFiles = true; - else - m_bFiles = false; - m_dwHoverStartTicks = 0; - hLastItem = NULL; - return CIDropTarget::DragEnter(pDataObj, grfKeyState, pt, pdwEffect); -} - -HRESULT CTreeDropTarget::DragOver(DWORD grfKeyState, POINTL pt, DWORD __RPC_FAR *pdwEffect) -{ - TVHITTESTINFO hit; - hit.pt = (POINT&)pt; - ScreenToClient(m_hTargetWnd,&hit.pt); - hit.flags = TVHT_ONITEM; - HTREEITEM hItem = TreeView_HitTest(m_hTargetWnd,&hit); - if (hItem != hLastItem) - m_dwHoverStartTicks = 0; - hLastItem = hItem; - - *pdwEffect = DROPEFFECT_MOVE; - if (grfKeyState & MK_CONTROL) - *pdwEffect = DROPEFFECT_COPY; - - if (hItem != NULL) - { - if (m_bFiles) - *pdwEffect = DROPEFFECT_COPY; - TreeView_SelectDropTarget(m_hTargetWnd, hItem); - if ((m_pRepoBrowser->m_RepoTree.GetItemState(hItem, TVIS_EXPANDED)&TVIS_EXPANDED) != TVIS_EXPANDED) - { - if (m_dwHoverStartTicks == 0) - m_dwHoverStartTicks = GetTickCount(); - UINT timeout = 0; - //SystemParametersInfo(SPI_GETMOUSEHOVERTIME, 0, &timeout, 0); - timeout = 2000; - if ((GetTickCount() - m_dwHoverStartTicks) > timeout) - { - // expand the item - m_pRepoBrowser->m_RepoTree.Expand(hItem, TVE_EXPAND); - m_dwHoverStartTicks = 0; - } - } - else - m_dwHoverStartTicks = 0; - } - else - { - TreeView_SelectDropTarget(m_hTargetWnd, NULL); - *pdwEffect = DROPEFFECT_NONE; - m_dwHoverStartTicks = 0; - } - CRect rect; - m_pRepoBrowser->m_RepoTree.GetWindowRect(&rect); - if (rect.PtInRect((POINT&)pt)) - { - if (pt.y > (rect.bottom-20)) - { - m_pRepoBrowser->m_RepoTree.SendMessage(WM_VSCROLL, MAKEWPARAM (SB_LINEDOWN, 0), NULL); - m_dwHoverStartTicks = 0; - } - if (pt.y < (rect.top+20)) - { - m_pRepoBrowser->m_RepoTree.SendMessage(WM_VSCROLL, MAKEWPARAM (SB_LINEUP, 0), NULL); - m_dwHoverStartTicks = 0; - } - } - - return CIDropTarget::DragOver(grfKeyState, pt, pdwEffect); -} - -HRESULT CTreeDropTarget::DragLeave(void) -{ - TreeView_SelectDropTarget(m_hTargetWnd, NULL); - m_dwHoverStartTicks = 0; - return CIDropTarget::DragLeave(); -} - -CListDropTarget::CListDropTarget(CRepositoryBrowser * pRepoBrowser):CIDropTarget(pRepoBrowser->m_RepoList.GetSafeHwnd()) - , m_pRepoBrowser(pRepoBrowser) - , m_bFiles(false) -{ -} - -bool CListDropTarget::OnDrop(FORMATETC* pFmtEtc, STGMEDIUM& medium, DWORD *pdwEffect, POINTL pt) -{ - // find the target url - CString targetUrl; - int targetIndex = m_pRepoBrowser->m_RepoList.GetNextItem(-1, LVNI_DROPHILITED); - if (targetIndex >= 0) - { - targetUrl = ((CItem*)m_pRepoBrowser->m_RepoList.GetItemData(targetIndex))->absolutepath; - } - else - { - HTREEITEM hDropTarget = m_pRepoBrowser->m_RepoTree.GetSelectedItem(); - if (hDropTarget) - { - targetUrl = ((CTreeItem*)m_pRepoBrowser->m_RepoTree.GetItemData(hDropTarget))->url; - } - } - if(pFmtEtc->cfFormat == CF_UNICODETEXT && medium.tymed == TYMED_HGLOBAL) - { - TCHAR* pStr = (TCHAR*)GlobalLock(medium.hGlobal); - CString urls; - if(pStr != NULL) - { - urls = pStr; - } - GlobalUnlock(medium.hGlobal); - urls.Replace(_T("\r\n"), _T("*")); - CTSVNPathList urlList; - urlList.LoadFromAsteriskSeparatedString(urls); - m_pRepoBrowser->OnDrop(CTSVNPath(targetUrl), urlList, m_pRepoBrowser->GetRevision(), *pdwEffect, pt); - } - if(pFmtEtc->cfFormat == CF_SVNURL && medium.tymed == TYMED_HGLOBAL) - { - TCHAR* pStr = (TCHAR*)GlobalLock(medium.hGlobal); - CString urls; - if(pStr != NULL) - { - urls = pStr; - } - GlobalUnlock(medium.hGlobal); - urls.Replace(_T("\r\n"), _T("*")); - CTSVNPathList urlListRevs; - urlListRevs.LoadFromAsteriskSeparatedString(urls); - CTSVNPathList urlList; - SVNRev srcRev; - for (int i=0; i 0) - { - if (!srcRev.IsValid()) - srcRev = SVNRev(urlListRevs[i].GetSVNPathString().Mid(pos+1)); - urlList.AddPath(CTSVNPath(urlListRevs[i].GetSVNPathString().Left(pos))); - } - else - urlList.AddPath(urlListRevs[i]); - } - - m_pRepoBrowser->OnDrop(CTSVNPath(targetUrl), urlList, srcRev, *pdwEffect, pt); - } - - if(pFmtEtc->cfFormat == CF_HDROP && medium.tymed == TYMED_HGLOBAL) - { - HDROP hDrop = (HDROP)GlobalLock(medium.hGlobal); - if(hDrop != NULL) - { - CTSVNPathList urlList; - TCHAR szFileName[MAX_PATH]; - - UINT cFiles = DragQueryFile(hDrop, 0xFFFFFFFF, NULL, 0); - for(UINT i = 0; i < cFiles; ++i) - { - DragQueryFile(hDrop, i, szFileName, sizeof(szFileName)); - urlList.AddPath(CTSVNPath(szFileName)); - } - m_pRepoBrowser->OnDrop(CTSVNPath(targetUrl), urlList, m_pRepoBrowser->GetRevision(), *pdwEffect, pt); - } - GlobalUnlock(medium.hGlobal); - } - ListView_SetItemState(m_hTargetWnd, -1, 0, LVIS_DROPHILITED); - return true; //let base free the medium -} - -HRESULT CListDropTarget::DragEnter(IDataObject __RPC_FAR *pDataObj, DWORD grfKeyState, POINTL pt, DWORD __RPC_FAR *pdwEffect) -{ - FORMATETC ftetc={0}; - ftetc.dwAspect = DVASPECT_CONTENT; - ftetc.lindex = -1; - ftetc.tymed = TYMED_HGLOBAL; - ftetc.cfFormat=CF_HDROP; - if (pDataObj->QueryGetData(&ftetc) == S_OK) - { - m_bFiles = true; - } - else - { - m_bFiles = false; - } - return CIDropTarget::DragEnter(pDataObj, grfKeyState, pt, pdwEffect); -} - - -HRESULT CListDropTarget::DragOver(DWORD grfKeyState, POINTL pt, DWORD __RPC_FAR *pdwEffect) -{ - LVHITTESTINFO hit; - hit.pt = (POINT&)pt; - ScreenToClient(m_hTargetWnd,&hit.pt); - hit.flags = LVHT_ONITEM; - int iItem = ListView_HitTest(m_hTargetWnd,&hit); - - *pdwEffect = DROPEFFECT_MOVE; - if (grfKeyState & MK_CONTROL) - *pdwEffect = DROPEFFECT_COPY; - - if (iItem >= 0) - { - CItem * pItem = (CItem*)m_pRepoBrowser->m_RepoList.GetItemData(iItem); - if (pItem) - { - if (pItem->kind != svn_node_dir) - { - *pdwEffect = DROPEFFECT_NONE; - ListView_SetItemState(m_hTargetWnd, -1, 0, LVIS_DROPHILITED); - } - else - { - if (m_bFiles) - *pdwEffect = DROPEFFECT_COPY; - ListView_SetItemState(m_hTargetWnd, -1, 0, LVIS_DROPHILITED); - ListView_SetItemState(m_hTargetWnd, iItem, LVIS_DROPHILITED, LVIS_DROPHILITED); - } - } - } - else - { - ListView_SetItemState(m_hTargetWnd, -1, 0, LVIS_DROPHILITED); - } - - CRect rect; - m_pRepoBrowser->m_RepoList.GetWindowRect(&rect); - if (rect.PtInRect((POINT&)pt)) - { - if (pt.y > (rect.bottom-20)) - { - m_pRepoBrowser->m_RepoList.SendMessage(WM_VSCROLL, MAKEWPARAM (SB_LINEDOWN, 0), NULL); - } - if (pt.y < (rect.top+20)) - { - m_pRepoBrowser->m_RepoList.SendMessage(WM_VSCROLL, MAKEWPARAM (SB_LINEUP, 0), NULL); - } - } - - return CIDropTarget::DragOver(grfKeyState, pt, pdwEffect); -} - -HRESULT CListDropTarget::DragLeave(void) -{ - ListView_SetItemState(m_hTargetWnd, -1, 0, LVIS_DROPHILITED); - return CIDropTarget::DragLeave(); -} diff --git a/src/TortoiseProc/RepoDrags.h b/src/TortoiseProc/RepoDrags.h deleted file mode 100644 index 9e3431c27..000000000 --- a/src/TortoiseProc/RepoDrags.h +++ /dev/null @@ -1,65 +0,0 @@ -// TortoiseSVN - a Windows shell extension for easy version control - -// Copyright (C) 2003-2008 - Stefan Kueng - -// This program is free software; you can redistribute it and/or -// modify it under the terms of the GNU General Public License -// as published by the Free Software Foundation; either version 2 -// of the License, or (at your option) any later version. - -// This program is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// GNU General Public License for more details. - -// You should have received a copy of the GNU General Public License -// along with this program; if not, write to the Free Software Foundation, -// 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. -// -#pragma once -#include "DragDropImpl.h" - - -class CItem; -class CTreeItem; -class CRepositoryBrowser; - -/** - * \ingroup TortoiseProc - * Implements a drop target on the left tree control in the repository browser - */ -class CTreeDropTarget : public CIDropTarget -{ -public: - CTreeDropTarget(CRepositoryBrowser * pRepoBrowser); - - virtual bool OnDrop(FORMATETC* pFmtEtc, STGMEDIUM& medium, DWORD *pdwEffect, POINTL pt); - virtual HRESULT STDMETHODCALLTYPE DragEnter(IDataObject __RPC_FAR *pDataObj, DWORD grfKeyState, POINTL pt, DWORD __RPC_FAR *pdwEffect); - virtual HRESULT STDMETHODCALLTYPE DragOver(DWORD grfKeyState, POINTL pt, DWORD __RPC_FAR *pdwEffect); - virtual HRESULT STDMETHODCALLTYPE DragLeave(void); - -private: - CRepositoryBrowser * m_pRepoBrowser; - bool m_bFiles; - DWORD m_dwHoverStartTicks; - HTREEITEM hLastItem; -}; - -/** - * \ingroup TortoiseProc - * Implements a drop target on the right list control in the repository browser - */ -class CListDropTarget : public CIDropTarget -{ -public: - CListDropTarget(CRepositoryBrowser * pRepoBrowser); - - virtual bool OnDrop(FORMATETC* pFmtEtc, STGMEDIUM& medium, DWORD *pdwEffect, POINTL pt); - virtual HRESULT STDMETHODCALLTYPE DragEnter(IDataObject __RPC_FAR *pDataObj, DWORD grfKeyState, POINTL pt, DWORD __RPC_FAR *pdwEffect); - virtual HRESULT STDMETHODCALLTYPE DragOver(DWORD grfKeyState, POINTL pt, DWORD __RPC_FAR *pdwEffect); - virtual HRESULT STDMETHODCALLTYPE DragLeave(void); - -private: - CRepositoryBrowser * m_pRepoBrowser; - bool m_bFiles; -}; diff --git a/src/TortoiseProc/RepositoryBar.cpp b/src/TortoiseProc/RepositoryBar.cpp deleted file mode 100644 index 9f4e39714..000000000 --- a/src/TortoiseProc/RepositoryBar.cpp +++ /dev/null @@ -1,404 +0,0 @@ -// TortoiseSVN - a Windows shell extension for easy version control - -// Copyright (C) 2003-2008 - TortoiseSVN - -// This program is free software; you can redistribute it and/or -// modify it under the terms of the GNU General Public License -// as published by the Free Software Foundation; either version 2 -// of the License, or (at your option) any later version. - -// This program is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// GNU General Public License for more details. - -// You should have received a copy of the GNU General Public License -// along with this program; if not, write to the Free Software Foundation, -// 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. -// -#include "stdafx.h" -#include "TortoiseProc.h" -#include "RepositoryBar.h" -#include "RevisionDlg.h" -#include "SVNInfo.h" -#include "SVN.h" -#include "WaitCursorEx.h" - -#define IDC_URL_COMBO 10000 -#define IDC_REVISION_BTN 10001 -#define IDC_UP_BTN 10002 - -IMPLEMENT_DYNAMIC(CRepositoryBar, CReBarCtrl) - -#pragma warning(push) -#pragma warning(disable: 4355) // 'this' used in base member initializer list - -CRepositoryBar::CRepositoryBar() : m_cbxUrl(this) - , m_pRepo(NULL) -{ - m_UpIcon = (HICON)LoadImage(AfxGetResourceHandle(), MAKEINTRESOURCE(IDI_UP), IMAGE_ICON, 16, 16, LR_DEFAULTCOLOR); -} - -#pragma warning(pop) - -CRepositoryBar::~CRepositoryBar() -{ - if (m_UpIcon) - DestroyIcon(m_UpIcon); -} - -BEGIN_MESSAGE_MAP(CRepositoryBar, CReBarCtrl) - ON_CBN_SELCHANGE(IDC_URL_COMBO, OnCbnSelChange) - ON_BN_CLICKED(IDC_REVISION_BTN, OnBnClicked) - ON_BN_CLICKED(IDC_UP_BTN, OnGoUp) - ON_WM_DESTROY() -END_MESSAGE_MAP() - -bool CRepositoryBar::Create(CWnd* parent, UINT id, bool in_dialog) -{ - CRect rect; - ASSERT(parent != 0); - parent->GetWindowRect(&rect); - - DWORD style = WS_CHILD | WS_VISIBLE | WS_CLIPSIBLINGS | WS_CLIPCHILDREN - | CCS_TOP | RBS_AUTOSIZE | RBS_VARHEIGHT; - - DWORD style_ex = WS_EX_TOOLWINDOW | WS_EX_TRANSPARENT; - - if (in_dialog) - { - style |= CCS_NODIVIDER; - } - else - { - style |= RBS_BANDBORDERS; - } - - if (CReBarCtrl::CreateEx(style_ex, style, CRect(0,0,200,100), parent, id)) - { - CFont *font = parent->GetFont(); - CString temp; - - REBARINFO rbi; - SecureZeroMemory(&rbi, sizeof rbi); - rbi.cbSize = sizeof rbi; - rbi.fMask = 0; - rbi.himl = (HIMAGELIST)0; - - if (!this->SetBarInfo(&rbi)) - return false; - - REBARBANDINFO rbbi; - SecureZeroMemory(&rbbi, sizeof rbbi); - rbbi.cbSize = sizeof rbbi; - rbbi.fMask = RBBIM_TEXT | RBBIM_STYLE | RBBIM_CHILD | RBBIM_CHILDSIZE | RBBIM_SIZE; - rbbi.fStyle = RBBS_NOGRIPPER | RBBS_FIXEDBMP; - - if (in_dialog) - rbbi.fMask |= RBBIM_COLORS; - else - rbbi.fMask |= RBBS_CHILDEDGE; - - // Create the "URL" combo box control to be added - rect = CRect(0, 0, 100, 400); - m_cbxUrl.Create(WS_CHILD | WS_TABSTOP | CBS_DROPDOWN, rect, this, IDC_URL_COMBO); - m_cbxUrl.SetURLHistory(true); - m_cbxUrl.SetFont(font); - m_cbxUrl.LoadHistory(_T("Software\\TortoiseGit\\History\\repoURLS"), _T("url")); - temp.LoadString(IDS_REPO_BROWSEURL); - rbbi.lpText = const_cast((LPCTSTR)temp); - rbbi.hwndChild = m_cbxUrl.m_hWnd; - rbbi.clrFore = ::GetSysColor(COLOR_WINDOWTEXT); - rbbi.clrBack = ::GetSysColor(COLOR_BTNFACE); - rbbi.cx = rect.right - rect.left; - rbbi.cxMinChild = rect.right - rect.left; - rbbi.cyMinChild = m_cbxUrl.GetItemHeight(-1) + 10; - if (!InsertBand(0, &rbbi)) - return false; - - // Reposition the combobox for correct redrawing - m_cbxUrl.GetWindowRect(rect); - m_cbxUrl.MoveWindow(rect.left, rect.top, rect.Width(), 300); - - // Create the "Up" button control to be added - rect = CRect(0, 0, 24, m_cbxUrl.GetItemHeight(-1) + 8); - m_btnUp.Create(_T("UP"), WS_CHILD | WS_TABSTOP | BS_PUSHBUTTON | BS_ICON, rect, this, IDC_UP_BTN); - m_btnUp.SetIcon(m_UpIcon); - m_btnUp.SetWindowText(_T("")); - rbbi.lpText = _T(""); - rbbi.hwndChild = m_btnUp.m_hWnd; - rbbi.clrFore = ::GetSysColor(COLOR_WINDOWTEXT); - rbbi.clrBack = ::GetSysColor(COLOR_BTNFACE); - rbbi.cx = rect.right - rect.left; - rbbi.cxMinChild = rect.right - rect.left; - rbbi.cyMinChild = rect.bottom - rect.top; - if (!InsertBand(1, &rbbi)) - return false; - - // Create the "Revision" button control to be added - rect = CRect(0, 0, 60, m_cbxUrl.GetItemHeight(-1) + 8); - m_btnRevision.Create(_T("HEAD"), WS_CHILD | WS_TABSTOP | BS_PUSHBUTTON, rect, this, IDC_REVISION_BTN); - m_btnRevision.SetFont(font); - temp.LoadString(IDS_REPO_BROWSEREV); - rbbi.lpText = const_cast((LPCTSTR)temp); - rbbi.hwndChild = m_btnRevision.m_hWnd; - rbbi.clrFore = ::GetSysColor(COLOR_WINDOWTEXT); - rbbi.clrBack = ::GetSysColor(COLOR_BTNFACE); - rbbi.cx = rect.right - rect.left; - rbbi.cxMinChild = rect.right - rect.left; - rbbi.cyMinChild = rect.bottom - rect.top; - if (!InsertBand(2, &rbbi)) - return false; - - MaximizeBand(0); - - m_tooltips.Create(this); - m_tooltips.AddTool(&m_btnUp, IDS_REPOBROWSE_TT_UPFOLDER); - - return true; - } - - return false; -} - -void CRepositoryBar::ShowUrl(const CString& url, SVNRev rev) -{ - if (url.Find('?')>=0) - { - m_url = url.Left(url.Find('?')); - m_rev = SVNRev(url.Mid(url.Find('?')+1)); - } - else - { - m_url = url; - m_rev = rev; - } - m_cbxUrl.SetWindowText(m_url); - m_btnUp.EnableWindow(m_url.CompareNoCase(m_pRepo->GetRepoRoot())); - m_btnRevision.SetWindowText(m_rev.ToString()); - if (m_headRev.IsValid()) - { - CString sTTText; - sTTText.Format(IDS_REPOBROWSE_TT_HEADREV, (LPCTSTR)m_headRev.ToString()); - m_tooltips.AddTool(&m_btnRevision, sTTText); - } - else - m_tooltips.DelTool(&m_btnRevision); -} - -void CRepositoryBar::GotoUrl(const CString& url, SVNRev rev, bool bAlreadyChecked /* = false */) -{ - CString new_url = url; - SVNRev new_rev = rev; - CWaitCursorEx wait; - - new_url.TrimRight('/'); - if (new_url.IsEmpty()) - { - new_url = GetCurrentUrl(); - new_rev = GetCurrentRev(); - new_url.TrimRight('/'); - } - if (new_url.Find('?')>=0) - { - new_rev = SVNRev(new_url.Mid(new_url.Find('?')+1)); - new_url = new_url.Left(new_url.Find('?')); - } - - if (m_pRepo) - { - SVNRev rev = new_rev; - m_headRev = SVNRev(); - m_pRepo->ChangeToUrl(new_url, rev, bAlreadyChecked); - if (new_rev.IsHead() && !rev.IsHead()) - m_headRev = rev; - if (!m_headRev.IsValid()) - { - SVN svn; - m_headRev = svn.GetHEADRevision(CTSVNPath(new_url)); - } - } - ShowUrl(new_url, new_rev); -} - -void CRepositoryBar::SetRevision(SVNRev rev) -{ - m_btnRevision.SetWindowText(rev.ToString()); - if (m_headRev.IsValid()) - { - CString sTTText; - sTTText.Format(IDS_REPOBROWSE_TT_HEADREV, (LPCTSTR)m_headRev.ToString()); - m_tooltips.AddTool(&m_btnRevision, sTTText); - } - else - m_tooltips.DelTool(&m_btnRevision); -} - -CString CRepositoryBar::GetCurrentUrl() const -{ - if (m_cbxUrl.m_hWnd != 0) - { - CString path, revision; - m_cbxUrl.GetWindowText(path); - m_btnRevision.GetWindowText(revision); - return path; - } - else - { - return m_url; - } -} - -SVNRev CRepositoryBar::GetCurrentRev() const -{ - if (m_cbxUrl.m_hWnd != 0) - { - CString path, revision; - m_cbxUrl.GetWindowText(path); - m_btnRevision.GetWindowText(revision); - return SVNRev(revision); - } - else - { - return m_rev; - } -} - -void CRepositoryBar::SaveHistory() -{ - m_cbxUrl.SaveHistory(); -} - -bool CRepositoryBar::CRepositoryCombo::OnReturnKeyPressed() -{ - if (m_bar != 0) - m_bar->GotoUrl(); - if (GetDroppedState()) - ShowDropDown(FALSE); - return true; -} - - -void CRepositoryBar::OnCbnSelChange() -{ - int idx = m_cbxUrl.GetCurSel(); - if (idx >= 0) - { - CString path, revision; - m_cbxUrl.GetLBText(idx, path); - m_btnRevision.GetWindowText(revision); - m_url = path; - m_rev = revision; - GotoUrl(m_url, m_rev); - } -} - -void CRepositoryBar::OnBnClicked() -{ - CString revision; - - m_tooltips.Pop(); - m_btnRevision.GetWindowText(revision); - - CRevisionDlg dlg(this); - dlg.AllowWCRevs(false); - *((SVNRev*)&dlg) = SVNRev(revision); - - if (dlg.DoModal() == IDOK) - { - revision = dlg.GetEnteredRevisionString(); - m_rev = SVNRev(revision); - m_btnRevision.SetWindowText(SVNRev(revision).ToString()); - GotoUrl(); - } -} - -void CRepositoryBar::OnGoUp() -{ - CString sCurrentUrl = GetCurrentUrl(); - CString sNewUrl = sCurrentUrl.Left(sCurrentUrl.ReverseFind('/')); - if (sNewUrl.GetLength() >= m_pRepo->GetRepoRoot().GetLength()) - GotoUrl(sNewUrl, GetCurrentRev(), true); -} - -void CRepositoryBar::SetFocusToURL() -{ - m_cbxUrl.GetEditCtrl()->SetFocus(); -} - -void CRepositoryBar::OnDestroy() -{ - int idx = m_cbxUrl.GetCurSel(); - if (idx >= 0) - { - CString path, revision; - m_cbxUrl.GetLBText(idx, path); - m_btnRevision.GetWindowText(revision); - m_url = path; - m_rev = revision; - } - CReBarCtrl::OnDestroy(); -} - - -BOOL CRepositoryBar::PreTranslateMessage(MSG* pMsg) -{ - m_tooltips.RelayEvent(pMsg); - return CReBarCtrl::PreTranslateMessage(pMsg); -} - -//////////////////////////////////////////////////////////////////////////////// - -CRepositoryBarCnr::CRepositoryBarCnr(CRepositoryBar *repository_bar) : - m_pbarRepository(repository_bar) -{ -} - -CRepositoryBarCnr::~CRepositoryBarCnr() -{ -} - -BEGIN_MESSAGE_MAP(CRepositoryBarCnr, CStatic) - ON_WM_ERASEBKGND() - ON_WM_SIZE() - ON_WM_GETDLGCODE() - ON_WM_KEYDOWN() -END_MESSAGE_MAP() - -IMPLEMENT_DYNAMIC(CRepositoryBarCnr, CStatic) - -BOOL CRepositoryBarCnr::OnEraseBkgnd(CDC* /* pDC */) -{ - return TRUE; -} - -void CRepositoryBarCnr::OnSize(UINT /* nType */, int cx, int cy) -{ - m_pbarRepository->MoveWindow(0, 0, cx, cy); -} - -void CRepositoryBarCnr::DrawItem(LPDRAWITEMSTRUCT) -{ -} - -UINT CRepositoryBarCnr::OnGetDlgCode() -{ - return CStatic::OnGetDlgCode() | DLGC_WANTTAB; -} - -void CRepositoryBarCnr::OnKeyDown(UINT nChar, UINT nRepCnt, UINT nFlags) -{ - if (nChar == VK_TAB) - { - CWnd *child = m_pbarRepository->GetWindow(GW_CHILD); - if (child != 0) - { - child = child->GetWindow(GW_HWNDLAST); - if (child != 0) - child->SetFocus(); - } - } - - CStatic::OnKeyDown(nChar, nRepCnt, nFlags); -} - diff --git a/src/TortoiseProc/RepositoryBar.h b/src/TortoiseProc/RepositoryBar.h deleted file mode 100644 index 5984023c3..000000000 --- a/src/TortoiseProc/RepositoryBar.h +++ /dev/null @@ -1,163 +0,0 @@ -// TortoiseSVN - a Windows shell extension for easy version control - -// Copyright (C) 2003-2008 - TortoiseSVN - -// This program is free software; you can redistribute it and/or -// modify it under the terms of the GNU General Public License -// as published by the Free Software Foundation; either version 2 -// of the License, or (at your option) any later version. - -// This program is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// GNU General Public License for more details. - -// You should have received a copy of the GNU General Public License -// along with this program; if not, write to the Free Software Foundation, -// 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. -// -#pragma once - -#include "GitRev.h" -#include "HistoryCombo.h" -#include "Tooltip.h" -#include "XPImageButton.h" - -class CRepositoryTree; - -/** - * \ingroup TortoiseProc - * Interface definition - */ -class IRepo -{ -public: - virtual bool ChangeToUrl(CString& url, GitRev& rev, bool bAlreadyChecked) = 0; - virtual CString GetRepoRoot() = 0; -}; - -/** - * \ingroup TortoiseProc - * Provides a CReBarCtrl which can be used as a "control center" for the - * repository browser. To associate the repository bar with any repository - * tree control, call AssocTree() once after both objects are created. As - * long as they are associated, the bar and the tree form a "team" of - * controls that work together. - */ -class CRepositoryBar : public CReBarCtrl -{ - DECLARE_DYNAMIC(CRepositoryBar) - -public: - CRepositoryBar(); - virtual ~CRepositoryBar(); - -public: - /** - * Creates the repository bar. Set \a in_dialog to TRUE when the bar - * is placed inside of a dialog. Otherwise it is assumed that the - * bar is placed in a frame window. - */ - bool Create(CWnd* parent, UINT id, bool in_dialog = true); - - /** - * Show the given \a svn_url in the URL combo and the revision button. - */ - void ShowUrl(const CString& url, GitRev rev); - - /** - * Show the given \a svn_url in the URL combo and the revision button, - * and select it in the associated repository tree. If no \a svn_url - * is given, the current values are used (which effectively refreshes - * the tree). - */ - void GotoUrl(const CString& url = CString(), GitRev rev = GitRev(), bool bAlreadyChecked = false); - - /** - * Returns the current URL. - */ - CString GetCurrentUrl() const; - - /** - * Returns the current revision - */ - GitRev GetCurrentRev() const; - - /** - * Saves the URL history of the HistoryCombo. - */ - void SaveHistory(); - - /** - * Set the revision - */ - void SetRevision(GitRev rev); - - void SetFocusToURL(); - - void SetIRepo(IRepo * pRepo) {m_pRepo = pRepo;} - - void SetHeadRevision(const GitRev& rev) {m_headRev = rev;} - afx_msg void OnGoUp(); -protected: - virtual BOOL PreTranslateMessage(MSG* pMsg); - afx_msg void OnCbnSelChange(); - afx_msg void OnBnClicked(); - afx_msg void OnDestroy(); - - DECLARE_MESSAGE_MAP() - -private: - CString m_url; - GitRev m_rev; - - IRepo * m_pRepo; - - class CRepositoryCombo : public CHistoryCombo - { - CRepositoryBar *m_bar; - public: - CRepositoryCombo(CRepositoryBar *bar) : m_bar(bar) {} - virtual bool OnReturnKeyPressed(); - } m_cbxUrl; - - CButton m_btnRevision; - CXPImageButton m_btnUp; - - GitRev m_headRev; - CToolTips m_tooltips; - HICON m_UpIcon; -}; - - -/** - * \ingroup TortoiseProc - * Implements a visual container for a CRepositoryBar which may be added to a - * dialog. A CRepositoryBarCnr is not needed if the CRepositoryBar is attached - * to a frame window. - */ -class CRepositoryBarCnr : public CStatic -{ - DECLARE_DYNAMIC(CRepositoryBarCnr) - -public: - CRepositoryBarCnr(CRepositoryBar *repository_bar); - ~CRepositoryBarCnr(); - - // Generated message map functions -protected: - afx_msg BOOL OnEraseBkgnd(CDC* pDC); - afx_msg void OnSize(UINT nType, int cx, int cy); - afx_msg UINT OnGetDlgCode(); - afx_msg void OnKeyDown(UINT nChar, UINT nRepCnt, UINT nFlags); - - virtual void DrawItem(LPDRAWITEMSTRUCT); - - DECLARE_MESSAGE_MAP() - -private: - CRepositoryBar *m_pbarRepository; - -}; - - diff --git a/src/TortoiseProc/RepositoryBrowser.cpp b/src/TortoiseProc/RepositoryBrowser.cpp deleted file mode 100644 index 454057ad5..000000000 --- a/src/TortoiseProc/RepositoryBrowser.cpp +++ /dev/null @@ -1,2935 +0,0 @@ -// TortoiseSVN - a Windows shell extension for easy version control - -// Copyright (C) 2003-2008 - TortoiseSVN - -// This program is free software; you can redistribute it and/or -// modify it under the terms of the GNU General Public License -// as published by the Free Software Foundation; either version 2 -// of the License, or (at your option) any later version. - -// This program is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// GNU General Public License for more details. - -// You should have received a copy of the GNU General Public License -// along with this program; if not, write to the Free Software Foundation, -// 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. -// -#include "stdafx.h" -#include "TortoiseProc.h" - -#include "MessageBox.h" -#include "InputLogDlg.h" -#include "LogDlg.h" -#include "PropDlg.h" -#include "EditPropertiesDlg.h" -#include "Blame.h" -#include "BlameDlg.h" -#include "WaitCursorEx.h" -#include "Repositorybrowser.h" -#include "BrowseFolder.h" -#include "RenameDlg.h" -#include "RevisionGraph\RevisionGraphDlg.h" -#include "CheckoutDlg.h" -#include "ExportDlg.h" -#include "SVNProgressDlg.h" -#include "AppUtils.h" -#include "PathUtils.h" -#include "StringUtils.h" -#include "TempFile.h" -#include "UnicodeUtils.h" -#include "BrowseFolder.h" -#include "SVNDiff.h" -#include "SysImageList.h" -#include "RepoDrags.h" -#include "SVNInfo.h" -#include "SVNDataObject.h" -#include "SVNLogHelper.h" -#include "XPTheme.h" -#include "IconMenu.h" - - -enum RepoBrowserContextMenuCommands -{ - // needs to start with 1, since 0 is the return value if *nothing* is clicked on in the context menu - ID_OPEN = 1, - ID_OPENWITH, - ID_SHOWLOG, - ID_REVGRAPH, - ID_BLAME, - ID_VIEWREV, - ID_VIEWPATHREV, - ID_EXPORT, - ID_CHECKOUT, - ID_REFRESH, - ID_SAVEAS, - ID_MKDIR, - ID_IMPORT, - ID_IMPORTFOLDER, - ID_BREAKLOCK, - ID_DELETE, - ID_RENAME, - ID_COPYTOWC, - ID_COPYTO, - ID_URLTOCLIPBOARD, - ID_PROPS, - ID_REVPROPS, - ID_GNUDIFF, - ID_DIFF, - ID_PREPAREDIFF, - ID_UPDATE, - -}; - -IMPLEMENT_DYNAMIC(CRepositoryBrowser, CResizableStandAloneDialog) - -CRepositoryBrowser::CRepositoryBrowser(const CString& url, const SVNRev& rev) - : CResizableStandAloneDialog(CRepositoryBrowser::IDD, NULL) - , m_cnrRepositoryBar(&m_barRepository) - , m_bStandAlone(true) - , m_InitialUrl(url) - , m_initialRev(rev) - , m_bInitDone(false) - , m_blockEvents(false) - , m_bSortAscending(true) - , m_nSortedColumn(0) - , m_pTreeDropTarget(NULL) - , m_pListDropTarget(NULL) - , m_bCancelled(false) - , m_diffKind(svn_node_none) - , m_hAccel(NULL) - , bDragMode(FALSE) -{ -} - -CRepositoryBrowser::CRepositoryBrowser(const CString& url, const SVNRev& rev, CWnd* pParent) - : CResizableStandAloneDialog(CRepositoryBrowser::IDD, pParent) - , m_cnrRepositoryBar(&m_barRepository) - , m_InitialUrl(url) - , m_initialRev(rev) - , m_bStandAlone(false) - , m_bInitDone(false) - , m_blockEvents(false) - , m_bSortAscending(true) - , m_nSortedColumn(0) - , m_pTreeDropTarget(NULL) - , m_pListDropTarget(NULL) - , m_bCancelled(false) - , m_diffKind(svn_node_none) -{ -} - -CRepositoryBrowser::~CRepositoryBrowser() -{ -} - -void CRepositoryBrowser::RecursiveRemove(HTREEITEM hItem, bool bChildrenOnly /* = false */) -{ - HTREEITEM childItem; - if (m_RepoTree.ItemHasChildren(hItem)) - { - for (childItem = m_RepoTree.GetChildItem(hItem);childItem != NULL; childItem = m_RepoTree.GetNextItem(childItem, TVGN_NEXT)) - { - RecursiveRemove(childItem); - if (bChildrenOnly) - { - CTreeItem * pTreeItem = (CTreeItem*)m_RepoTree.GetItemData(childItem); - delete pTreeItem; - m_RepoTree.SetItemData(childItem, 0); - m_RepoTree.DeleteItem(childItem); - } - } - } - - if ((hItem)&&(!bChildrenOnly)) - { - CTreeItem * pTreeItem = (CTreeItem*)m_RepoTree.GetItemData(hItem); - delete pTreeItem; - m_RepoTree.SetItemData(hItem, 0); - } -} - -void CRepositoryBrowser::DoDataExchange(CDataExchange* pDX) -{ - CResizableStandAloneDialog::DoDataExchange(pDX); - DDX_Control(pDX, IDC_REPOTREE, m_RepoTree); - DDX_Control(pDX, IDC_REPOLIST, m_RepoList); -} - -BEGIN_MESSAGE_MAP(CRepositoryBrowser, CResizableStandAloneDialog) - ON_BN_CLICKED(IDHELP, OnBnClickedHelp) - ON_WM_SETCURSOR() - ON_REGISTERED_MESSAGE(WM_AFTERINIT, OnAfterInitDialog) - ON_WM_MOUSEMOVE() - ON_WM_LBUTTONDOWN() - ON_WM_LBUTTONUP() - ON_NOTIFY(TVN_SELCHANGED, IDC_REPOTREE, &CRepositoryBrowser::OnTvnSelchangedRepotree) - ON_NOTIFY(TVN_ITEMEXPANDING, IDC_REPOTREE, &CRepositoryBrowser::OnTvnItemexpandingRepotree) - ON_NOTIFY(NM_DBLCLK, IDC_REPOLIST, &CRepositoryBrowser::OnNMDblclkRepolist) - ON_NOTIFY(HDN_ITEMCLICK, 0, &CRepositoryBrowser::OnHdnItemclickRepolist) - ON_NOTIFY(LVN_ITEMCHANGED, IDC_REPOLIST, &CRepositoryBrowser::OnLvnItemchangedRepolist) - ON_NOTIFY(LVN_BEGINDRAG, IDC_REPOLIST, &CRepositoryBrowser::OnLvnBegindragRepolist) - ON_NOTIFY(LVN_BEGINRDRAG, IDC_REPOLIST, &CRepositoryBrowser::OnLvnBeginrdragRepolist) - ON_WM_CONTEXTMENU() - ON_NOTIFY(LVN_ENDLABELEDIT, IDC_REPOLIST, &CRepositoryBrowser::OnLvnEndlabeleditRepolist) - ON_NOTIFY(TVN_ENDLABELEDIT, IDC_REPOTREE, &CRepositoryBrowser::OnTvnEndlabeleditRepotree) - ON_WM_TIMER() - ON_COMMAND(ID_URL_FOCUS, &CRepositoryBrowser::OnUrlFocus) - ON_COMMAND(ID_EDIT_COPY, &CRepositoryBrowser::OnCopy) - ON_COMMAND(ID_INLINEEDIT, &CRepositoryBrowser::OnInlineedit) - ON_COMMAND(ID_REFRESHBROWSER, &CRepositoryBrowser::OnRefresh) - ON_COMMAND(ID_DELETEBROWSERITEM, &CRepositoryBrowser::OnDelete) - ON_COMMAND(ID_URL_UP, &CRepositoryBrowser::OnGoUp) - ON_NOTIFY(TVN_BEGINDRAG, IDC_REPOTREE, &CRepositoryBrowser::OnTvnBegindragRepotree) - ON_NOTIFY(TVN_BEGINRDRAG, IDC_REPOTREE, &CRepositoryBrowser::OnTvnBeginrdragRepotree) -END_MESSAGE_MAP() - -SVNRev CRepositoryBrowser::GetRevision() const -{ - return m_barRepository.GetCurrentRev(); -} - -CString CRepositoryBrowser::GetPath() const -{ - return m_barRepository.GetCurrentUrl(); -} - -BOOL CRepositoryBrowser::OnInitDialog() -{ - CResizableStandAloneDialog::OnInitDialog(); - - GetWindowText(m_origDlgTitle); - - m_hAccel = LoadAccelerators(AfxGetResourceHandle(),MAKEINTRESOURCE(IDR_ACC_REPOBROWSER)); - - m_cnrRepositoryBar.SubclassDlgItem(IDC_REPOS_BAR_CNR, this); - m_barRepository.Create(&m_cnrRepositoryBar, 12345); - m_barRepository.SetIRepo(this); - - m_pTreeDropTarget = new CTreeDropTarget(this); - RegisterDragDrop(m_RepoTree.GetSafeHwnd(), m_pTreeDropTarget); - // create the supported formats: - FORMATETC ftetc={0}; - ftetc.cfFormat = CF_SVNURL; - ftetc.dwAspect = DVASPECT_CONTENT; - ftetc.lindex = -1; - ftetc.tymed = TYMED_HGLOBAL; - m_pTreeDropTarget->AddSuportedFormat(ftetc); - ftetc.cfFormat=CF_HDROP; - m_pTreeDropTarget->AddSuportedFormat(ftetc); - - m_pListDropTarget = new CListDropTarget(this); - RegisterDragDrop(m_RepoList.GetSafeHwnd(), m_pListDropTarget); - // create the supported formats: - ftetc.cfFormat = CF_SVNURL; - m_pListDropTarget->AddSuportedFormat(ftetc); - ftetc.cfFormat=CF_HDROP; - m_pListDropTarget->AddSuportedFormat(ftetc); - - if (m_bStandAlone) - { - GetDlgItem(IDCANCEL)->ShowWindow(FALSE); - - // reposition the buttons - CRect rect_cancel; - GetDlgItem(IDCANCEL)->GetWindowRect(rect_cancel); - ScreenToClient(rect_cancel); - GetDlgItem(IDOK)->MoveWindow(rect_cancel); - } - - m_nIconFolder = SYS_IMAGE_LIST().GetDirIconIndex(); - m_nOpenIconFolder = SYS_IMAGE_LIST().GetDirOpenIconIndex(); - // set up the list control - // set the extended style of the list control - // the style LVS_EX_FULLROWSELECT interferes with the background watermark image but it's more important to be able to select in the whole row. - CRegDWORD regFullRowSelect(_T("Software\\TortoiseGit\\FullRowSelect"), TRUE); - DWORD exStyle = LVS_EX_HEADERDRAGDROP | LVS_EX_DOUBLEBUFFER | LVS_EX_INFOTIP | LVS_EX_SUBITEMIMAGES; - if (DWORD(regFullRowSelect)) - exStyle |= LVS_EX_FULLROWSELECT; - m_RepoList.SetExtendedStyle(exStyle); - m_RepoList.SetImageList(&SYS_IMAGE_LIST(), LVSIL_SMALL); - m_RepoList.ShowText(CString(MAKEINTRESOURCE(IDS_REPOBROWSE_INITWAIT))); - - m_RepoTree.SetImageList(&SYS_IMAGE_LIST(), TVSIL_NORMAL); - - CXPTheme theme; - theme.SetWindowTheme(m_RepoList.GetSafeHwnd(), L"Explorer", NULL); - theme.SetWindowTheme(m_RepoTree.GetSafeHwnd(), L"Explorer", NULL); - - - AddAnchor(IDC_REPOS_BAR_CNR, TOP_LEFT, TOP_RIGHT); - AddAnchor(IDC_F5HINT, BOTTOM_LEFT, BOTTOM_RIGHT); - AddAnchor(IDC_REPOTREE, TOP_LEFT, BOTTOM_LEFT); - AddAnchor(IDC_REPOLIST, TOP_LEFT, BOTTOM_RIGHT); - AddAnchor(IDCANCEL, BOTTOM_RIGHT); - AddAnchor(IDOK, BOTTOM_RIGHT); - AddAnchor(IDHELP, BOTTOM_RIGHT); - EnableSaveRestore(_T("RepositoryBrowser")); - if (hWndExplorer) - CenterWindow(CWnd::FromHandle(hWndExplorer)); - m_bThreadRunning = true; - if (AfxBeginThread(InitThreadEntry, this)==NULL) - { - m_bThreadRunning = false; - CMessageBox::Show(NULL, IDS_ERR_THREADSTARTFAILED, IDS_APPNAME, MB_OK | MB_ICONERROR); - } - return TRUE; -} - -void CRepositoryBrowser::InitRepo() -{ - CWaitCursorEx wait; - - m_InitialUrl = CPathUtils::PathUnescape(m_InitialUrl); - if (m_InitialUrl.Find('?')>=0) - { - m_initialRev = SVNRev(m_InitialUrl.Mid(m_InitialUrl.Find('?')+1)); - m_InitialUrl = m_InitialUrl.Left(m_InitialUrl.Find('?')); - } - - // We don't know if the url passed to us points to a file or a folder, - // let's find out: - SVNInfo info; - const SVNInfoData * data = NULL; - CString error; // contains the first error of GetFirstFileInfo() - do - { - data = info.GetFirstFileInfo(CTSVNPath(m_InitialUrl),m_initialRev, m_initialRev); - if ((data == NULL)||(data->kind != svn_node_dir)) - { - // in case the url is not a valid directory, try the parent dir - // until there's no more parent dir - m_InitialUrl = m_InitialUrl.Left(m_InitialUrl.ReverseFind('/')); - if ((m_InitialUrl.Compare(_T("http://")) == 0) || - (m_InitialUrl.Compare(_T("https://")) == 0)|| - (m_InitialUrl.Compare(_T("svn://")) == 0)|| - (m_InitialUrl.Compare(_T("svn+ssh://")) == 0)|| - (m_InitialUrl.Compare(_T("file:///")) == 0)|| - (m_InitialUrl.Compare(_T("file://")) == 0)) - { - m_InitialUrl.Empty(); - } - if (error.IsEmpty()) - { - if (((data)&&(data->kind == svn_node_dir))||(data == NULL)) - error = info.GetLastErrorMsg(); - } - } - } while(!m_InitialUrl.IsEmpty() && ((data == NULL) || (data->kind != svn_node_dir))); - - if (data == NULL) - { - m_InitialUrl.Empty(); - m_RepoList.ShowText(error, true); - return; - } - else if (m_initialRev.IsHead()) - { - m_barRepository.SetHeadRevision(data->rev); - } - m_InitialUrl.TrimRight('/'); - - m_bCancelled = false; - m_strReposRoot = data->reposRoot; - m_sUUID = data->reposUUID; - m_strReposRoot = CPathUtils::PathUnescape(m_strReposRoot); - // the initial url can be in the format file:///\, but the - // repository root returned would still be file:// - // to avoid string length comparison faults, we adjust - // the repository root here to match the initial url - if ((m_InitialUrl.Left(9).CompareNoCase(_T("file:///\\")) == 0) && - (m_strReposRoot.Left(9).CompareNoCase(_T("file:///\\")) != 0)) - m_strReposRoot.Replace(_T("file://"), _T("file:///\\")); - SetWindowText(m_strReposRoot + _T(" - ") + m_origDlgTitle); - // now check the repository root for the url type, then - // set the corresponding background image - if (!m_strReposRoot.IsEmpty()) - { - UINT nID = IDI_REPO_UNKNOWN; - if (m_strReposRoot.Left(7).CompareNoCase(_T("http://"))==0) - nID = IDI_REPO_HTTP; - if (m_strReposRoot.Left(8).CompareNoCase(_T("https://"))==0) - nID = IDI_REPO_HTTPS; - if (m_strReposRoot.Left(6).CompareNoCase(_T("svn://"))==0) - nID = IDI_REPO_SVN; - if (m_strReposRoot.Left(10).CompareNoCase(_T("svn+ssh://"))==0) - nID = IDI_REPO_SVNSSH; - if (m_strReposRoot.Left(7).CompareNoCase(_T("file://"))==0) - nID = IDI_REPO_FILE; - CXPTheme theme; - if (theme.IsAppThemed()) - CAppUtils::SetListCtrlBackgroundImage(m_RepoList.GetSafeHwnd(), nID); - } -} - -UINT CRepositoryBrowser::InitThreadEntry(LPVOID pVoid) -{ - return ((CRepositoryBrowser*)pVoid)->InitThread(); -} - -//this is the thread function which calls the subversion function -UINT CRepositoryBrowser::InitThread() -{ - // In this thread, we try to find out the repository root. - // Since this is a remote operation, it can take a while, that's - // Why we do this inside a thread. - - // force the cursor to change - RefreshCursor(); - - DialogEnableWindow(IDOK, FALSE); - DialogEnableWindow(IDCANCEL, FALSE); - - InitRepo(); - - PostMessage(WM_AFTERINIT); - DialogEnableWindow(IDOK, TRUE); - DialogEnableWindow(IDCANCEL, TRUE); - - m_bThreadRunning = false; - - RefreshCursor(); - return 0; -} - -LRESULT CRepositoryBrowser::OnAfterInitDialog(WPARAM /*wParam*/, LPARAM /*lParam*/) -{ - if ((m_InitialUrl.IsEmpty())||(m_strReposRoot.IsEmpty())) - { - return 0; - } - - m_barRepository.GotoUrl(m_InitialUrl, m_initialRev, true); - m_RepoList.ClearText(); - m_bInitDone = TRUE; - return 0; -} - -void CRepositoryBrowser::OnOK() -{ - RevokeDragDrop(m_RepoList.GetSafeHwnd()); - RevokeDragDrop(m_RepoTree.GetSafeHwnd()); - - SaveColumnWidths(true); - - HTREEITEM hItem = m_RepoTree.GetRootItem(); - RecursiveRemove(hItem); - - m_barRepository.SaveHistory(); - CResizableStandAloneDialog::OnOK(); -} - -void CRepositoryBrowser::OnCancel() -{ - RevokeDragDrop(m_RepoList.GetSafeHwnd()); - RevokeDragDrop(m_RepoTree.GetSafeHwnd()); - - SaveColumnWidths(true); - - HTREEITEM hItem = m_RepoTree.GetRootItem(); - RecursiveRemove(hItem); - - __super::OnCancel(); -} - -void CRepositoryBrowser::OnBnClickedHelp() -{ - OnHelp(); -} - -/******************************************************************************/ -/* tree and list view resizing */ -/******************************************************************************/ - -BOOL CRepositoryBrowser::OnSetCursor(CWnd* pWnd, UINT nHitTest, UINT message) -{ - if (m_bThreadRunning) - { - HCURSOR hCur = LoadCursor(NULL, MAKEINTRESOURCE(IDC_WAIT)); - SetCursor(hCur); - return TRUE; - } - if (pWnd == this) - { - RECT rect; - POINT pt; - GetClientRect(&rect); - GetCursorPos(&pt); - ScreenToClient(&pt); - if (PtInRect(&rect, pt)) - { - ClientToScreen(&pt); - // are we right of the tree control? - GetDlgItem(IDC_REPOTREE)->GetWindowRect(&rect); - if ((pt.x > rect.right)&& - (pt.y >= rect.top)&& - (pt.y <= rect.bottom)) - { - // but left of the list control? - GetDlgItem(IDC_REPOLIST)->GetWindowRect(&rect); - if (pt.x < rect.left) - { - HCURSOR hCur = LoadCursor(NULL, MAKEINTRESOURCE(IDC_SIZEWE)); - SetCursor(hCur); - return TRUE; - } - } - } - } - return CStandAloneDialogTmpl::OnSetCursor(pWnd, nHitTest, message); -} - -void CRepositoryBrowser::OnMouseMove(UINT nFlags, CPoint point) -{ - CDC * pDC; - RECT rect, tree, list, treelist, treelistclient; - - if (bDragMode == FALSE) - return; - - // create an union of the tree and list control rectangle - GetDlgItem(IDC_REPOLIST)->GetWindowRect(&list); - GetDlgItem(IDC_REPOTREE)->GetWindowRect(&tree); - UnionRect(&treelist, &tree, &list); - treelistclient = treelist; - ScreenToClient(&treelistclient); - - //convert the mouse coordinates relative to the top-left of - //the window - ClientToScreen(&point); - GetClientRect(&rect); - ClientToScreen(&rect); - point.x -= rect.left; - point.y -= treelist.top; - - //same for the window coordinates - make them relative to 0,0 - OffsetRect(&treelist, -treelist.left, -treelist.top); - - if (point.x < treelist.left+REPOBROWSER_CTRL_MIN_WIDTH) - point.x = treelist.left+REPOBROWSER_CTRL_MIN_WIDTH; - if (point.x > treelist.right-REPOBROWSER_CTRL_MIN_WIDTH) - point.x = treelist.right-REPOBROWSER_CTRL_MIN_WIDTH; - - if ((nFlags & MK_LBUTTON) && (point.x != oldx)) - { - pDC = GetDC(); - - if (pDC) - { - DrawXorBar(pDC, oldx+2, treelistclient.top, 4, treelistclient.bottom-treelistclient.top-2); - DrawXorBar(pDC, point.x+2, treelistclient.top, 4, treelistclient.bottom-treelistclient.top-2); - - ReleaseDC(pDC); - } - - oldx = point.x; - oldy = point.y; - } - - CStandAloneDialogTmpl::OnMouseMove(nFlags, point); -} - -void CRepositoryBrowser::OnLButtonDown(UINT nFlags, CPoint point) -{ - CDC * pDC; - RECT rect, tree, list, treelist, treelistclient; - - // create an union of the tree and list control rectangle - GetDlgItem(IDC_REPOLIST)->GetWindowRect(&list); - GetDlgItem(IDC_REPOTREE)->GetWindowRect(&tree); - UnionRect(&treelist, &tree, &list); - treelistclient = treelist; - ScreenToClient(&treelistclient); - - //convert the mouse coordinates relative to the top-left of - //the window - ClientToScreen(&point); - GetClientRect(&rect); - ClientToScreen(&rect); - point.x -= rect.left; - point.y -= treelist.top; - - //same for the window coordinates - make them relative to 0,0 - OffsetRect(&treelist, -treelist.left, -treelist.top); - - if (point.x < treelist.left+REPOBROWSER_CTRL_MIN_WIDTH) - point.x = treelist.left+REPOBROWSER_CTRL_MIN_WIDTH; - if (point.x > treelist.right-3) - return CStandAloneDialogTmpl::OnLButtonDown(nFlags, point); - if (point.x > treelist.right-REPOBROWSER_CTRL_MIN_WIDTH) - point.x = treelist.right-REPOBROWSER_CTRL_MIN_WIDTH; - - if ((point.y < treelist.top) || - (point.y > treelist.bottom)) - return CStandAloneDialogTmpl::OnLButtonDown(nFlags, point); - - bDragMode = true; - - SetCapture(); - - pDC = GetDC(); - DrawXorBar(pDC, point.x+2, treelistclient.top, 4, treelistclient.bottom-treelistclient.top-2); - ReleaseDC(pDC); - - oldx = point.x; - oldy = point.y; - - CStandAloneDialogTmpl::OnLButtonDown(nFlags, point); -} - -void CRepositoryBrowser::OnLButtonUp(UINT nFlags, CPoint point) -{ - CDC * pDC; - RECT rect, tree, list, treelist, treelistclient; - - if (bDragMode == FALSE) - return; - - // create an union of the tree and list control rectangle - GetDlgItem(IDC_REPOLIST)->GetWindowRect(&list); - GetDlgItem(IDC_REPOTREE)->GetWindowRect(&tree); - UnionRect(&treelist, &tree, &list); - treelistclient = treelist; - ScreenToClient(&treelistclient); - - ClientToScreen(&point); - GetClientRect(&rect); - ClientToScreen(&rect); - - CPoint point2 = point; - if (point2.x < treelist.left+REPOBROWSER_CTRL_MIN_WIDTH) - point2.x = treelist.left+REPOBROWSER_CTRL_MIN_WIDTH; - if (point2.x > treelist.right-REPOBROWSER_CTRL_MIN_WIDTH) - point2.x = treelist.right-REPOBROWSER_CTRL_MIN_WIDTH; - - point.x -= rect.left; - point.y -= treelist.top; - - OffsetRect(&treelist, -treelist.left, -treelist.top); - - if (point.x < treelist.left+REPOBROWSER_CTRL_MIN_WIDTH) - point.x = treelist.left+REPOBROWSER_CTRL_MIN_WIDTH; - if (point.x > treelist.right-REPOBROWSER_CTRL_MIN_WIDTH) - point.x = treelist.right-REPOBROWSER_CTRL_MIN_WIDTH; - - pDC = GetDC(); - DrawXorBar(pDC, oldx+2, treelistclient.top, 4, treelistclient.bottom-treelistclient.top-2); - ReleaseDC(pDC); - - oldx = point.x; - oldy = point.y; - - bDragMode = false; - ReleaseCapture(); - - //position the child controls - GetDlgItem(IDC_REPOTREE)->GetWindowRect(&treelist); - treelist.right = point2.x - 2; - ScreenToClient(&treelist); - RemoveAnchor(IDC_REPOTREE); - GetDlgItem(IDC_REPOTREE)->MoveWindow(&treelist); - GetDlgItem(IDC_REPOLIST)->GetWindowRect(&treelist); - treelist.left = point2.x + 2; - ScreenToClient(&treelist); - RemoveAnchor(IDC_REPOLIST); - GetDlgItem(IDC_REPOLIST)->MoveWindow(&treelist); - - AddAnchor(IDC_REPOTREE, TOP_LEFT, BOTTOM_LEFT); - AddAnchor(IDC_REPOLIST, TOP_LEFT, BOTTOM_RIGHT); - - CStandAloneDialogTmpl::OnLButtonUp(nFlags, point); -} - -void CRepositoryBrowser::DrawXorBar(CDC * pDC, int x1, int y1, int width, int height) -{ - static WORD _dotPatternBmp[8] = - { - 0x0055, 0x00aa, 0x0055, 0x00aa, - 0x0055, 0x00aa, 0x0055, 0x00aa - }; - - HBITMAP hbm; - HBRUSH hbr, hbrushOld; - - hbm = CreateBitmap(8, 8, 1, 1, _dotPatternBmp); - hbr = CreatePatternBrush(hbm); - - pDC->SetBrushOrg(x1, y1); - hbrushOld = (HBRUSH)pDC->SelectObject(hbr); - - PatBlt(pDC->GetSafeHdc(), x1, y1, width, height, PATINVERT); - - pDC->SelectObject(hbrushOld); - - DeleteObject(hbr); - DeleteObject(hbm); -} - -/******************************************************************************/ -/* repository information gathering */ -/******************************************************************************/ - -BOOL CRepositoryBrowser::ReportList(const CString& path, svn_node_kind_t kind, - svn_filesize_t size, bool has_props, - svn_revnum_t created_rev, apr_time_t time, - const CString& author, const CString& locktoken, - const CString& lockowner, const CString& lockcomment, - bool is_dav_comment, apr_time_t lock_creationdate, - apr_time_t lock_expirationdate, - const CString& absolutepath) -{ - static deque * pDirList = NULL; - static CTreeItem * pTreeItem = NULL; - static CString dirPath; - - CString sParent = absolutepath; - int slashpos = path.ReverseFind('/'); - bool abspath_has_slash = (absolutepath.GetAt(absolutepath.GetLength()-1) == '/'); - if ((slashpos > 0) && (!abspath_has_slash)) - sParent += _T("/"); - sParent += path.Left(slashpos); - if (sParent.Compare(_T("/"))==0) - sParent.Empty(); - if ((path.IsEmpty())|| - (pDirList == NULL)|| - (sParent.Compare(dirPath))) - { - HTREEITEM hItem = FindUrl(m_strReposRoot + sParent); - pTreeItem = (CTreeItem*)m_RepoTree.GetItemData(hItem); - pDirList = &(pTreeItem->children); - - dirPath = sParent; - } - if (path.IsEmpty()) - return TRUE; - - if (kind == svn_node_dir) - { - FindUrl(m_strReposRoot + absolutepath + (abspath_has_slash ? _T("") : _T("/")) + path); - if (pTreeItem) - pTreeItem->has_child_folders = true; - } - pDirList->push_back(CItem(path.Mid(slashpos+1), kind, size, has_props, - created_rev, time, author, locktoken, - lockowner, lockcomment, is_dav_comment, - lock_creationdate, lock_expirationdate, - m_strReposRoot+absolutepath+(abspath_has_slash ? _T("") : _T("/"))+path)); - if (pTreeItem) - pTreeItem->children_fetched = true; - return TRUE; -} - -bool CRepositoryBrowser::ChangeToUrl(CString& url, SVNRev& rev, bool bAlreadyChecked) -{ - CWaitCursorEx wait; - if (!bAlreadyChecked) - { - // check if the entered url is valid - SVNInfo info; - const SVNInfoData * data = NULL; - CString orig_url = url; - m_bCancelled = false; - do - { - data = info.GetFirstFileInfo(CTSVNPath(url), rev, rev); - if (data && rev.IsHead()) - { - rev = data->rev; - } - if ((data == NULL)||(data->kind != svn_node_dir)) - { - // in case the url is not a valid directory, try the parent dir - // until there's no more parent dir - url = url.Left(url.ReverseFind('/')); - } - } while(!m_bCancelled && !url.IsEmpty() && ((data == NULL) || (data->kind != svn_node_dir))); - if (url.IsEmpty()) - url = orig_url; - } - CString partUrl = url; - HTREEITEM hItem = m_RepoTree.GetRootItem(); - if ((LONG(rev) != LONG(m_initialRev))|| - (m_strReposRoot.IsEmpty())|| - (m_strReposRoot.Compare(url.Left(m_strReposRoot.GetLength())))|| - (url.GetAt(m_strReposRoot.GetLength()) != '/')) - { - // if the revision changed, then invalidate everything - RecursiveRemove(hItem); - m_RepoTree.DeleteAllItems(); - m_RepoList.DeleteAllItems(); - m_RepoList.ShowText(CString(MAKEINTRESOURCE(IDS_REPOBROWSE_WAIT)), true); - hItem = m_RepoTree.GetRootItem(); - if ((m_strReposRoot.IsEmpty())||(m_strReposRoot.Compare(url.Left(m_strReposRoot.GetLength())))|| - (url.GetAt(m_strReposRoot.GetLength()) != '/')) - { - // if the repository root has changed, initialize all data from scratch - // and clear the project properties we might have loaded previously - m_ProjectProperties = ProjectProperties(); - m_InitialUrl = url; - InitRepo(); - if ((m_InitialUrl.IsEmpty())||(m_strReposRoot.IsEmpty())) - return false; - } - } - if (hItem == NULL) - { - // the tree view is empty, just fill in the repository root - CTreeItem * pTreeItem = new CTreeItem(); - pTreeItem->unescapedname = m_strReposRoot; - pTreeItem->url = m_strReposRoot; - - TVINSERTSTRUCT tvinsert = {0}; - tvinsert.hParent = TVI_ROOT; - tvinsert.hInsertAfter = TVI_ROOT; - tvinsert.itemex.mask = TVIF_CHILDREN | TVIF_DI_SETITEM | TVIF_PARAM | TVIF_TEXT | TVIF_IMAGE | TVIF_SELECTEDIMAGE; - tvinsert.itemex.pszText = m_strReposRoot.GetBuffer(m_strReposRoot.GetLength()); - tvinsert.itemex.cChildren = 1; - tvinsert.itemex.lParam = (LPARAM)pTreeItem; - tvinsert.itemex.iImage = m_nIconFolder; - tvinsert.itemex.iSelectedImage = m_nOpenIconFolder; - - hItem = m_RepoTree.InsertItem(&tvinsert); - m_strReposRoot.ReleaseBuffer(); - } - if (hItem == NULL) - { - // something terrible happened! - return false; - } - hItem = FindUrl(url); - if (hItem == NULL) - return false; - - CTreeItem * pTreeItem = (CTreeItem *)m_RepoTree.GetItemData(hItem); - if (pTreeItem == NULL) - return FALSE; - - if (!m_RepoList.HasText()) - m_RepoList.ShowText(_T(" "), true); - - RefreshNode(hItem); - m_RepoTree.Expand(hItem, TVE_EXPAND); - FillList(&pTreeItem->children); - - m_blockEvents = true; - m_RepoTree.EnsureVisible(hItem); - m_RepoTree.SelectItem(hItem); - m_blockEvents = false; - - m_RepoList.ClearText(); - - return true; -} - -void CRepositoryBrowser::FillList(deque * pItems) -{ - if (pItems == NULL) - return; - CWaitCursorEx wait; - m_RepoList.SetRedraw(false); - m_RepoList.DeleteAllItems(); - - int c = ((CHeaderCtrl*)(m_RepoList.GetDlgItem(0)))->GetItemCount()-1; - while (c>=0) - m_RepoList.DeleteColumn(c--); - - c = 0; - CString temp; - // - // column 0: contains tree - temp.LoadString(IDS_LOG_FILE); - m_RepoList.InsertColumn(c++, temp); - // - // column 1: file extension - temp.LoadString(IDS_STATUSLIST_COLEXT); - m_RepoList.InsertColumn(c++, temp); - // - // column 2: revision number - temp.LoadString(IDS_LOG_REVISION); - m_RepoList.InsertColumn(c++, temp, LVCFMT_RIGHT); - // - // column 3: author - temp.LoadString(IDS_LOG_AUTHOR); - m_RepoList.InsertColumn(c++, temp); - // - // column 4: size - temp.LoadString(IDS_LOG_SIZE); - m_RepoList.InsertColumn(c++, temp, LVCFMT_RIGHT); - // - // column 5: date - temp.LoadString(IDS_LOG_DATE); - m_RepoList.InsertColumn(c++, temp); - // - // column 6: lock owner - temp.LoadString(IDS_STATUSLIST_COLLOCK); - m_RepoList.InsertColumn(c++, temp); - - // now fill in the data - - TCHAR date_native[SVN_DATE_BUFFER]; - int nCount = 0; - for (deque::const_iterator it = pItems->begin(); it != pItems->end(); ++it) - { - int icon_idx; - if (it->kind == svn_node_dir) - icon_idx = m_nIconFolder; - else - icon_idx = SYS_IMAGE_LIST().GetFileIconIndex(it->path); - int index = m_RepoList.InsertItem(nCount, it->path, icon_idx); - // extension - temp = CPathUtils::GetFileExtFromPath(it->path); - if (it->kind == svn_node_file) - m_RepoList.SetItemText(index, 1, temp); - // revision - temp.Format(_T("%ld"), it->created_rev); - m_RepoList.SetItemText(index, 2, temp); - // author - m_RepoList.SetItemText(index, 3, it->author); - // size - if (it->kind == svn_node_file) - { - StrFormatByteSize(it->size, temp.GetBuffer(20), 20); - temp.ReleaseBuffer(); - m_RepoList.SetItemText(index, 4, temp); - } - // date - SVN::formatDate(date_native, (apr_time_t&)it->time, true); - m_RepoList.SetItemText(index, 5, date_native); - // lock owner - m_RepoList.SetItemText(index, 6, it->lockowner); - m_RepoList.SetItemData(index, (DWORD_PTR)&(*it)); - } - - ListView_SortItemsEx(m_RepoList, ListSort, this); - SetSortArrow(); - - for (int col = 0; col <= (((CHeaderCtrl*)(m_RepoList.GetDlgItem(0)))->GetItemCount()-1); col++) - { - m_RepoList.SetColumnWidth(col, LVSCW_AUTOSIZE_USEHEADER); - } - for (int col = 0; col <= (((CHeaderCtrl*)(m_RepoList.GetDlgItem(0)))->GetItemCount()-1); col++) - { - m_arColumnAutoWidths[col] = m_RepoList.GetColumnWidth(col); - } - - CRegString regColWidths(_T("Software\\TortoiseGit\\RepoBrowserColumnWidth")); - if (!CString(regColWidths).IsEmpty()) - { - StringToWidthArray(regColWidths, m_arColumnWidths); - - int maxcol = ((CHeaderCtrl*)(m_RepoList.GetDlgItem(0)))->GetItemCount()-1; - for (int col = 1; col <= maxcol; col++) - { - if (m_arColumnWidths[col] == 0) - m_RepoList.SetColumnWidth(col, LVSCW_AUTOSIZE_USEHEADER); - else - m_RepoList.SetColumnWidth(col, m_arColumnWidths[col]); - } - } - - m_RepoList.SetRedraw(true); -} - -HTREEITEM CRepositoryBrowser::FindUrl(const CString& fullurl, bool create /* = true */) -{ - return FindUrl(fullurl, fullurl, create, TVI_ROOT); -} - -HTREEITEM CRepositoryBrowser::FindUrl(const CString& fullurl, const CString& url, bool create /* true */, HTREEITEM hItem /* = TVI_ROOT */) -{ - if (hItem == TVI_ROOT) - { - hItem = m_RepoTree.GetRootItem(); - if (fullurl.Compare(m_strReposRoot)==0) - return hItem; - return FindUrl(fullurl, url.Mid(m_strReposRoot.GetLength()+1), create, hItem); - } - HTREEITEM hSibling = hItem; - if (m_RepoTree.GetNextItem(hItem, TVGN_CHILD)) - { - hSibling = m_RepoTree.GetNextItem(hItem, TVGN_CHILD); - do - { - CTreeItem * pTItem = ((CTreeItem*)m_RepoTree.GetItemData(hSibling)); - if (pTItem) - { - CString sSibling = pTItem->unescapedname; - if (sSibling.Compare(url.Left(sSibling.GetLength()))==0) - { - if (sSibling.GetLength() == url.GetLength()) - return hSibling; - if (url.GetAt(sSibling.GetLength()) == '/') - return FindUrl(fullurl, url.Mid(sSibling.GetLength()+1), create, hSibling); - } - } - } while ((hSibling = m_RepoTree.GetNextItem(hSibling, TVGN_NEXT)) != NULL); - } - if (!create) - return NULL; - // create tree items for every path part in the url - CString sUrl = url; - int slash = -1; - HTREEITEM hNewItem = hItem; - CString sTemp; - while ((slash=sUrl.Find('/')) >= 0) - { - CTreeItem * pTreeItem = new CTreeItem(); - sTemp = sUrl.Left(slash); - pTreeItem->unescapedname = sTemp; - pTreeItem->url = fullurl.Left(fullurl.GetLength()-sUrl.GetLength()+slash); - UINT state = pTreeItem->url.CompareNoCase(m_diffURL.GetSVNPathString()) ? 0 : TVIS_BOLD; - TVINSERTSTRUCT tvinsert = {0}; - tvinsert.hParent = hNewItem; - tvinsert.hInsertAfter = TVI_SORT; - tvinsert.itemex.mask = TVIF_CHILDREN | TVIF_DI_SETITEM | TVIF_PARAM | TVIF_TEXT | TVIF_IMAGE | TVIF_SELECTEDIMAGE | TVIF_STATE; - tvinsert.itemex.state = state; - tvinsert.itemex.stateMask = state; - tvinsert.itemex.pszText = sTemp.GetBuffer(sTemp.GetLength()); - tvinsert.itemex.cChildren = 1; - tvinsert.itemex.lParam = (LPARAM)pTreeItem; - tvinsert.itemex.iImage = m_nIconFolder; - tvinsert.itemex.iSelectedImage = m_nOpenIconFolder; - - hNewItem = m_RepoTree.InsertItem(&tvinsert); - sTemp.ReleaseBuffer(); - sUrl = sUrl.Mid(slash+1); - ATLTRACE(_T("created tree entry %s, url %s\n"), sTemp, pTreeItem->url); - } - if (!sUrl.IsEmpty()) - { - CTreeItem * pTreeItem = new CTreeItem(); - sTemp = sUrl; - pTreeItem->unescapedname = sTemp; - pTreeItem->url = fullurl; - UINT state = pTreeItem->url.CompareNoCase(m_diffURL.GetSVNPathString()) ? 0 : TVIS_BOLD; - TVINSERTSTRUCT tvinsert = {0}; - tvinsert.hParent = hNewItem; - tvinsert.hInsertAfter = TVI_SORT; - tvinsert.itemex.mask = TVIF_CHILDREN | TVIF_DI_SETITEM | TVIF_PARAM | TVIF_TEXT | TVIF_IMAGE | TVIF_SELECTEDIMAGE | TVIF_STATE; - tvinsert.itemex.state = state; - tvinsert.itemex.stateMask = state; - tvinsert.itemex.pszText = sTemp.GetBuffer(sTemp.GetLength()); - tvinsert.itemex.cChildren = 1; - tvinsert.itemex.lParam = (LPARAM)pTreeItem; - tvinsert.itemex.iImage = m_nIconFolder; - tvinsert.itemex.iSelectedImage = m_nOpenIconFolder; - - hNewItem = m_RepoTree.InsertItem(&tvinsert); - sTemp.ReleaseBuffer(); - m_RepoTree.SortChildren(hNewItem); - return hNewItem; - } - return NULL; -} - -bool CRepositoryBrowser::RefreshNode(const CString& url, bool force /* = false*/, bool recursive /* = false*/) -{ - HTREEITEM hNode = FindUrl(url); - return RefreshNode(hNode, force, recursive); -} - -bool CRepositoryBrowser::RefreshNode(HTREEITEM hNode, bool force /* = false*/, bool recursive /* = false*/) -{ - if (hNode == NULL) - return false; - SaveColumnWidths(); - CWaitCursorEx wait; - CTreeItem * pTreeItem = (CTreeItem *)m_RepoTree.GetItemData(hNode); - HTREEITEM hSel1 = m_RepoTree.GetSelectedItem(); - if (m_RepoTree.ItemHasChildren(hNode)) - { - HTREEITEM hChild = m_RepoTree.GetChildItem(hNode); - HTREEITEM hNext; - m_blockEvents = true; - while (hChild) - { - hNext = m_RepoTree.GetNextItem(hChild, TVGN_NEXT); - RecursiveRemove(hChild); - m_RepoTree.DeleteItem(hChild); - hChild = hNext; - } - m_blockEvents = false; - } - if (pTreeItem == NULL) - return false; - pTreeItem->children.clear(); - pTreeItem->has_child_folders = false; - m_bCancelled = false; - if (!List(CTSVNPath(pTreeItem->url), GetRevision(), GetRevision(), recursive ? svn_depth_infinity : svn_depth_immediates, true)) - { - // error during list() - m_RepoList.ShowText(GetLastErrorMessage()); - return false; - } - pTreeItem->children_fetched = true; - // if there are no child folders, remove the '+' in front of the node - { - TVITEM tvitem = {0}; - tvitem.hItem = hNode; - tvitem.mask = TVIF_CHILDREN; - tvitem.cChildren = pTreeItem->has_child_folders ? 1 : 0; - m_RepoTree.SetItem(&tvitem); - } - if ((force)||(hSel1 == hNode)||(hSel1 != m_RepoTree.GetSelectedItem())) - { - FillList(&pTreeItem->children); - } - return true; -} - -BOOL CRepositoryBrowser::PreTranslateMessage(MSG* pMsg) -{ - if (pMsg->message>=WM_KEYFIRST && pMsg->message<=WM_KEYLAST) - { - // Check if there is an in place Edit active: - // in place edits are done with an edit control, where the parent - // is the control with the editable item (tree or list control here) - HWND hWndFocus = ::GetFocus(); - if (hWndFocus) - hWndFocus = ::GetParent(hWndFocus); - if (hWndFocus && ((hWndFocus == m_RepoTree.GetSafeHwnd())||(hWndFocus == m_RepoList.GetSafeHwnd()))) - { - // Do a direct translation. - ::TranslateMessage(pMsg); - ::DispatchMessage(pMsg); - return TRUE; - } - if (m_hAccel) - { - if (pMsg->message == WM_KEYDOWN) - { - switch (pMsg->wParam) - { - case 'C': - case VK_INSERT: - case VK_DELETE: - case VK_BACK: - { - if ((pMsg->hwnd == m_barRepository.GetSafeHwnd())||(::IsChild(m_barRepository.GetSafeHwnd(), pMsg->hwnd))) - return __super::PreTranslateMessage(pMsg); - } - break; - } - } - int ret = TranslateAccelerator(m_hWnd, m_hAccel, pMsg); - if (ret) - return TRUE; - } - } - return __super::PreTranslateMessage(pMsg); -} - -void CRepositoryBrowser::OnDelete() -{ - CTSVNPathList urlList; - bool bTreeItem = false; - - POSITION pos = m_RepoList.GetFirstSelectedItemPosition(); - int index = -1; - while ((index = m_RepoList.GetNextSelectedItem(pos))>=0) - { - CItem * pItem = (CItem *)m_RepoList.GetItemData(index); - CString absPath = pItem->absolutepath; - absPath.Replace(_T("\\"), _T("%5C")); - urlList.AddPath(CTSVNPath(absPath)); - } - if ((urlList.GetCount() == 0)) - { - HTREEITEM hItem = m_RepoTree.GetSelectedItem(); - CTreeItem * pTreeItem = (CTreeItem *)m_RepoTree.GetItemData(hItem); - if (pTreeItem) - { - urlList.AddPath(CTSVNPath(pTreeItem->url)); - bTreeItem = true; - } - } - - if (urlList.GetCount() == 0) - return; - - - CWaitCursorEx wait_cursor; - CInputLogDlg input(this); - input.SetUUID(m_sUUID); - input.SetProjectProperties(&m_ProjectProperties); - CString hint; - if (urlList.GetCount() == 1) - hint.Format(IDS_INPUT_REMOVEONE, (LPCTSTR)urlList[0].GetFileOrDirectoryName()); - else - hint.Format(IDS_INPUT_REMOVEMORE, urlList.GetCount()); - input.SetActionText(hint); - if (input.DoModal() == IDOK) - { - if (!Remove(urlList, true, false, input.GetLogMessage())) - { - wait_cursor.Hide(); - CMessageBox::Show(this->m_hWnd, GetLastErrorMessage(), _T("TortoiseSVN"), MB_ICONERROR); - return; - } - if (bTreeItem) - RefreshNode(m_RepoTree.GetParentItem(m_RepoTree.GetSelectedItem()), true); - else - RefreshNode(m_RepoTree.GetSelectedItem(), true); - } -} - -void CRepositoryBrowser::OnGoUp() -{ - m_barRepository.OnGoUp(); -} - -void CRepositoryBrowser::OnUrlFocus() -{ - m_barRepository.SetFocusToURL(); -} - -void CRepositoryBrowser::OnCopy() -{ - // Ctrl-C : copy the selected item urls to the clipboard - CString url; - POSITION pos = m_RepoList.GetFirstSelectedItemPosition(); - int index = -1; - while ((index = m_RepoList.GetNextSelectedItem(pos))>=0) - { - CItem * pItem = (CItem *)m_RepoList.GetItemData(index); - url += CUnicodeUtils::GetUnicode(CPathUtils::PathEscape(CUnicodeUtils::GetUTF8(pItem->absolutepath))) + _T("\r\n"); - } - if (!url.IsEmpty()) - { - url.TrimRight(_T("\r\n")); - CStringUtils::WriteAsciiStringToClipboard(url); - } -} - -void CRepositoryBrowser::OnInlineedit() -{ - POSITION pos = m_RepoList.GetFirstSelectedItemPosition(); - int selIndex = m_RepoList.GetNextSelectedItem(pos); - m_blockEvents = true; - if (selIndex >= 0) - { - m_RepoList.SetFocus(); - m_RepoList.EditLabel(selIndex); - } - else - { - m_RepoTree.SetFocus(); - HTREEITEM hTreeItem = m_RepoTree.GetSelectedItem(); - if (hTreeItem != m_RepoTree.GetRootItem()) - m_RepoTree.EditLabel(hTreeItem); - } - m_blockEvents = false; -} - -void CRepositoryBrowser::OnRefresh() -{ - m_blockEvents = true; - RefreshNode(m_RepoTree.GetSelectedItem(), true, !!(GetKeyState(VK_CONTROL)&0x8000)); - m_blockEvents = false; -} - -void CRepositoryBrowser::OnTvnSelchangedRepotree(NMHDR *pNMHDR, LRESULT *pResult) -{ - LPNMTREEVIEW pNMTreeView = reinterpret_cast(pNMHDR); - *pResult = 0; - - if (m_blockEvents) - return; - - if (pNMTreeView->action == TVC_BYKEYBOARD) - SetTimer(REPOBROWSER_FETCHTIMER, 300, NULL); - else - OnTimer(REPOBROWSER_FETCHTIMER); -} - -void CRepositoryBrowser::OnTimer(UINT_PTR nIDEvent) -{ - if (nIDEvent == REPOBROWSER_FETCHTIMER) - { - KillTimer(REPOBROWSER_FETCHTIMER); - // find the currently selected item - HTREEITEM hSelItem = m_RepoTree.GetSelectedItem(); - if (hSelItem) - { - CTreeItem * pTreeItem = (CTreeItem *)m_RepoTree.GetItemData(hSelItem); - if (pTreeItem) - { - if (!pTreeItem->children_fetched) - { - m_RepoList.ShowText(_T(" "), true); - RefreshNode(hSelItem); - m_RepoList.ClearText(); - } - - FillList(&pTreeItem->children); - m_barRepository.ShowUrl(pTreeItem->url, GetRevision()); - } - } - } - - __super::OnTimer(nIDEvent); -} - -void CRepositoryBrowser::OnTvnItemexpandingRepotree(NMHDR *pNMHDR, LRESULT *pResult) -{ - LPNMTREEVIEW pNMTreeView = reinterpret_cast(pNMHDR); - *pResult = 0; - - if (m_blockEvents) - return; - - CTreeItem * pTreeItem = (CTreeItem *)pNMTreeView->itemNew.lParam; - - if (pTreeItem == NULL) - return; - - if (pNMTreeView->action == TVE_COLLAPSE) - { - // user wants to collapse a tree node. - // if we don't know anything about the children - // of the node, we suppress the collapsing but fetch the info instead - if (!pTreeItem->children_fetched) - { - RefreshNode(pNMTreeView->itemNew.hItem); - *pResult = 1; - return; - } - return; - } - - // user wants to expand a tree node. - // check if we already know its children - if not we have to ask the repository! - - if (!pTreeItem->children_fetched) - { - RefreshNode(pNMTreeView->itemNew.hItem); - } - else - { - // if there are no child folders, remove the '+' in front of the node - if (!pTreeItem->has_child_folders) - { - TVITEM tvitem = {0}; - tvitem.hItem = pNMTreeView->itemNew.hItem; - tvitem.mask = TVIF_CHILDREN; - tvitem.cChildren = 0; - m_RepoTree.SetItem(&tvitem); - } - } -} - -void CRepositoryBrowser::OnNMDblclkRepolist(NMHDR *pNMHDR, LRESULT *pResult) -{ - LPNMITEMACTIVATE pNmItemActivate = reinterpret_cast(pNMHDR); - *pResult = 0; - - if (m_blockEvents) - return; - - if (pNmItemActivate->iItem < 0) - return; - CItem * pItem = (CItem*)m_RepoList.GetItemData(pNmItemActivate->iItem); - if ((pItem)&&(pItem->kind == svn_node_dir)) - { - // a double click on a folder results in selecting that folder - ChangeToUrl(pItem->absolutepath, m_initialRev, true); - } -} - -void CRepositoryBrowser::OnHdnItemclickRepolist(NMHDR *pNMHDR, LRESULT *pResult) -{ - LPNMHEADER phdr = reinterpret_cast(pNMHDR); - // a click on a header means sorting the items - if (m_nSortedColumn != phdr->iItem) - m_bSortAscending = true; - else - m_bSortAscending = !m_bSortAscending; - m_nSortedColumn = phdr->iItem; - - m_blockEvents = true; - ListView_SortItemsEx(m_RepoList, ListSort, this); - SetSortArrow(); - m_blockEvents = false; - *pResult = 0; -} - -int CRepositoryBrowser::ListSort(LPARAM lParam1, LPARAM lParam2, LPARAM lParam3) -{ - CRepositoryBrowser * pThis = (CRepositoryBrowser*)lParam3; - CItem * pItem1 = (CItem*)pThis->m_RepoList.GetItemData(static_cast(lParam1)); - CItem * pItem2 = (CItem*)pThis->m_RepoList.GetItemData(static_cast(lParam2)); - int nRet = 0; - switch (pThis->m_nSortedColumn) - { - case 1: // extension - nRet = pThis->m_RepoList.GetItemText(static_cast(lParam1), 1) - .CompareNoCase(pThis->m_RepoList.GetItemText(static_cast(lParam2), 1)); - if (nRet != 0) - break; - // fall through - case 2: // revision number - nRet = pItem1->created_rev - pItem2->created_rev; - if (nRet != 0) - break; - // fall through - case 3: // author - nRet = pItem1->author.CompareNoCase(pItem2->author); - if (nRet != 0) - break; - // fall through - case 4: // size - nRet = int(pItem1->size - pItem2->size); - if (nRet != 0) - break; - // fall through - case 5: // date - nRet = (pItem1->time - pItem2->time) > 0 ? 1 : -1; - if (nRet != 0) - break; - // fall through - case 6: // lock owner - nRet = pItem1->lockowner.CompareNoCase(pItem2->lockowner); - if (nRet != 0) - break; - // fall through - case 0: // filename - nRet = CStringUtils::CompareNumerical(pItem1->path, pItem2->path); - break; - } - - if (!pThis->m_bSortAscending) - nRet = -nRet; - - // we want folders on top, then the files - if (pItem1->kind != pItem2->kind) - { - if (pItem1->kind == svn_node_dir) - nRet = -1; - else - nRet = 1; - } - - return nRet; -} - -void CRepositoryBrowser::SetSortArrow() -{ - CHeaderCtrl * pHeader = m_RepoList.GetHeaderCtrl(); - HDITEM HeaderItem = {0}; - HeaderItem.mask = HDI_FORMAT; - for (int i=0; iGetItemCount(); ++i) - { - pHeader->GetItem(i, &HeaderItem); - HeaderItem.fmt &= ~(HDF_SORTDOWN | HDF_SORTUP); - pHeader->SetItem(i, &HeaderItem); - } - - pHeader->GetItem(m_nSortedColumn, &HeaderItem); - HeaderItem.fmt |= (m_bSortAscending ? HDF_SORTUP : HDF_SORTDOWN); - pHeader->SetItem(m_nSortedColumn, &HeaderItem); -} - -void CRepositoryBrowser::OnLvnItemchangedRepolist(NMHDR *pNMHDR, LRESULT *pResult) -{ - LPNMLISTVIEW pNMLV = reinterpret_cast(pNMHDR); - *pResult = 0; - if (m_blockEvents) - return; - if (m_RepoList.HasText()) - return; - if (pNMLV->uChanged & LVIF_STATE) - { - if (pNMLV->uNewState & LVIS_SELECTED) - { - CItem * pItem = (CItem*)m_RepoList.GetItemData(pNMLV->iItem); - if (pItem) - m_barRepository.ShowUrl(pItem->absolutepath, GetRevision()); - } - } -} - -void CRepositoryBrowser::OnLvnEndlabeleditRepolist(NMHDR *pNMHDR, LRESULT *pResult) -{ - NMLVDISPINFO *pDispInfo = reinterpret_cast(pNMHDR); - *pResult = 0; - if (pDispInfo->item.pszText == NULL) - return; - // rename the item in the repository - CItem * pItem = (CItem *)m_RepoList.GetItemData(pDispInfo->item.iItem); - - CWaitCursorEx wait_cursor; - CInputLogDlg input(this); - input.SetUUID(m_sUUID); - input.SetProjectProperties(&m_ProjectProperties); - CTSVNPath targetUrl = CTSVNPath(EscapeUrl(CTSVNPath(pItem->absolutepath.Left(pItem->absolutepath.ReverseFind('/')+1)+pDispInfo->item.pszText))); - if (!targetUrl.IsValidOnWindows()) - { - if (CMessageBox::Show(GetSafeHwnd(), IDS_WARN_NOVALIDPATH, IDS_APPNAME, MB_ICONINFORMATION|MB_YESNO) != IDYES) - return; - } - CString sHint; - sHint.Format(IDS_INPUT_RENAME, (LPCTSTR)(pItem->absolutepath), (LPCTSTR)targetUrl.GetSVNPathString()); - input.SetActionText(sHint); - if (input.DoModal() == IDOK) - { - m_bCancelled = false; - if (!Move(CTSVNPathList(CTSVNPath(EscapeUrl(CTSVNPath(pItem->absolutepath)))), - targetUrl, - true, input.GetLogMessage())) - { - wait_cursor.Hide(); - CMessageBox::Show(this->m_hWnd, GetLastErrorMessage(), _T("TortoiseSVN"), MB_ICONERROR); - return; - } - *pResult = TRUE; - RefreshNode(m_RepoTree.GetSelectedItem(), true); - } -} - -void CRepositoryBrowser::OnTvnEndlabeleditRepotree(NMHDR *pNMHDR, LRESULT *pResult) -{ - LPNMTVDISPINFO pTVDispInfo = reinterpret_cast(pNMHDR); - *pResult = 0; - if (pTVDispInfo->item.pszText == NULL) - return; - - // rename the item in the repository - HTREEITEM hSelectedItem = pTVDispInfo->item.hItem; - CTreeItem * pItem = (CTreeItem *)m_RepoTree.GetItemData(hSelectedItem); - if (pItem == NULL) - return; - - CWaitCursorEx wait_cursor; - CInputLogDlg input(this); - input.SetUUID(m_sUUID); - input.SetProjectProperties(&m_ProjectProperties); - CTSVNPath targetUrl = CTSVNPath(EscapeUrl(CTSVNPath(pItem->url.Left(pItem->url.ReverseFind('/')+1)+pTVDispInfo->item.pszText))); - if (!targetUrl.IsValidOnWindows()) - { - if (CMessageBox::Show(GetSafeHwnd(), IDS_WARN_NOVALIDPATH, IDS_APPNAME, MB_ICONINFORMATION|MB_YESNO) != IDYES) - return; - } - CString sHint; - sHint.Format(IDS_INPUT_RENAME, (LPCTSTR)(pItem->url), (LPCTSTR)targetUrl.GetSVNPathString()); - input.SetActionText(sHint); - if (input.DoModal() == IDOK) - { - m_bCancelled = false; - if (!Move(CTSVNPathList(CTSVNPath(EscapeUrl(CTSVNPath(pItem->url)))), - targetUrl, - true, input.GetLogMessage())) - { - wait_cursor.Hide(); - CMessageBox::Show(this->m_hWnd, GetLastErrorMessage(), _T("TortoiseSVN"), MB_ICONERROR); - return; - } - *pResult = TRUE; - pItem->url = targetUrl.GetSVNPathString(); - pItem->unescapedname = pTVDispInfo->item.pszText; - m_RepoTree.SetItemData(hSelectedItem, (DWORD_PTR)pItem); - if (hSelectedItem == m_RepoTree.GetSelectedItem()) - RefreshNode(hSelectedItem, true); - } -} - -void CRepositoryBrowser::OnLvnBeginrdragRepolist(NMHDR *pNMHDR, LRESULT *pResult) -{ - m_bRightDrag = true; - *pResult = 0; - OnBeginDrag(pNMHDR); -} - -void CRepositoryBrowser::OnLvnBegindragRepolist(NMHDR *pNMHDR, LRESULT *pResult) -{ - m_bRightDrag = false; - *pResult = 0; - OnBeginDrag(pNMHDR); -} - -void CRepositoryBrowser::OnBeginDrag(NMHDR *pNMHDR) -{ - LPNMLISTVIEW pNMLV = reinterpret_cast(pNMHDR); - - if (m_RepoList.HasText()) - return; - CIDropSource* pdsrc = new CIDropSource; - if (pdsrc == NULL) - return; - pdsrc->AddRef(); - - CTSVNPathList sourceURLs; - POSITION pos = m_RepoList.GetFirstSelectedItemPosition(); - int index = -1; - while ((index = m_RepoList.GetNextSelectedItem(pos))>=0) - { - CItem * pItem = (CItem *)m_RepoList.GetItemData(index); - if (pItem) - sourceURLs.AddPath(CTSVNPath(EscapeUrl(CTSVNPath(pItem->absolutepath)))); - } - - SVNDataObject* pdobj = new SVNDataObject(sourceURLs, GetRevision(), GetRevision()); - if (pdobj == NULL) - { - delete pdsrc; - return; - } - pdobj->AddRef(); - pdobj->SetAsyncMode(TRUE); - - CDragSourceHelper dragsrchelper; - dragsrchelper.InitializeFromWindow(m_RepoList.GetSafeHwnd(), pNMLV->ptAction, pdobj); - // Initiate the Drag & Drop - DWORD dwEffect; - ::DoDragDrop(pdobj, pdsrc, DROPEFFECT_MOVE|DROPEFFECT_COPY, &dwEffect); - pdsrc->Release(); - pdobj->Release(); -} - -void CRepositoryBrowser::OnTvnBegindragRepotree(NMHDR *pNMHDR, LRESULT *pResult) -{ - m_bRightDrag = false; - *pResult = 0; - OnBeginDragTree(pNMHDR); -} - -void CRepositoryBrowser::OnTvnBeginrdragRepotree(NMHDR *pNMHDR, LRESULT *pResult) -{ - m_bRightDrag = true; - *pResult = 0; - OnBeginDragTree(pNMHDR); -} - -void CRepositoryBrowser::OnBeginDragTree(NMHDR *pNMHDR) -{ - LPNMTREEVIEW pNMTreeView = reinterpret_cast(pNMHDR); - - if (m_blockEvents) - return; - - CTreeItem * pTreeItem = (CTreeItem *)pNMTreeView->itemNew.lParam; - - if (pTreeItem == NULL) - return; - - CIDropSource* pdsrc = new CIDropSource; - if (pdsrc == NULL) - return; - pdsrc->AddRef(); - - CTSVNPathList sourceURLs; - sourceURLs.AddPath(CTSVNPath(EscapeUrl(CTSVNPath(pTreeItem->url)))); - - SVNDataObject* pdobj = new SVNDataObject(sourceURLs, GetRevision(), GetRevision()); - if (pdobj == NULL) - { - delete pdsrc; - return; - } - pdobj->AddRef(); - - CDragSourceHelper dragsrchelper; - dragsrchelper.InitializeFromWindow(m_RepoTree.GetSafeHwnd(), pNMTreeView->ptDrag, pdobj); - // Initiate the Drag & Drop - DWORD dwEffect; - ::DoDragDrop(pdobj, pdsrc, DROPEFFECT_MOVE|DROPEFFECT_COPY, &dwEffect); - pdsrc->Release(); - pdobj->Release(); -} - - -bool CRepositoryBrowser::OnDrop(const CTSVNPath& target, const CTSVNPathList& pathlist, const SVNRev& srcRev, DWORD dwEffect, POINTL /*pt*/) -{ - ATLTRACE(_T("dropped %ld items on %s, source revision is %s, dwEffect is %ld\n"), pathlist.GetCount(), (LPCTSTR)target.GetSVNPathString(), srcRev.ToString(), dwEffect); - if (pathlist.GetCount() == 0) - return false; - - CString targetName = pathlist[0].GetFileOrDirectoryName(); - if (m_bRightDrag) - { - // right dragging means we have to show a context menu - POINT pt; - DWORD ptW = GetMessagePos(); - pt.x = GET_X_LPARAM(ptW); - pt.y = GET_Y_LPARAM(ptW); - CMenu popup; - if (popup.CreatePopupMenu()) - { - CString temp(MAKEINTRESOURCE(IDS_REPOBROWSE_COPYDROP)); - popup.AppendMenu(MF_STRING | MF_ENABLED, 1, temp); - temp.LoadString(IDS_REPOBROWSE_MOVEDROP); - popup.AppendMenu(MF_STRING | MF_ENABLED, 2, temp); - if ((pathlist.GetCount() == 1)&&(PathIsURL(pathlist[0]))) - { - // these entries are only shown if *one* item was dragged, and if the - // item is not one dropped from e.g. the explorer but from the repository - // browser itself. - popup.AppendMenu(MF_SEPARATOR, 3); - temp.LoadString(IDS_REPOBROWSE_COPYRENAMEDROP); - popup.AppendMenu(MF_STRING | MF_ENABLED, 4, temp); - temp.LoadString(IDS_REPOBROWSE_MOVERENAMEDROP); - popup.AppendMenu(MF_STRING | MF_ENABLED, 5, temp); - } - int cmd = popup.TrackPopupMenu(TPM_RETURNCMD | TPM_LEFTALIGN | TPM_NONOTIFY, pt.x, pt.y, this, 0); - switch (cmd) - { - default:// nothing clicked - return false; - case 1: // copy drop - dwEffect = DROPEFFECT_COPY; - break; - case 2: // move drop - dwEffect = DROPEFFECT_MOVE; - break; - case 4: // copy rename drop - { - dwEffect = DROPEFFECT_COPY; - CRenameDlg dlg; - dlg.m_name = targetName; - dlg.m_windowtitle.LoadString(IDS_REPOBROWSE_RENAME); - CStringUtils::RemoveAccelerators(dlg.m_windowtitle); - if (dlg.DoModal() != IDOK) - return false; - targetName = dlg.m_name; - if (!CTSVNPath(targetName).IsValidOnWindows()) - { - if (CMessageBox::Show(GetSafeHwnd(), IDS_WARN_NOVALIDPATH, IDS_APPNAME, MB_ICONINFORMATION|MB_YESNO) != IDYES) - return false; - } - } - break; - case 5: // move rename drop - { - dwEffect = DROPEFFECT_MOVE; - CRenameDlg dlg; - dlg.m_name = targetName; - dlg.m_windowtitle.LoadString(IDS_REPOBROWSE_RENAME); - CStringUtils::RemoveAccelerators(dlg.m_windowtitle); - if (dlg.DoModal() != IDOK) - return false; - targetName = dlg.m_name; - if (!CTSVNPath(targetName).IsValidOnWindows()) - { - if (CMessageBox::Show(GetSafeHwnd(), IDS_WARN_NOVALIDPATH, IDS_APPNAME, MB_ICONINFORMATION|MB_YESNO) != IDYES) - return false; - } - } - break; - } - } - - } - // check the first item in the path list: - // if it's an url, we do a copy or move operation - // if it's a local path, we do an import - if (PathIsURL(pathlist[0])) - { - // If any of the paths are 'special' (branches, tags, or trunk) and we are - // about to perform a move, we should warn the user and get them to confirm - // that this is what they intended. Yes, I *have* accidentally moved the - // trunk when I was trying to create a tag! :) - if (DROPEFFECT_COPY != dwEffect) - { - bool pathListIsSpecial = false; - int pathCount = pathlist.GetCount(); - for (int i=0 ; im_hWnd, GetLastErrorMessage(), _T("TortoiseSVN"), MB_ICONERROR); - } - else if (GetRevision().IsHead()) - { - // mark the target as dirty - HTREEITEM hTarget = FindUrl(target.GetSVNPathString(), false); - if (hTarget) - { - CTreeItem * pItem = (CTreeItem*)m_RepoTree.GetItemData(hTarget); - if (pItem) - { - // mark the target as 'dirty' - pItem->children_fetched = false; - RecursiveRemove(hTarget, true); - TVITEM tvitem = {0}; - tvitem.hItem = hTarget; - tvitem.mask = TVIF_CHILDREN; - tvitem.cChildren = 1; - m_RepoTree.SetItem(&tvitem); - } - } - if (dwEffect == DROPEFFECT_MOVE) - { - // if items were moved, we have to - // invalidate all sources too - for (int i=0; ichildren_fetched = false; - if ((dwEffect == DROPEFFECT_MOVE)||(pItem->url.Compare(target.GetSVNPathString())==0)) - { - // Refresh the current view - RefreshNode(hSelected, true); - } - } - } - } - } - } - else - { - // import files dragged onto us - if (pathlist.GetCount() > 1) - { - if (CMessageBox::Show(m_hWnd, IDS_REPOBROWSE_MULTIIMPORT, IDS_APPNAME, MB_YESNO | MB_ICONQUESTION)!=IDYES) - return false; - } - - CInputLogDlg input(this); - input.SetProjectProperties(&m_ProjectProperties); - input.SetUUID(m_sUUID); - CString sHint; - if (pathlist.GetCount() == 1) - sHint.Format(IDS_INPUT_IMPORTFILEFULL, pathlist[0].GetWinPath(), (LPCTSTR)(target.GetSVNPathString() + _T("/") + pathlist[0].GetFileOrDirectoryName())); - else - sHint.Format(IDS_INPUT_IMPORTFILES, pathlist.GetCount()); - input.SetActionText(sHint); - - if (input.DoModal() == IDOK) - { - m_bCancelled = false; - for (int importindex = 0; importindexm_hWnd, GetLastErrorMessage(), _T("TortoiseSVN"), MB_ICONERROR); - return false; - } - } - if (GetRevision().IsHead()) - { - // if the import operation was to the currently shown url, - // update the current view. Otherwise mark the target URL as 'not fetched'. - HTREEITEM hSelected = m_RepoTree.GetSelectedItem(); - if (hSelected) - { - CTreeItem * pItem = (CTreeItem*)m_RepoTree.GetItemData(hSelected); - if (pItem) - { - if (pItem->url.Compare(target.GetSVNPathString())==0) - { - // Refresh the current view - RefreshNode(hSelected, true); - } - else - { - // only mark the target as 'dirty' - pItem->children_fetched = false; - } - } - } - } - } - - } - return true; -} - -CString CRepositoryBrowser::EscapeUrl(const CTSVNPath& url) -{ - return CUnicodeUtils::GetUnicode(CPathUtils::PathEscape(CUnicodeUtils::GetUTF8(url.GetSVNPathString()))); -} - -void CRepositoryBrowser::OnContextMenu(CWnd* pWnd, CPoint point) -{ - HTREEITEM hSelectedTreeItem = NULL; - HTREEITEM hChosenTreeItem = NULL; - if ((point.x == -1) && (point.y == -1)) - { - if (pWnd == &m_RepoTree) - { - CRect rect; - m_RepoTree.GetItemRect(m_RepoTree.GetSelectedItem(), &rect, TRUE); - m_RepoTree.ClientToScreen(&rect); - point = rect.CenterPoint(); - } - else - { - CRect rect; - POSITION pos = m_RepoList.GetFirstSelectedItemPosition(); - m_RepoList.GetItemRect(m_RepoList.GetNextSelectedItem(pos), &rect, LVIR_LABEL); - m_RepoList.ClientToScreen(&rect); - point = rect.CenterPoint(); - } - } - m_bCancelled = false; - CTSVNPathList urlList; - CTSVNPathList urlListEscaped; - int nFolders = 0; - int nLocked = 0; - if (pWnd == &m_RepoList) - { - CString urls; - - POSITION pos = m_RepoList.GetFirstSelectedItemPosition(); - int index = -1; - while ((index = m_RepoList.GetNextSelectedItem(pos))>=0) - { - CItem * pItem = (CItem *)m_RepoList.GetItemData(index); - CString absPath = pItem->absolutepath; - absPath.Replace(_T("\\"), _T("%5C")); - urlList.AddPath(CTSVNPath(absPath)); - urlListEscaped.AddPath(CTSVNPath(EscapeUrl(CTSVNPath(absPath)))); - if (pItem->kind == svn_node_dir) - nFolders++; - if (!pItem->locktoken.IsEmpty()) - nLocked++; - } - if (urlList.GetCount() == 0) - { - // Right-click outside any list control items. It may be the background, - // but it also could be the list control headers. - CRect hr; - m_RepoList.GetHeaderCtrl()->GetWindowRect(&hr); - if (!hr.PtInRect(point)) - { - // Seems to be a right-click on the list view background. - // Use the currently selected item in the tree view as the source. - m_blockEvents = true; - hSelectedTreeItem = m_RepoTree.GetSelectedItem(); - if (hSelectedTreeItem) - { - m_RepoTree.SetItemState(hSelectedTreeItem, 0, TVIS_SELECTED); - m_blockEvents = false; - m_RepoTree.SetItemState(hSelectedTreeItem, TVIS_DROPHILITED, TVIS_DROPHILITED); - CTreeItem * pTreeItem = (CTreeItem *)m_RepoTree.GetItemData(hSelectedTreeItem); - if (pTreeItem) - { - urlList.AddPath(CTSVNPath(pTreeItem->url)); - urlListEscaped.AddPath(CTSVNPath(EscapeUrl(CTSVNPath(pTreeItem->url)))); - nFolders++; - } - } - } - } - } - if ((pWnd == &m_RepoTree)||(urlList.GetCount() == 0)) - { - UINT uFlags; - CPoint ptTree = point; - m_RepoTree.ScreenToClient(&ptTree); - HTREEITEM hItem = m_RepoTree.HitTest(ptTree, &uFlags); - // in case the right-clicked item is not the selected one, - // use the TVIS_DROPHILITED style to indicate on which item - // the context menu will work on - if ((hItem) && (uFlags & TVHT_ONITEM) && (hItem != m_RepoTree.GetSelectedItem())) - { - m_blockEvents = true; - hSelectedTreeItem = m_RepoTree.GetSelectedItem(); - m_RepoTree.SetItemState(hSelectedTreeItem, 0, TVIS_SELECTED); - m_blockEvents = false; - m_RepoTree.SetItemState(hItem, TVIS_DROPHILITED, TVIS_DROPHILITED); - } - if (hItem) - { - hChosenTreeItem = hItem; - CTreeItem * pTreeItem = (CTreeItem *)m_RepoTree.GetItemData(hItem); - if (pTreeItem) - { - urlList.AddPath(CTSVNPath(pTreeItem->url)); - urlListEscaped.AddPath(CTSVNPath(EscapeUrl(CTSVNPath(pTreeItem->url)))); - nFolders++; - } - } - } - - if (urlList.GetCount() == 0) - return; - - CIconMenu popup; - if (popup.CreatePopupMenu()) - { - if (urlList.GetCount() == 1) - { - if (nFolders == 0) - { - // Let "Open" be the very first entry, like in Explorer - popup.AppendMenuIcon(ID_OPEN, IDS_REPOBROWSE_OPEN, IDI_OPEN); // "open" - popup.AppendMenuIcon(ID_OPENWITH, IDS_LOG_POPUP_OPENWITH, IDI_OPEN); // "open with..." - popup.AppendMenu(MF_SEPARATOR, NULL); - } - popup.AppendMenuIcon(ID_SHOWLOG, IDS_REPOBROWSE_SHOWLOG, IDI_LOG); // "Show Log..." - // the revision graph on the repository root would be empty. We - // don't show the context menu entry there. - if (urlList[0].GetSVNPathString().Compare(m_strReposRoot)!=0) - { - popup.AppendMenuIcon(ID_REVGRAPH, IDS_MENUREVISIONGRAPH, IDI_REVISIONGRAPH); // "Revision graph" - } - if (nFolders == 0) - { - popup.AppendMenuIcon(ID_BLAME, IDS_MENUBLAME, IDI_BLAME); // "Blame..." - } - if (!m_ProjectProperties.sWebViewerRev.IsEmpty()) - { - popup.AppendMenuIcon(ID_VIEWREV, IDS_LOG_POPUP_VIEWREV); // "View revision in webviewer" - } - if (!m_ProjectProperties.sWebViewerPathRev.IsEmpty()) - { - popup.AppendMenuIcon(ID_VIEWPATHREV, IDS_LOG_POPUP_VIEWPATHREV); // "View revision for path in webviewer" - } - if ((!m_ProjectProperties.sWebViewerPathRev.IsEmpty())|| - (!m_ProjectProperties.sWebViewerRev.IsEmpty())) - { - popup.AppendMenu(MF_SEPARATOR, NULL); - } - if (nFolders) - { - popup.AppendMenuIcon(ID_EXPORT, IDS_MENUEXPORT, IDI_EXPORT); // "Export" - } - } - // We allow checkout of multiple folders at once (we do that one by one) - if (nFolders == urlList.GetCount()) - { - popup.AppendMenuIcon(ID_CHECKOUT, IDS_MENUCHECKOUT, IDI_CHECKOUT); // "Checkout.." - } - if (urlList.GetCount() == 1) - { - if (nFolders) - { - popup.AppendMenuIcon(ID_REFRESH, IDS_REPOBROWSE_REFRESH, IDI_REFRESH); // "Refresh" - } - popup.AppendMenu(MF_SEPARATOR, NULL); - - if (GetRevision().IsHead()) - { - if (nFolders) - { - popup.AppendMenuIcon(ID_MKDIR, IDS_REPOBROWSE_MKDIR, IDI_MKDIR); // "create directory" - popup.AppendMenuIcon(ID_IMPORT, IDS_REPOBROWSE_IMPORT, IDI_IMPORT); // "Add/Import File" - popup.AppendMenuIcon(ID_IMPORTFOLDER, IDS_REPOBROWSE_IMPORTFOLDER, IDI_IMPORT); // "Add/Import Folder" - popup.AppendMenu(MF_SEPARATOR, NULL); - } - - popup.AppendMenuIcon(ID_RENAME, IDS_REPOBROWSE_RENAME, IDI_RENAME); // "Rename" - } - if (nLocked) - { - popup.AppendMenuIcon(ID_BREAKLOCK, IDS_MENU_UNLOCKFORCE, IDI_UNLOCK); // "Break Lock" - } - } - if (urlList.GetCount() > 0) - { - if (GetRevision().IsHead()) - { - popup.AppendMenuIcon(ID_DELETE, IDS_REPOBROWSE_DELETE, IDI_DELETE); // "Remove" - } - if (nFolders == 0) - { - popup.AppendMenuIcon(ID_SAVEAS, IDS_REPOBROWSE_SAVEAS, IDI_SAVEAS); // "Save as..." - } - if ((urlList.GetCount() == nFolders)||(nFolders == 0)) - { - popup.AppendMenuIcon(ID_COPYTOWC, IDS_REPOBROWSE_COPYTOWC); // "Copy To Working Copy..." - } - } - if (urlList.GetCount() == 1) - { - popup.AppendMenuIcon(ID_COPYTO, IDS_REPOBROWSE_COPY, IDI_COPY); // "Copy To..." - popup.AppendMenuIcon(ID_URLTOCLIPBOARD, IDS_REPOBROWSE_URLTOCLIPBOARD, IDI_COPYCLIP); // "Copy URL to clipboard" - popup.AppendMenu(MF_SEPARATOR, NULL); - popup.AppendMenuIcon(ID_PROPS, IDS_REPOBROWSE_SHOWPROP, IDI_PROPERTIES); // "Show Properties" - // Revision properties are not associated to paths - // so we only show that context menu on the repository root - if (urlList[0].GetSVNPathString().Compare(m_strReposRoot)==0) - { - popup.AppendMenuIcon(ID_REVPROPS, IDS_REPOBROWSE_SHOWREVPROP, IDI_PROPERTIES); // "Show Revision Properties" - } - if (nFolders == 1) - { - popup.AppendMenu(MF_SEPARATOR, NULL); - popup.AppendMenuIcon(ID_PREPAREDIFF, IDS_REPOBROWSE_PREPAREDIFF); // "Mark for comparison" - - if ((m_diffKind == svn_node_dir)&&(!m_diffURL.IsEquivalentTo(urlList[0]))) - { - popup.AppendMenuIcon(ID_GNUDIFF, IDS_LOG_POPUP_GNUDIFF, IDI_DIFF); // "Show differences as unified diff" - popup.AppendMenuIcon(ID_DIFF, IDS_REPOBROWSE_SHOWDIFF, IDI_DIFF); // "Compare URLs" - } - } - } - if (urlList.GetCount() == 2) - { - if ((nFolders == 2)||(nFolders == 0)) - { - popup.AppendMenu(MF_SEPARATOR, NULL); - popup.AppendMenuIcon(ID_GNUDIFF, IDS_LOG_POPUP_GNUDIFF, IDI_DIFF); // "Show differences as unified diff" - popup.AppendMenuIcon(ID_DIFF, IDS_REPOBROWSE_SHOWDIFF, ID_DIFF); // "Compare URLs" - popup.AppendMenu(MF_SEPARATOR, NULL); - } - popup.AppendMenuIcon(ID_SHOWLOG, IDS_MENULOG, IDI_LOG); // "Show Log..." - } - if ((urlList.GetCount() == 1) && - m_path.Exists() && - CTSVNPath(m_InitialUrl).IsAncestorOf(urlList[0])) - { - CTSVNPath wcPath = m_path; - wcPath.AppendPathString(urlList[0].GetWinPathString().Mid(m_InitialUrl.GetLength())); - if (!wcPath.Exists()) - { - bool bWCPresent = false; - while (!bWCPresent && m_path.IsAncestorOf(wcPath)) - { - bWCPresent = wcPath.GetContainingDirectory().Exists(); - wcPath = wcPath.GetContainingDirectory(); - } - if (bWCPresent) - { - popup.AppendMenu(MF_SEPARATOR, NULL); - popup.AppendMenuIcon(ID_UPDATE, IDS_LOG_POPUP_UPDATE, IDI_UPDATE); // "Update item to revision" - } - } - } - int cmd = popup.TrackPopupMenu(TPM_RETURNCMD | TPM_LEFTALIGN | TPM_NONOTIFY, point.x, point.y, this, 0); - - if (pWnd == &m_RepoTree) - { - UINT uFlags; - CPoint ptTree = point; - m_RepoTree.ScreenToClient(&ptTree); - HTREEITEM hItem = m_RepoTree.HitTest(ptTree, &uFlags); - // restore the previously selected item state - if ((hItem) && (uFlags & TVHT_ONITEM) && (hItem != m_RepoTree.GetSelectedItem())) - { - m_blockEvents = true; - m_RepoTree.SetItemState(hSelectedTreeItem, TVIS_SELECTED, TVIS_SELECTED); - m_blockEvents = false; - m_RepoTree.SetItemState(hItem, 0, TVIS_DROPHILITED); - } - } - if (hSelectedTreeItem) - { - m_blockEvents = true; - m_RepoTree.SetItemState(hSelectedTreeItem, 0, TVIS_DROPHILITED); - m_RepoTree.SetItemState(hSelectedTreeItem, TVIS_SELECTED, TVIS_SELECTED); - m_blockEvents = false; - } - DialogEnableWindow(IDOK, FALSE); - bool bOpenWith = false; - switch (cmd) - { - case ID_UPDATE: - { - CTSVNPath wcPath = m_path; - wcPath.AppendPathString(urlList[0].GetWinPathString().Mid(m_InitialUrl.GetLength())); - CString sCmd; - sCmd.Format(_T("\"%s\" /command:update /path:\"%s\" /rev"), - (LPCTSTR)(CPathUtils::GetAppDirectory()+_T("TortoiseProc.exe")), wcPath.GetWinPath()); - - CAppUtils::LaunchApplication(sCmd, NULL, false); - } - break; - case ID_PREPAREDIFF: - { - m_RepoTree.SetItemState(FindUrl(m_diffURL.GetSVNPathString(), false), 0, TVIS_BOLD); - if (urlList.GetCount() == 1) - { - m_diffURL = urlList[0]; - m_diffKind = nFolders ? svn_node_dir : svn_node_file; - // make the marked tree item bold - if (m_diffKind == svn_node_dir) - { - m_RepoTree.SetItemState(FindUrl(m_diffURL.GetSVNPathString(), false), TVIS_BOLD, TVIS_BOLD); - } - } - else - { - m_diffURL.Reset(); - m_diffKind = svn_node_none; - } - } - break; - case ID_URLTOCLIPBOARD: - { - CString url; - for (int i=0; i 0); - if (bSavePathOK) - { - CWaitCursorEx wait_cursor; - - CString saveurl; - CProgressDlg progDlg; - int counter = 0; // the file counter - progDlg.SetTitle(IDS_REPOBROWSE_SAVEASPROGTITLE); - progDlg.SetAnimation(IDR_DOWNLOAD); - progDlg.ShowModeless(GetSafeHwnd()); - progDlg.SetProgress((DWORD)0, (DWORD)urlList.GetCount()); - SetAndClearProgressInfo(&progDlg); - for (int i=0; im_hWnd, GetLastErrorMessage(), _T("TortoiseSVN"), MB_ICONERROR); - return; - } - counter++; - progDlg.SetProgress((DWORD)counter, (DWORD)urlList.GetCount()); - } - progDlg.Stop(); - SetAndClearProgressInfo((HWND)NULL); - } - } - break; - case ID_SHOWLOG: - { - if (urlList.GetCount() == 2) - { - // get log of first URL - CString sCopyFrom1, sCopyFrom2; - SVNLogHelper helper; - helper.SetRepositoryRoot(m_strReposRoot); - SVNRev rev1 = helper.GetCopyFromRev(CTSVNPath(EscapeUrl(urlList[0])), GetRevision(), sCopyFrom1); - if (!rev1.IsValid()) - { - CMessageBox::Show(this->m_hWnd, helper.GetLastErrorMessage(), _T("TortoiseSVN"), MB_ICONERROR); - break; - } - SVNRev rev2 = helper.GetCopyFromRev(CTSVNPath(EscapeUrl(urlList[1])), GetRevision(), sCopyFrom2); - if (!rev2.IsValid()) - { - CMessageBox::Show(this->m_hWnd, helper.GetLastErrorMessage(), _T("TortoiseSVN"), MB_ICONERROR); - break; - } - if ((sCopyFrom1.IsEmpty())||(sCopyFrom1.Compare(sCopyFrom2)!=0)) - { - // no common copy from URL, so showing a log between - // the two urls is not possible. - CMessageBox::Show(m_hWnd, IDS_ERR_NOCOMMONCOPYFROM, IDS_APPNAME, MB_ICONERROR); - break; - } - if ((LONG)rev1 < (LONG)rev2) - { - SVNRev temp = rev1; - rev1 = rev2; - rev2 = temp; - } - CString sCmd; - sCmd.Format(_T("\"%s\" /command:log /path:\"%s\" /startrev:%s /endrev:%s"), - (LPCTSTR)(CPathUtils::GetAppDirectory()+_T("TortoiseProc.exe")), (LPCTSTR)sCopyFrom1, (LPCTSTR)rev1.ToString(), (LPCTSTR)rev2.ToString()); - - ATLTRACE(sCmd); - if (!m_path.IsUrl()) - { - sCmd += _T(" /propspath:\""); - sCmd += m_path.GetWinPathString(); - sCmd += _T("\""); - } - - CAppUtils::LaunchApplication(sCmd, NULL, false); - } - else - { - CString sCmd; - sCmd.Format(_T("\"%s\" /command:log /path:\"%s\" /startrev:%s"), - (LPCTSTR)(CPathUtils::GetAppDirectory()+_T("TortoiseProc.exe")), (LPCTSTR)EscapeUrl(urlList[0]), (LPCTSTR)GetRevision().ToString()); - - if (!m_path.IsUrl()) - { - sCmd += _T(" /propspath:\""); - sCmd += m_path.GetWinPathString(); - sCmd += _T("\""); - } - - CAppUtils::LaunchApplication(sCmd, NULL, false); - } - } - break; - case ID_VIEWREV: - { - CString url = m_ProjectProperties.sWebViewerRev; - url.Replace(_T("%REVISION%"), GetRevision().ToString()); - if (!url.IsEmpty()) - ShellExecute(this->m_hWnd, _T("open"), url, NULL, NULL, SW_SHOWDEFAULT); - } - break; - case ID_VIEWPATHREV: - { - CString relurl = EscapeUrl(urlList[0]); - relurl = relurl.Mid(m_strReposRoot.GetLength()); - CString weburl = m_ProjectProperties.sWebViewerPathRev; - weburl.Replace(_T("%REVISION%"), GetRevision().ToString()); - weburl.Replace(_T("%PATH%"), relurl); - if (!weburl.IsEmpty()) - ShellExecute(this->m_hWnd, _T("open"), weburl, NULL, NULL, SW_SHOWDEFAULT); - } - break; - case ID_CHECKOUT: - { - CString itemsToCheckout; - for (int i=0; im_hWnd, GetLastErrorMessage(), _T("TortoiseSVN"), MB_ICONERROR); - break;; - } - progDlg.Stop(); - SetAndClearProgressInfo((HWND)NULL); - // set the file as read-only to tell the app which opens the file that it's only - // a temporary file and must not be edited. - SetFileAttributes(tempfile.GetWinPath(), FILE_ATTRIBUTE_READONLY); - if (!bOpenWith) - { - int ret = (int)ShellExecute(NULL, _T("open"), tempfile.GetWinPathString(), NULL, NULL, SW_SHOWNORMAL); - if (ret <= HINSTANCE_ERROR) - bOpenWith = true; - } - else - { - CString cmd = _T("RUNDLL32 Shell32,OpenAs_RunDLL "); - cmd += tempfile.GetWinPathString() + _T(" "); - CAppUtils::LaunchApplication(cmd, NULL, false); - } - } - break; - case ID_DELETE: - { - CWaitCursorEx wait_cursor; - CInputLogDlg input(this); - input.SetUUID(m_sUUID); - input.SetProjectProperties(&m_ProjectProperties); - CString hint; - if (urlList.GetCount() == 1) - hint.Format(IDS_INPUT_REMOVEONE, (LPCTSTR)urlList[0].GetFileOrDirectoryName()); - else - hint.Format(IDS_INPUT_REMOVEMORE, urlList.GetCount()); - input.SetActionText(hint); - if (input.DoModal() == IDOK) - { - if (!Remove(urlList, true, false, input.GetLogMessage())) - { - wait_cursor.Hide(); - CMessageBox::Show(this->m_hWnd, GetLastErrorMessage(), _T("TortoiseSVN"), MB_ICONERROR); - return; - } - if (hChosenTreeItem) - { - HTREEITEM hParent = m_RepoTree.GetParentItem(hChosenTreeItem); - RecursiveRemove(hChosenTreeItem); - RefreshNode(hParent); - } - else - RefreshNode(m_RepoTree.GetSelectedItem(), true); - } - } - break; - case ID_BREAKLOCK: - { - if (!Unlock(urlListEscaped, TRUE)) - { - CMessageBox::Show(this->m_hWnd, GetLastErrorMessage(), _T("TortoiseSVN"), MB_ICONERROR); - return; - } - RefreshNode(m_RepoTree.GetSelectedItem(), true); - } - break; - case ID_IMPORTFOLDER: - { - CString path; - CBrowseFolder folderBrowser; - folderBrowser.m_style = BIF_EDITBOX | BIF_NEWDIALOGSTYLE | BIF_RETURNFSANCESTORS | BIF_RETURNONLYFSDIRS; - if (folderBrowser.Show(GetSafeHwnd(), path)==CBrowseFolder::OK) - { - CTSVNPath svnPath(path); - CWaitCursorEx wait_cursor; - CString filename = svnPath.GetFileOrDirectoryName(); - CInputLogDlg input(this); - input.SetUUID(m_sUUID); - input.SetProjectProperties(&m_ProjectProperties); - CString sHint; - sHint.Format(IDS_INPUT_IMPORTFOLDER, (LPCTSTR)svnPath.GetSVNPathString(), (LPCTSTR)(urlList[0].GetSVNPathString()+_T("/")+filename)); - input.SetActionText(sHint); - if (input.DoModal() == IDOK) - { - CProgressDlg progDlg; - progDlg.SetTitle(IDS_APPNAME); - CString sInfoLine; - sInfoLine.Format(IDS_PROGRESSIMPORT, (LPCTSTR)filename); - progDlg.SetLine(1, sInfoLine, true); - SetAndClearProgressInfo(&progDlg); - progDlg.ShowModeless(m_hWnd); - if (!Import(svnPath, - CTSVNPath(EscapeUrl(CTSVNPath(urlList[0].GetSVNPathString()+_T("/")+filename))), - input.GetLogMessage(), - &m_ProjectProperties, - svn_depth_infinity, - FALSE, FALSE)) - { - progDlg.Stop(); - SetAndClearProgressInfo((HWND)NULL); - wait_cursor.Hide(); - CMessageBox::Show(this->m_hWnd, GetLastErrorMessage(), _T("TortoiseSVN"), MB_ICONERROR); - return; - } - progDlg.Stop(); - SetAndClearProgressInfo((HWND)NULL); - RefreshNode(m_RepoTree.GetSelectedItem(), true); - } - } - } - break; - case ID_IMPORT: - { - // Display the Open dialog box. - CString openPath; - if (CAppUtils::FileOpenSave(openPath, NULL, IDS_REPOBROWSE_IMPORT, IDS_COMMONFILEFILTER, true, m_hWnd)) - { - CTSVNPath path(openPath); - CWaitCursorEx wait_cursor; - CString filename = path.GetFileOrDirectoryName(); - CInputLogDlg input(this); - input.SetUUID(m_sUUID); - input.SetProjectProperties(&m_ProjectProperties); - CString sHint; - sHint.Format(IDS_INPUT_IMPORTFILEFULL, path.GetWinPath(), (LPCTSTR)(urlList[0].GetSVNPathString()+_T("/")+filename)); - input.SetActionText(sHint); - if (input.DoModal() == IDOK) - { - CProgressDlg progDlg; - progDlg.SetTitle(IDS_APPNAME); - CString sInfoLine; - sInfoLine.Format(IDS_PROGRESSIMPORT, (LPCTSTR)filename); - progDlg.SetLine(1, sInfoLine, true); - SetAndClearProgressInfo(&progDlg); - progDlg.ShowModeless(m_hWnd); - if (!Import(path, - CTSVNPath(EscapeUrl(CTSVNPath(urlList[0].GetSVNPathString()+_T("/")+filename))), - input.GetLogMessage(), - &m_ProjectProperties, - svn_depth_empty, - TRUE, FALSE)) - { - progDlg.Stop(); - SetAndClearProgressInfo((HWND)NULL); - wait_cursor.Hide(); - CMessageBox::Show(this->m_hWnd, GetLastErrorMessage(), _T("TortoiseSVN"), MB_ICONERROR); - return; - } - progDlg.Stop(); - SetAndClearProgressInfo((HWND)NULL); - RefreshNode(m_RepoTree.GetSelectedItem(), true); - } - } - } - break; - case ID_RENAME: - { - if (pWnd == &m_RepoList) - { - POSITION pos = m_RepoList.GetFirstSelectedItemPosition(); - int selIndex = m_RepoList.GetNextSelectedItem(pos); - if (selIndex >= 0) - { - m_RepoList.SetFocus(); - m_RepoList.EditLabel(selIndex); - } - else - { - m_RepoTree.SetFocus(); - HTREEITEM hTreeItem = m_RepoTree.GetSelectedItem(); - if (hTreeItem != m_RepoTree.GetRootItem()) - m_RepoTree.EditLabel(hTreeItem); - } - } - else if (pWnd == &m_RepoTree) - { - m_RepoTree.SetFocus(); - if (hChosenTreeItem != m_RepoTree.GetRootItem()) - m_RepoTree.EditLabel(hChosenTreeItem); - } - } - break; - case ID_COPYTO: - { - CRenameDlg dlg; - dlg.m_name = urlList[0].GetSVNPathString(); - dlg.m_windowtitle.LoadString(IDS_REPOBROWSE_COPY); - CStringUtils::RemoveAccelerators(dlg.m_windowtitle); - if (dlg.DoModal() == IDOK) - { - CWaitCursorEx wait_cursor; - CInputLogDlg input(this); - input.SetUUID(m_sUUID); - input.SetProjectProperties(&m_ProjectProperties); - CString sHint; - sHint.Format(IDS_INPUT_COPY, (LPCTSTR)urlList[0].GetSVNPathString(), (LPCTSTR)dlg.m_name); - input.SetActionText(sHint); - if (!CTSVNPath(dlg.m_name).IsValidOnWindows()) - { - if (CMessageBox::Show(GetSafeHwnd(), IDS_WARN_NOVALIDPATH, IDS_APPNAME, MB_ICONINFORMATION|MB_YESNO) != IDYES) - break; - } - if (input.DoModal() == IDOK) - { - if (!Copy(urlList, CTSVNPath(dlg.m_name), GetRevision(), GetRevision(), input.GetLogMessage())) - { - wait_cursor.Hide(); - CMessageBox::Show(this->m_hWnd, GetLastErrorMessage(), _T("TortoiseSVN"), MB_ICONERROR); - return; - } - if (GetRevision().IsHead()) - { - RefreshNode(m_RepoTree.GetSelectedItem(), true); - } - } - } - } - break; - case ID_COPYTOWC: - { - CTSVNPath tempfile; - bool bSavePathOK = AskForSavePath(urlList, tempfile, nFolders > 0); - if (bSavePathOK) - { - CWaitCursorEx wait_cursor; - - CProgressDlg progDlg; - progDlg.SetAnimation(IDR_DOWNLOAD); - progDlg.SetTitle(IDS_APPNAME); - SetAndClearProgressInfo(&progDlg); - progDlg.ShowModeless(m_hWnd); - - bool bCopyAsChild = (urlList.GetCount() > 1); - if (!Copy(urlList, tempfile, GetRevision(), GetRevision(), CString(), bCopyAsChild)||(progDlg.HasUserCancelled())) - { - progDlg.Stop(); - SetAndClearProgressInfo((HWND)NULL); - wait_cursor.Hide(); - progDlg.Stop(); - if (!progDlg.HasUserCancelled()) - CMessageBox::Show(this->m_hWnd, GetLastErrorMessage(), _T("TortoiseSVN"), MB_ICONERROR); - return; - } - progDlg.Stop(); - SetAndClearProgressInfo((HWND)NULL); - } - } - break; - case ID_MKDIR: - { - CRenameDlg dlg; - dlg.m_name = _T(""); - dlg.m_windowtitle.LoadString(IDS_REPOBROWSE_MKDIR); - CStringUtils::RemoveAccelerators(dlg.m_windowtitle); - if (dlg.DoModal() == IDOK) - { - CWaitCursorEx wait_cursor; - CInputLogDlg input(this); - input.SetUUID(m_sUUID); - input.SetProjectProperties(&m_ProjectProperties); - CString sHint; - sHint.Format(IDS_INPUT_MKDIR, (LPCTSTR)(urlList[0].GetSVNPathString()+_T("/")+dlg.m_name.Trim())); - input.SetActionText(sHint); - if (input.DoModal() == IDOK) - { - // when creating the new folder, also trim any whitespace chars from it - if (!MakeDir(CTSVNPathList(CTSVNPath(EscapeUrl(CTSVNPath(urlList[0].GetSVNPathString()+_T("/")+dlg.m_name.Trim())))), input.GetLogMessage(), true)) - { - wait_cursor.Hide(); - CMessageBox::Show(this->m_hWnd, GetLastErrorMessage(), _T("TortoiseSVN"), MB_ICONERROR); - return; - } - RefreshNode(m_RepoTree.GetSelectedItem(), true); - } - } - } - break; - case ID_REFRESH: - { - RefreshNode(urlList[0].GetSVNPathString(), true); - } - break; - case ID_GNUDIFF: - { - m_bCancelled = false; - SVNDiff diff(this, this->m_hWnd, true); - if (urlList.GetCount() == 1) - { - if (PromptShown()) - diff.ShowUnifiedDiff(CTSVNPath(EscapeUrl(urlList[0])), GetRevision(), - CTSVNPath(EscapeUrl(m_diffURL)), GetRevision()); - else - CAppUtils::StartShowUnifiedDiff(m_hWnd, CTSVNPath(EscapeUrl(urlList[0])), GetRevision(), - CTSVNPath(EscapeUrl(m_diffURL)), GetRevision()); - } - else - { - if (PromptShown()) - diff.ShowUnifiedDiff(CTSVNPath(EscapeUrl(urlList[0])), GetRevision(), - CTSVNPath(EscapeUrl(urlList[1])), GetRevision()); - else - CAppUtils::StartShowUnifiedDiff(m_hWnd, CTSVNPath(EscapeUrl(urlList[0])), GetRevision(), - CTSVNPath(EscapeUrl(urlList[1])), GetRevision()); - } - } - break; - case ID_DIFF: - { - m_bCancelled = false; - SVNDiff diff(this, this->m_hWnd, true); - diff.SetAlternativeTool(!!(GetAsyncKeyState(VK_SHIFT) & 0x8000)); - if (urlList.GetCount() == 1) - { - if (PromptShown()) - diff.ShowCompare(CTSVNPath(EscapeUrl(urlList[0])), GetRevision(), - CTSVNPath(EscapeUrl(m_diffURL)), GetRevision(), SVNRev(), true); - else - CAppUtils::StartShowCompare(m_hWnd, CTSVNPath(EscapeUrl(urlList[0])), GetRevision(), - CTSVNPath(EscapeUrl(m_diffURL)), GetRevision(), SVNRev(), SVNRev(), - !!(GetAsyncKeyState(VK_SHIFT) & 0x8000), true); - } - else - { - if (PromptShown()) - diff.ShowCompare(CTSVNPath(EscapeUrl(urlList[0])), GetRevision(), - CTSVNPath(EscapeUrl(urlList[1])), GetRevision(), SVNRev(), true); - else - CAppUtils::StartShowCompare(m_hWnd, CTSVNPath(EscapeUrl(urlList[0])), GetRevision(), - CTSVNPath(EscapeUrl(urlList[1])), GetRevision(), SVNRev(), SVNRev(), - !!(GetAsyncKeyState(VK_SHIFT) & 0x8000), true); - } - } - break; - case ID_PROPS: - { - if (GetRevision().IsHead()) - { - CEditPropertiesDlg dlg; - dlg.SetProjectProperties(&m_ProjectProperties); - dlg.SetUUID(m_sUUID); - CTSVNPathList escapedlist; - for (int i=0; im_hWnd, blame.GetLastErrorMessage(), _T("TortoiseSVN"), MB_ICONERROR); - } - } - - } - default: - break; - } - DialogEnableWindow(IDOK, TRUE); - } -} - - -bool CRepositoryBrowser::AskForSavePath(const CTSVNPathList& urlList, CTSVNPath &tempfile, bool bFolder) -{ - bool bSavePathOK = false; - if ((!bFolder)&&(urlList.GetCount() == 1)) - { - CString savePath = urlList[0].GetFilename(); - bSavePathOK = CAppUtils::FileOpenSave(savePath, NULL, IDS_REPOBROWSE_SAVEAS, IDS_COMMONFILEFILTER, false, m_hWnd); - if (bSavePathOK) - tempfile.SetFromWin(savePath); - } - else - { - CBrowseFolder browser; - CString sTempfile; - browser.m_style = BIF_EDITBOX | BIF_NEWDIALOGSTYLE | BIF_RETURNFSANCESTORS | BIF_RETURNONLYFSDIRS; - browser.Show(GetSafeHwnd(), sTempfile); - if (!sTempfile.IsEmpty()) - { - bSavePathOK = true; - tempfile.SetFromWin(sTempfile); - } - } - return bSavePathOK; -} - -bool CRepositoryBrowser::StringToWidthArray(const CString& WidthString, int WidthArray[]) -{ - TCHAR * endchar; - for (int i=0; i<7; ++i) - { - CString hex = WidthString.Mid(i*8, 8); - if ( hex.IsEmpty() ) - { - // This case only occurs when upgrading from an older - // TSVN version in which there were fewer columns. - WidthArray[i] = 0; - } - else - { - WidthArray[i] = _tcstol(hex, &endchar, 16); - } - } - return true; -} - -CString CRepositoryBrowser::WidthArrayToString(int WidthArray[]) -{ - CString sResult; - TCHAR buf[10]; - for (int i=0; i<7; ++i) - { - _stprintf_s(buf, 10, _T("%08X"), WidthArray[i]); - sResult += buf; - } - return sResult; -} - -void CRepositoryBrowser::SaveColumnWidths(bool bSaveToRegistry /* = false */) -{ - CRegString regColWidth(_T("Software\\TortoiseGit\\RepoBrowserColumnWidth")); - int maxcol = ((CHeaderCtrl*)(m_RepoList.GetDlgItem(0)))->GetItemCount()-1; - // first clear the width array - for (int col = 0; col < 7; ++col) - m_arColumnWidths[col] = 0; - for (int col = 0; col <= maxcol; ++col) - { - m_arColumnWidths[col] = m_RepoList.GetColumnWidth(col); - if (m_arColumnWidths[col] == m_arColumnAutoWidths[col]) - m_arColumnWidths[col] = 0; - } - if (bSaveToRegistry) - { - CString sWidths = WidthArrayToString(m_arColumnWidths); - regColWidth = sWidths; - } -} - - diff --git a/src/TortoiseProc/RepositoryBrowser.h b/src/TortoiseProc/RepositoryBrowser.h deleted file mode 100644 index 96534b059..000000000 --- a/src/TortoiseProc/RepositoryBrowser.h +++ /dev/null @@ -1,302 +0,0 @@ -// TortoiseSVN - a Windows shell extension for easy version control - -// Copyright (C) 2003-2008 - Stefan Kueng - -// This program is free software; you can redistribute it and/or -// modify it under the terms of the GNU General Public License -// as published by the Free Software Foundation; either version 2 -// of the License, or (at your option) any later version. - -// This program is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// GNU General Public License for more details. - -// You should have received a copy of the GNU General Public License -// along with this program; if not, write to the Free Software Foundation, -// 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. -// -#pragma once - -#include -#include - -#include "resource.h" -#include "TGitPath.h" -#include "RepositoryBar.h" -#include "StandAloneDlg.h" -#include "ProjectProperties.h" -#include "LogDlg.h" -#include "HintListCtrl.h" - -#define REPOBROWSER_CTRL_MIN_WIDTH 20 -#define REPOBROWSER_FETCHTIMER 101 - -using namespace std; - -class CInputLogDlg; -class CTreeDropTarget; -class CListDropTarget; - -/** - * \ingroup TortoiseProc - * helper class which holds all the information of an item (file or folder) - * in the repository. The information gets filled by the svn_client_list() - * callback. - */ -class CItem -{ -public: - CItem() : kind(svn_node_none) - , size(0) - , has_props(false) - , created_rev(0) - , time(0) - , is_dav_comment(false) - , lock_creationdate(0) - , lock_expirationdate(0) - { - } - CItem(const CString& _path, - svn_node_kind_t _kind, - svn_filesize_t _size, - bool _has_props, - svn_revnum_t _created_rev, - apr_time_t _time, - const CString& _author, - const CString& _locktoken, - const CString& _lockowner, - const CString& _lockcomment, - bool _is_dav_comment, - apr_time_t _lock_creationdate, - apr_time_t _lock_expirationdate, - const CString& _absolutepath) - { - path = _path; - kind = _kind; - size = _size; - has_props = _has_props; - created_rev = _created_rev; - time = _time; - author = _author; - locktoken = _locktoken; - lockowner = _lockowner; - lockcomment = _lockcomment; - is_dav_comment = _is_dav_comment; - lock_creationdate = _lock_creationdate; - lock_expirationdate = _lock_expirationdate; - absolutepath = _absolutepath; - } -public: - CString path; - svn_node_kind_t kind; - svn_filesize_t size; - bool has_props; - svn_revnum_t created_rev; - apr_time_t time; - CString author; - CString locktoken; - CString lockowner; - CString lockcomment; - bool is_dav_comment; - apr_time_t lock_creationdate; - apr_time_t lock_expirationdate; - CString absolutepath; ///< unescaped url stripped of repository root -}; - -/** - * \ingroup TortoiseProc - * helper class which holds the information for a tree item - * in the repository browser. - */ -class CTreeItem -{ -public: - CTreeItem() : children_fetched(false), has_child_folders(false) {} - - CString unescapedname; - CString url; ///< unescaped url - bool children_fetched; ///< whether the contents of the folder are known/fetched or not - deque children; - bool has_child_folders; -}; - - -/** - * \ingroup TortoiseProc - * Dialog to browse a repository. - */ -class CRepositoryBrowser : public CResizableStandAloneDialog, public SVN, public IRepo -{ - DECLARE_DYNAMIC(CRepositoryBrowser) -friend class CTreeDropTarget; -friend class CListDropTarget; - -public: - CRepositoryBrowser(const CString& url, const SVNRev& rev); ///< standalone repository browser - CRepositoryBrowser(const CString& url, const SVNRev& rev, CWnd* pParent); ///< dependent repository browser - virtual ~CRepositoryBrowser(); - - /// Returns the currently displayed revision only (for convenience) - SVNRev GetRevision() const; - /// Returns the currently displayed URL's path only (for convenience) - CString GetPath() const; - - /// switches to the \c url at \c rev. If the url is valid and exists, - /// the repository browser will show the content of that url. - bool ChangeToUrl(CString& url, SVNRev& rev, bool bAlreadyChecked); - - CString GetRepoRoot() { return m_strReposRoot; } - - enum { IDD = IDD_REPOSITORY_BROWSER }; - - /// the project properties if the repository browser was started from a working copy - ProjectProperties m_ProjectProperties; - /// the local path of the working copy - CTSVNPath m_path; -protected: - virtual void DoDataExchange(CDataExchange* pDX); // DDX/DDV support - virtual BOOL OnInitDialog(); - virtual void OnOK(); - virtual void OnCancel(); - virtual BOOL PreTranslateMessage(MSG* pMsg); - virtual BOOL Cancel() {return m_bCancelled;} - - afx_msg void OnBnClickedHelp(); - afx_msg BOOL OnSetCursor(CWnd* pWnd, UINT nHitTest, UINT message); - afx_msg void OnMouseMove(UINT nFlags, CPoint point); - afx_msg void OnLButtonDown(UINT nFlags, CPoint point); - afx_msg void OnLButtonUp(UINT nFlags, CPoint point); - afx_msg void OnTvnSelchangedRepotree(NMHDR *pNMHDR, LRESULT *pResult); - afx_msg void OnTvnItemexpandingRepotree(NMHDR *pNMHDR, LRESULT *pResult); - afx_msg void OnNMDblclkRepolist(NMHDR *pNMHDR, LRESULT *pResult); - afx_msg void OnHdnItemclickRepolist(NMHDR *pNMHDR, LRESULT *pResult); - afx_msg void OnLvnItemchangedRepolist(NMHDR *pNMHDR, LRESULT *pResult); - afx_msg void OnLvnBegindragRepolist(NMHDR *pNMHDR, LRESULT *pResult); - afx_msg void OnLvnBeginrdragRepolist(NMHDR *pNMHDR, LRESULT *pResult); - afx_msg void OnTvnBegindragRepotree(NMHDR *pNMHDR, LRESULT *pResult); - afx_msg void OnTvnBeginrdragRepotree(NMHDR *pNMHDR, LRESULT *pResult); - afx_msg void OnContextMenu(CWnd* /*pWnd*/, CPoint /*point*/); - afx_msg void OnLvnEndlabeleditRepolist(NMHDR *pNMHDR, LRESULT *pResult); - afx_msg void OnTvnEndlabeleditRepotree(NMHDR *pNMHDR, LRESULT *pResult); - afx_msg void OnTimer(UINT_PTR nIDEvent); - - afx_msg void OnUrlFocus(); - afx_msg void OnCopy(); - afx_msg void OnInlineedit(); - afx_msg void OnRefresh(); - afx_msg void OnDelete(); - afx_msg void OnGoUp(); - - DECLARE_MESSAGE_MAP() - - /// called after the init thread has finished - LRESULT OnAfterInitDialog(WPARAM /*wParam*/, LPARAM /*lParam*/); - /// draws the bar when the tree and list control are resized - void DrawXorBar(CDC * pDC, int x1, int y1, int width, int height); - /// callback from the SVN::List() method which stores all the information - virtual BOOL ReportList(const CString& path, svn_node_kind_t kind, - svn_filesize_t size, bool has_props, svn_revnum_t created_rev, - apr_time_t time, const CString& author, const CString& locktoken, - const CString& lockowner, const CString& lockcomment, - bool is_dav_comment, apr_time_t lock_creationdate, - apr_time_t lock_expirationdate, const CString& absolutepath); - - /// recursively removes all items from \c hItem on downwards. - void RecursiveRemove(HTREEITEM hItem, bool bChildrenOnly = false); - /// searches the tree item for the specified \c fullurl. - HTREEITEM FindUrl(const CString& fullurl, bool create = true); - /// searches the tree item for the specified \c fullurl. - HTREEITEM FindUrl(const CString& fullurl, const CString& url, bool create = true, HTREEITEM hItem = TVI_ROOT); - /** - * Refetches the information for \c url. If \c force is true, then the list - * control is refilled again. - * \param recursive if true, the information is fetched recursively. - */ - bool RefreshNode(const CString& url, bool force = false, bool recursive = false); - /** - * Refetches the information for \c hNode. If \c force is true, then the list - * control is refilled again. - * \param recursive if true, the information is fetched recursively. - */ - bool RefreshNode(HTREEITEM hNode, bool force = false, bool recursive = false); - /// Fills the list control with all the items in \c pItems. - void FillList(deque * pItems); - /// Sets the sort arrow in the list view header according to the currently used sorting. - void SetSortArrow(); - /// called when a drag-n-drop operation starts - void OnBeginDrag(NMHDR *pNMHDR); - void OnBeginDragTree(NMHDR *pNMHDR); - /// called when a drag-n-drop operation ends and the user dropped something on us. - bool OnDrop(const CTSVNPath& target, const CTSVNPathList& pathlist, const SVNRev& srcRev, DWORD dwEffect, POINTL pt); - /** - * Since all urls we store and use are not properly escaped but "UI friendly", this - * method converts those urls to a properly escaped url which we can use in - * Subversion API calls. - */ - CString EscapeUrl(const CTSVNPath& url); - /// Initializes the repository browser with a new root url - void InitRepo(); - /// Helper function to show the "File Save" dialog - bool AskForSavePath(const CTSVNPathList& urlList, CTSVNPath &tempfile, bool bFolder); - - /// Saves the column widths - void SaveColumnWidths(bool bSaveToRegistry = false); - /// converts a string to an array of column widths - bool StringToWidthArray(const CString& WidthString, int WidthArray[]); - /// converts an array of column widths to a string - CString WidthArrayToString(int WidthArray[]); - - - static UINT InitThreadEntry(LPVOID pVoid); - UINT InitThread(); - - static int CALLBACK ListSort(LPARAM lParam1, LPARAM lParam2, LPARAM lParam3); - -protected: - bool m_bInitDone; - CRepositoryBar m_barRepository; - CRepositoryBarCnr m_cnrRepositoryBar; - - CTreeCtrl m_RepoTree; - CHintListCtrl m_RepoList; - - CString m_strReposRoot; - CString m_sUUID; - - HACCEL m_hAccel; - -private: - bool m_bStandAlone; - CString m_InitialUrl; - SVNRev m_initialRev; - bool m_bThreadRunning; - static const UINT m_AfterInitMessage; - - int m_nIconFolder; - int m_nOpenIconFolder; - - volatile bool m_blockEvents; - - bool m_bSortAscending; - int m_nSortedColumn; - int m_arColumnWidths[7]; - int m_arColumnAutoWidths[7]; - - CTreeDropTarget * m_pTreeDropTarget; - CListDropTarget * m_pListDropTarget; - bool m_bRightDrag; - - int oldy, oldx; - bool bDragMode; - - bool m_bCancelled; - - svn_node_kind_t m_diffKind; - CTSVNPath m_diffURL; - - CString m_origDlgTitle; -}; - -static UINT WM_AFTERINIT = RegisterWindowMessage(_T("TORTOISESVN_AFTERINIT_MSG")); - diff --git a/src/TortoiseProc/RevisionGraph/RevisionGraphWnd.cpp b/src/TortoiseProc/RevisionGraph/RevisionGraphWnd.cpp deleted file mode 100644 index 733da6684..000000000 --- a/src/TortoiseProc/RevisionGraph/RevisionGraphWnd.cpp +++ /dev/null @@ -1,1481 +0,0 @@ -// TortoiseSVN - a Windows shell extension for easy version control - -// Copyright (C) 2003-2009 - TortoiseSVN - -// This program is free software; you can redistribute it and/or -// modify it under the terms of the GNU General Public License -// as published by the Free Software Foundation; either version 2 -// of the License, or (at your option) any later version. - -// This program is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// GNU General Public License for more details. - -// You should have received a copy of the GNU General Public License -// along with this program; if not, write to the Free Software Foundation, -// 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. -// -#include "stdafx.h" -#include "TortoiseProc.h" -#include "Revisiongraphwnd.h" -#include "MessageBox.h" -#include "SVN.h" -#include "AppUtils.h" -#include "PathUtils.h" -#include "TempFile.h" -#include "UnicodeUtils.h" -#include "TSVNPath.h" -#include "SVNInfo.h" -#include "SVNDiff.h" -#include "RevisionGraphDlg.h" -#include "CachedLogInfo.h" -#include "RevisionIndex.h" -#include "RepositoryInfo.h" -#include "BrowseFolder.h" -#include "SVNProgressDlg.h" -#include "ChangedDlg.h" -#include "RevisionGraph/StandardLayout.h" -#include "RevisionGraph/UpsideDownLayout.h" - -#ifdef _DEBUG -#define new DEBUG_NEW -#undef THIS_FILE -static char THIS_FILE[] = __FILE__; -#endif - -using namespace Gdiplus; - -enum RevisionGraphContextMenuCommands -{ - // needs to start with 1, since 0 is the return value if *nothing* is clicked on in the context menu - GROUP_MASK = 0xff00, - ID_SHOWLOG = 1, - ID_CFM = 2, - ID_BROWSEREPO, - ID_COMPAREREVS = 0x100, - ID_COMPAREHEADS, - ID_UNIDIFFREVS, - ID_UNIDIFFHEADS, - ID_MERGETO = 0x300, - ID_UPDATE, - ID_SWITCHTOHEAD, - ID_SWITCH, - ID_EXPAND_ALL = 0x400, - ID_JOIN_ALL, - ID_GRAPH_EXPANDCOLLAPSE_ABOVE = 0x500, - ID_GRAPH_EXPANDCOLLAPSE_RIGHT, - ID_GRAPH_EXPANDCOLLAPSE_BELOW, - ID_GRAPH_SPLITJOIN_ABOVE, - ID_GRAPH_SPLITJOIN_RIGHT, - ID_GRAPH_SPLITJOIN_BELOW -}; - -CRevisionGraphWnd::CRevisionGraphWnd() - : CWnd() - , m_SelectedEntry1(NULL) - , m_SelectedEntry2(NULL) - , m_bThreadRunning(TRUE) - , m_pProgress(NULL) - , m_pDlgTip(NULL) - , m_nFontSize(12) - , m_bTweakTrunkColors(true) - , m_bTweakTagsColors(true) - , m_fZoomFactor(1.0) - , m_ptRubberEnd(0,0) - , m_ptRubberStart(0,0) - , m_bShowOverview(false) - , m_parent (NULL) - , m_hoverIndex ((index_t)NO_INDEX) - , m_hoverGlyphs (0) - , m_tooltipIndex ((index_t)NO_INDEX) - , m_showHoverGlyphs (false) -{ - memset(&m_lfBaseFont, 0, sizeof(LOGFONT)); - for (int i=0; iLoadStandardCursor(IDC_ARROW); - wndcls.hbrBackground = (HBRUSH) (COLOR_WINDOW + 1); - wndcls.lpszMenuName = NULL; - wndcls.lpszClassName = REVGRAPH_CLASSNAME; - - RegisterClass(&wndcls); - } - - m_bTweakTrunkColors = CRegDWORD(_T("Software\\TortoiseSVN\\RevisionGraph\\TweakTrunkColors"), TRUE) != FALSE; - m_bTweakTagsColors = CRegDWORD(_T("Software\\TortoiseSVN\\RevisionGraph\\TweakTagsColors"), TRUE) != FALSE; -} - -CRevisionGraphWnd::~CRevisionGraphWnd() -{ - for (int i=0; iDeleteObject(); - delete m_apFonts[i]; - } - m_apFonts[i] = NULL; - } - if (m_pDlgTip) - delete m_pDlgTip; -} - -void CRevisionGraphWnd::DoDataExchange(CDataExchange* pDX) -{ - CWnd::DoDataExchange(pDX); -} - - -BEGIN_MESSAGE_MAP(CRevisionGraphWnd, CWnd) - ON_WM_PAINT() - ON_WM_ERASEBKGND() - ON_WM_HSCROLL() - ON_WM_VSCROLL() - ON_WM_SIZE() - ON_WM_LBUTTONDOWN() - ON_NOTIFY_EX_RANGE(TTN_NEEDTEXTW, 0, 0xFFFF, OnToolTipNotify) - ON_NOTIFY_EX_RANGE(TTN_NEEDTEXTA, 0, 0xFFFF, OnToolTipNotify) - ON_WM_MOUSEWHEEL() - ON_WM_CONTEXTMENU() - ON_WM_MOUSEMOVE() - ON_WM_LBUTTONUP() - ON_WM_SETCURSOR() - ON_WM_TIMER() - ON_MESSAGE(WM_WORKERTHREADDONE,OnWorkerThreadDone) -END_MESSAGE_MAP() - -void CRevisionGraphWnd::Init(CWnd * pParent, LPRECT rect) -{ - WNDCLASS wndcls; - HINSTANCE hInst = AfxGetInstanceHandle(); -#define REVGRAPH_CLASSNAME _T("Revgraph_windowclass") - if (!(::GetClassInfo(hInst, REVGRAPH_CLASSNAME, &wndcls))) - { - // otherwise we need to register a new class - wndcls.style = CS_DBLCLKS | CS_OWNDC; - wndcls.lpfnWndProc = ::DefWindowProc; - wndcls.cbClsExtra = wndcls.cbWndExtra = 0; - wndcls.hInstance = hInst; - wndcls.hIcon = NULL; - wndcls.hCursor = AfxGetApp()->LoadStandardCursor(IDC_ARROW); - wndcls.hbrBackground = (HBRUSH) (COLOR_WINDOW + 1); - wndcls.lpszMenuName = NULL; - wndcls.lpszClassName = REVGRAPH_CLASSNAME; - - RegisterClass(&wndcls); - } - - if (!IsWindow(m_hWnd)) - CreateEx(WS_EX_CLIENTEDGE, REVGRAPH_CLASSNAME, _T("RevGraph"), WS_CHILD|WS_VISIBLE|WS_TABSTOP, *rect, pParent, 0); - m_pDlgTip = new CToolTipCtrl; - if(!m_pDlgTip->Create(this)) - { - TRACE("Unable to add tooltip!\n"); - } - EnableToolTips(); - - memset(&m_lfBaseFont, 0, sizeof(m_lfBaseFont)); - m_lfBaseFont.lfHeight = 0; - m_lfBaseFont.lfWeight = FW_NORMAL; - m_lfBaseFont.lfItalic = FALSE; - m_lfBaseFont.lfCharSet = DEFAULT_CHARSET; - m_lfBaseFont.lfOutPrecision = OUT_DEFAULT_PRECIS; - m_lfBaseFont.lfClipPrecision = CLIP_DEFAULT_PRECIS; - m_lfBaseFont.lfQuality = DEFAULT_QUALITY; - m_lfBaseFont.lfPitchAndFamily = DEFAULT_PITCH; - - m_dwTicks = GetTickCount(); - - m_parent = dynamic_cast(pParent); -} - -CPoint CRevisionGraphWnd::GetLogCoordinates (CPoint point) const -{ - // translate point into logical coordinates - - int nVScrollPos = GetScrollPos(SB_VERT); - int nHScrollPos = GetScrollPos(SB_HORZ); - - return CPoint ( (int)((point.x + nHScrollPos) / m_fZoomFactor) - , (int)((point.y + nVScrollPos) / m_fZoomFactor)); -} - -index_t CRevisionGraphWnd::GetHitNode (CPoint point, CSize border) const -{ - // any nodes at all? - - CSyncPointer nodeList (m_state.GetNodes()); - if (!nodeList) - return index_t(NO_INDEX); - - // search the nodes for one at that grid position - - return nodeList->GetAt (GetLogCoordinates (point), border); -} - -DWORD CRevisionGraphWnd::GetHoverGlyphs (CPoint point) const -{ - // if there is no layout, there will be no nodes, - // hence, no glyphs - - CSyncPointer nodeList (m_state.GetNodes()); - if (!nodeList) - return 0; - - // get node at point or node that is close enough - // so that point may hit a glyph area - - index_t nodeIndex = GetHitNode(point); - if (nodeIndex == NO_INDEX) - nodeIndex = GetHitNode(point, CSize (GLYPH_SIZE, GLYPH_SIZE / 2)); - - if (nodeIndex >= nodeList->GetCount()) - return 0; - - ILayoutNodeList::SNode node = nodeList->GetNode (nodeIndex); - const CVisibleGraphNode* base = node.node; - - // what glyphs should be shown depending on position of point - // relative to the node rect? - - CPoint logCoordinates = GetLogCoordinates (point); - CRect r = node.rect; - CPoint center = r.CenterPoint(); - - CRect rightGlyphArea ( r.right - GLYPH_SIZE, center.y - GLYPH_SIZE / 2 - , r.right + GLYPH_SIZE, center.y + GLYPH_SIZE / 2); - CRect topGlyphArea ( center.x - GLYPH_SIZE, r.top - GLYPH_SIZE / 2 - , center.x + GLYPH_SIZE, r.top + GLYPH_SIZE / 2); - CRect bottomGlyphArea ( center.x - GLYPH_SIZE, r.bottom - GLYPH_SIZE / 2 - , center.x + GLYPH_SIZE, r.bottom + GLYPH_SIZE / 2); - - bool upsideDown - = m_state.GetOptions()->GetOption()->IsActive(); - - if (upsideDown) - { - std::swap (topGlyphArea.top, bottomGlyphArea.top); - std::swap (topGlyphArea.bottom, bottomGlyphArea.bottom); - } - - DWORD result = 0; - if (rightGlyphArea.PtInRect (logCoordinates)) - result = base->GetFirstCopyTarget() != NULL - ? CGraphNodeStates::COLLAPSED_RIGHT | CGraphNodeStates::SPLIT_RIGHT - : 0; - - if (topGlyphArea.PtInRect (logCoordinates)) - result = base->GetSource() != NULL - ? CGraphNodeStates::COLLAPSED_ABOVE | CGraphNodeStates::SPLIT_ABOVE - : 0; - - if (bottomGlyphArea.PtInRect (logCoordinates)) - result = base->GetNext() != NULL - ? CGraphNodeStates::COLLAPSED_BELOW | CGraphNodeStates::SPLIT_BELOW - : 0; - - // if some nodes have already been split, don't allow collapsing etc. - - CSyncPointer nodeStates (m_state.GetNodeStates()); - if (result & nodeStates->GetFlags (base)) - result = 0; - - return result; -} - -const CRevisionGraphState::SVisibleGlyph* CRevisionGraphWnd::GetHitGlyph (CPoint point) const -{ - float glyphSize = GLYPH_SIZE * m_fZoomFactor; - - CSyncPointer - visibleGlyphs (m_state.GetVisibleGlyphs()); - - for (size_t i = 0, count = visibleGlyphs->size(); i < count; ++i) - { - const CRevisionGraphState::SVisibleGlyph* entry = &(*visibleGlyphs)[i]; - - float xRel = point.x - entry->leftTop.X; - float yRel = point.y - entry->leftTop.Y; - - if ( (xRel >= 0) && (xRel < glyphSize) - && (yRel >= 0) && (yRel < glyphSize)) - { - return entry; - } - } - - return NULL; -} - -void CRevisionGraphWnd::OnHScroll(UINT nSBCode, UINT nPos, CScrollBar* pScrollBar) -{ - SCROLLINFO sinfo = {0}; - sinfo.cbSize = sizeof(SCROLLINFO); - GetScrollInfo(SB_HORZ, &sinfo); - - // Determine the new position of scroll box. - switch (nSBCode) - { - case SB_LEFT: // Scroll to far left. - sinfo.nPos = sinfo.nMin; - break; - case SB_RIGHT: // Scroll to far right. - sinfo.nPos = sinfo.nMax; - break; - case SB_ENDSCROLL: // End scroll. - break; - case SB_LINELEFT: // Scroll left. - if (sinfo.nPos > sinfo.nMin) - sinfo.nPos--; - break; - case SB_LINERIGHT: // Scroll right. - if (sinfo.nPos < sinfo.nMax) - sinfo.nPos++; - break; - case SB_PAGELEFT: // Scroll one page left. - { - if (sinfo.nPos > sinfo.nMin) - sinfo.nPos = max(sinfo.nMin, sinfo.nPos - (int) sinfo.nPage); - } - break; - case SB_PAGERIGHT: // Scroll one page right. - { - if (sinfo.nPos < sinfo.nMax) - sinfo.nPos = min(sinfo.nMax, sinfo.nPos + (int) sinfo.nPage); - } - break; - case SB_THUMBPOSITION: // Scroll to absolute position. nPos is the position - sinfo.nPos = sinfo.nTrackPos; // of the scroll box at the end of the drag operation. - break; - case SB_THUMBTRACK: // Drag scroll box to specified position. nPos is the - sinfo.nPos = sinfo.nTrackPos; // position that the scroll box has been dragged to. - break; - } - SetScrollInfo(SB_HORZ, &sinfo); - Invalidate (FALSE); - __super::OnHScroll(nSBCode, nPos, pScrollBar); -} - -void CRevisionGraphWnd::OnVScroll(UINT nSBCode, UINT nPos, CScrollBar* pScrollBar) -{ - SCROLLINFO sinfo = {0}; - sinfo.cbSize = sizeof(SCROLLINFO); - GetScrollInfo(SB_VERT, &sinfo); - - // Determine the new position of scroll box. - switch (nSBCode) - { - case SB_LEFT: // Scroll to far left. - sinfo.nPos = sinfo.nMin; - break; - case SB_RIGHT: // Scroll to far right. - sinfo.nPos = sinfo.nMax; - break; - case SB_ENDSCROLL: // End scroll. - break; - case SB_LINELEFT: // Scroll left. - if (sinfo.nPos > sinfo.nMin) - sinfo.nPos--; - break; - case SB_LINERIGHT: // Scroll right. - if (sinfo.nPos < sinfo.nMax) - sinfo.nPos++; - break; - case SB_PAGELEFT: // Scroll one page left. - { - if (sinfo.nPos > sinfo.nMin) - sinfo.nPos = max(sinfo.nMin, sinfo.nPos - (int) sinfo.nPage); - } - break; - case SB_PAGERIGHT: // Scroll one page right. - { - if (sinfo.nPos < sinfo.nMax) - sinfo.nPos = min(sinfo.nMax, sinfo.nPos + (int) sinfo.nPage); - } - break; - case SB_THUMBPOSITION: // Scroll to absolute position. nPos is the position - sinfo.nPos = sinfo.nTrackPos; // of the scroll box at the end of the drag operation. - break; - case SB_THUMBTRACK: // Drag scroll box to specified position. nPos is the - sinfo.nPos = sinfo.nTrackPos; // position that the scroll box has been dragged to. - break; - } - SetScrollInfo(SB_VERT, &sinfo); - Invalidate(FALSE); - __super::OnVScroll(nSBCode, nPos, pScrollBar); -} - -void CRevisionGraphWnd::OnSize(UINT nType, int cx, int cy) -{ - __super::OnSize(nType, cx, cy); - SetScrollbars(GetScrollPos(SB_VERT), GetScrollPos(SB_HORZ)); - Invalidate(FALSE); -} - -void CRevisionGraphWnd::OnLButtonDown(UINT nFlags, CPoint point) -{ - if (m_bThreadRunning) - return __super::OnLButtonDown(nFlags, point); - - CSyncPointer nodeList (m_state.GetNodes()); - - ATLTRACE("right clicked on x=%d y=%d\n", point.x, point.y); - SetFocus(); - bool bHit = false; - bool bControl = !!(GetKeyState(VK_CONTROL)&0x8000); - if (!m_bShowOverview || !m_OverviewRect.PtInRect(point)) - { - const CRevisionGraphState::SVisibleGlyph* hitGlyph - = GetHitGlyph (point); - - if (hitGlyph != NULL) - { - ToggleNodeFlag (hitGlyph->node, hitGlyph->state); - return __super::OnLButtonDown(nFlags, point); - } - else - { - index_t nodeIndex = GetHitNode (point); - if (nodeIndex != NO_INDEX) - { - const CVisibleGraphNode* reventry = nodeList->GetNode (nodeIndex).node; - if (bControl) - { - if (m_SelectedEntry1 == reventry) - { - if (m_SelectedEntry2) - { - m_SelectedEntry1 = m_SelectedEntry2; - m_SelectedEntry2 = NULL; - } - else - m_SelectedEntry1 = NULL; - } - else if (m_SelectedEntry2 == reventry) - m_SelectedEntry2 = NULL; - else if (m_SelectedEntry1) - m_SelectedEntry2 = reventry; - else - m_SelectedEntry1 = reventry; - } - else - { - if (m_SelectedEntry1 == reventry) - m_SelectedEntry1 = NULL; - else - m_SelectedEntry1 = reventry; - m_SelectedEntry2 = NULL; - } - bHit = true; - Invalidate(FALSE); - } - } - } - - if ((!bHit)&&(!bControl)) - { - m_SelectedEntry1 = NULL; - m_SelectedEntry2 = NULL; - m_bIsRubberBand = true; - ATLTRACE("LButtonDown: x = %ld, y = %ld\n", point.x, point.y); - Invalidate(FALSE); - if (m_bShowOverview && m_OverviewRect.PtInRect(point)) - m_bIsRubberBand = false; - } - m_ptRubberStart = point; - - UINT uEnable = MF_BYCOMMAND; - if ((m_SelectedEntry1 != NULL)&&(m_SelectedEntry2 != NULL)) - uEnable |= MF_ENABLED; - else - uEnable |= MF_GRAYED; - - EnableMenuItem(GetParent()->GetMenu()->m_hMenu, ID_VIEW_COMPAREREVISIONS, uEnable); - EnableMenuItem(GetParent()->GetMenu()->m_hMenu, ID_VIEW_COMPAREHEADREVISIONS, uEnable); - EnableMenuItem(GetParent()->GetMenu()->m_hMenu, ID_VIEW_UNIFIEDDIFF, uEnable); - EnableMenuItem(GetParent()->GetMenu()->m_hMenu, ID_VIEW_UNIFIEDDIFFOFHEADREVISIONS, uEnable); - - __super::OnLButtonDown(nFlags, point); -} - -void CRevisionGraphWnd::OnLButtonUp(UINT nFlags, CPoint point) -{ - if (!m_bIsRubberBand) - return; // we don't have a rubberband, so no zooming necessary - - m_bIsRubberBand = false; - ReleaseCapture(); - if (m_bThreadRunning) - return __super::OnLButtonUp(nFlags, point); - // zooming is finished - m_ptRubberEnd = CPoint(0,0); - CRect rect = GetClientRect(); - int x = abs(m_ptRubberStart.x - point.x); - int y = abs(m_ptRubberStart.y - point.y); - - if ((x < 20)&&(y < 20)) - { - // too small zoom rectangle - // assume zooming by accident - Invalidate(FALSE); - __super::OnLButtonUp(nFlags, point); - return; - } - - float xfact = float(rect.Width())/float(x); - float yfact = float(rect.Height())/float(y); - float fact = max(yfact, xfact); - - // find out where to scroll to - x = min(m_ptRubberStart.x, point.x) + GetScrollPos(SB_HORZ); - y = min(m_ptRubberStart.y, point.y) + GetScrollPos(SB_VERT); - - float fZoomfactor = m_fZoomFactor*fact; - if (fZoomfactor > 20.0) - { - // with such a big zoomfactor, the user - // most likely zoomed by accident - Invalidate(FALSE); - __super::OnLButtonUp(nFlags, point); - return; - } - if (fZoomfactor > 2.0) - { - fZoomfactor = 2.0; - fact = fZoomfactor/m_fZoomFactor; - } - - CRevisionGraphDlg * pDlg = (CRevisionGraphDlg*)GetParent(); - if (pDlg) - { - m_fZoomFactor = fZoomfactor; - pDlg->DoZoom (m_fZoomFactor); - SetScrollbars(int(float(y)*fact), int(float(x)*fact)); - } - __super::OnLButtonUp(nFlags, point); -} - -bool CRevisionGraphWnd::CancelMouseZoom() -{ - bool bRet = m_bIsRubberBand; - ReleaseCapture(); - if (m_bIsRubberBand) - Invalidate(FALSE); - m_bIsRubberBand = false; - m_ptRubberEnd = CPoint(0,0); - return bRet; -} - -INT_PTR CRevisionGraphWnd::OnToolHitTest(CPoint point, TOOLINFO* pTI) const -{ - if (m_bThreadRunning) - return -1; - - index_t nodeIndex = GetHitNode (point); - if (m_tooltipIndex != nodeIndex) - { - // force tooltip to be updated - - m_tooltipIndex = nodeIndex; - return -1; - } - - if (nodeIndex == NO_INDEX) - return -1; - - if ((GetHoverGlyphs (point) != 0) || (GetHitGlyph (point) != NULL)) - return -1; - - pTI->hwnd = this->m_hWnd; - CWnd::GetClientRect(&pTI->rect); - pTI->uFlags |= TTF_ALWAYSTIP | TTF_IDISHWND; - pTI->uId = (UINT)m_hWnd; - pTI->lpszText = LPSTR_TEXTCALLBACK; - - return 1; -} - -BOOL CRevisionGraphWnd::OnToolTipNotify(UINT /*id*/, NMHDR *pNMHDR, LRESULT *pResult) -{ - if (pNMHDR->idFrom != (UINT)m_hWnd) - return FALSE; - - // need to handle both ANSI and UNICODE versions of the message - TOOLTIPTEXTA* pTTTA = (TOOLTIPTEXTA*)pNMHDR; - TOOLTIPTEXTW* pTTTW = (TOOLTIPTEXTW*)pNMHDR; - - POINT point; - DWORD ptW = GetMessagePos(); - point.x = GET_X_LPARAM(ptW); - point.y = GET_Y_LPARAM(ptW); - ScreenToClient(&point); - - CString strTipText = TooltipText (GetHitNode (point)); - - *pResult = 0; - if (strTipText.IsEmpty()) - return TRUE; - - CSize tooltipSize = UsableTooltipRect(); - strTipText = DisplayableText (strTipText, tooltipSize); - - if (pNMHDR->code == TTN_NEEDTEXTA) - { - ::SendMessage(pNMHDR->hwndFrom, TTM_SETMAXTIPWIDTH, 0, tooltipSize.cx); - pTTTA->lpszText = m_szTip; - WideCharToMultiByte(CP_ACP, 0, strTipText, -1, m_szTip, strTipText.GetLength()+1, 0, 0); - } - else - { - ::SendMessage(pNMHDR->hwndFrom, TTM_SETMAXTIPWIDTH, 0, tooltipSize.cx); - lstrcpyn(m_wszTip, strTipText, strTipText.GetLength()+1); - pTTTW->lpszText = m_wszTip; - } - - // show the tooltip for 32 seconds. A higher value than 32767 won't work - // even though it's nowhere documented! - ::SendMessage(pNMHDR->hwndFrom, TTM_SETDELAYTIME, TTDT_AUTOPOP, 32767); - return TRUE; // message was handled -} - -CSize CRevisionGraphWnd::UsableTooltipRect() -{ - // get screen size - - int screenWidth = GetSystemMetrics(SM_CXSCREEN); - int screenHeight = GetSystemMetrics(SM_CYSCREEN); - - // get current mouse position - - CPoint cursorPos; - if (GetCursorPos (&cursorPos) == FALSE) - { - // we could not determine the mouse position - // use screen / 2 minus some safety margin - - return CSize (screenWidth / 2 - 20, screenHeight / 2 - 20); - } - - // tool tip will display in the biggest sector beside the cursor - // deduct some safety margin (for the mouse cursor itself - - CSize biggestSector - ( max (screenWidth - cursorPos.x - 40, cursorPos.x - 24) - , max (screenHeight - cursorPos.y - 40, cursorPos.y - 24)); - - return biggestSector; -} - -CString CRevisionGraphWnd::DisplayableText ( const CString& wholeText - , const CSize& tooltipSize) -{ - CDC* dc = GetDC(); - if (dc == NULL) - { - // no access to the device context -> truncate hard at 1000 chars - - return wholeText.GetLength() >= MAX_TT_LENGTH_DEFAULT - ? wholeText.Left (MAX_TT_LENGTH_DEFAULT-4) + _T(" ...") - : wholeText; - } - - // select the tooltip font - - NONCLIENTMETRICS metrics; - metrics.cbSize = sizeof (metrics); - SystemParametersInfo (SPI_GETNONCLIENTMETRICS, sizeof(NONCLIENTMETRICS), &metrics, 0); - - CFont font; - font.CreateFontIndirect(&metrics.lfStatusFont); - CFont* pOldFont = dc->SelectObject (&font); - - // split into lines and fill the tooltip rect - - CString result; - - int remainingHeight = tooltipSize.cy; - int pos = 0; - while (pos < wholeText.GetLength()) - { - // extract a whole line - - int nextPos = wholeText.Find ('\n', pos); - if (nextPos < 0) - nextPos = wholeText.GetLength(); - - CString line = wholeText.Mid (pos, nextPos-pos+1); - - // find a way to make it fit - - CSize size = dc->GetTextExtent (line); - while (size.cx > tooltipSize.cx) - { - line.Delete (line.GetLength()-1); - int nextPos2 = line.ReverseFind (' '); - if (nextPos2 < 0) - break; - - line.Delete (pos+1, line.GetLength() - pos-1); - size = dc->GetTextExtent (line); - } - - // enough room for the new line? - - remainingHeight -= size.cy; - if (remainingHeight <= size.cy) - { - result += _T("..."); - break; - } - - // add the line - - result += line; - pos += line.GetLength(); - } - - // relase temp. resources - - dc->SelectObject (pOldFont); - ReleaseDC(dc); - - // ready - - return result; -} - -CString CRevisionGraphWnd::TooltipText (index_t index) -{ - if (index != NO_INDEX) - { - CSyncPointer nodeList (m_state.GetNodes()); - return nodeList->GetToolTip (index); - } - - return CString(); -} - -void CRevisionGraphWnd::SaveGraphAs(CString sSavePath) -{ - CString extension = CPathUtils::GetFileExtFromPath(sSavePath); - if (extension.CompareNoCase(_T(".wmf"))==0) - { - // save the graph as an enhanced metafile - CMetaFileDC wmfDC; - wmfDC.CreateEnhanced(NULL, sSavePath, NULL, _T("TortoiseSVN\0Revision Graph\0\0")); - float fZoom = m_fZoomFactor; - m_fZoomFactor = 1.0; - DoZoom(m_fZoomFactor); - CRect rect; - rect = GetViewRect(); - DrawGraph(&wmfDC, rect, 0, 0, true); - HENHMETAFILE hemf = wmfDC.CloseEnhanced(); - DeleteEnhMetaFile(hemf); - m_fZoomFactor = fZoom; - DoZoom(m_fZoomFactor); - } - else - { - // save the graph as a pixel picture instead of a vector picture - // create dc to paint on - try - { - CString sErrormessage; - CWindowDC ddc(this); - CDC dc; - if (!dc.CreateCompatibleDC(&ddc)) - { - LPVOID lpMsgBuf; - if (!FormatMessage( - FORMAT_MESSAGE_ALLOCATE_BUFFER | - FORMAT_MESSAGE_FROM_SYSTEM | - FORMAT_MESSAGE_IGNORE_INSERTS, - NULL, - GetLastError(), - MAKELANGID(LANG_NEUTRAL, SUBLANG_DEFAULT), // Default language - (LPTSTR) &lpMsgBuf, - 0, - NULL )) - { - return; - } - MessageBox( (LPCTSTR)lpMsgBuf, _T("Error"), MB_OK | MB_ICONINFORMATION ); - LocalFree( lpMsgBuf ); - return; - } - CRect rect; - rect = GetGraphRect(); - rect.bottom = (LONG)(float(rect.Height()) * m_fZoomFactor); - rect.right = (LONG)(float(rect.Width()) * m_fZoomFactor); - BITMAPINFO bmi; - HBITMAP hbm; - LPBYTE pBits; - // Initialize header to 0s. - SecureZeroMemory(&bmi, sizeof(bmi)); - // Fill out the fields you care about. - bmi.bmiHeader.biSize = sizeof(BITMAPINFOHEADER); - bmi.bmiHeader.biWidth = rect.Width(); - bmi.bmiHeader.biHeight = rect.Height(); - bmi.bmiHeader.biPlanes = 1; - bmi.bmiHeader.biBitCount = 24; - bmi.bmiHeader.biCompression = BI_RGB; - - // Create the surface. - hbm = CreateDIBSection(ddc.m_hDC, &bmi, DIB_RGB_COLORS,(void **)&pBits, NULL, 0); - if (hbm==0) - { - CMessageBox::Show(m_hWnd, IDS_REVGRAPH_ERR_NOMEMORY, IDS_APPNAME, MB_ICONERROR); - return; - } - HBITMAP oldbm = (HBITMAP)dc.SelectObject(hbm); - // paint the whole graph - DrawGraph(&dc, rect, 0, 0, true); - // now use GDI+ to save the picture - CLSID encoderClsid; - { - Bitmap bitmap(hbm, NULL); - if (bitmap.GetLastStatus()==Ok) - { - // Get the CLSID of the encoder. - int ret = 0; - if (CPathUtils::GetFileExtFromPath(sSavePath).CompareNoCase(_T(".png"))==0) - ret = GetEncoderClsid(L"image/png", &encoderClsid); - else if (CPathUtils::GetFileExtFromPath(sSavePath).CompareNoCase(_T(".jpg"))==0) - ret = GetEncoderClsid(L"image/jpeg", &encoderClsid); - else if (CPathUtils::GetFileExtFromPath(sSavePath).CompareNoCase(_T(".jpeg"))==0) - ret = GetEncoderClsid(L"image/jpeg", &encoderClsid); - else if (CPathUtils::GetFileExtFromPath(sSavePath).CompareNoCase(_T(".bmp"))==0) - ret = GetEncoderClsid(L"image/bmp", &encoderClsid); - else if (CPathUtils::GetFileExtFromPath(sSavePath).CompareNoCase(_T(".gif"))==0) - ret = GetEncoderClsid(L"image/gif", &encoderClsid); - else - { - sSavePath += _T(".jpg"); - ret = GetEncoderClsid(L"image/jpeg", &encoderClsid); - } - if (ret >= 0) - { - CStringW tfile = CStringW(sSavePath); - bitmap.Save(tfile, &encoderClsid, NULL); - } - else - { - sErrormessage.Format(IDS_REVGRAPH_ERR_NOENCODER, (LPCTSTR)CPathUtils::GetFileExtFromPath(sSavePath)); - } - } - else - { - sErrormessage.LoadString(IDS_REVGRAPH_ERR_NOBITMAP); - } - } - dc.SelectObject(oldbm); - DeleteObject(hbm); - dc.DeleteDC(); - if (!sErrormessage.IsEmpty()) - { - CMessageBox::Show(m_hWnd, sErrormessage, _T("TortoiseSVN"), MB_ICONERROR); - } - } - catch (CException * pE) - { - TCHAR szErrorMsg[2048]; - pE->GetErrorMessage(szErrorMsg, 2048); - CMessageBox::Show(m_hWnd, szErrorMsg, _T("TortoiseSVN"), MB_ICONERROR); - } - } -} - -BOOL CRevisionGraphWnd::OnMouseWheel(UINT nFlags, short zDelta, CPoint pt) -{ - if (m_bThreadRunning) - return __super::OnMouseWheel(nFlags, zDelta, pt); - int orientation = GetKeyState(VK_CONTROL)&0x8000 ? SB_HORZ : SB_VERT; - int pos = GetScrollPos(orientation); - pos -= (zDelta); - SetScrollPos(orientation, pos); - Invalidate(FALSE); - return __super::OnMouseWheel(nFlags, zDelta, pt); -} - -bool CRevisionGraphWnd::UpdateSelectedEntry (const CVisibleGraphNode * clickedentry) -{ - if ((m_SelectedEntry1 == NULL)&&(clickedentry == NULL)) - return false; - - if (m_SelectedEntry1 == NULL) - { - m_SelectedEntry1 = clickedentry; - Invalidate(FALSE); - } - if ((m_SelectedEntry2 == NULL)&&(clickedentry != m_SelectedEntry1)) - { - m_SelectedEntry1 = clickedentry; - Invalidate(FALSE); - } - if (m_SelectedEntry1 && m_SelectedEntry2) - { - if ((m_SelectedEntry2 != clickedentry)&&(m_SelectedEntry1 != clickedentry)) - return false; - } - if (m_SelectedEntry1 == NULL) - return false; - - return true; -} - -void CRevisionGraphWnd::AppendMenu - ( CMenu& popup - , UINT title - , UINT command - , UINT flags) -{ - // separate different groups / section within the context menu - - if (popup.GetMenuItemCount() > 0) - { - UINT lastCommand = popup.GetMenuItemID (popup.GetMenuItemCount()-1); - if ((lastCommand & GROUP_MASK) != (command & GROUP_MASK)) - popup.AppendMenu(MF_SEPARATOR, NULL); - } - - // actually add the new item - - CString titleString; - titleString.LoadString (title); - popup.AppendMenu (MF_STRING | flags, command, titleString); -} - -void CRevisionGraphWnd::AddSVNOps (CMenu& popup) -{ - bool bothPresent = (m_SelectedEntry1 != NULL) - && !m_SelectedEntry1->GetClassification().Is (CNodeClassification::IS_DELETED) - && (m_SelectedEntry2 != NULL) - && !m_SelectedEntry2->GetClassification().Is (CNodeClassification::IS_DELETED); - - bool bSameURL = (m_SelectedEntry2 && m_SelectedEntry1 - && (m_SelectedEntry1->GetPath() == m_SelectedEntry2->GetPath())); - - if (m_SelectedEntry1 && (m_SelectedEntry2 == NULL)) - { - AppendMenu (popup, IDS_REPOBROWSE_SHOWLOG, ID_SHOWLOG); - if (!m_SelectedEntry1->GetClassification().Is (CNodeClassification::IS_MODIFIED_WC)) - AppendMenu (popup, IDS_LOG_BROWSEREPO, ID_BROWSEREPO); - if (PathIsDirectory(m_sPath)) - if (m_SelectedEntry1->GetClassification().Is (CNodeClassification::IS_MODIFIED_WC)) - AppendMenu (popup, IDS_REVGRAPH_POPUP_CFM, ID_CFM); - else - AppendMenu (popup, IDS_LOG_POPUP_MERGEREV, ID_MERGETO); - - if (!m_SelectedEntry1->GetClassification().Is (CNodeClassification::IS_WORKINGCOPY)) - if (!CTSVNPath (m_sPath).IsUrl()) - if (GetWCURL() == GetSelectedURL()) - { - AppendMenu (popup, IDS_REVGRAPH_POPUP_UPDATE, ID_UPDATE); - } - else - { - AppendMenu (popup, IDS_REVGRAPH_POPUP_SWITCHTOHEAD, ID_SWITCHTOHEAD); - AppendMenu (popup, IDS_REVGRAPH_POPUP_SWITCH, ID_SWITCH); - } - - } - - if (bothPresent) - { - if (!m_SelectedEntry2->GetClassification().Is (CNodeClassification::IS_MODIFIED_WC)) - { - // TODO: TSVN currently can't compare URL -> WC, but only vice versa) - - AppendMenu (popup, IDS_REVGRAPH_POPUP_COMPAREREVS, ID_COMPAREREVS); - if (!bSameURL) - AppendMenu (popup, IDS_REVGRAPH_POPUP_COMPAREHEADS, ID_COMPAREHEADS); - } - - AppendMenu (popup, IDS_REVGRAPH_POPUP_UNIDIFFREVS, ID_UNIDIFFREVS); - if (!bSameURL) - AppendMenu (popup, IDS_REVGRAPH_POPUP_UNIDIFFHEADS, ID_UNIDIFFHEADS); - } -} - -void CRevisionGraphWnd::AddGraphOps (CMenu& popup, const CVisibleGraphNode * node) -{ - CSyncPointer nodeStates (m_state.GetNodeStates()); - - if (node == NULL) - { - DWORD state = nodeStates->GetCombinedFlags(); - if (state != 0) - { - if (state & CGraphNodeStates::COLLAPSED_ALL) - AppendMenu (popup, IDS_REVGRAPH_POPUP_EXPAND_ALL, ID_EXPAND_ALL); - - if (state & CGraphNodeStates::SPLIT_ALL) - AppendMenu (popup, IDS_REVGRAPH_POPUP_JOIN_ALL, ID_JOIN_ALL); - } - } - else - { - DWORD state = nodeStates->GetFlags (node); - - if (node->GetSource() || (state & CGraphNodeStates::COLLAPSED_ABOVE)) - AppendMenu ( popup - , (state & CGraphNodeStates::COLLAPSED_ABOVE) - ? IDS_REVGRAPH_POPUP_EXPAND_ABOVE - : IDS_REVGRAPH_POPUP_COLLAPSE_ABOVE - , ID_GRAPH_EXPANDCOLLAPSE_ABOVE); - - if (node->GetFirstCopyTarget() || (state & CGraphNodeStates::COLLAPSED_RIGHT)) - AppendMenu ( popup - , (state & CGraphNodeStates::COLLAPSED_RIGHT) - ? IDS_REVGRAPH_POPUP_EXPAND_RIGHT - : IDS_REVGRAPH_POPUP_COLLAPSE_RIGHT - , ID_GRAPH_EXPANDCOLLAPSE_RIGHT); - - if (node->GetNext() || (state & CGraphNodeStates::COLLAPSED_BELOW)) - AppendMenu ( popup - , (state & CGraphNodeStates::COLLAPSED_BELOW) - ? IDS_REVGRAPH_POPUP_EXPAND_BELOW - : IDS_REVGRAPH_POPUP_COLLAPSE_BELOW - , ID_GRAPH_EXPANDCOLLAPSE_BELOW); - - if (node->GetSource() || (state & CGraphNodeStates::SPLIT_ABOVE)) - AppendMenu ( popup - , (state & CGraphNodeStates::SPLIT_ABOVE) - ? IDS_REVGRAPH_POPUP_JOIN_ABOVE - : IDS_REVGRAPH_POPUP_SPLIT_ABOVE - , ID_GRAPH_SPLITJOIN_ABOVE); - - if (node->GetFirstCopyTarget() || (state & CGraphNodeStates::SPLIT_RIGHT)) - AppendMenu ( popup - , (state & CGraphNodeStates::SPLIT_RIGHT) - ? IDS_REVGRAPH_POPUP_JOIN_RIGHT - : IDS_REVGRAPH_POPUP_SPLIT_RIGHT - , ID_GRAPH_SPLITJOIN_RIGHT); - - if (node->GetNext() || (state & CGraphNodeStates::SPLIT_BELOW)) - AppendMenu ( popup - , (state & CGraphNodeStates::SPLIT_BELOW) - ? IDS_REVGRAPH_POPUP_JOIN_BELOW - : IDS_REVGRAPH_POPUP_SPLIT_BELOW - , ID_GRAPH_SPLITJOIN_BELOW); - } -} - -CString CRevisionGraphWnd::GetSelectedURL() const -{ - if (m_SelectedEntry1 == NULL) - return CString(); - - CString URL = m_state.GetRepositoryRoot() - + CUnicodeUtils::GetUnicode (m_SelectedEntry1->GetPath().GetPath().c_str()); - URL = CUnicodeUtils::GetUnicode(CPathUtils::PathEscape(CUnicodeUtils::GetUTF8(URL))); - - return URL; -} - -CString CRevisionGraphWnd::GetWCURL() const -{ - CTSVNPath path (m_sPath); - if (path.IsUrl()) - return CString(); - - SVNInfo info; - const SVNInfoData * status - = info.GetFirstFileInfo (path, SVNRev(), SVNRev()); - - return status == NULL ? CString() : status->url; -} - -void CRevisionGraphWnd::DoShowLog() -{ - CString URL = GetSelectedURL(); - - CString sCmd; - sCmd.Format(_T("\"%s\" /command:log /path:\"%s\" /startrev:%ld"), - (LPCTSTR)(CPathUtils::GetAppDirectory()+_T("TortoiseProc.exe")), - (LPCTSTR)URL, - m_SelectedEntry1->GetRevision()); - - if (!SVN::PathIsURL(CTSVNPath(m_sPath))) - { - sCmd += _T(" /propspath:\""); - sCmd += m_sPath; - sCmd += _T("\""); - } - - CAppUtils::LaunchApplication(sCmd, NULL, false); -} - -void CRevisionGraphWnd::DoCheckForModification() -{ - CChangedDlg dlg; - dlg.m_pathList = CTSVNPathList (CTSVNPath (m_sPath)); - dlg.DoModal(); -} - -void CRevisionGraphWnd::DoMergeTo() -{ - CString URL = GetSelectedURL(); - CString path = m_sPath; - CBrowseFolder folderBrowser; - folderBrowser.SetInfo(CString(MAKEINTRESOURCE(IDS_LOG_MERGETO))); - if (folderBrowser.Show(GetSafeHwnd(), path, path) == CBrowseFolder::OK) - { - CSVNProgressDlg dlg; - dlg.SetCommand(CSVNProgressDlg::SVNProgress_Merge); - dlg.SetPathList(CTSVNPathList(CTSVNPath(path))); - dlg.SetUrl(URL); - dlg.SetSecondUrl(URL); - SVNRevRangeArray revarray; - revarray.AddRevRange(m_SelectedEntry1->GetRevision(), svn_revnum_t(m_SelectedEntry1->GetRevision())-1); - dlg.SetRevisionRanges(revarray); - dlg.DoModal(); - } -} - -void CRevisionGraphWnd::DoUpdate() -{ - CSVNProgressDlg progDlg; - progDlg.SetCommand (CSVNProgressDlg::SVNProgress_Update); - progDlg.SetOptions (0); // don't ignore externals - progDlg.SetPathList (CTSVNPathList (CTSVNPath (m_sPath))); - progDlg.SetRevision (m_SelectedEntry1->GetRevision()); - progDlg.SetDepth(); - progDlg.DoModal(); - - if (m_state.GetFetchedWCState()) - m_parent->UpdateFullHistory(); -} - -void CRevisionGraphWnd::DoSwitch() -{ - CSVNProgressDlg progDlg; - progDlg.SetCommand (CSVNProgressDlg::SVNProgress_Switch); - progDlg.SetPathList (CTSVNPathList (CTSVNPath (m_sPath))); - progDlg.SetUrl (GetSelectedURL()); - progDlg.SetRevision (m_SelectedEntry1->GetRevision()); - progDlg.DoModal(); - - if (m_state.GetFetchedWCState()) - m_parent->UpdateFullHistory(); -} - -void CRevisionGraphWnd::DoSwitchToHead() -{ - CSVNProgressDlg progDlg; - progDlg.SetCommand (CSVNProgressDlg::SVNProgress_Switch); - progDlg.SetPathList (CTSVNPathList (CTSVNPath (m_sPath))); - progDlg.SetUrl (GetSelectedURL()); - progDlg.SetRevision (SVNRev::REV_HEAD); - progDlg.SetPegRevision (m_SelectedEntry1->GetRevision()); - progDlg.DoModal(); - - if (m_state.GetFetchedWCState()) - m_parent->UpdateFullHistory(); -} - -void CRevisionGraphWnd::DoBrowseRepo() -{ - CString sCmd; - sCmd.Format(_T("%s /command:repobrowser /path:\"%s\" /rev:%d"), - (LPCTSTR)(CPathUtils::GetAppDirectory()+_T("TortoiseProc.exe")), - (LPCTSTR)GetSelectedURL(), m_SelectedEntry1->GetRevision()); - - CAppUtils::LaunchApplication(sCmd, NULL, false); -} - -void CRevisionGraphWnd::ResetNodeFlags (DWORD flags) -{ - m_state.GetNodeStates()->ResetFlags (flags); - m_parent->StartWorkerThread(); -} - -void CRevisionGraphWnd::ToggleNodeFlag (const CVisibleGraphNode *node, DWORD flag) -{ - CSyncPointer nodeStates (m_state.GetNodeStates()); - - if (nodeStates->GetFlags (node) & flag) - nodeStates->ResetFlags (node, flag); - else - nodeStates->SetFlags (node, flag); - - m_parent->StartWorkerThread(); -} - -void CRevisionGraphWnd::OnContextMenu(CWnd* /*pWnd*/, CPoint point) -{ - if (m_bThreadRunning) - return; - - CSyncPointer nodeList (m_state.GetNodes()); - - CPoint clientpoint = point; - this->ScreenToClient(&clientpoint); - ATLTRACE("right clicked on x=%d y=%d\n", clientpoint.x, clientpoint.y); - - index_t nodeIndex = GetHitNode (clientpoint); - const CVisibleGraphNode * clickedentry = NULL; - if (nodeIndex != NO_INDEX) - { - clickedentry = nodeList->GetNode (nodeIndex).node; - } - - if ( !UpdateSelectedEntry (clickedentry) - && !m_state.GetNodeStates()->GetCombinedFlags()) - return; - - CMenu popup; - if (popup.CreatePopupMenu()) - { - AddSVNOps (popup); - AddGraphOps (popup, clickedentry); - - // if the context menu is invoked through the keyboard, we have to use - // a calculated position on where to anchor the menu on - if ((point.x == -1) && (point.y == -1)) - { - CRect rect = GetWindowRect(); - point = rect.CenterPoint(); - } - - int cmd = popup.TrackPopupMenu(TPM_RETURNCMD | TPM_LEFTALIGN | TPM_NONOTIFY, point.x, point.y, this, 0); - switch (cmd) - { - case ID_COMPAREREVS: - if (m_SelectedEntry1 != NULL) - CompareRevs(false); - break; - case ID_COMPAREHEADS: - if (m_SelectedEntry1 != NULL) - CompareRevs(true); - break; - case ID_UNIDIFFREVS: - if (m_SelectedEntry1 != NULL) - UnifiedDiffRevs(false); - break; - case ID_UNIDIFFHEADS: - if (m_SelectedEntry1 != NULL) - UnifiedDiffRevs(true); - break; - case ID_SHOWLOG: - DoShowLog(); - break; - case ID_CFM: - DoCheckForModification(); - break; - case ID_MERGETO: - DoMergeTo(); - break; - case ID_UPDATE: - DoUpdate(); - break; - case ID_SWITCHTOHEAD: - DoSwitchToHead(); - break; - case ID_SWITCH: - DoSwitch(); - break; - case ID_BROWSEREPO: - DoBrowseRepo(); - break; - case ID_EXPAND_ALL: - ResetNodeFlags (CGraphNodeStates::COLLAPSED_ALL); - break; - case ID_JOIN_ALL: - ResetNodeFlags (CGraphNodeStates::SPLIT_ALL); - break; - case ID_GRAPH_EXPANDCOLLAPSE_ABOVE: - ToggleNodeFlag (clickedentry, CGraphNodeStates::COLLAPSED_ABOVE); - break; - case ID_GRAPH_EXPANDCOLLAPSE_RIGHT: - ToggleNodeFlag (clickedentry, CGraphNodeStates::COLLAPSED_RIGHT); - break; - case ID_GRAPH_EXPANDCOLLAPSE_BELOW: - ToggleNodeFlag (clickedentry, CGraphNodeStates::COLLAPSED_BELOW); - break; - case ID_GRAPH_SPLITJOIN_ABOVE: - ToggleNodeFlag (clickedentry, CGraphNodeStates::SPLIT_ABOVE); - break; - case ID_GRAPH_SPLITJOIN_RIGHT: - ToggleNodeFlag (clickedentry, CGraphNodeStates::SPLIT_RIGHT); - break; - case ID_GRAPH_SPLITJOIN_BELOW: - ToggleNodeFlag (clickedentry, CGraphNodeStates::SPLIT_BELOW); - break; - } - } -} - -void CRevisionGraphWnd::OnMouseMove(UINT nFlags, CPoint point) -{ - if (m_bThreadRunning) - { - return __super::OnMouseMove(nFlags, point); - } - if (!m_bIsRubberBand) - { - if (m_bShowOverview && (m_OverviewRect.PtInRect(point))&&(nFlags & MK_LBUTTON)) - { - // scrolling - CRect viewRect = GetViewRect(); - int x = (int)((point.x-m_OverviewRect.left - (m_OverviewPosRect.Width()/2)) / m_previewZoom * m_fZoomFactor); - int y = (int)((point.y - (m_OverviewPosRect.Height()/2)) / m_previewZoom * m_fZoomFactor); - SetScrollbars(y, x); - Invalidate(FALSE); - return __super::OnMouseMove(nFlags, point); - } - else - { - // update screen if we hover over a different - // node than during the last redraw - - CPoint clientPoint = point; - GetCursorPos (&clientPoint); - ScreenToClient (&clientPoint); - - const CRevisionGraphState::SVisibleGlyph* hitGlyph - = GetHitGlyph (clientPoint); - const CFullGraphNode* glyphNode - = hitGlyph ? hitGlyph->node->GetBase() : NULL; - - const CFullGraphNode* hoverNode = NULL; - if (m_hoverIndex != NO_INDEX) - { - CSyncPointer nodeList (m_state.GetNodes()); - if (m_hoverIndex < nodeList->GetCount()) - hoverNode = nodeList->GetNode (m_hoverIndex).node->GetBase(); - } - - bool onHoverNodeGlyph = (hoverNode != NULL) && (glyphNode == hoverNode); - if ( !onHoverNodeGlyph - && ( (m_hoverIndex != GetHitNode (clientPoint)) - || (m_hoverGlyphs != GetHoverGlyphs (clientPoint)))) - { - m_showHoverGlyphs = false; - - KillTimer (GLYPH_HOVER_EVENT); - SetTimer (GLYPH_HOVER_EVENT, GLYPH_HOVER_DELAY, NULL); - - Invalidate(FALSE); - } - - return __super::OnMouseMove(nFlags, point); - } - } - - if ((abs(m_ptRubberStart.x - point.x) < 2)&&(abs(m_ptRubberStart.y - point.y) < 2)) - { - return __super::OnMouseMove(nFlags, point); - } - - SetCapture(); - - if ((m_ptRubberEnd.x != 0)||(m_ptRubberEnd.y != 0)) - DrawRubberBand(); - m_ptRubberEnd = point; - CRect rect = GetClientRect(); - m_ptRubberEnd.x = max(m_ptRubberEnd.x, rect.left); - m_ptRubberEnd.x = min(m_ptRubberEnd.x, rect.right); - m_ptRubberEnd.y = max(m_ptRubberEnd.y, rect.top); - m_ptRubberEnd.y = min(m_ptRubberEnd.y, rect.bottom); - DrawRubberBand(); - - __super::OnMouseMove(nFlags, point); -} - -BOOL CRevisionGraphWnd::OnSetCursor(CWnd* pWnd, UINT nHitTest, UINT message) -{ - CRect viewRect = GetViewRect(); - - LPTSTR cursorID = IDC_ARROW; - HINSTANCE resourceHandle = NULL; - - if ((nHitTest == HTCLIENT)&&(pWnd == this)&&(viewRect.Width())&&(viewRect.Height())&&(message)) - { - POINT pt; - if (GetCursorPos(&pt)) - { - ScreenToClient(&pt); - if (m_OverviewPosRect.PtInRect(pt)) - { - resourceHandle = AfxGetResourceHandle(); - cursorID = GetKeyState(VK_LBUTTON) & 0x8000 - ? MAKEINTRESOURCE(IDC_PANCURDOWN) - : MAKEINTRESOURCE(IDC_PANCUR); - } - } - } - - HCURSOR hCur = LoadCursor(resourceHandle, MAKEINTRESOURCE(cursorID)); - if (GetCursor() != hCur) - SetCursor (hCur); - - return TRUE; -} - -void CRevisionGraphWnd::OnTimer (UINT_PTR nIDEvent) -{ - if (nIDEvent == GLYPH_HOVER_EVENT) - { - KillTimer (GLYPH_HOVER_EVENT); - - m_showHoverGlyphs = true; - Invalidate (FALSE); - } - else - { - __super::OnTimer (nIDEvent); - } -} - -LRESULT CRevisionGraphWnd::OnWorkerThreadDone(WPARAM, LPARAM) -{ - InitView(); - BuildPreview(); - Invalidate(FALSE); - - SVN svn; - LogCache::CRepositoryInfo& cachedProperties - = svn.GetLogCachePool()->GetRepositoryInfo(); - - CSyncPointer fullHistoy (m_state.GetFullHistory()); - if (fullHistoy.get() != NULL) - { - SetDlgTitle (cachedProperties.IsOffline - ( fullHistoy->GetRepositoryUUID() - , fullHistoy->GetRepositoryRoot() - , false)); - } - - return 0; -} - -void CRevisionGraphWnd::SetDlgTitle (bool offline) -{ - if (m_sTitle.IsEmpty()) - GetParent()->GetWindowText(m_sTitle); - - CString newTitle; - if (offline) - newTitle.Format (IDS_REVGRAPH_DLGTITLEOFFLINE, (LPCTSTR)m_sTitle); - else - newTitle = m_sTitle; - - GetParent()->SetWindowText (newTitle); -} - diff --git a/src/TortoiseProc/TortoiseProc.vcproj b/src/TortoiseProc/TortoiseProc.vcproj index dd64d2bb3..a1f5a0710 100644 --- a/src/TortoiseProc/TortoiseProc.vcproj +++ b/src/TortoiseProc/TortoiseProc.vcproj @@ -814,10 +814,6 @@ > - - diff --git a/src/TortoiseProc/resource.h b/src/TortoiseProc/resource.h index 12cada7ba..e91cf824c 100644 --- a/src/TortoiseProc/resource.h +++ b/src/TortoiseProc/resource.h @@ -30,7 +30,6 @@ #define IDR_MOVEANI 149 #define IDD_RENAME 151 #define IDD_UPDATE 152 -#define IDD_REPOSITORY_BROWSER 153 #define IDD_ADD 155 #define IDD_RELOCATE 157 #define IDD_CHANGEDFILES 158 @@ -122,7 +121,6 @@ #define IDC_PANCUR 250 #define IDC_PANCURDOWN 251 #define IDI_TORTOISEBLAME 252 -#define IDR_ACC_REPOBROWSER 253 #define IDR_ACC_LOGDLG 254 #define IDI_ADD_BKG 255 #define IDI_RESOLVE_BKG 256 @@ -312,7 +310,6 @@ #define IDC_SSHCLIENT 1068 #define IDC_INCLUDE_IGNORED 1068 #define IDC_SSHBROWSE 1069 -#define IDC_REPOS_BAR_CNR 1070 #define IDC_DEFAULTLOG 1071 #define IDC_RELATIVETIMES 1072 #define IDC_DONTCONVERT 1073 @@ -382,7 +379,6 @@ #define IDC_LOG_FIRSTPARENT 1126 #define IDC_IGNOREEOL 1126 #define IDC_SORTBYCOMMITCOUNT 1126 -#define IDC_F5HINT 1127 #define IDC_IGNOREEOL2 1127 #define IDC_DIFFBYDOUBLECLICK 1127 #define IDC_CHECK_STOPONCOPY 1130 @@ -466,8 +462,6 @@ #define IDC_COPYREV 1185 #define IDC_COPYREVTEXT 1186 #define IDC_BROWSEFROM 1187 -#define IDS_REPO_BROWSEREV 1190 -#define IDS_REPO_BROWSEURL 1191 #define IDC_SPLITTERTOP 1191 #define IDC_SPLITTERBOTTOM 1192 #define IDC_SEARCHEDIT 1194 @@ -732,9 +726,7 @@ #define IDC_HOOKCOPYBUTTON 1367 #define IDC_INFOLABEL 1368 #define IDC_UNLOCKLIST 1369 -#define IDC_REPOTREE 1371 #define IDC_LIST1 1372 -#define IDC_REPOLIST 1372 #define IDC_REPOSITORYLIST 1372 #define IDC_BUGTRAQLIST 1372 #define IDC_LIST_PATCH 1372 @@ -1106,32 +1098,19 @@ #define IDC_BUGTRAQ_APPEND_TRUE 1601 #define IDS_REPOBROWSE_OPEN 1602 #define IDC_CHECK_REBASE 1602 -#define IDS_REPOBROWSE_COPY 1603 #define IDC_CLONE_GROUP_SVN 1603 #define IDC_CHECK_PRUNE 1603 -#define IDS_REPOBROWSE_DELETE 1604 #define IDC_CHECK_SVN 1604 -#define IDS_REPOBROWSE_IMPORT 1605 #define IDC_CHECK_SVN_TRUNK 1605 -#define IDS_REPOBROWSE_RENAME 1606 #define IDC_EDIT_SVN_TRUNK 1606 -#define IDS_REPOBROWSE_MKDIR 1607 #define IDC_REBASE_CHECK_FORCE 1607 #define IDC_EDIT_DEPTH 1607 -#define IDS_REPOBROWSE_IMPORTFOLDER 1608 #define IDC_CHECK_SVN_FROM 1608 -#define IDS_REPOBROWSE_REFRESH 1609 -#define IDS_REPOBROWSE_SHOWPROP 1610 #define IDC_COMBOBOXEX_URL 1610 -#define IDS_REPOBROWSE_COPYTOWC 1611 #define IDC_BUTTON_PULL 1611 -#define IDS_REPOBROWSE_URLTOCLIPBOARD 1612 #define IDC_BUTTON_PUSH 1612 -#define IDS_REPOBROWSE_COPYERROR 1613 #define IDC_BUTTON_APPLY 1613 -#define IDS_REPOBROWSE_SHOWDIFF 1614 #define IDC_BUTTON_EMAIL 1614 -#define IDS_REPOBROWSE_PREPAREDIFF 1615 #define IDC_STATIC_LOCAL_BRANCH 1616 #define IDC_STATIC_REMOTE_BRANCH 1617 #define IDC_STATIC_REMOTE_URL 1618 @@ -1145,9 +1124,7 @@ #define IDC_RADIO_CLEAN_ALL 1627 #define IDC_RADIO_CLEAN_NO 1628 #define IDC_RADIO_CLEAN_IGNORE 1629 -#define IDS_REPOBROWSE_URLALREADYEXISTS 1630 #define IDC_GROUP_CLEAN_TYPE 1630 -#define IDS_REPOBROWSE_INVALIDDROPDATA 1631 #define IDC_CHECK_AUTOCRLF 1631 #define IDC_CHECK_SAFECRLF 1632 #define IDC_CHECK4 1634 @@ -1156,25 +1133,15 @@ #define IDC_PATCH 1636 #define IDC_VIEW_PATCH 1637 #define IDC_BUTTON_SUBMODULE 1639 -#define IDS_REPOBROWSE_SAVEASPROGTITLE 1640 #define IDC_RADIO_EXCLUDE 1640 -#define IDS_REPOBROWSE_SAVEAS_LINE1 1641 #define IDC_RADIO_GITIGNORE 1641 -#define IDS_REPOBROWSE_SAVEAS_LINE2 1642 #define IDC_GROUP_TYPE 1642 -#define IDS_REPOBROWSE_COPYTOWCPROGTITLE 1643 #define IDC_REV1EDIT 1643 -#define IDS_REPOBROWSE_COPYTOWC_LINE1 1644 #define IDC_REV1GROUP 1644 -#define IDS_REPOBROWSE_COPYTOWC_LINE2 1645 #define IDC_REV2GROUP 1645 -#define IDS_REPOBROWSE_COPYDROP 1646 #define IDC_CHECK_DEPTH 1646 -#define IDS_REPOBROWSE_MOVEDROP 1647 #define IDC_EDIT_MESSAGE 1647 -#define IDS_REPOBROWSE_COPYRENAMEDROP 1648 #define IDC_GROUP_MESSAGE 1648 -#define IDS_REPOBROWSE_MOVERENAMEDROP 1649 #define IDC_STATIC_REMINDER 1649 #define IDC_CHECK_USERNAME 1650 #define IDC_EDIT_USERNAME 1651 @@ -1187,23 +1154,15 @@ #define IDC_CHECK_IGNORE_SPACE 1657 #define IDC_AM_SPLIT 1658 #define IDC_AM_DUMY_TAB 1659 -#define IDS_REPOBROWSE_INITWAIT 1660 #define IDC_REMEMBER 1660 #define IDC_HIDEMENUS 1660 -#define IDS_REPOBROWSE_WAIT 1661 #define IDC_ALTERNATIVEEDITOR_OFF 1661 #define IDC_ALTERNATIVEEDITOR_ON 1662 #define IDC_ALTERNATIVEEDITOR 1663 #define IDC_ALTERNATIVEEDITORBROWSE 1664 #define IDC_NOAUTOSELECTSUBMODULES 1669 -#define IDS_REPOBROWSE_MULTIIMPORT 1670 #define IDC_COMMIT_DATEPICKER 1670 -#define IDS_REPOBROWSE_MULTICOPY 1671 #define IDC_COMMIT_TIMEPICKER 1671 -#define IDS_REPOBROWSE_MULTIMOVE 1672 -#define IDS_REPOBROWSE_MOVETRUNK 1673 -#define IDS_REPOBROWSE_TT_HEADREV 1680 -#define IDS_REPOBROWSE_TT_UPFOLDER 1681 #define IDS_ABOUTVERSION 1700 #define IDS_ABOUTVERSIONBOX 1701 #define IDS_DLGTITLE_ADD_DIFF_TOOL 1750 @@ -1283,7 +1242,6 @@ #define IDC_RADIO_SVN_COMMIT 2152 #define IDC_RADIO_GIT_COMMIT 2153 #define IDS_LOG_COMPAREWITHBASE 2200 -#define IDS_LOG_BROWSEREPO 2201 #define IDS_PROC_ENTERURLLABEL 2300 #define IDS_PROC_PATCHTITLE 2301 #define IDS_PROC_SAVEPATCHTO 2302 @@ -1870,9 +1828,7 @@ #define ID_VIEW_TOPDOWN 32814 #define ID_URL_FOCUS 32814 #define ID_VIEW_SHOWHEAD 32815 -#define ID_REFRESHBROWSER 32815 #define ID_VIEW_EXACTCOPYSOURCE 32816 -#define ID_INLINEEDIT 32816 #define ID_VIEW_FOLDTAGS 32818 #define ID_VIEW_REDUCECROSSLINES 32819 #define ID_VIEW_REMOVEDELETEDONES 32820 @@ -1880,8 +1836,6 @@ #define ID_LOGDLG_FIND 32822 #define ID_LOGDLG_FOCUSFILTER 32825 #define ID_VIEW_SHOWWCREV 32826 -#define ID_DELETEBROWSERITEM 32829 -#define ID_URL_UP 32835 #define ID_FOCUS_MESSAGE 32837 // Next default values for new objects diff --git a/src/TortoiseShell/resource.h b/src/TortoiseShell/resource.h index 5f300f112..c5cacb1ca 100644 --- a/src/TortoiseShell/resource.h +++ b/src/TortoiseShell/resource.h @@ -108,8 +108,6 @@ #define IDS_DROPCOPYMENU 198 #define IDS_PROPWAITCANCEL 199 #define IDS_SETPROPTITLE 200 -#define IDS_MENUREPOBROWSE 201 -#define IDS_MENUDESCREPOBROWSE 202 #define IDS_MENUBLAME 203 #define IDS_STATUSEXTERNAL 204 #define IDS_MENUDESCBLAME 205 diff --git a/src/TortoiseShell/resourceshell.rc b/src/TortoiseShell/resourceshell.rc index 716911b82..79ddffebd 100644 --- a/src/TortoiseShell/resourceshell.rc +++ b/src/TortoiseShell/resourceshell.rc @@ -304,8 +304,6 @@ BEGIN IDS_DROPCOPYMENU "Git Copy versioned item(s) here" IDS_PROPWAITCANCEL "Please wait while cancelling..." IDS_SETPROPTITLE "Setting properties..." - IDS_MENUREPOBROWSE "&Repo-browser" - IDS_MENUDESCREPOBROWSE "Opens the repository browser to tweak the repository online" IDS_MENUBLAME "&Blame" IDS_STATUSEXTERNAL "external" IDS_MENUDESCBLAME "Blames each line of a file on an author" -- 2.11.4.GIT