OSDN Git Service

Git Blame Status Show at Properties Bar.
authorFrank Li <lznuaa@gmail.com>
Mon, 12 Jan 2009 15:49:45 +0000 (23:49 +0800)
committerFrank Li <lznuaa@gmail.com>
Mon, 12 Jan 2009 15:49:45 +0000 (23:49 +0800)
Signed-off-by: Frank Li <lznuaa@gmail.com>
src/Resources/TortoiseGitBlame.rc
src/TortoiseGitBlame/MainFrm.h
src/TortoiseGitBlame/PropertiesWnd.cpp
src/TortoiseGitBlame/PropertiesWnd.h
src/TortoiseGitBlame/TortoiseGitBlameView.cpp

index 1c5fdb3..7f43f89 100644 (file)
@@ -431,11 +431,11 @@ BEGIN
        IDS_STATUS_PANE2        "Pane 2"\r
        IDS_TOOLBAR_STANDARD    "Standard"\r
        IDS_TOOLBAR_CUSTOMIZE   "Customize..."\r
-       IDS_OUTPUT_WND          "Output"\r
+       IDS_OUTPUT_WND          "Git Revision List"\r
        IDS_BUILD_TAB           "Build"\r
        IDS_DEBUG_TAB           "Debug"\r
        IDS_FIND_TAB            "Find"\r
-       IDS_PROPERTIES_WND      "Properties"\r
+       IDS_PROPERTIES_WND      "Commit Info"\r
        IDS_EDIT_MENU           "Edit"\r
 END\r
 \r
index 36f6a27..ff50500 100644 (file)
@@ -33,14 +33,14 @@ public:
 #endif\r
 \r
        COutputWnd        m_wndOutput;\r
-\r
+       CPropertiesWnd    m_wndProperties;\r
 protected:  // control bar embedded members\r
        CMFCMenuBar       m_wndMenuBar;\r
        CMFCToolBar       m_wndToolBar;\r
        CMFCStatusBar     m_wndStatusBar;\r
        CMFCToolBarImages m_UserImages;\r
        \r
-       CPropertiesWnd    m_wndProperties;\r
+\r
 \r
 // Generated message map functions\r
 protected:\r
index 595ad6a..cb56cc4 100644 (file)
@@ -160,22 +160,91 @@ void CPropertiesWnd::InitPropList()
        m_wndPropList.EnableDescriptionArea();\r
        m_wndPropList.SetVSDotNetLook();\r
        m_wndPropList.MarkModifiedProperties();\r
+       \r
+       CMFCPropertyGridProperty* pGroup1 = new CMFCPropertyGridProperty(_T("Basic Info"));\r
+\r
+       \r
+       m_CommitHash = new CMFCPropertyGridProperty(\r
+                               _T("Commit Hash"), \r
+                               _T(""),\r
+                               _T("Commit Hash")\r
+                               );\r
+       pGroup1->AddSubItem(m_CommitHash);\r
+\r
+       m_AuthorName = new CMFCPropertyGridProperty(\r
+                               _T("Author"), \r
+                               _T(""),\r
+                               _T("Author")\r
+                               );\r
+       pGroup1->AddSubItem(m_AuthorName);\r
+\r
+       m_AuthorDate = new CMFCPropertyGridProperty(\r
+                               _T("Author Date"), \r
+                               _T(""),\r
+                               _T("Author Date")\r
+                               );\r
+       pGroup1->AddSubItem(m_AuthorDate);\r
+\r
+       m_AuthorEmail= new CMFCPropertyGridProperty(\r
+                               _T("Author Email"), \r
+                               _T(""),\r
+                               _T("Author Email")\r
+                               );\r
+       pGroup1->AddSubItem(m_AuthorEmail);\r
+\r
+       m_CommitterName = new CMFCPropertyGridProperty(\r
+                               _T("Committer Name"), \r
+                               _T(""),\r
+                               _T("Committer Name")\r
+                               );\r
+       pGroup1->AddSubItem(m_CommitterName);\r
+\r
+       m_CommitterEmail =new CMFCPropertyGridProperty(\r
+                               _T("Committer Email"), \r
+                               _T(""),\r
+                               _T("Committer Email")\r
+                               );\r
+       pGroup1->AddSubItem(m_CommitterEmail);\r
+\r
+       m_CommitterDate = new CMFCPropertyGridProperty(\r
+                               _T("Committer Date"), \r
+                               _T(""),\r
+                               _T("Committer Date")\r
+                               );;\r
+       pGroup1->AddSubItem(m_CommitterDate);\r
+\r
+       m_Subject = new CMFCPropertyGridProperty(\r
+                               _T("Subject"), \r
+                               _T(""),\r
+                               _T("Subject")\r
+                               );;;\r
+       pGroup1->AddSubItem(m_Subject);\r
+\r
+       m_Body = new CMFCPropertyGridProperty(\r
+                               _T("Body"), \r
+                               _T(""),\r
+                               _T("Body")\r
+                               );;;;\r
+       pGroup1->AddSubItem(m_Body);\r
+\r
+       for(int i=0;i<pGroup1->GetSubItemsCount();i++)\r
+       {\r
+               pGroup1->GetSubItem(i)->AllowEdit(FALSE);\r
+       }\r
 \r
