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

Subversion Repositories openrisc

[/] [openrisc/] [trunk/] [rtos/] [ecos-2.0/] [tools/] [src/] [tools/] [configtool/] [common/] [win32/] [PropertiesView.cpp] - Blame information for rev 26

Go to most recent revision | Details | Compare with Previous | View Log

Line No. Rev Author Line
1 26 unneback
//####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
// TestViewView.cpp : implementation of the CPropertiesView class
26
//
27
 
28
#include "stdafx.h"
29
#include "ConfigTool.h"
30
#include "ConfigToolDoc.h"
31
#include "ConfigItem.h"
32
#include "ControlView.h"
33
#include "CTUtils.h"
34
#include "PropertiesList.h"
35
#include "PropertiesView.h"
36
#include "resource.h"
37
 
38
#ifdef _DEBUG
39
#define new DEBUG_NEW
40
#undef THIS_FILE
41
static char THIS_FILE[] = __FILE__;
42
#endif
43
 
44
/////////////////////////////////////////////////////////////////////////////
45
// CPropertiesView
46
 
47
IMPLEMENT_DYNCREATE(CPropertiesView, CView)
48
 
49
BEGIN_MESSAGE_MAP(CPropertiesView, CView)
50
        //{{AFX_MSG_MAP(CPropertiesView)
51
        ON_WM_CREATE()
52
        ON_WM_SIZE()
53
        ON_WM_HELPINFO()
54
        //}}AFX_MSG_MAP
55
END_MESSAGE_MAP()
56
 
57
/////////////////////////////////////////////////////////////////////////////
58
// CPropertiesView construction/destruction
59
 
60
CPropertiesView::CPropertiesView()
61
{
62
  CConfigTool::SetPropertiesView(this);
63
}
64
 
65
CPropertiesView::~CPropertiesView()
66
{
67
  CConfigTool::SetPropertiesView(0);
68
}
69
 
70
BOOL CPropertiesView::PreCreateWindow(CREATESTRUCT& cs)
71
{
72
        // TODO: Modify the Window class or styles here by modifying
73
        //  the CREATESTRUCT cs
74
 
75
        return CView::PreCreateWindow(cs);
76
}
77
 
78
/////////////////////////////////////////////////////////////////////////////
79
// CPropertiesView drawing
80
 
81
void CPropertiesView::OnDraw(CDC* pDC)
82
{
83
  UNUSED_ALWAYS(pDC);
84
}
85
 
86
/////////////////////////////////////////////////////////////////////////////
87
// CPropertiesView diagnostics
88
 
89
#ifdef _DEBUG
90
void CPropertiesView::AssertValid() const
91
{
92
        CView::AssertValid();
93
}
94
 
95
void CPropertiesView::Dump(CDumpContext& dc) const
96
{
97
        CView::Dump(dc);
98
}
99
 
100
#endif //_DEBUG
101
 
102
/////////////////////////////////////////////////////////////////////////////
103
// CPropertiesView message handlers
104
 
105
int CPropertiesView::OnCreate(LPCREATESTRUCT lpCreateStruct)
106
{
107
        if (CView::OnCreate(lpCreateStruct) == -1)
108
                return -1;
109
        CRect rect;
110
  GetClientRect(rect);
111
  m_List.Create(WS_CHILD|WS_VISIBLE,rect,this,1);
112
        return 0;
113
}
114
 
115
void CPropertiesView::OnSize(UINT nType, int cx, int cy)
116
{
117
        CView::OnSize(nType, cx, cy);
118
        CRect rect;
119
  GetClientRect(rect);
120
  m_List.MoveWindow(rect);
121
}
122
 
123
void CPropertiesView::OnInitialUpdate()
124
{
125
        CView::OnInitialUpdate();
126
  CControlView *pControlView=CConfigTool::GetControlView();
127
  if(pControlView){
128
    HTREEITEM hItem = pControlView->GetSelectedItem();
129
    if(NULL!=hItem){
130
      m_List.Fill(&(pControlView->TI(hItem)));
131
    }
132
  }
133
}
134
 
135
void CPropertiesView::OnUpdate(CView* /*pSender*/, LPARAM lHint, CObject* pHint)
136
{
137
  CConfigItem *pti=(CConfigItem *)pHint;
138
 
139
        // For all known hints we redraw everything
140
        // The Selchanged hint tells us what to redraw
141
        CConfigToolDoc* pDoc = CConfigTool::GetConfigToolDoc();
142
        switch(lHint){
143
                case CConfigToolDoc::SelChanged:
144
                        if(pDoc->ItemCount()>0){
145
                                m_List.Fill(pti);
146
                        } else {
147
                                // In process of destroying configitems - no nothing
148
                                m_List.DeleteAllItems();
149
                        }
150
                        break;
151
                case CConfigToolDoc::Clear:
152
                        m_List.Fill(NULL);
153
                        break;
154
                case CConfigToolDoc::IntFormatChanged:
155
                        if(pti && pti->Type()==CConfigItem::Integer){
156
                                m_List.SetItem(CPropertiesList::Value,pti->StringValue());
157
                                m_List.SetItem(CPropertiesList::DefaultValue,CUtils::IntToStr(pti->DefaultValue(),CConfigTool::GetConfigToolDoc()->m_bHex));
158
                        }
159
                        break;
160
                case CConfigToolDoc::AllSaved:
161
                        if(pti){
162
                                m_List.Fill(pti); // lazy update of default value
163
                        }
164
                        break;
165
                case CConfigToolDoc::ValueChanged:
166
                        if(pti){
167
        m_List.RefreshValue();
168
                        }
169
                        break;
170
                default:
171
                        return;
172
        }
173
 
174
}
175
 
176
BOOL CPropertiesView::OnHelpInfo(HELPINFO*)
177
{
178
  return CConfigTool::GetConfigToolDoc()->ShowURL(CUtils::LoadString(IDS_PROPERTIES_VIEW_HELP));
179
}

powered by: WebSVN 2.1.0

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