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
50 if (!m_wndOutputBuild.Create(dwStyle, rectDummy, &m_wndTabs, 2) ||
\r
51 !m_wndOutputDebug.Create(dwStyle, rectDummy, &m_wndTabs, 3) ||
\r
52 !m_wndOutputFind.Create(dwStyle, rectDummy, &m_wndTabs, 4))
\r
54 TRACE0("Failed to create output windows\n");
\r
55 return -1; // fail to create
\r
58 m_wndOutputBuild.SetFont(&m_Font);
\r
59 m_wndOutputDebug.SetFont(&m_Font);
\r
60 m_wndOutputFind.SetFont(&m_Font);
\r
65 // Attach list windows to tab:
\r
66 bNameValid = strTabName.LoadString(IDS_BUILD_TAB);
\r
68 m_wndTabs.AddTab(&m_wndOutputBuild, strTabName, (UINT)0);
\r
69 bNameValid = strTabName.LoadString(IDS_DEBUG_TAB);
\r
71 m_wndTabs.AddTab(&m_wndOutputDebug, strTabName, (UINT)1);
\r
72 bNameValid = strTabName.LoadString(IDS_FIND_TAB);
\r
74 m_wndTabs.AddTab(&m_wndOutputFind, strTabName, (UINT)2);
\r
76 // Fill output tabs with some dummy text (nothing magic here)
\r
84 void COutputWnd::OnSize(UINT nType, int cx, int cy)
\r
86 CDockablePane::OnSize(nType, cx, cy);
\r
88 // Tab control should cover the whole client area:
\r
89 m_wndTabs.SetWindowPos (NULL, -1, -1, cx, cy, SWP_NOMOVE | SWP_NOACTIVATE | SWP_NOZORDER);
\r
92 void COutputWnd::AdjustHorzScroll(CListBox& wndListBox)
\r
95 CFont* pOldFont = dc.SelectObject(&m_Font);
\r
97 int cxExtentMax = 0;
\r
99 for (int i = 0; i < wndListBox.GetCount(); i ++)
\r
102 wndListBox.GetText(i, strItem);
\r
104 cxExtentMax = max(cxExtentMax, dc.GetTextExtent(strItem).cx);
\r
107 wndListBox.SetHorizontalExtent(cxExtentMax);
\r
108 dc.SelectObject(pOldFont);
\r
111 void COutputWnd::FillBuildWindow()
\r
113 m_wndOutputBuild.AddString(_T("Build output is being displayed here."));
\r
114 m_wndOutputBuild.AddString(_T("The output is being displayed in rows of a list view"));
\r
115 m_wndOutputBuild.AddString(_T("but you can change the way it is displayed as you wish..."));
\r
118 void COutputWnd::FillDebugWindow()
\r
120 m_wndOutputDebug.AddString(_T("Debug output is being displayed here."));
\r
121 m_wndOutputDebug.AddString(_T("The output is being displayed in rows of a list view"));
\r
122 m_wndOutputDebug.AddString(_T("but you can change the way it is displayed as you wish..."));
\r
125 void COutputWnd::FillFindWindow()
\r
127 m_wndOutputFind.AddString(_T("Find output is being displayed here."));
\r
128 m_wndOutputFind.AddString(_T("The output is being displayed in rows of a list view"));
\r
129 m_wndOutputFind.AddString(_T("but you can change the way it is displayed as you wish..."));
\r
132 /////////////////////////////////////////////////////////////////////////////
\r
135 COutputList::COutputList()
\r
139 COutputList::~COutputList()
\r
143 BEGIN_MESSAGE_MAP(COutputList, CListBox)
\r
144 ON_WM_CONTEXTMENU()
\r
145 ON_COMMAND(ID_EDIT_COPY, OnEditCopy)
\r
146 ON_COMMAND(ID_EDIT_CLEAR, OnEditClear)
\r
147 ON_COMMAND(ID_VIEW_OUTPUTWND, OnViewOutput)
\r
148 ON_WM_WINDOWPOSCHANGING()
\r
150 /////////////////////////////////////////////////////////////////////////////
\r
151 // COutputList message handlers
\r
153 void COutputList::OnContextMenu(CWnd* /*pWnd*/, CPoint point)
\r
156 menu.LoadMenu(IDR_OUTPUT_POPUP);
\r
158 CMenu* pSumMenu = menu.GetSubMenu(0);
\r
160 if (AfxGetMainWnd()->IsKindOf(RUNTIME_CLASS(CMDIFrameWndEx)))
\r
162 CMFCPopupMenu* pPopupMenu = new CMFCPopupMenu;
\r
164 if (!pPopupMenu->Create(this, point.x, point.y, (HMENU)pSumMenu->m_hMenu, FALSE, TRUE))
\r
167 ((CMDIFrameWndEx*)AfxGetMainWnd())->OnShowPopupMenu(pPopupMenu);
\r
168 UpdateDialogControls(this, FALSE);
\r
174 void COutputList::OnEditCopy()
\r
176 MessageBox(_T("Copy output"));
\r
179 void COutputList::OnEditClear()
\r
181 MessageBox(_T("Clear output"));
\r
184 void COutputList::OnViewOutput()
\r
186 CDockablePane* pParentBar = DYNAMIC_DOWNCAST(CDockablePane, GetOwner());
\r
187 CMDIFrameWndEx* pMainFrame = DYNAMIC_DOWNCAST(CMDIFrameWndEx, GetTopLevelFrame());
\r
189 if (pMainFrame != NULL && pParentBar != NULL)
\r
191 pMainFrame->SetFocus();
\r
192 pMainFrame->ShowPane(pParentBar, FALSE, FALSE, FALSE);
\r
193 pMainFrame->RecalcLayout();
\r