1 //####COPYRIGHTBEGIN####
3 // ----------------------------------------------------------------------------
4 // Copyright (C) 1998, 1999, 2000 Red Hat, Inc.
6 // This program is part of the eCos host tools.
8 // This program is free software; you can redistribute it and/or modify it
9 // under the terms of the GNU General Public License as published by the Free
10 // Software Foundation; either version 2 of the License, or (at your option)
13 // This program is distributed in the hope that it will be useful, but WITHOUT
14 // ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
15 // FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
18 // You should have received a copy of the GNU General Public License along with
19 // this program; if not, write to the Free Software Foundation, Inc.,
20 // 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
22 // ----------------------------------------------------------------------------
24 //####COPYRIGHTEND####
25 // OutputEdit.cpp : implementation file
29 #include "OutputEdit.h"
30 #include "TestToolRes.h" // main symbols
35 static char THIS_FILE[] = __FILE__;
38 /////////////////////////////////////////////////////////////////////////////
41 COutputEdit::COutputEdit()
45 COutputEdit::~COutputEdit()
50 BEGIN_MESSAGE_MAP(COutputEdit, CEdit)
51 //{{AFX_MSG_MAP(COutputEdit)
53 ON_COMMAND(ID_EDIT_SELECT_ALL, OnEditSelectAll)
54 ON_COMMAND(ID_EDIT_COPY, OnEditCopy)
55 ON_COMMAND(ID_EDIT_CLEAR, OnEditClear)
59 ON_COMMAND(ID_TT_EDIT_SAVE, OnEditSave)
63 /////////////////////////////////////////////////////////////////////////////
64 // COutputEdit message handlers
66 void COutputEdit::OnContextMenu(CWnd* pWnd, CPoint point)
69 if(GetWindowTextLength()>0){
71 menu.LoadMenu(IDR_TT_CONTEXTMENU2);
73 CMenu *pPopup=menu.GetSubMenu(0);
80 pPopup->EnableMenuItem(ID_EDIT_COPY,MF_BYCOMMAND|MF_GRAYED);
82 pPopup->TrackPopupMenu(TPM_LEFTALIGN|TPM_LEFTBUTTON|TPM_RIGHTBUTTON, point.x,point.y,this);
86 void COutputEdit::OnEditSelectAll()
91 void COutputEdit::OnEditCopy()
96 void COutputEdit::OnEditClear()
98 SetWindowText(_T(""));
101 void COutputEdit::OnChar(UINT nChar, UINT nRepCnt, UINT nFlags)
111 CEdit::OnChar(nChar, nRepCnt, nFlags);
116 // Control gets sent WM_SETSEL (0,0xffffffff) when property page is selected
117 // I don't know why, but this works around it:
118 void COutputEdit::OnSetFocus(CWnd* pOldWnd)
120 CEdit::OnSetFocus(pOldWnd);
125 void COutputEdit::OnKillFocus(CWnd* pNewWnd)
128 CEdit::OnKillFocus(pNewWnd);
131 void COutputEdit::OnEditSave()
133 CFileDialog dlg( FALSE, _T("log"), _T("Output"), OFN_HIDEREADONLY | OFN_OVERWRITEPROMPT,
134 _T("Log Files (*.log)|*.log|All Files (*.*)|*.*||"));
135 if(IDOK==dlg.DoModal()){
138 CStdioFile f( dlg.GetPathName(), CFile::modeCreate | CFile::modeWrite );
144 CATCH( CFileException, e )
146 MessageBox(_T("Failed to write file"));