235 lines
5.5 KiB
C++
235 lines
5.5 KiB
C++
// GasFireCalcDlg.cpp : implementation file
|
|
//
|
|
|
|
#include "stdafx.h"
|
|
#include "resource.h"
|
|
#include "GasFireCalcDlg.h"
|
|
#include "TGAs.h"
|
|
|
|
#ifdef _DEBUG
|
|
#define new DEBUG_NEW
|
|
#undef THIS_FILE
|
|
static char THIS_FILE[] = __FILE__;
|
|
#endif
|
|
|
|
void GasFireCalc()
|
|
{
|
|
CGasFireCalcDlg dlg;
|
|
{
|
|
CTemporaryResourceOverride vTemp;
|
|
dlg.Create(IDD_CALC_GASFIRE, acedGetAcadFrame());
|
|
}
|
|
dlg.ShowWindow(SW_SHOW);
|
|
acedGetAcadDwgView()->SetFocus();
|
|
|
|
// 通过隐含的用户交互函数暂停程序,以便完成操作
|
|
acedInitGet(RSG_NOZERO, _T("~ "));
|
|
TCHAR sz[10];
|
|
acedGetString(0, _T(""),sz);
|
|
|
|
dlg.DestroyWindow();
|
|
}
|
|
|
|
/////////////////////////////////////////////////////////////////////////////
|
|
// CGasFireCalcDlg dialog
|
|
|
|
|
|
CGasFireCalcDlg::CGasFireCalcDlg(CWnd* pParent /*=NULL*/)
|
|
: CModelessDialog(CGasFireCalcDlg::IDD, pParent)
|
|
{
|
|
//{{AFX_DATA_INIT(CGasFireCalcDlg)
|
|
// NOTE: the ClassWizard will add member initialization here
|
|
m_nType = 0;
|
|
//}}AFX_DATA_INIT
|
|
}
|
|
|
|
|
|
void CGasFireCalcDlg::DoDataExchange(CDataExchange* pDX)
|
|
{
|
|
CModelessDialog::DoDataExchange(pDX);
|
|
//{{AFX_DATA_MAP(CGasFireCalcDlg)
|
|
DDX_Control(pDX, IDC_TAB_SEL, m_wndTabCalcType);
|
|
//}}AFX_DATA_MAP
|
|
}
|
|
|
|
|
|
BEGIN_MESSAGE_MAP(CGasFireCalcDlg, CModelessDialog)
|
|
//{{AFX_MSG_MAP(CGasFireCalcDlg)
|
|
ON_NOTIFY(TCN_SELCHANGE, IDC_TAB_SEL, OnSelchangeTabSel)
|
|
ON_WM_CLOSE()
|
|
//}}AFX_MSG_MAP
|
|
END_MESSAGE_MAP()
|
|
|
|
/////////////////////////////////////////////////////////////////////////////
|
|
// CGasFireCalcDlg message handlers
|
|
|
|
void CGasFireCalcDlg::OnSelchangeTabSel(NMHDR* pNMHDR, LRESULT* pResult)
|
|
{
|
|
// TODO: Add your control notification handler code here
|
|
|
|
UpdateData(TRUE);
|
|
m_nType = m_wndTabCalcType.GetCurSel();
|
|
CalcTypeChange();
|
|
*pResult = 0;
|
|
acedGetAcadDwgView()->SetFocus();
|
|
}
|
|
|
|
BOOL CGasFireCalcDlg::OnInitDialog()
|
|
{
|
|
CModelessDialog::OnInitDialog();
|
|
|
|
m_wndTabCalcType.InsertItem(0, _T("七氟丙烷灭火系统"));
|
|
m_wndTabCalcType.InsertItem(1, _T("IG541混合气体灭火系统"));
|
|
m_wndTabCalcType.InsertItem(2, _T("热气溶胶预制灭火系统"));
|
|
m_wndTabCalcType.SetCurSel(m_nType);
|
|
|
|
CodeBase db;
|
|
XString fullFile;
|
|
if(!FindFile(_T("twtdatastore.dbf"), fullFile))
|
|
{
|
|
AfxMessageBox(_T("对不起,没有发现twtdatastore.dbf文件!"));
|
|
acedGetAcadDwgView()->SetFocus();
|
|
}
|
|
|
|
m_dlgType1.Create(IDD_CALC_GASFIRE1, &m_wndTabCalcType);
|
|
m_dlgType2.Create(IDD_CALC_GASFIRE2, &m_wndTabCalcType);
|
|
m_dlgType3.Create(IDD_CALC_GASFIRE3, &m_wndTabCalcType);
|
|
CRect rect;
|
|
m_wndTabCalcType.GetClientRect(&rect);
|
|
rect.right += 20;
|
|
m_wndTabCalcType.MoveWindow(&rect);
|
|
|
|
m_dlgType1.GetClientRect(&rect);
|
|
rect.left += 7;
|
|
rect.top += 25;
|
|
rect.right += 7;
|
|
rect.bottom += 25;
|
|
m_dlgType1.MoveWindow(&rect);
|
|
|
|
m_dlgType2.GetClientRect(&rect);
|
|
rect.left += 7;
|
|
rect.top += 25;
|
|
rect.right += 7;
|
|
rect.bottom += 25;
|
|
m_dlgType2.MoveWindow(&rect);
|
|
|
|
m_dlgType3.GetClientRect(&rect);
|
|
rect.left += 7;
|
|
rect.top += 25;
|
|
rect.right += 7;
|
|
rect.bottom += 25;
|
|
m_dlgType3.MoveWindow(&rect);
|
|
|
|
UpdateData(FALSE);
|
|
CalcTypeChange();
|
|
|
|
return TRUE;
|
|
}
|
|
|
|
void CGasFireCalcDlg::CalcTypeChange()
|
|
{
|
|
m_dlgType1.ShowWindow(SW_HIDE);
|
|
m_dlgType2.ShowWindow(SW_HIDE);
|
|
m_dlgType3.ShowWindow(SW_HIDE);
|
|
switch(m_wndTabCalcType.GetCurSel())
|
|
{
|
|
case 0:
|
|
{
|
|
m_dlgType1.ShowWindow(SW_SHOW);
|
|
CRect rect1;
|
|
m_dlgType1.GetWindowRect(&rect1);
|
|
CRect rect;
|
|
GetClientRect(&rect);
|
|
double dW1 = 0.0, dW2 = 0.0, dH1 = 0.0, dH2 = 0.0;
|
|
dW1 = rect1.Width();
|
|
dW2 = rect.Width();
|
|
dH1 = rect1.Height();
|
|
dH2 = rect.Height();
|
|
GetWindowRect(&rect);
|
|
rect.right += dW1 - dW2 + 25;
|
|
rect.bottom += dH1 - dH2 + 40;
|
|
MoveWindow(&rect);
|
|
// 调整tab大小
|
|
m_wndTabCalcType.GetClientRect(&rect);
|
|
dW1 = rect1.Width();
|
|
dW2 = rect.Width();
|
|
dH1 = rect1.Height();
|
|
dH2 = rect.Height();
|
|
rect.left += 5;
|
|
rect.top += 5;
|
|
rect.right += dW1 - dW2 + 20;
|
|
rect.bottom += dH1 - dH2 + 35;
|
|
m_wndTabCalcType.MoveWindow(&rect);
|
|
break;
|
|
}
|
|
case 1:
|
|
{
|
|
m_dlgType2.ShowWindow(SW_SHOW);
|
|
CRect rect1;
|
|
m_dlgType2.GetWindowRect(&rect1);
|
|
CRect rect;
|
|
GetClientRect(&rect);
|
|
double dW1 = 0.0, dW2 = 0.0, dH1 = 0.0, dH2 = 0.0;
|
|
dW1 = rect1.Width();
|
|
dW2 = rect.Width();
|
|
dH1 = rect1.Height();
|
|
dH2 = rect.Height();
|
|
GetWindowRect(&rect);
|
|
rect.right += dW1 - dW2 + 25;
|
|
rect.bottom += dH1 - dH2 + 40;
|
|
MoveWindow(&rect);
|
|
// 调整tab大小
|
|
m_wndTabCalcType.GetClientRect(&rect);
|
|
dW1 = rect1.Width();
|
|
dW2 = rect.Width();
|
|
dH1 = rect1.Height();
|
|
dH2 = rect.Height();
|
|
rect.left += 5;
|
|
rect.top += 5;
|
|
rect.right += dW1 - dW2 + 20;
|
|
rect.bottom += dH1 - dH2 + 35;
|
|
m_wndTabCalcType.MoveWindow(&rect);
|
|
break;
|
|
}
|
|
case 2:
|
|
{
|
|
m_dlgType3.ShowWindow(SW_SHOW);
|
|
CRect rect1;
|
|
m_dlgType3.GetWindowRect(&rect1);
|
|
CRect rect;
|
|
GetClientRect(&rect);
|
|
double dW1 = 0.0, dW2 = 0.0, dH1 = 0.0, dH2 = 0.0;
|
|
dW1 = rect1.Width();
|
|
dW2 = rect.Width();
|
|
dH1 = rect1.Height();
|
|
dH2 = rect.Height();
|
|
GetWindowRect(&rect);
|
|
rect.right += dW1 - dW2 + 25;
|
|
rect.bottom += dH1 - dH2 + 40;
|
|
MoveWindow(&rect);
|
|
// 调整tab大小
|
|
m_wndTabCalcType.GetClientRect(&rect);
|
|
dW1 = rect1.Width();
|
|
dW2 = rect.Width();
|
|
dH1 = rect1.Height();
|
|
dH2 = rect.Height();
|
|
rect.left += 5;
|
|
rect.top += 5;
|
|
rect.right += dW1 - dW2 + 20;
|
|
rect.bottom += dH1 - dH2 + 35;
|
|
m_wndTabCalcType.MoveWindow(&rect);
|
|
break;
|
|
}
|
|
}
|
|
}
|
|
|
|
void CGasFireCalcDlg::OnClose()
|
|
{
|
|
m_dlgType1.DestroyWindow();
|
|
m_dlgType2.DestroyWindow();
|
|
m_dlgType3.DestroyWindow();
|
|
PostCommand(_T("~ "));
|
|
acedGetAcadDwgView()->SetFocus();
|
|
CModelessDialog::OnClose();
|
|
}
|