From e793eba69bc31050e918d4e79ea7c88f6bd0fdbc Mon Sep 17 00:00:00 2001 From: Frank Li Date: Fri, 16 Jan 2009 19:40:06 +0800 Subject: [PATCH] Add Command Line Argument to select blame version. Copy Selection version to clipboard okay Signed-off-by: Frank Li --- src/TortoiseGitBlame/TortoiseGitBlame.cpp | 2 +- src/TortoiseGitBlame/TortoiseGitBlame.h | 1 + src/TortoiseGitBlame/TortoiseGitBlame.vcproj | 28 ++++++++-------- .../TortoiseGitBlame.vcproj.FSL.B20596.user | 2 +- src/TortoiseGitBlame/TortoiseGitBlameDoc.cpp | 13 ++++++-- src/TortoiseGitBlame/TortoiseGitBlameView.cpp | 38 ++-------------------- 6 files changed, 30 insertions(+), 54 deletions(-) diff --git a/src/TortoiseGitBlame/TortoiseGitBlame.cpp b/src/TortoiseGitBlame/TortoiseGitBlame.cpp index e26dbd990..79adf9802 100644 --- a/src/TortoiseGitBlame/TortoiseGitBlame.cpp +++ b/src/TortoiseGitBlame/TortoiseGitBlame.cpp @@ -9,6 +9,7 @@ #include "TortoiseGitBlameDoc.h" #include "TortoiseGitBlameView.h" +#include "CmdLineParser.h" #ifdef _DEBUG #define new DEBUG_NEW @@ -106,7 +107,6 @@ BOOL CTortoiseGitBlameApp::InitInstance() CCommandLineInfo cmdInfo; ParseCommandLine(cmdInfo); - // Dispatch commands specified on the command line. Will return FALSE if // app was launched with /RegServer, /Register, /Unregserver or /Unregister. if (!ProcessShellCommand(cmdInfo)) diff --git a/src/TortoiseGitBlame/TortoiseGitBlame.h b/src/TortoiseGitBlame/TortoiseGitBlame.h index 3b0d00d05..004fcb2f3 100644 --- a/src/TortoiseGitBlame/TortoiseGitBlame.h +++ b/src/TortoiseGitBlame/TortoiseGitBlame.h @@ -32,6 +32,7 @@ public: virtual void LoadCustomState(); virtual void SaveCustomState(); + CString m_Rev; afx_msg void OnAppAbout(); DECLARE_MESSAGE_MAP() }; diff --git a/src/TortoiseGitBlame/TortoiseGitBlame.vcproj b/src/TortoiseGitBlame/TortoiseGitBlame.vcproj index 075564aec..8e8c0f9a8 100644 --- a/src/TortoiseGitBlame/TortoiseGitBlame.vcproj +++ b/src/TortoiseGitBlame/TortoiseGitBlame.vcproj @@ -339,19 +339,19 @@ > m_lpCmdLine); + if(parser.HasVal(_T("rev"))) + { + m_Rev=parser.GetVal(_T("rev")); + }else + { + m_Rev.Empty(); + } + + return OnOpenDocument(lpszPathName,m_Rev); } BOOL CTortoiseGitBlameDoc::OnOpenDocument(LPCTSTR lpszPathName,CString Rev) @@ -59,7 +69,6 @@ BOOL CTortoiseGitBlameDoc::OnOpenDocument(LPCTSTR lpszPathName,CString Rev) return FALSE; m_CurrentFileName=lpszPathName; - m_Rev=Rev; // TODO: add reinitialization code here diff --git a/src/TortoiseGitBlame/TortoiseGitBlameView.cpp b/src/TortoiseGitBlame/TortoiseGitBlameView.cpp index c5a679634..4653405a8 100644 --- a/src/TortoiseGitBlame/TortoiseGitBlameView.cpp +++ b/src/TortoiseGitBlame/TortoiseGitBlameView.cpp @@ -45,6 +45,7 @@ BEGIN_MESSAGE_MAP(CTortoiseGitBlameView, CView) ON_COMMAND(ID_FILE_PRINT_PREVIEW, &CTortoiseGitBlameView::OnFilePrintPreview) ON_COMMAND(ID_EDIT_FIND,OnEditFind) ON_COMMAND(ID_EDIT_GOTO,OnEditGoto) + ON_COMMAND(ID_EDIT_COPY,CopySelectedLogToClipboard) ON_WM_CREATE() ON_WM_SIZE() ON_WM_MOUSEMOVE() @@ -733,33 +734,7 @@ bool CTortoiseGitBlameView::ScrollToLine(long line) void CTortoiseGitBlameView::CopySelectedLogToClipboard() { -#if 0 - if (m_selectedrev <= 0) - return; - std::map::iterator iter; - if ((iter = app.logmessages.find(m_selectedrev)) != app.logmessages.end()) - { - CString msg; - msg += m_selectedauthor; - msg += " "; - msg += app.m_selecteddate; - msg += '\n'; - msg += iter->second; - msg += _T("\n"); - if (OpenClipboard(app.wBlame)) - { - EmptyClipboard(); - HGLOBAL hClipboardData; - hClipboardData = GlobalAlloc(GMEM_DDESHARE, msg.size()+1); - char * pchData; - pchData = (char*)GlobalLock(hClipboardData); - strcpy_s(pchData, msg.size()+1, msg.c_str()); - GlobalUnlock(hClipboardData); - SetClipboardData(CF_TEXT,hClipboardData); - CloseClipboard(); - } - } -#endif + this->GetLogList()->CopySelectionToClipBoard(FALSE); } void CTortoiseGitBlameView::BlamePreviousRevision() @@ -973,15 +948,6 @@ void CTortoiseGitBlameView::Command(int id) #endif } -void CTortoiseGitBlameView::GotoLineDlg() -{ -#if 0 - if (DialogBox(hResource, MAKEINTRESOURCE(IDD_GOTODLG), wMain, GotoDlgProc)==IDOK) - { - GotoLine(m_gotoline); - } -#endif -} LONG CTortoiseGitBlameView::GetBlameWidth() { -- 2.11.4.GIT