You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

200 lines
5.5 KiB
C++

#include "stdafx.h"
#include "PropertiesWnd.h"
#include "Resource.h"
#include "MainFrm.h"
#include "LaiPuLaser.h"
#include "Propertie.h"
#include "Module.h"
#include "LogMgr.h"
#include "PropertieMgr.h"
#include "ModuleDeviceMgr.h"
#ifdef _DEBUG
#undef THIS_FILE
static char THIS_FILE[]=__FILE__;
#define new DEBUG_NEW
#endif
/////////////////////////////////////////////////////////////////////////////
// CResourceViewBar
CPanePropertiesWnd::CPanePropertiesWnd()
{
m_bUseObjectCombo = true;//ʹ<><CAB9><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>б<EFBFBD>
}
CPanePropertiesWnd::~CPanePropertiesWnd()
{
}
BEGIN_MESSAGE_MAP(CPanePropertiesWnd, CDockablePane)
ON_WM_CREATE()
ON_WM_SIZE()
ON_COMMAND(ID_EXPAND_ALL, OnExpandAllProperties)
ON_UPDATE_COMMAND_UI(ID_EXPAND_ALL, OnUpdateExpandAllProperties)
ON_COMMAND(ID_SORTPROPERTIES, OnSortProperties)
ON_UPDATE_COMMAND_UI(ID_SORTPROPERTIES, OnUpdateSortProperties)
ON_WM_SETFOCUS()
ON_WM_SETTINGCHANGE()
END_MESSAGE_MAP()
/////////////////////////////////////////////////////////////////////////////
// CResourceViewBar <20><>Ϣ<EFBFBD><CFA2><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
void CPanePropertiesWnd::DoDataExchange(CDataExchange* pDX)
{
CDockablePane::DoDataExchange(pDX);
DDX_Control(pDX, ID_PROPERTY_COMB, m_wndObjectCombo);
}
#if 1
int CPanePropertiesWnd::OnCreate(LPCREATESTRUCT lpCreateStruct)
{
if (CDockablePane::OnCreate(lpCreateStruct) == -1)
return -1;
CRect rectDummy;
rectDummy.SetRectEmpty();
// <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>:
//const DWORD dwViewStyle = WS_CHILD | WS_VISIBLE | CBS_DROPDOWNLIST | WS_BORDER | CBS_SORT | WS_CLIPSIBLINGS | WS_CLIPCHILDREN;
const DWORD dwViewStyle = WS_CHILD | WS_VISIBLE | CBS_DROPDOWNLIST | WS_BORDER | WS_CLIPSIBLINGS | WS_CLIPCHILDREN;
if(m_bUseObjectCombo)
{
if (!m_wndObjectCombo.Create(dwViewStyle, rectDummy, this, ID_PROPERTY_COMB))
{
TRACE0("δ<EFBFBD>ܴ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> \n");
return -1; // δ<>ܴ<EFBFBD><DCB4><EFBFBD>
}
IniObjectCombo();
}
if (!m_wndPropList.Create(WS_VISIBLE | WS_CHILD, rectDummy, this, 2))
{
TRACE0("δ<EFBFBD>ܴ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>\n");
return -1; // δ<>ܴ<EFBFBD><DCB4><EFBFBD>
}
InitPropList();
m_wndToolBar.Create(this, AFX_DEFAULT_TOOLBAR_STYLE, IDR_PROPERTIES);
m_wndToolBar.LoadToolBar(IDR_PROPERTIES, 0, 0, TRUE /* <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>*/);
m_wndToolBar.CleanUpLockedImages();
m_wndToolBar.LoadBitmap(theApp.m_bHiColorIcons ? IDB_PROPERTIES_HC : IDR_PROPERTIES, 0, 0, TRUE /* <20><><EFBFBD><EFBFBD>*/);
m_wndToolBar.SetPaneStyle(m_wndToolBar.GetPaneStyle() | CBRS_TOOLTIPS | CBRS_FLYBY);
m_wndToolBar.SetPaneStyle(m_wndToolBar.GetPaneStyle() & ~(CBRS_GRIPPER | CBRS_SIZE_DYNAMIC | CBRS_BORDER_TOP | CBRS_BORDER_BOTTOM | CBRS_BORDER_LEFT | CBRS_BORDER_RIGHT));
m_wndToolBar.SetOwner(this);
// <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ͨ<EEBDAB><CDA8><EFBFBD>˿ؼ<CBBF>·<EFBFBD>ɣ<EFBFBD><C9A3><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ͨ<EFBFBD><CDA8><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>·<EFBFBD><C2B7>:
m_wndToolBar.SetRouteCommandsViaFrame(FALSE);
AdjustLayout();
return 0;
}
void CPanePropertiesWnd::OnSize(UINT nType, int cx, int cy)
{
CDockablePane::OnSize(nType, cx, cy);
AdjustLayout();
}
#endif
void CPanePropertiesWnd::OnExpandAllProperties()
{
m_wndPropList.ExpandAll();
}
void CPanePropertiesWnd::OnUpdateExpandAllProperties(CCmdUI* /* pCmdUI */)
{
}
void CPanePropertiesWnd::OnSortProperties()
{
m_wndPropList.SetAlphabeticMode(!m_wndPropList.IsAlphabeticMode());
}
void CPanePropertiesWnd::OnUpdateSortProperties(CCmdUI* pCmdUI)
{
pCmdUI->SetCheck(m_wndPropList.IsAlphabeticMode());
}
void CPanePropertiesWnd::InitPropList()
{
SetPropListFont();
m_wndPropList.EnableHeaderCtrl(FALSE);
m_wndPropList.EnableDescriptionArea();//<2F><><EFBFBD><EFBFBD>˵<EFBFBD><CBB5>area
m_wndPropList.SetVSDotNetLook();
//m_wndPropList.MarkModifiedProperties();//<2F><><EFBFBD>DZ<EFBFBD><C7B1>޸ĵ<DEB8><C4B5><EFBFBD><EFBFBD><EFBFBD>
}
//<2F><><EFBFBD><EFBFBD>һ<EFBFBD><D2BB><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
void CPanePropertiesWnd::InsertGridProperty(CMFCPropertyGridProperty* pProp)
{
if(pProp)
{
m_wndPropList.AddProperty(pProp);
}
}
void CPanePropertiesWnd::OnSetFocus(CWnd* pOldWnd)
{
CDockablePane::OnSetFocus(pOldWnd);
m_wndPropList.SetFocus();
}
void CPanePropertiesWnd::OnSettingChange(UINT uFlags, LPCTSTR lpszSection)
{
CDockablePane::OnSettingChange(uFlags, lpszSection);
SetPropListFont();
}
void CPanePropertiesWnd::SetPropListFont()
{
::DeleteObject(m_fntPropList.Detach());
LOGFONT lf;
afxGlobalData.fontRegular.GetLogFont(&lf);
NONCLIENTMETRICS info;
info.cbSize = sizeof(info);
afxGlobalData.GetNonClientMetrics(info);
lf.lfHeight = info.lfMenuFont.lfHeight;
lf.lfWeight = info.lfMenuFont.lfWeight;
lf.lfItalic = info.lfMenuFont.lfItalic;
m_fntPropList.CreateFontIndirect(&lf);
m_wndPropList.SetFont(&m_fntPropList);
if(m_bUseObjectCombo)
{
m_wndObjectCombo.SetFont(&m_fntPropList);
}
}
#if 1
//ˢ<>¿ؼ<C2BF><D8BC><EFBFBD>λ<EFBFBD><CEBB>
void CPanePropertiesWnd::AdjustLayout()
{
if (GetSafeHwnd() == NULL)
{
return;
}
CRect rectClient,rectCombo;
GetClientRect(rectClient);
int cyCmb = 0;
if(m_bUseObjectCombo)
{
m_wndObjectCombo.GetWindowRect(&rectCombo);
cyCmb = rectCombo.Size().cy;
}
int cyTlb = m_wndToolBar.CalcFixedLayout(FALSE, TRUE).cy;
if(m_bUseObjectCombo)
{
//300 <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ĸ߶<C4B8>
m_wndObjectCombo.SetWindowPos(NULL, rectClient.left, rectClient.top, rectClient.Width(), 300, SWP_NOACTIVATE | SWP_NOZORDER);
}
m_wndToolBar.SetWindowPos(NULL, rectClient.left, rectClient.top + cyCmb, rectClient.Width(), cyTlb, SWP_NOACTIVATE | SWP_NOZORDER);
m_wndPropList.SetWindowPos(NULL, rectClient.left, rectClient.top + cyCmb + cyTlb, rectClient.Width(), rectClient.Height() -(cyCmb+cyTlb), SWP_NOACTIVATE | SWP_NOZORDER);
}
#endif