//####COPYRIGHTBEGIN####
|
//####COPYRIGHTBEGIN####
|
//
|
//
|
// ----------------------------------------------------------------------------
|
// ----------------------------------------------------------------------------
|
// Copyright (C) 1998, 1999, 2000 Red Hat, Inc.
|
// Copyright (C) 1998, 1999, 2000 Red Hat, Inc.
|
//
|
//
|
// This program is part of the eCos host tools.
|
// This program is part of the eCos host tools.
|
//
|
//
|
// This program is free software; you can redistribute it and/or modify it
|
// This program is free software; you can redistribute it and/or modify it
|
// under the terms of the GNU General Public License as published by the Free
|
// under the terms of the GNU General Public License as published by the Free
|
// Software Foundation; either version 2 of the License, or (at your option)
|
// Software Foundation; either version 2 of the License, or (at your option)
|
// any later version.
|
// any later version.
|
//
|
//
|
// This program is distributed in the hope that it will be useful, but WITHOUT
|
// This program is distributed in the hope that it will be useful, but WITHOUT
|
// ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
// ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
// FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
|
// FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
|
// more details.
|
// more details.
|
//
|
//
|
// You should have received a copy of the GNU General Public License along with
|
// You should have received a copy of the GNU General Public License along with
|
// this program; if not, write to the Free Software Foundation, Inc.,
|
// this program; if not, write to the Free Software Foundation, Inc.,
|
// 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
// 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
//
|
//
|
// ----------------------------------------------------------------------------
|
// ----------------------------------------------------------------------------
|
//
|
//
|
//####COPYRIGHTEND####
|
//####COPYRIGHTEND####
|
// TestViewView.cpp : implementation of the CPropertiesView class
|
// TestViewView.cpp : implementation of the CPropertiesView class
|
//
|
//
|
|
|
#include "stdafx.h"
|
#include "stdafx.h"
|
#include "ConfigTool.h"
|
#include "ConfigTool.h"
|
#include "ConfigToolDoc.h"
|
#include "ConfigToolDoc.h"
|
#include "ConfigItem.h"
|
#include "ConfigItem.h"
|
#include "ControlView.h"
|
#include "ControlView.h"
|
#include "CTUtils.h"
|
#include "CTUtils.h"
|
#include "PropertiesList.h"
|
#include "PropertiesList.h"
|
#include "PropertiesView.h"
|
#include "PropertiesView.h"
|
#include "resource.h"
|
#include "resource.h"
|
|
|
#ifdef _DEBUG
|
#ifdef _DEBUG
|
#define new DEBUG_NEW
|
#define new DEBUG_NEW
|
#undef THIS_FILE
|
#undef THIS_FILE
|
static char THIS_FILE[] = __FILE__;
|
static char THIS_FILE[] = __FILE__;
|
#endif
|
#endif
|
|
|
/////////////////////////////////////////////////////////////////////////////
|
/////////////////////////////////////////////////////////////////////////////
|
// CPropertiesView
|
// CPropertiesView
|
|
|
IMPLEMENT_DYNCREATE(CPropertiesView, CView)
|
IMPLEMENT_DYNCREATE(CPropertiesView, CView)
|
|
|
BEGIN_MESSAGE_MAP(CPropertiesView, CView)
|
BEGIN_MESSAGE_MAP(CPropertiesView, CView)
|
//{{AFX_MSG_MAP(CPropertiesView)
|
//{{AFX_MSG_MAP(CPropertiesView)
|
ON_WM_CREATE()
|
ON_WM_CREATE()
|
ON_WM_SIZE()
|
ON_WM_SIZE()
|
ON_WM_HELPINFO()
|
ON_WM_HELPINFO()
|
//}}AFX_MSG_MAP
|
//}}AFX_MSG_MAP
|
END_MESSAGE_MAP()
|
END_MESSAGE_MAP()
|
|
|
/////////////////////////////////////////////////////////////////////////////
|
/////////////////////////////////////////////////////////////////////////////
|
// CPropertiesView construction/destruction
|
// CPropertiesView construction/destruction
|
|
|
CPropertiesView::CPropertiesView()
|
CPropertiesView::CPropertiesView()
|
{
|
{
|
CConfigTool::SetPropertiesView(this);
|
CConfigTool::SetPropertiesView(this);
|
}
|
}
|
|
|
CPropertiesView::~CPropertiesView()
|
CPropertiesView::~CPropertiesView()
|
{
|
{
|
CConfigTool::SetPropertiesView(0);
|
CConfigTool::SetPropertiesView(0);
|
}
|
}
|
|
|
BOOL CPropertiesView::PreCreateWindow(CREATESTRUCT& cs)
|
BOOL CPropertiesView::PreCreateWindow(CREATESTRUCT& cs)
|
{
|
{
|
// TODO: Modify the Window class or styles here by modifying
|
// TODO: Modify the Window class or styles here by modifying
|
// the CREATESTRUCT cs
|
// the CREATESTRUCT cs
|
|
|
return CView::PreCreateWindow(cs);
|
return CView::PreCreateWindow(cs);
|
}
|
}
|
|
|
/////////////////////////////////////////////////////////////////////////////
|
/////////////////////////////////////////////////////////////////////////////
|
// CPropertiesView drawing
|
// CPropertiesView drawing
|
|
|
void CPropertiesView::OnDraw(CDC* pDC)
|
void CPropertiesView::OnDraw(CDC* pDC)
|
{
|
{
|
UNUSED_ALWAYS(pDC);
|
UNUSED_ALWAYS(pDC);
|
}
|
}
|
|
|
/////////////////////////////////////////////////////////////////////////////
|
/////////////////////////////////////////////////////////////////////////////
|
// CPropertiesView diagnostics
|
// CPropertiesView diagnostics
|
|
|
#ifdef _DEBUG
|
#ifdef _DEBUG
|
void CPropertiesView::AssertValid() const
|
void CPropertiesView::AssertValid() const
|
{
|
{
|
CView::AssertValid();
|
CView::AssertValid();
|
}
|
}
|
|
|
void CPropertiesView::Dump(CDumpContext& dc) const
|
void CPropertiesView::Dump(CDumpContext& dc) const
|
{
|
{
|
CView::Dump(dc);
|
CView::Dump(dc);
|
}
|
}
|
|
|
#endif //_DEBUG
|
#endif //_DEBUG
|
|
|
/////////////////////////////////////////////////////////////////////////////
|
/////////////////////////////////////////////////////////////////////////////
|
// CPropertiesView message handlers
|
// CPropertiesView message handlers
|
|
|
int CPropertiesView::OnCreate(LPCREATESTRUCT lpCreateStruct)
|
int CPropertiesView::OnCreate(LPCREATESTRUCT lpCreateStruct)
|
{
|
{
|
if (CView::OnCreate(lpCreateStruct) == -1)
|
if (CView::OnCreate(lpCreateStruct) == -1)
|
return -1;
|
return -1;
|
CRect rect;
|
CRect rect;
|
GetClientRect(rect);
|
GetClientRect(rect);
|
m_List.Create(WS_CHILD|WS_VISIBLE,rect,this,1);
|
m_List.Create(WS_CHILD|WS_VISIBLE,rect,this,1);
|
return 0;
|
return 0;
|
}
|
}
|
|
|
void CPropertiesView::OnSize(UINT nType, int cx, int cy)
|
void CPropertiesView::OnSize(UINT nType, int cx, int cy)
|
{
|
{
|
CView::OnSize(nType, cx, cy);
|
CView::OnSize(nType, cx, cy);
|
CRect rect;
|
CRect rect;
|
GetClientRect(rect);
|
GetClientRect(rect);
|
m_List.MoveWindow(rect);
|
m_List.MoveWindow(rect);
|
}
|
}
|
|
|
void CPropertiesView::OnInitialUpdate()
|
void CPropertiesView::OnInitialUpdate()
|
{
|
{
|
CView::OnInitialUpdate();
|
CView::OnInitialUpdate();
|
CControlView *pControlView=CConfigTool::GetControlView();
|
CControlView *pControlView=CConfigTool::GetControlView();
|
if(pControlView){
|
if(pControlView){
|
HTREEITEM hItem = pControlView->GetSelectedItem();
|
HTREEITEM hItem = pControlView->GetSelectedItem();
|
if(NULL!=hItem){
|
if(NULL!=hItem){
|
m_List.Fill(&(pControlView->TI(hItem)));
|
m_List.Fill(&(pControlView->TI(hItem)));
|
}
|
}
|
}
|
}
|
}
|
}
|
|
|
void CPropertiesView::OnUpdate(CView* /*pSender*/, LPARAM lHint, CObject* pHint)
|
void CPropertiesView::OnUpdate(CView* /*pSender*/, LPARAM lHint, CObject* pHint)
|
{
|
{
|
CConfigItem *pti=(CConfigItem *)pHint;
|
CConfigItem *pti=(CConfigItem *)pHint;
|
|
|
// For all known hints we redraw everything
|
// For all known hints we redraw everything
|
// The Selchanged hint tells us what to redraw
|
// The Selchanged hint tells us what to redraw
|
CConfigToolDoc* pDoc = CConfigTool::GetConfigToolDoc();
|
CConfigToolDoc* pDoc = CConfigTool::GetConfigToolDoc();
|
switch(lHint){
|
switch(lHint){
|
case CConfigToolDoc::SelChanged:
|
case CConfigToolDoc::SelChanged:
|
if(pDoc->ItemCount()>0){
|
if(pDoc->ItemCount()>0){
|
m_List.Fill(pti);
|
m_List.Fill(pti);
|
} else {
|
} else {
|
// In process of destroying configitems - no nothing
|
// In process of destroying configitems - no nothing
|
m_List.DeleteAllItems();
|
m_List.DeleteAllItems();
|
}
|
}
|
break;
|
break;
|
case CConfigToolDoc::Clear:
|
case CConfigToolDoc::Clear:
|
m_List.Fill(NULL);
|
m_List.Fill(NULL);
|
break;
|
break;
|
case CConfigToolDoc::IntFormatChanged:
|
case CConfigToolDoc::IntFormatChanged:
|
if(pti && pti->Type()==CConfigItem::Integer){
|
if(pti && pti->Type()==CConfigItem::Integer){
|
m_List.SetItem(CPropertiesList::Value,pti->StringValue());
|
m_List.SetItem(CPropertiesList::Value,pti->StringValue());
|
m_List.SetItem(CPropertiesList::DefaultValue,CUtils::IntToStr(pti->DefaultValue(),CConfigTool::GetConfigToolDoc()->m_bHex));
|
m_List.SetItem(CPropertiesList::DefaultValue,CUtils::IntToStr(pti->DefaultValue(),CConfigTool::GetConfigToolDoc()->m_bHex));
|
}
|
}
|
break;
|
break;
|
case CConfigToolDoc::AllSaved:
|
case CConfigToolDoc::AllSaved:
|
if(pti){
|
if(pti){
|
m_List.Fill(pti); // lazy update of default value
|
m_List.Fill(pti); // lazy update of default value
|
}
|
}
|
break;
|
break;
|
case CConfigToolDoc::ValueChanged:
|
case CConfigToolDoc::ValueChanged:
|
if(pti){
|
if(pti){
|
m_List.RefreshValue();
|
m_List.RefreshValue();
|
}
|
}
|
break;
|
break;
|
default:
|
default:
|
return;
|
return;
|
}
|
}
|
|
|
}
|
}
|
|
|
BOOL CPropertiesView::OnHelpInfo(HELPINFO*)
|
BOOL CPropertiesView::OnHelpInfo(HELPINFO*)
|
{
|
{
|
return CConfigTool::GetConfigToolDoc()->ShowURL(CUtils::LoadString(IDS_PROPERTIES_VIEW_HELP));
|
return CConfigTool::GetConfigToolDoc()->ShowURL(CUtils::LoadString(IDS_PROPERTIES_VIEW_HELP));
|
}
|
}
|
|
|