X-Git-Url: http://git.sourceforge.jp/view?a=blobdiff_plain;f=src%2FTortoiseGitBlame%2FOutputWnd.cpp;h=9ae92c1b0afbe9cc6d06e7dfe857deea29c27bfe;hb=37cc0a5dac9c85bc5c55996c282678ed7947afd6;hp=fa17a70a05c1632ce4e4ea7d69dba19e04889e04;hpb=95c01687f8a0697b66bceab4e0e0bd3c69cb3a47;p=tortoisegit%2FTortoiseGitJp.git diff --git a/src/TortoiseGitBlame/OutputWnd.cpp b/src/TortoiseGitBlame/OutputWnd.cpp index fa17a70..9ae92c1 100644 --- a/src/TortoiseGitBlame/OutputWnd.cpp +++ b/src/TortoiseGitBlame/OutputWnd.cpp @@ -4,6 +4,8 @@ #include "OutputWnd.h" #include "Resource.h" #include "MainFrm.h" +#include "TortoiseGitBlameDoc.h" +#include "TortoiseGitBlameView.h" #ifdef _DEBUG #define new DEBUG_NEW @@ -22,9 +24,22 @@ COutputWnd::~COutputWnd() { } +IMPLEMENT_DYNCREATE(CGitMFCTabCtrl, CMFCTabCtrl) + +BEGIN_MESSAGE_MAP(CGitMFCTabCtrl, CMFCTabCtrl) + ON_NOTIFY(LVN_ITEMCHANGED, 0, OnLvnItemchangedLoglist) +END_MESSAGE_MAP() + +void CGitMFCTabCtrl::OnLvnItemchangedLoglist(NMHDR *pNMHDR, LRESULT *pResult) +{ + COutputWnd *pWnd=DYNAMIC_DOWNCAST(COutputWnd,this->GetParent()); + pWnd->OnLvnItemchangedLoglist(pNMHDR,pResult); +} + BEGIN_MESSAGE_MAP(COutputWnd, CDockablePane) ON_WM_CREATE() ON_WM_SIZE() + ON_NOTIFY(LVN_ITEMCHANGED, 0, OnLvnItemchangedLoglist) END_MESSAGE_MAP() int COutputWnd::OnCreate(LPCREATESTRUCT lpCreateStruct) @@ -32,21 +47,29 @@ int COutputWnd::OnCreate(LPCREATESTRUCT lpCreateStruct) if (CDockablePane::OnCreate(lpCreateStruct) == -1) return -1; + TRACE(_T("%u\n"),LVN_ITEMCHANGED); m_Font.CreateStockObject(DEFAULT_GUI_FONT); CRect rectDummy; rectDummy.SetRectEmpty(); // Create tabs window: - if (!m_wndTabs.Create(CMFCTabCtrl::STYLE_FLAT, rectDummy, this, 1)) + if (!m_wndTabs.Create(CMFCTabCtrl::STYLE_FLAT, rectDummy, this, 0)) { TRACE0("Failed to create output tab window\n"); return -1; // fail to create } // Create output panes: - const DWORD dwStyle = LBS_NOINTEGRALHEIGHT | WS_CHILD | WS_VISIBLE | WS_HSCROLL | WS_VSCROLL; + //const DWORD dwStyle = LBS_NOINTEGRALHEIGHT | WS_CHILD | WS_VISIBLE | WS_HSCROLL | WS_VSCROLL; + const DWORD dwStyle =LVS_REPORT | LVS_SHOWSELALWAYS | LVS_ALIGNLEFT | LVS_OWNERDATA | WS_BORDER | WS_TABSTOP |LVS_SINGLESEL |WS_CHILD | WS_VISIBLE; + if (! m_LogList.Create(dwStyle,rectDummy,&m_wndTabs,0) ) + { + TRACE0("Failed to create output windows\n"); + return -1; // fail to create + } +#if 0 if (!m_wndOutputBuild.Create(dwStyle, rectDummy, &m_wndTabs, 2) || !m_wndOutputDebug.Create(dwStyle, rectDummy, &m_wndTabs, 3) || !m_wndOutputFind.Create(dwStyle, rectDummy, &m_wndTabs, 4)) @@ -54,30 +77,42 @@ int COutputWnd::OnCreate(LPCREATESTRUCT lpCreateStruct) TRACE0("Failed to create output windows\n"); return -1; // fail to create } +#endif - m_wndOutputBuild.SetFont(&m_Font); - m_wndOutputDebug.SetFont(&m_Font); - m_wndOutputFind.SetFont(&m_Font); + m_LogList.SetFont(&m_Font); + //m_wndOutputBuild.SetFont(&m_Font); + //m_wndOutputDebug.SetFont(&m_Font); + //m_wndOutputFind.SetFont(&m_Font); CString strTabName; BOOL bNameValid; // Attach list windows to tab: - bNameValid = strTabName.LoadString(IDS_BUILD_TAB); + bNameValid = strTabName.LoadString(IDS_GIT_LOG_TAB); ASSERT(bNameValid); - m_wndTabs.AddTab(&m_wndOutputBuild, strTabName, (UINT)0); + + m_wndTabs.AddTab(&m_LogList, strTabName, (UINT)0); + + m_LogList.m_IsIDReplaceAction=TRUE; + m_LogList.DeleteAllItems(); + m_LogList.InsertGitColumn(); + + +#if 0 bNameValid = strTabName.LoadString(IDS_DEBUG_TAB); ASSERT(bNameValid); m_wndTabs.AddTab(&m_wndOutputDebug, strTabName, (UINT)1); bNameValid = strTabName.LoadString(IDS_FIND_TAB); ASSERT(bNameValid); m_wndTabs.AddTab(&m_wndOutputFind, strTabName, (UINT)2); +#endif; // Fill output tabs with some dummy text (nothing magic here) FillBuildWindow(); - FillDebugWindow(); - FillFindWindow(); +// FillDebugWindow(); +// FillFindWindow(); + this->SetWindowTextW(_T("Git Log")); return 0; } @@ -110,25 +145,57 @@ void COutputWnd::AdjustHorzScroll(CListBox& wndListBox) void COutputWnd::FillBuildWindow() { - m_wndOutputBuild.AddString(_T("Build output is being displayed here.")); - m_wndOutputBuild.AddString(_T("The output is being displayed in rows of a list view")); - m_wndOutputBuild.AddString(_T("but you can change the way it is displayed as you wish...")); +// m_wndOutputBuild.AddString(_T("Build output is being displayed here.")); +// m_wndOutputBuild.AddString(_T("The output is being displayed in rows of a list view")); +// m_wndOutputBuild.AddString(_T("but you can change the way it is displayed as you wish...")); } void COutputWnd::FillDebugWindow() { - m_wndOutputDebug.AddString(_T("Debug output is being displayed here.")); - m_wndOutputDebug.AddString(_T("The output is being displayed in rows of a list view")); - m_wndOutputDebug.AddString(_T("but you can change the way it is displayed as you wish...")); +// m_wndOutputDebug.AddString(_T("Debug output is being displayed here.")); +// m_wndOutputDebug.AddString(_T("The output is being displayed in rows of a list view")); +// m_wndOutputDebug.AddString(_T("but you can change the way it is displayed as you wish...")); } void COutputWnd::FillFindWindow() { - m_wndOutputFind.AddString(_T("Find output is being displayed here.")); - m_wndOutputFind.AddString(_T("The output is being displayed in rows of a list view")); - m_wndOutputFind.AddString(_T("but you can change the way it is displayed as you wish...")); +// m_wndOutputFind.AddString(_T("Find output is being displayed here.")); +// m_wndOutputFind.AddString(_T("The output is being displayed in rows of a list view")); +// m_wndOutputFind.AddString(_T("but you can change the way it is displayed as you wish...")); } +int COutputWnd::LoadHistory(CString filename) +{ + m_LogList.ReloadHashMap(); + CTGitPath path; + path.SetFromWin(filename); + + m_LogList.Clear(); + m_LogList.FillGitLog(&path,0/*CGit::LOG_INFO_FULLHISTORY*/); + + return 0; + +} +void COutputWnd::OnLvnItemchangedLoglist(NMHDR *pNMHDR, LRESULT *pResult) +{ + LPNMLISTVIEW pNMLV = reinterpret_cast(pNMHDR); + *pResult = 0; + + //if (this->IsThreadRunning()) + if (pNMLV->iItem >= 0) + { + if (pNMLV->iSubItem != 0) + return; + + if (pNMLV->uNewState & LVIS_SELECTED) + { + CMainFrame *pMain=DYNAMIC_DOWNCAST(CMainFrame,AfxGetApp()->GetMainWnd()); + POSITION pos=pMain->GetActiveDocument()->GetFirstViewPosition(); + CTortoiseGitBlameView *pView=DYNAMIC_DOWNCAST(CTortoiseGitBlameView,pMain->GetActiveDocument()->GetNextView(pos)); + pView->FocusOn(&this->m_LogList.m_logEntries[pNMLV->iItem]); + } + } +} ///////////////////////////////////////////////////////////////////////////// // COutputList1 @@ -195,4 +262,3 @@ void COutputList::OnViewOutput() } } -