X-Git-Url: http://git.sourceforge.jp/view?p=tortoisegit%2FTortoiseGitJp.git;a=blobdiff_plain;f=src%2FTortoiseGitBlame%2FOutputWnd.cpp;h=9ae92c1b0afbe9cc6d06e7dfe857deea29c27bfe;hp=7fc8ba60e88ce5145180120c8ccbda589788f367;hb=37cc0a5dac9c85bc5c55996c282678ed7947afd6;hpb=c6a39f9102d652432a14c9cc97d968fb5bda3b8d diff --git a/src/TortoiseGitBlame/OutputWnd.cpp b/src/TortoiseGitBlame/OutputWnd.cpp index 7fc8ba6..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,13 +47,14 @@ 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 @@ -46,9 +62,9 @@ int COutputWnd::OnCreate(LPCREATESTRUCT lpCreateStruct) // Create output panes: //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; + 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,2) ) + if (! m_LogList.Create(dwStyle,rectDummy,&m_wndTabs,0) ) { TRACE0("Failed to create output windows\n"); return -1; // fail to create @@ -96,6 +112,7 @@ int COutputWnd::OnCreate(LPCREATESTRUCT lpCreateStruct) // FillDebugWindow(); // FillFindWindow(); + this->SetWindowTextW(_T("Git Log")); return 0; } @@ -152,12 +169,33 @@ int COutputWnd::LoadHistory(CString filename) m_LogList.ReloadHashMap(); CTGitPath path; path.SetFromWin(filename); - - m_LogList.FillGitLog(&path,CGit::LOG_INFO_FULLHISTORY); + + 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