OSDN Git Service

Add Command Line Argument to select blame version.
authorFrank Li <lznuaa@gmail.com>
Fri, 16 Jan 2009 11:40:06 +0000 (19:40 +0800)
committerFrank Li <lznuaa@gmail.com>
Fri, 16 Jan 2009 11:40:06 +0000 (19:40 +0800)
Copy Selection version to clipboard okay

Signed-off-by: Frank Li <lznuaa@gmail.com>
src/TortoiseGitBlame/TortoiseGitBlame.cpp
src/TortoiseGitBlame/TortoiseGitBlame.h
src/TortoiseGitBlame/TortoiseGitBlame.vcproj
src/TortoiseGitBlame/TortoiseGitBlame.vcproj.FSL.B20596.user
src/TortoiseGitBlame/TortoiseGitBlameDoc.cpp
src/TortoiseGitBlame/TortoiseGitBlameView.cpp

index e26dbd9..79adf98 100644 (file)
@@ -9,6 +9,7 @@
 \r
 #include "TortoiseGitBlameDoc.h"\r
 #include "TortoiseGitBlameView.h"\r
+#include "CmdLineParser.h"\r
 \r
 #ifdef _DEBUG\r
 #define new DEBUG_NEW\r
@@ -106,7 +107,6 @@ BOOL CTortoiseGitBlameApp::InitInstance()
        CCommandLineInfo cmdInfo;\r
        ParseCommandLine(cmdInfo);\r
 \r
-\r
        // Dispatch commands specified on the command line.  Will return FALSE if\r
        // app was launched with /RegServer, /Register, /Unregserver or /Unregister.\r
        if (!ProcessShellCommand(cmdInfo))\r
index 3b0d00d..004fcb2 100644 (file)
@@ -32,6 +32,7 @@ public:
        virtual void LoadCustomState();\r
        virtual void SaveCustomState();\r
 \r
+       CString m_Rev;\r
        afx_msg void OnAppAbout();\r
        DECLARE_MESSAGE_MAP()\r
 };\r
index 075564a..8e8c0f9 100644 (file)
                                >\r
                        </File>\r
                        <File\r
-                               RelativePath=".\res\output_wnd.ico"\r
+                               RelativePath="..\Resources\blameres\output_wnd.ico"\r
                                >\r
                        </File>\r
                        <File\r
-                               RelativePath="..\Resources\blameres\output_wnd.ico"\r
+                               RelativePath=".\res\output_wnd.ico"\r
                                >\r
                        </File>\r
                        <File\r
-                               RelativePath=".\res\output_wnd_hc.ico"\r
+                               RelativePath="..\Resources\blameres\output_wnd_hc.ico"\r
                                >\r
                        </File>\r
                        <File\r
-                               RelativePath="..\Resources\blameres\output_wnd_hc.ico"\r
+                               RelativePath=".\res\output_wnd_hc.ico"\r
                                >\r
                        </File>\r
                        <File\r
                                >\r
                        </File>\r
                        <File\r
-                               RelativePath="..\Resources\blameres\properties_hc.bmp"\r
+                               RelativePath=".\res\properties_hc.bmp"\r
                                >\r
                        </File>\r
                        <File\r
-                               RelativePath=".\res\properties_hc.bmp"\r
+                               RelativePath="..\Resources\blameres\properties_hc.bmp"\r
                                >\r
                        </File>\r
                        <File\r
-                               RelativePath="..\Resources\blameres\properties_wnd.ico"\r
+                               RelativePath=".\res\properties_wnd.ico"\r
                                >\r
                        </File>\r
                        <File\r
-                               RelativePath=".\res\properties_wnd.ico"\r
+                               RelativePath="..\Resources\blameres\properties_wnd.ico"\r
                                >\r
                        </File>\r
                        <File\r
                                >\r
                        </File>\r
                        <File\r
-                               RelativePath="..\Resources\blameres\Toolbar.bmp"\r
+                               RelativePath=".\res\Toolbar.bmp"\r
                                >\r
                        </File>\r
                        <File\r
-                               RelativePath=".\res\Toolbar.bmp"\r
+                               RelativePath="..\Resources\blameres\Toolbar.bmp"\r
                                >\r
                        </File>\r
                        <File\r
-                               RelativePath="..\Resources\blameres\Toolbar256.bmp"\r
+                               RelativePath=".\res\Toolbar256.bmp"\r
                                >\r
                        </File>\r
                        <File\r
-                               RelativePath=".\res\Toolbar256.bmp"\r
+                               RelativePath="..\Resources\blameres\Toolbar256.bmp"\r
                                >\r
                        </File>\r
                        <File\r
                                </FileConfiguration>\r
                        </File>\r
                        <File\r
-                               RelativePath="..\Resources\blameres\TortoiseGitBlameDoc.ico"\r
+                               RelativePath=".\res\TortoiseGitBlameDoc.ico"\r
                                >\r
                        </File>\r
                        <File\r
