OpenCores
URL https://opencores.org/ocsvn/openrisc/openrisc/trunk

Subversion Repositories openrisc

[/] [openrisc/] [trunk/] [rtos/] [ecos-3.0/] [host/] [tools/] [configtool/] [common/] [win32/] [BuildOptionsDialog.cpp] - Blame information for rev 786

Details | Compare with Previous | View Log

Line No. Rev Author Line
1 786 skrzyp
// ####ECOSHOSTGPLCOPYRIGHTBEGIN####                                        
2
// -------------------------------------------                              
3
// This file is part of the eCos host tools.                                
4
// Copyright (C) 1998, 1999, 2000 Free Software Foundation, Inc.            
5
//
6
// This program is free software; you can redistribute it and/or modify     
7
// it under the terms of the GNU General Public License as published by     
8
// the Free Software Foundation; either version 2 or (at your option) any   
9
// later version.                                                           
10
//
11
// This program is distributed in the hope that it will be useful, but      
12
// WITHOUT ANY WARRANTY; without even the implied warranty of               
13
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU        
14
// General Public License for more details.                                 
15
//
16
// You should have received a copy of the GNU General Public License        
17
// along with this program; if not, write to the                            
18
// Free Software Foundation, Inc., 51 Franklin Street,                      
19
// Fifth Floor, Boston, MA  02110-1301, USA.                                
20
// -------------------------------------------                              
21
// ####ECOSHOSTGPLCOPYRIGHTEND####                                          
22
// BuildOptionsDialog.cpp : implementation file
23
//
24
 
25
#include "stdafx.h"
26
#include "ConfigItem.h"
27
#include "ConfigTool.h"
28
#include "ConfigToolDoc.h"
29
#include "BuildOptionsDialog.h"
30
#include "CTUtils.h"
31
 
32
#define INCLUDEFILE "cdl.hxx"
33
#include "IncludeSTL.h"
34
#define INCLUDEFILE "flags.hxx"
35
#include "IncludeSTL.h"
36
 
37
#ifdef _DEBUG
38
#define new DEBUG_NEW
39
#undef THIS_FILE
40
static char THIS_FILE[] = __FILE__;
41
#endif
42
 
43
/////////////////////////////////////////////////////////////////////////////
44
// CBuildOptionsDialog dialog
45
 
46
CBuildOptionsDialog::CBuildOptionsDialog(CWnd* pParent /*=NULL*/)
47
        : CeCosDialog(CBuildOptionsDialog::IDD, pParent),
48
  m_hCurrent(0),
49
  arEntries(CConfigTool::GetConfigToolDoc()->BuildInfo().entries)
50
{
51
        //{{AFX_DATA_INIT(CBuildOptionsDialog)
52
                // NOTE: the ClassWizard will add member initialization here
53
        //}}AFX_DATA_INIT
54
}
55
 
56
 
57
void CBuildOptionsDialog::DoDataExchange(CDataExchange* pDX)
58
{
59
        CeCosDialog::DoDataExchange(pDX);
60
        //{{AFX_DATA_MAP(CBuildOptionsDialog)
61
        DDX_Control(pDX, IDC_BUILD_OPTIONS_LIST, m_List);
62
        DDX_Control(pDX, IDC_TREE1, m_Tree);
63
        //}}AFX_DATA_MAP
64
}
65
 
66
 
67
BEGIN_MESSAGE_MAP(CBuildOptionsDialog, CeCosDialog)
68
        //{{AFX_MSG_MAP(CBuildOptionsDialog)
69
        ON_NOTIFY(TVN_SELCHANGED, IDC_TREE1, OnSelchangedTree)
70
        ON_CBN_SELCHANGE(IDC_COMBO1, OnSelchangeCombo)
71
        //}}AFX_MSG_MAP
72
END_MESSAGE_MAP()
73
 
