comparison host/tools/Utils/win32/eCosDialog.cpp @ 76:435cced73e2f ecos-v1_3_1-release

eCos v1.3.1 merged from eCos master repository on 2000-03-27-23:22:51-BST
author jlarmour
date Tue, 28 Mar 2000 14:10:45 +0000
parents
children
comparison
equal deleted inserted replaced
75:41bf073c0c32 76:435cced73e2f
1 //####COPYRIGHTBEGIN####
2 //
3 // ----------------------------------------------------------------------------
4 // Copyright (C) 1998, 1999, 2000 Red Hat, Inc.
5 //
6 // This program is part of the eCos host tools.
7 //
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)
11 // any later version.
12 //
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
16 // more details.
17 //
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.
21 //
22 // ----------------------------------------------------------------------------
23 //
24 //####COPYRIGHTEND####
25 // eCosDialog.cpp : implementation file
26 //
27
28 #include "stdafx.h"
29 #include "eCosDialog.h"
30
31 #ifdef _DEBUG
32 #define new DEBUG_NEW
33 #undef THIS_FILE
34 static char THIS_FILE[] = __FILE__;
35 #endif
36
37 /////////////////////////////////////////////////////////////////////////////
38 // CeCosDialog dialog
39
40 void CeCosDialog::DoDataExchange(CDataExchange* pDX)
41 {
42 CCSHDialog::DoDataExchange(pDX);
43 //{{AFX_DATA_MAP(CeCosDialog)
44 // NOTE: the ClassWizard will add DDX and DDV calls here
45 //}}AFX_DATA_MAP
46 }
47
48
49 BEGIN_MESSAGE_MAP(CeCosDialog, CCSHDialog)
50 //{{AFX_MSG_MAP(CeCosDialog)
51 //}}AFX_MSG_MAP
52 END_MESSAGE_MAP()
53
54 /////////////////////////////////////////////////////////////////////////////
55 // CeCosDialog message handlers
56
57 CPtrArray CeCosDialog::m_arDialogMaps;
58
59 CString CeCosDialog::CSHFile() const
60 {
61 return CSHFile((UINT)m_lpszTemplateName);
62 }
63
64 CString CeCosDialog::CSHFile(UINT nID)
65 {
66 if(nID){
67 for(int j=m_arDialogMaps.GetSize()-1;j>=0;--j){
68 UINT *map=(UINT *)m_arDialogMaps[j];
69 for(int i=0;map[i];i+=2){
70 if(nID==map[i]){
71 CString strFile;
72 if(strFile.LoadString(map[i+1])){
73 return m_strCSHFilePath+strFile;
74 } else {
75 TRACE(_T("CCSHDialog::Failed to load help file id %d for dialog id=%d\n"),map[i+1],nID);
76 }
77 }
78 }
79 }
80 }
81 TRACE(_T("CCSHDialog::Failed to find help file for dialog id=%d\n"),nID);
82 return _T("");
83 }
84
85 UINT CeCosDialog::HelpID (DWORD dwCtrlID) const
86 {
87 return HelpID((UINT)m_lpszTemplateName,dwCtrlID);
88 }
89
90 UINT CeCosDialog::HelpID (UINT dlgID, DWORD dwCtrlID)
91 {
92 UNUSED_ALWAYS(dlgID); // because we have a single namespace for all control IDs
93 LPCTSTR id;
94 switch(dwCtrlID){
95 case IDOK:
96 id=_T("Closes the dialog and saves any changes you have made.");
97 break;
98 case IDCANCEL:
99 id=_T("Closes the dialog without saving any changes you have made.");
100 break;
101 case ID_APPLY_NOW:
102 id=_T("Saves all the changes you have made without closing this dialog box.");
103 break;
104 case ID_HELP:
105 case IDHELP:
106 id=_T("Click this to display an overview of the dialog box.");
107 break;
108 default:
109 id=(LPCTSTR)dwCtrlID;
110 break;
111 }
112 return (UINT)id;
113 }
114
115 HINSTANCE CeCosDialog::GetInstanceHandle()
116 {
117 #ifdef PLUGIN
118 extern HINSTANCE heCosInstance;
119 return heCosInstance;
120 #else
121 return AfxGetInstanceHandle();
122 #endif
123 }