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.DeleteAllItems();
\r
81 m_LogList.InsertGitColumn();
\r
85 bNameValid = strTabName.LoadString(IDS_DEBUG_TAB);
\r
87 m_wndTabs.AddTab(&m_wndOutputDebug, strTabName, (UINT)1);
\r
88 bNameValid = strTabName.LoadString(IDS_FIND_TAB);
\r
90 m_wndTabs.AddTab(&m_wndOutputFind, strTabName, (UINT)2);
\r
93 // Fill output tabs with some dummy text (nothing magic here)
\r
95 // FillDebugWindow();
\r
96 // FillFindWindow();
\r
101 void COutputWnd::OnSize(UINT nType, int cx, int cy)
\r
103 CDockablePane::OnSize(nType, cx, cy);
\r
105 // Tab control should cover the whole client area:
\r
106 m_wndTabs.SetWindowPos (NULL, -1, -1, cx, cy, SWP_NOMOVE | SWP_NOACTIVATE | SWP_NOZORDER);
\r
109 void COutputWnd::AdjustHorzScroll(CListBox& wndListBox)
\r
111 CClientDC dc(this);
\r
112 CFont* pOldFont = dc.SelectObject(&m_Font);
\r
114 int cxExtentMax = 0;
\r
116 for (int i = 0; i < wndListBox.GetCount(); i ++)
\r
119 wndListBox.GetText(i, strItem);
\r
121 cxExtentMax = max(cxExtentMax, dc.GetTextExtent(strItem).cx);
\r
124 wndListBox.SetHorizontalExtent(cxExtentMax);
\r
125 dc.SelectObject(pOldFont);
\r
128 void COutputWnd::FillBuildWindow()
\r
130 // m_wndOutputBuild.AddString(_T("Build output is being displayed here."));
\r
131 // m_wndOutputBuild.AddString(_T("The output is being displayed in rows of a list view"));
\r
132 // m_wndOutputBuild.AddString(_T("but you can change the way it is displayed as you wish..."));
\r
135 void COutputWnd::FillDebugWindow()
\r
137 // m_wndOutputDebug.AddString(_T("Debug output is being displayed here."));
\r
138 // m_wndOutputDebug.AddString(_T("The output is being displayed in rows of a list view"));
\r
139 // m_wndOutputDebug.AddString(_T("but you can change the way it is displayed as you wish..."));
\r
142 void COutputWnd::FillFindWindow()
\r
144 // m_wndOutputFind.AddString(_T("Find output is being displayed here."));
\r
145 // m_wndOutputFind.AddString(_T("The output is being displayed in rows of a list view"));
\r
146 // m_wndOutputFind.AddString(_T("but you can change the way it is displayed as you wish..."));
\r
149 /////////////////////////////////////////////////////////////////////////////
\r
152 COutputList::COutputList()
\r
156 COutputList::~COutputList()
\r
160 BEGIN_MESSAGE_MAP(COutputList, CListBox)
\r
161 ON_WM_CONTEXTMENU()
\r
162 ON_COMMAND(ID_EDIT_COPY, OnEditCopy)
\r
163 ON_COMMAND(ID_EDIT_CLEAR, OnEditClear)
\r
164 ON_COMMAND(ID_VIEW_OUTPUTWND, OnViewOutput)
\r
165 ON_WM_WINDOWPOSCHANGING()
\r
167 /////////////////////////////////////////////////////////////////////////////
\r
168 // COutputList message handlers
\r
170 void COutputList::OnContextMenu(CWnd* /*pWnd*/, CPoint point)
\r
173 menu.LoadMenu(IDR_OUTPUT_POPUP);
\r
175 CMenu* pSumMenu = menu.GetSubMenu(0);
\r
177 if (AfxGetMainWnd()->IsKindOf(RUNTIME_CLASS(CMDIFrameWndEx)))
\r
179 CMFCPopupMenu* pPopupMenu = new CMFCPopupMenu;
\r
181 if (!pPopupMenu->Create(this, point.x, point.y, (HMENU)pSumMenu->m_hMenu, FALSE, TRUE))
\r
184 ((CMDIFrameWndEx*)AfxGetMainWnd())->OnShowPopupMenu(pPopupMenu);
\r
185 UpdateDialogControls(this, FALSE);
\r
191 void COutputList::OnEditCopy()
\r
193 MessageBox(_T("Copy output"));
\r
196 void COutputList::OnEditClear()
\r
198 MessageBox(_T("Clear output"));
\r
201 void COutputList::OnViewOutput()
\r
203 CDockablePane* pParentBar = DYNAMIC_DOWNCAST(CDockablePane, GetOwner());
\r
204 CMDIFrameWndEx* pMainFrame = DYNAMIC_DOWNCAST(CMDIFrameWndEx, GetTopLevelFrame());
\r
206 if (pMainFrame != NULL && pParentBar != NULL)
\r
208 pMainFrame->SetFocus();
\r
209 pMainFrame->ShowPane(pParentBar, FALSE, FALSE, FALSE);
\r
210 pMainFrame->RecalcLayout();
\r