-       CMFCPropertyGridProperty* pGroup1 = new CMFCPropertyGridProperty(_T("Appearance"));\r
+       //std::vector<CMFCPropertyGridProperty*> m_ParentHash;\r
+       //std::vector<CMFCPropertyGridProperty*> m_ParentSubject;\r
 \r
-       pGroup1->AddSubItem(new CMFCPropertyGridProperty(_T("3D Look"), (_variant_t) false, _T("Specifies the window's font will be non-bold and controls will have a 3D border")));\r
+       m_wndPropList.AddProperty(pGroup1);\r
+       m_BaseInfoGroup=pGroup1;\r
 \r
-       CMFCPropertyGridProperty* pProp = new CMFCPropertyGridProperty(_T("Border"), _T("Dialog Frame"), _T("One of: None, Thin, Resizable, or Dialog Frame"));\r
-       pProp->AddOption(_T("None"));\r
-       pProp->AddOption(_T("Thin"));\r
-       pProp->AddOption(_T("Resizable"));\r
-       pProp->AddOption(_T("Dialog Frame"));\r
-       pProp->AllowEdit(FALSE);\r
+       m_ParentGroup=new CMFCPropertyGridProperty(_T("Parent"));\r
 \r
-       pGroup1->AddSubItem(pProp);\r
+       m_wndPropList.AddProperty(m_ParentGroup);\r
+#if 0\r
        pGroup1->AddSubItem(new CMFCPropertyGridProperty(_T("Caption"), (_variant_t) _T("About"), _T("Specifies the text that will be displayed in the window's title bar")));\r
 \r
-       m_wndPropList.AddProperty(pGroup1);\r
+       \r
 \r
        CMFCPropertyGridProperty* pSize = new CMFCPropertyGridProperty(_T("Window Size"), 0, TRUE);\r
 \r
@@ -233,6 +302,7 @@ void CPropertiesWnd::InitPropList()
 \r
        pGroup4->Expand(FALSE);\r
        m_wndPropList.AddProperty(pGroup4);\r
+#endif\r
 }\r
 \r
 void CPropertiesWnd::OnSetFocus(CWnd* pOldWnd)\r
@@ -267,3 +337,80 @@ void CPropertiesWnd::SetPropListFont()
 \r
        m_wndPropList.SetFont(&m_fntPropList);\r
 }\r
