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 // BuildOptionsDialog.cpp : implementation file
29 #include "ConfigItem.h"
30 #include "ConfigTool.h"
31 #include "ConfigToolDoc.h"
32 #include "BuildOptionsDialog.h"
35 #define INCLUDEFILE "cdl.hxx"
36 #include "IncludeSTL.h"
37 #define INCLUDEFILE "flags.hxx"
38 #include "IncludeSTL.h"
43 static char THIS_FILE[] = __FILE__;
46 /////////////////////////////////////////////////////////////////////////////
47 // CBuildOptionsDialog dialog
49 CBuildOptionsDialog::CBuildOptionsDialog(CWnd* pParent /*=NULL*/)
50 : CeCosDialog(CBuildOptionsDialog::IDD, pParent),
52 arEntries(CConfigTool::GetConfigToolDoc()->BuildInfo().entries)
54 //{{AFX_DATA_INIT(CBuildOptionsDialog)
55 // NOTE: the ClassWizard will add member initialization here
60 void CBuildOptionsDialog::DoDataExchange(CDataExchange* pDX)
62 CeCosDialog::DoDataExchange(pDX);
63 //{{AFX_DATA_MAP(CBuildOptionsDialog)
64 DDX_Control(pDX, IDC_BUILD_OPTIONS_LIST, m_List);
65 DDX_Control(pDX, IDC_TREE1, m_Tree);
70 BEGIN_MESSAGE_MAP(CBuildOptionsDialog, CeCosDialog)
71 //{{AFX_MSG_MAP(CBuildOptionsDialog)
72 ON_NOTIFY(TVN_SELCHANGED, IDC_TREE1, OnSelchangedTree)
73 ON_CBN_SELCHANGE(IDC_COMBO1, OnSelchangeCombo)
77 /////////////////////////////////////////////////////////////////////////////
78 // CBuildOptionsDialog message handlers
79 void CBuildOptionsDialog::Create(CConfigItem *pti,HTREEITEM hParent)
81 if(pti->IsPackage()||TVI_ROOT==hParent){
82 HTREEITEM h=m_Tree.InsertItem(pti->ItemNameOrMacro(),hParent);
83 m_Tree.SetItemData(h,(DWORD)pti);
84 m_Tree.SetItemImage(h,18,18);
85 for(CConfigItem *pChild=pti->FirstChild();pChild;pChild=pChild->NextSibling()){
91 BOOL CBuildOptionsDialog::OnInitDialog()
93 CeCosDialog::OnInitDialog();
94 m_il.Create(IDB_BITMAP2,16,1,RGB(0,128,128));
95 m_Tree.SetImageList(&m_il,TVSIL_NORMAL);
96 Create(CConfigTool::GetConfigToolDoc()->FirstItem(), TVI_ROOT);
97 ((CComboBox *)GetDlgItem(IDC_COMBO1))->SetCurSel(0);
98 HTREEITEM h=m_Tree.GetFirstVisibleItem();
99 m_Tree.Expand(h,TVE_EXPAND);
100 m_Tree.SetItemState(h,TVIS_SELECTED,TVIS_SELECTED);
102 return FALSE; // return TRUE unless you set the focus to a control
103 // EXCEPTION: OCX Property Pages should return FALSE
106 void CBuildOptionsDialog::OnSelchangedTree(NMHDR* pNMHDR, LRESULT* pResult)
108 NM_TREEVIEW* pNMTreeView = (NM_TREEVIEW*)pNMHDR;
109 m_hCurrent=pNMTreeView->itemNew.hItem;
110 Redisplay(m_hCurrent);
114 void CBuildOptionsDialog::OnSelchangeCombo()
117 Redisplay(m_hCurrent);
121 void CBuildOptionsDialog::Redisplay(HTREEITEM h)
123 CConfigItem *pti=(CConfigItem *)m_Tree.GetItemData(h);
124 const CdlValuable valuable = pti->GetCdlValuable();
126 const CdlBuildInfo_Loadable *pe=NULL;
128 const char *pszname=valuable->get_name().c_str();
129 for(EntriesArray::size_type j=0;j<arEntries.size();j++){
130 if(0==strcmp(arEntries[j].name.c_str(),pszname)){
137 GetDlgItemText(IDC_COMBO1,strCat);
138 const CString strFlags=get_flags(CConfigTool::GetConfigToolDoc()->GetCdlConfig(),pe,CUtils::UnicodeToStdStr(strCat)).c_str();
140 CUtils::Chop(strFlags,ar,_TCHAR(' '),false,false);
142 bool bRedraw=(m_List.GetCount()!=ar.GetSize());
144 for(int i=0;i<ar.GetSize();i++){
146 m_List.GetText(i,strOld);
154 m_List.ResetContent();
155 for(int i=0;i<ar.GetSize();i++){
156 m_List.AddString(ar[i]);