-                               RelativePath=".\res\TortoiseGitBlameDoc.ico"\r
+                               RelativePath="..\Resources\blameres\TortoiseGitBlameDoc.ico"\r
                                >\r
                        </File>\r
                        <File\r
index e7e7f7d..d149873 100644 (file)
@@ -11,7 +11,7 @@
                        <DebugSettings\r
                                Command="$(TargetPath)"\r
                                WorkingDirectory=""\r
-                               CommandArguments="D:\Profiles\b20596\git\alloc.c"\r
+                               CommandArguments="D:\Profiles\b20596\git\alloc.c /rev:2c1cbe"\r
                                Attach="false"\r
                                DebuggerType="3"\r
                                Remote="1"\r
index 32a9a63..6811a8c 100644 (file)
@@ -12,6 +12,7 @@
 #include "MainFrm.h"\r
 #include "TGitPath.h"\r
 #include "TortoiseGitBlameView.h"\r
+#include "CmdLineParser.h"\r
 \r
 #ifdef _DEBUG\r
 #define new DEBUG_NEW\r
@@ -50,7 +51,16 @@ BOOL CTortoiseGitBlameDoc::OnNewDocument()
 }\r
 BOOL CTortoiseGitBlameDoc::OnOpenDocument(LPCTSTR lpszPathName)\r
 {\r
-       return OnOpenDocument(lpszPathName,_T(""));\r
+       CCmdLineParser parser(AfxGetApp()->m_lpCmdLine);\r
+       if(parser.HasVal(_T("rev")))\r
+       {\r
+               m_Rev=parser.GetVal(_T("rev"));\r
+       }else\r
+       {\r
+               m_Rev.Empty();\r
+       }\r
+\r
+       return OnOpenDocument(lpszPathName,m_Rev);\r
 }\r
 \r
 BOOL CTortoiseGitBlameDoc::OnOpenDocument(LPCTSTR lpszPathName,CString Rev)\r
@@ -59,7 +69,6 @@ BOOL CTortoiseGitBlameDoc::OnOpenDocument(LPCTSTR lpszPathName,CString Rev)
                return FALSE;\r
 \r
        m_CurrentFileName=lpszPathName;\r
-\r
        m_Rev=Rev;\r
 \r
        // TODO: add reinitialization code here\r
index c5a6796..4653405 100644 (file)
@@ -45,6 +45,7 @@ BEGIN_MESSAGE_MAP(CTortoiseGitBlameView, CView)
        ON_COMMAND(ID_FILE_PRINT_PREVIEW, &CTortoiseGitBlameView::OnFilePrintPreview)\r
        ON_COMMAND(ID_EDIT_FIND,OnEditFind)\r
        ON_COMMAND(ID_EDIT_GOTO,OnEditGoto)\r
+       ON_COMMAND(ID_EDIT_COPY,CopySelectedLogToClipboard)\r
        ON_WM_CREATE()\r
        ON_WM_SIZE()\r
        ON_WM_MOUSEMOVE()\r
@@ -733,33 +734,7 @@ bool CTortoiseGitBlameView::ScrollToLine(long line)
 \r
 void CTortoiseGitBlameView::CopySelectedLogToClipboard()\r
 {\r
-#if 0\r
-       if (m_selectedrev <= 0)\r
-               return;\r
-       std::map<LONG, CString>::iterator iter;\r
-       if ((iter = app.logmessages.find(m_selectedrev)) != app.logmessages.end())\r
-       {\r
-               CString msg;\r
-               msg += m_selectedauthor;\r
-               msg += "  ";\r
-               msg += app.m_selecteddate;\r
-               msg += '\n';\r
-               msg += iter->second;\r
-               msg += _T("\n");\r
-               if (OpenClipboard(app.wBlame))\r
-               {\r
-                       EmptyClipboard();\r
-                       HGLOBAL hClipboardData;\r
-                       hClipboardData = GlobalAlloc(GMEM_DDESHARE, msg.size()+1);\r
-                       char * pchData;\r
-                       pchData = (char*)GlobalLock(hClipboardData);\r
-                       strcpy_s(pchData, msg.size()+1, msg.c_str());\r
-                       GlobalUnlock(hClipboardData);\r
-                       SetClipboardData(CF_TEXT,hClipboardData);\r
-                       CloseClipboard();\r
-               }\r
-       }\r
-#endif\r
+       this->GetLogList()->CopySelectionToClipBoard(FALSE);\r
 }\r
 \r
 void CTortoiseGitBlameView::BlamePreviousRevision()\r
@@ -973,15 +948,6 @@ void CTortoiseGitBlameView::Command(int id)
 #endif\r
 }\r
 \r
-void CTortoiseGitBlameView::GotoLineDlg()\r
-{\r
-#if 0\r
-       if (DialogBox(hResource, MAKEINTRESOURCE(IDD_GOTODLG), wMain, GotoDlgProc)==IDOK)\r
-       {\r
-               GotoLine(m_gotoline);\r
-       }\r
-#endif\r
-}\r
 \r
 LONG CTortoiseGitBlameView::GetBlameWidth()\r
 {\r