+void CPropertiesWnd::RemoveParent()\r
+{\r
+       for(int i=0;i<m_ParentGroup->GetSubItemsCount();i++)\r
+       {\r
+               CMFCPropertyGridProperty * p=m_ParentGroup->GetSubItem(0);\r
+               m_ParentGroup->RemoveSubItem(p);\r
+       }\r
+       \r
+}\r
+void CPropertiesWnd::UpdateProperties(GitRev *rev)\r
+{\r
+       if(rev)\r
+       {\r
+               m_CommitHash->SetValue(rev->m_CommitHash);\r
+               m_AuthorName->SetValue(rev->m_AuthorName);\r
+               m_AuthorDate->SetValue(rev->m_AuthorDate.Format(_T("%Y-%m-%d %H:%M")));\r
+               m_AuthorEmail->SetValue(rev->m_AuthorEmail);    \r
+\r
+               m_CommitterName->SetValue(rev->m_CommitterName);\r
+               m_CommitterEmail->SetValue(rev->m_CommitterEmail);\r
+               m_CommitterDate->SetValue(rev->m_CommitterDate.Format(_T("%Y-%m-%d %H:%M")));\r
+\r
+               m_Subject->SetValue(rev->m_Subject);\r
+               m_Body->SetValue(rev->m_Body);\r
+\r
+               RemoveParent();\r
+\r
+               m_ParentGroup;\r
+       \r
+               CLogDataVector          *pLogEntry = &((CMainFrame*)AfxGetApp()->GetMainWnd())->m_wndOutput.m_LogList.m_logEntries;\r
+\r
+               for(int i=0;i<rev->m_ParentHash.size();i++)\r
+               {\r
+                       CString str;\r
+                       CString parentsubject;\r
+                       int index=pLogEntry->m_HashMap[rev->m_ParentHash[i]];\r
+                       if(index>=0)\r
+                               parentsubject=pLogEntry->at(index).m_Subject;\r
+\r
+                       str.Format(_T("%d - %s \n %s"),i,rev->m_ParentHash[i],parentsubject);\r
+                       \r
+                       CMFCPropertyGridProperty*p=new CMFCPropertyGridProperty(\r
+                                                                                       rev->m_ParentHash[i].Left(8), \r
+                                                                                               parentsubject,\r
+                                                                                               str\r
+                                                                                       );\r
+                       m_ParentGroup->AddSubItem(p);\r
+                       m_ParentGroup->Expand();\r
+               }\r
+               for(int i=0;i<m_BaseInfoGroup->GetSubItemsCount();i++)\r
+                       m_BaseInfoGroup->GetSubItem(i)->SetDescription(m_BaseInfoGroup->GetSubItem(i)->GetValue());\r
+\r
+       }else\r
+       {\r
+               m_CommitHash->SetValue(_T(""));\r
+               m_AuthorName->SetValue(_T(""));\r
+               m_AuthorDate->SetValue(_T(""));\r
+               m_AuthorEmail->SetValue(_T(""));\r
+\r
+               m_CommitterName->SetValue(_T(""));\r
+               m_CommitterEmail->SetValue(_T(""));\r
+               m_CommitterDate->SetValue(_T(""));\r
+\r
+               m_Subject->SetValue(_T(""));\r
+               m_Body->SetValue(_T(""));\r
+\r
+               RemoveParent();\r
+               //m_ParentGroup;\r
+\r
+               //m_ParentHash->SetValue(_T(""));\r
+               //m_ParentSubject->SetValue(_T(""));            \r
+               for(int i=0;i<m_BaseInfoGroup->GetSubItemsCount();i++)\r
+                       m_BaseInfoGroup->GetSubItem(i)->SetDescription(_T(""));\r
+       }\r
+       this->Invalidate();\r
+       m_wndPropList.Invalidate();\r
+}
\ No newline at end of file
index b081d33..2100862 100644 (file)
@@ -1,6 +1,8 @@
 \r
 #pragma once\r
 \r
+#include "GitRev.h"\r
+\r
 class CPropertiesToolBar : public CMFCToolBar\r
 {\r
 public:\r
@@ -28,12 +30,16 @@ public:
                m_wndPropList.SetGroupNameFullWidth(bSet);\r
        }\r
 \r
+       // rev=NULL, means clear properties info;\r
+       void UpdateProperties(GitRev *rev=NULL);\r
+\r
 protected:\r
        CFont m_fntPropList;\r
        CComboBox m_wndObjectCombo;\r
        CPropertiesToolBar m_wndToolBar;\r
        CMFCPropertyGridCtrl m_wndPropList;\r
 \r
+       void RemoveParent();\r
 // Implementation\r
 public:\r
        virtual ~CPropertiesWnd();\r
@@ -56,5 +62,24 @@ protected:
 \r
        void InitPropList();\r
        void SetPropListFont();\r
+\r
+       CMFCPropertyGridProperty* m_CommitHash;\r
+       CMFCPropertyGridProperty* m_AuthorName;\r
+       CMFCPropertyGridProperty* m_AuthorDate;\r
+       CMFCPropertyGridProperty* m_AuthorEmail;\r
+\r
+       CMFCPropertyGridProperty* m_CommitterName;\r
+       CMFCPropertyGridProperty* m_CommitterEmail;\r
+       CMFCPropertyGridProperty* m_CommitterDate;\r
+\r
+       CMFCPropertyGridProperty* m_Subject;\r
+       CMFCPropertyGridProperty* m_Body;\r
+\r
+       CMFCPropertyGridProperty* m_ParentGroup;\r
+       CMFCPropertyGridProperty* m_BaseInfoGroup;\r
+\r
+       std::vector<CMFCPropertyGridProperty*> m_ParentHash;\r
+       std::vector<CMFCPropertyGridProperty*> m_ParentSubject;\r
+\r
 };\r
 \r
index 728d3e4..319a4f7 100644 (file)
@@ -2519,6 +2519,10 @@ void CTortoiseGitBlameView::OnLButtonDown(UINT nFlags,CPoint point)
                        this->GetLogList()->SetItemState(this->GetLogList()->GetItemCount()-m_ID[line],\r
                                                                                                                        LVIS_SELECTED,\r
                                                                                                                        LVIS_SELECTED);\r
+\r
+                       GitRev *pRev;\r
+                       pRev=&this->GetLogData()->at(this->GetLogList()->GetItemCount()-m_ID[line]);\r
+                       this->GetDocument()->GetMainFrame()->m_wndProperties.UpdateProperties(pRev);\r
                }\r
                else\r
                {\r