74
/////////////////////////////////////////////////////////////////////////////
75
// CBuildOptionsDialog message handlers
76
void CBuildOptionsDialog::Create(CConfigItem *pti,HTREEITEM hParent)
77
{
78
  if(pti->IsPackage()||TVI_ROOT==hParent){
79
          HTREEITEM h=m_Tree.InsertItem(pti->ItemNameOrMacro(),hParent);
80
          m_Tree.SetItemData(h,(DWORD)pti);
81
    m_Tree.SetItemImage(h,18,18);
82
          for(CConfigItem *pChild=pti->FirstChild();pChild;pChild=pChild->NextSibling()){
83
                  Create(pChild,h);
84
          }
85
  }
86
}
87
 
88
BOOL CBuildOptionsDialog::OnInitDialog()
89
{
90
        CeCosDialog::OnInitDialog();
91
  m_il.Create(IDB_BITMAP2,16,1,RGB(0,128,128));
92
        m_Tree.SetImageList(&m_il,TVSIL_NORMAL);
93
  Create(CConfigTool::GetConfigToolDoc()->FirstItem(), TVI_ROOT);
94
  ((CComboBox *)GetDlgItem(IDC_COMBO1))->SetCurSel(0);
95
  HTREEITEM h=m_Tree.GetFirstVisibleItem();
96
  m_Tree.Expand(h,TVE_EXPAND);
97
  m_Tree.SetItemState(h,TVIS_SELECTED,TVIS_SELECTED);
98
  m_Tree.SetFocus();
99
        return FALSE;  // return TRUE unless you set the focus to a control
100
                      // EXCEPTION: OCX Property Pages should return FALSE
101
}
102
 
103
void CBuildOptionsDialog::OnSelchangedTree(NMHDR* pNMHDR, LRESULT* pResult)
104
{
105
        NM_TREEVIEW* pNMTreeView = (NM_TREEVIEW*)pNMHDR;
106
  m_hCurrent=pNMTreeView->itemNew.hItem;
107
        Redisplay(m_hCurrent);
108
  *pResult = 0;
109
}
110
 
111
void CBuildOptionsDialog::OnSelchangeCombo()
112
{
113
  if(m_hCurrent){
114
    Redisplay(m_hCurrent);
115
  }
116
}
117
 
118
void CBuildOptionsDialog::Redisplay(HTREEITEM h)
119
{
120
  CConfigItem *pti=(CConfigItem *)m_Tree.GetItemData(h);
121
        const CdlValuable valuable = pti->GetCdlValuable();
122
  std::string name;
123
  const CdlBuildInfo_Loadable *pe=NULL;
124
  if(valuable){
125
    const char *pszname=valuable->get_name().c_str();
126
    for(EntriesArray::size_type j=0;j<arEntries.size();j++){
127
      if(0==strcmp(arEntries[j].name.c_str(),pszname)){
128
        pe=&arEntries[j];
129
        break;
130
      }
131
    }
132
  }
133
  CString strCat;
134
  GetDlgItemText(IDC_COMBO1,strCat);
135
  const CString strFlags=get_flags(CConfigTool::GetConfigToolDoc()->GetCdlConfig(),pe,CUtils::UnicodeToStdStr(strCat)).c_str();
136
  CStringArray ar;
137
  CUtils::Chop(strFlags,ar,_TCHAR(' '),false,false);
138
  CString strEdit;
139
  bool bRedraw=(m_List.GetCount()!=ar.GetSize());
140
  if(!bRedraw){
141
    for(int i=0;i<ar.GetSize();i++){
142
      CString strOld;
143
      m_List.GetText(i,strOld);
144
      if(strOld!=ar[i]){
145
        bRedraw=true;
146
        break;
147
      }
148
    }
149
  }
150
  if(bRedraw){
151
    m_List.ResetContent();
152
    for(int i=0;i<ar.GetSize();i++){
153
      m_List.AddString(ar[i]);
154
    }
155
  }
156
}

powered by: WebSVN 2.1.0

© copyright 1999-2024 OpenCores.org, equivalent to Oliscience, all rights reserved. OpenCores®, registered trademark.