4 #include "OutputWnd.h"
\r
5 #include "Resource.h"
\r
9 #define new DEBUG_NEW
\r
11 static char THIS_FILE[] = __FILE__;
\r
14 /////////////////////////////////////////////////////////////////////////////
\r
17 COutputWnd::COutputWnd()
\r
21 COutputWnd::~COutputWnd()
\r
25 BEGIN_MESSAGE_MAP(COutputWnd, CDockablePane)
\r
30 int COutputWnd::OnCreate(LPCREATESTRUCT lpCreateStruct)
\r
32 if (CDockablePane::OnCreate(lpCreateStruct) == -1)
\r
35 m_Font.CreateStockObject(DEFAULT_GUI_FONT);
\r
38 rectDummy.SetRectEmpty();
\r
40 // Create tabs window:
\r
41 if (!m_wndTabs.Create(CMFCTabCtrl::STYLE_FLAT, rectDummy, this, 1))
\r
43 TRACE0("Failed to create output tab window\n");
\r
44 return -1; // fail to create
\r
47 // Create output panes:
\r
48 //const DWORD dwStyle = LBS_NOINTEGRALHEIGHT | WS_CHILD | WS_VISIBLE | WS_HSCROLL | WS_VSCROLL;
\r
49 const DWORD dwStyle =LVS_REPORT | LVS_SHOWSELALWAYS | LVS_ALIGNLEFT | LVS_OWNERDATA | WS_BORDER | WS_TABSTOP;
\r
51 if (! m_LogList.Create(dwStyle,rectDummy,&m_wndTabs,2) )
\r
53 TRACE0("Failed to create output windows\n");
\r
54 return -1; // fail to create
\r
57 if (!m_wndOutputBuild.Create(dwStyle, rectDummy, &m_wndTabs, 2) ||
\r
58 !m_wndOutputDebug.Create(dwStyle, rectDummy, &m_wndTabs, 3) ||
\r
59 !m_wndOutputFind.Create(dwStyle, rectDummy, &m_wndTabs, 4))
\r
61 TRACE0("Failed to create output windows\n");
\r
62 return -1; // fail to create
\r
66 m_LogList.SetFont(&m_Font);
\r
67 //m_wndOutputBuild.SetFont(&m_Font);
\r
68 //m_wndOutputDebug.SetFont(&m_Font);
\r
69 //m_wndOutputFind.SetFont(&m_Font);
\r
74 // Attach list windows to tab:
\r
75 bNameValid = strTabName.LoadString(IDS_GIT_LOG_TAB);
\r
78 m_wndTabs.AddTab(&m_LogList, strTabName, (UINT)0);
\r
80 m_LogList.m_IsIDReplaceAction=TRUE;
\r
81 m_LogList.DeleteAllItems();
\r
82 m_LogList.InsertGitColumn();
\r
86 bNameValid = strTabName.LoadString(IDS_DEBUG_TAB);
\r
88 m_wndTabs.AddTab(&m_wndOutputDebug, strTabName, (UINT)1);
\r
89 bNameValid = strTabName.LoadString(IDS_FIND_TAB);
\r
91 m_wndTabs.AddTab(&m_wndOutputFind, strTabName, (UINT)2);
\r
94 // Fill output tabs with some dummy text (nothing magic here)
\r
96 // FillDebugWindow();
\r
97 // FillFindWindow();
\r
102 void COutputWnd::OnSize(UINT nType, int cx, int cy)
\r
104 CDockablePane::OnSize(nType, cx, cy);
\r
106 // Tab control should cover the whole client area:
\r
107 m_wndTabs.SetWindowPos (NULL, -1, -1, cx, cy, SWP_NOMOVE | SWP_NOACTIVATE | SWP_NOZORDER);
\r
110 void COutputWnd::AdjustHorzScroll(CListBox& wndListBox)
\r
112 CClientDC dc(this);
\r
113 CFont* pOldFont = dc.SelectObject(&m_Font);
\r
115 int cxExtentMax = 0;
\r
117 for (int i = 0; i < wndListBox.GetCount(); i ++)
\r
120 wndListBox.GetText(i, strItem);
\r
122 cxExtentMax = max(cxExtentMax, dc.GetTextExtent(strItem).cx);
\r
125 wndListBox.SetHorizontalExtent(cxExtentMax);
\r
126 dc.SelectObject(pOldFont);
\r
129 void COutputWnd::FillBuildWindow()
\r
131 // m_wndOutputBuild.AddString(_T("Build output is being displayed here."));
\r
132 // m_wndOutputBuild.AddString(_T("The output is being displayed in rows of a list view"));
\r
133 // m_wndOutputBuild.AddString(_T("but you can change the way it is displayed as you wish..."));
\r
136 void COutputWnd::FillDebugWindow()
\r
138 // m_wndOutputDebug.AddString(_T("Debug output is being displayed here."));
\r
139 // m_wndOutputDebug.AddString(_T("The output is being displayed in rows of a list view"));
\r
140 // m_wndOutputDebug.AddString(_T("but you can change the way it is displayed as you wish..."));
\r
143 void COutputWnd::FillFindWindow()
\r
145 // m_wndOutputFind.AddString(_T("Find output is being displayed here."));
\r
146 // m_wndOutputFind.AddString(_T("The output is being displayed in rows of a list view"));
\r
147 // m_wndOutputFind.AddString(_T("but you can change the way it is displayed as you wish..."));
\r
150 int COutputWnd::LoadHistory(CString filename)
\r
152 m_LogList.ReloadHashMap();
\r
154 path.SetFromWin(filename);
\r
156 m_LogList.FillGitLog(&path,0);
\r
161 /////////////////////////////////////////////////////////////////////////////
\r
164 COutputList::COutputList()
\r
168 COutputList::~COutputList()
\r
172 BEGIN_MESSAGE_MAP(COutputList, CListBox)
\r
173 ON_WM_CONTEXTMENU()
\r
174 ON_COMMAND(ID_EDIT_COPY, OnEditCopy)
\r
175 ON_COMMAND(ID_EDIT_CLEAR, OnEditClear)
\r
176 ON_COMMAND(ID_VIEW_OUTPUTWND, OnViewOutput)
\r
177 ON_WM_WINDOWPOSCHANGING()
\r
179 /////////////////////////////////////////////////////////////////////////////
\r
180 // COutputList message handlers
\r
182 void COutputList::OnContextMenu(CWnd* /*pWnd*/, CPoint point)
\r
185 menu.LoadMenu(IDR_OUTPUT_POPUP);
\r
187 CMenu* pSumMenu = menu.GetSubMenu(0);
\r
189 if (AfxGetMainWnd()->IsKindOf(RUNTIME_CLASS(CMDIFrameWndEx)))
\r
191 CMFCPopupMenu* pPopupMenu = new CMFCPopupMenu;
\r
193 if (!pPopupMenu->Create(this, point.x, point.y, (HMENU)pSumMenu->m_hMenu, FALSE, TRUE))
\r
196 ((CMDIFrameWndEx*)AfxGetMainWnd())->OnShowPopupMenu(pPopupMenu);
\r
197 UpdateDialogControls(this, FALSE);
\r
203 void COutputList::OnEditCopy()
\r
205 MessageBox(_T("Copy output"));
\r
208 void COutputList::OnEditClear()
\r
210 MessageBox(_T("Clear output"));
\r
213 void COutputList::OnViewOutput()
\r
215 CDockablePane* pParentBar = DYNAMIC_DOWNCAST(CDockablePane, GetOwner());
\r
216 CMDIFrameWndEx* pMainFrame = DYNAMIC_DOWNCAST(CMDIFrameWndEx, GetTopLevelFrame());
\r
218 if (pMainFrame != NULL && pParentBar != NULL)
\r
220 pMainFrame->SetFocus();
\r
221 pMainFrame->ShowPane(pParentBar, FALSE, FALSE, FALSE);
\r
222 pMainFrame->RecalcLayout();
\r