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

Subversion Repositories openrisc

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

powered by: WebSVN 2.1.0

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