]> git.kernelconcepts.de Git - karo-tx-redboot.git/blob - tools/src/tools/configtool/common/win32/CTOptionsDialog.cpp
Initial revision
[karo-tx-redboot.git] / tools / src / tools / configtool / common / win32 / CTOptionsDialog.cpp
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 // OutputPage.cpp : implementation file
26 //
27 //
28 //===========================================================================
29 //===========================================================================
30 //#####DESCRIPTIONBEGIN####
31 //
32 // Author(s):   sdf
33 // Contact(s):  sdf
34 // Date:                1998/08/11
35 // Version:             0.01
36 // Purpose:     
37 // Description: This is the implementation of the Configuration -> Options View tab
38 // Requires:    
39 // Provides:    
40 // See also:    
41 // Known bugs:  
42 // Usage:       
43 //
44 //####DESCRIPTIONEND####
45 //
46 //===========================================================================
47
48
49 #include "stdafx.h"
50 #include "ConfigTool.h"
51 #include "ConfigToolDoc.h"
52 #include "CTOptionsDialog.h"
53 #include "ConfigItem.h"
54
55 #ifdef _DEBUG
56 #define new DEBUG_NEW
57 #undef THIS_FILE
58 static char THIS_FILE[] = __FILE__;
59 #endif
60
61 /////////////////////////////////////////////////////////////////////////////
62 // CToolsOptionsDialog property page
63
64 CToolsOptionsDialog::CToolsOptionsDialog() 
65         : CeCosDialog(IDD, NULL)
66 {
67         //{{AFX_DATA_INIT(CToolsOptionsDialog)
68         //}}AFX_DATA_INIT
69 }
70
71 CToolsOptionsDialog::~CToolsOptionsDialog()
72 {
73 }
74
75 void CToolsOptionsDialog::DoDataExchange(CDataExchange* pDX)
76 {
77         CeCosDialog::DoDataExchange(pDX);
78         //{{AFX_DATA_MAP(CToolsOptionsDialog)
79         //}}AFX_DATA_MAP
80 }
81
82
83 BEGIN_MESSAGE_MAP(CToolsOptionsDialog, CeCosDialog)
84         //{{AFX_MSG_MAP(CToolsOptionsDialog)
85         ON_BN_CLICKED(IDC_DEFERRED, OnDeferred)
86         ON_BN_CLICKED(IDC_IMMEDIATE, OnImmediate)
87         //}}AFX_MSG_MAP
88 END_MESSAGE_MAP()
89
90 /////////////////////////////////////////////////////////////////////////////
91 // CToolsOptionsDialog message handlers
92
93
94 BOOL CToolsOptionsDialog::OnInitDialog() 
95 {
96   CeCosDialog::OnInitDialog();
97   CConfigToolDoc*pDoc=CConfigTool::GetConfigToolDoc();
98   ((CButton *)GetDlgItem(IDC_IMMEDIATE))->SetCheck(pDoc->m_nRuleChecking&CConfigToolDoc::Immediate);
99   ((CButton *)GetDlgItem(IDC_DEFERRED ))->SetCheck(pDoc->m_nRuleChecking&CConfigToolDoc::Deferred);
100   ((CButton *)GetDlgItem(IDC_SUGGEST_FIXES ))->SetCheck(pDoc->m_nRuleChecking&CConfigToolDoc::SuggestFixes);
101   UpdateData(FALSE);
102   SetButtons();
103   return TRUE;  // return TRUE unless you set the focus to a control
104   // EXCEPTION: OCX Property Pages should return FALSE
105 }
106
107 void CToolsOptionsDialog::OnDeferred() 
108 {
109   SetButtons();
110 }
111
112 void CToolsOptionsDialog::OnImmediate() 
113 {
114   SetButtons();
115 }
116
117 void CToolsOptionsDialog::OnOK() 
118 {
119   CConfigToolDoc *pDoc=CConfigTool::GetConfigToolDoc();
120   UpdateData(TRUE);
121   pDoc->m_nRuleChecking=
122     (CConfigToolDoc::SuggestFixes * ((CButton *)GetDlgItem(IDC_SUGGEST_FIXES))->GetCheck())|
123     (CConfigToolDoc::Immediate    * ((CButton *)GetDlgItem(IDC_IMMEDIATE))->GetCheck())|
124     (CConfigToolDoc::Deferred     * ((CButton *)GetDlgItem(IDC_DEFERRED))->GetCheck());
125   CeCosDialog::OnOK();
126 }
127
128
129
130
131 void CToolsOptionsDialog::SetButtons()
132 {
133   GetDlgItem(IDC_SUGGEST_FIXES)->EnableWindow(((CButton *)GetDlgItem(IDC_IMMEDIATE))->GetCheck()|((CButton *)GetDlgItem(IDC_DEFERRED))->GetCheck());
134 }