📄 fladsview.cpp
字号:
str=_T("电话:0769-2462746");
pCmdUI->SetText(str);
}
void CFLADSView::OnFileOpen()
{
// TODO: Add your command handler code here
FILE *fp;
char chbuf[100],strbuf[100]="";
int i,m;
unsigned int k;
unsigned short buf[100];
CString fileName,string,filt,exty,extt,ext;
theApp.FSTATE=FileOpen;
switch(theApp.ControlMode)
{
case MainControl_Window:
case Set_Window: filt=_T("*.hwl|*.hwl||");
exty=_T("*.hwl");
extt=_T(".hwl");
break;
case Para_Window: return;
break;
case Test_Window: return;
break;
case Info_Window: return;
break;
case Warn_Window: return;
break;
case Curve_Window: filt=_T("TempFile (*.tdx)|*.tdx||");
exty=_T("*.tdx");
extt=_T(".tdx");
break;
default: return;
break;
}
// OPENFILENAME - so i can get to its Help page easily
CFileDialog fileDlg(TRUE,exty,exty,NULL,filt,this);
fileDlg.m_ofn.lpstrInitialDir = _T("\\DiskC");
fileDlg.m_ofn.Flags|=OFN_FILEMUSTEXIST;
fileDlg.m_ofn.lpstrTitle=_T("Open File !");
if (fileDlg.DoModal()==IDOK)
{
AfxGetApp()->DoWaitCursor(1);
string=fileDlg.GetPathName();
fileName=fileDlg.GetFileTitle();
ext=string.Right(4);
if (!ext.CompareNoCase(extt))
{//---------------------------------------------
switch(theApp.ControlMode)
{
case MainControl_Window:
case Set_Window:
fp=fopen("\\DiskC\\Resent.dat","w+b");
string="";
theApp.HwlFileName=fileName;
theApp.HwlFileType=_T(".hwl");
theApp.HwlFileDir=_T("\\DiskC\\");
theApp.HwlFileNameAll=theApp.HwlFileDir+theApp.HwlFileName+theApp.HwlFileType;
m=theApp.HwlFileDir.GetLength();
fwrite((int *)&(m),sizeof(int),1,fp);
fwrite(theApp.HwlFileDir, theApp.HwlFileDir.GetLength(),2,fp);
m=theApp.HwlFileName.GetLength();
fwrite((int *)&(m),sizeof(int),1,fp);
fwrite(theApp.HwlFileName, theApp.HwlFileName.GetLength(),2,fp);
m=theApp.HwlFileType.GetLength();
fwrite((int *)&(m),sizeof(int),1,fp);
fwrite(theApp.HwlFileType, theApp.HwlFileType.GetLength(),2,fp);
fclose(fp);
theApp.LoadHwl();
theApp.openflash=0xff;
break;
case Para_Window:
break;
case Test_Window:
break;
case Info_Window:
break;
case Warn_Window:
break;
case Curve_Window: theApp.init_curve_flag=0xff;
fileName=fileDlg.GetPathName();
theApp.LoadTdx(fileName);
theApp.TdxFileName=fileName;
pDlg->PostMessage(WM_FLASHCURVE);
break;
default:
break;
}
}//---------------------------------------------
}
}
void CFLADSView::OnOpenFloppy()
{
// TODO: Add your command handler code here
_SHELLEXECUTEINFO Info;
Info.lpDirectory=_T("\\DISKC");
Info.lpParameters=NULL;
Info.lpFile=_T("FLMOUNT.EXE");
::ShellExecuteEx(&Info);
}
void CFLADSView::OnFileSaveIn()
{//另存
// TODO: Add your command handler code here
// TODO: Add your control notification handler code here
CString fileName,string,filt,exty,extt,ext;
switch(theApp.ControlMode)
{
case MainControl_Window:
case Set_Window:
filt=_T("*.hwl|*.hwl||");
exty=_T("*.hwl");
extt=_T(".hwl");
break;
case Para_Window: return;
break;
case Test_Window: return;
break;
case Info_Window: return;
break;
case Warn_Window: return;
break;
case Curve_Window: filt=_T("TempFile (*.tdx)|*.tdx||");
exty=_T("*.tdx");
extt=_T(".tdx");
break;
default:
break;
}
CFileDialog fileDlg(FALSE,exty,exty,NULL,filt,this);
fileDlg.m_ofn.lpstrInitialDir = _T("\\DiskC");
fileDlg.m_ofn.Flags|=OFN_FILEMUSTEXIST;
fileDlg.m_ofn.lpstrTitle=_T("Save As File !");
if (fileDlg.DoModal()==IDOK)
{
AfxGetApp()->DoWaitCursor(1);
fileName=fileDlg.GetPathName();
ext=fileName.Right(4);
if (!ext.CompareNoCase(extt))
{
switch(theApp.ControlMode)
{
case MainControl_Window:
case Set_Window: theApp.SaveHwl(fileName);
break;
break;
case Para_Window:
break;
case Test_Window:
break;
case Info_Window:
break;
case Warn_Window:
break;
case Curve_Window: theApp.SaveTdx(fileName);
theApp.TdxFileName=fileName;
theApp.FSTATE=FileOpen;
theApp.init_curve_flag=0xff;
theApp.TDisplayfg=0xff;
break;
default:
break;
}
}
AfxGetApp()->DoWaitCursor(-1);
}
theApp.FSTATE=FileOpen;
}
void CFLADSView::OnFileNew()
{
// TODO: Add your command handler code here
theApp.FSTATE=FileNewCreate;
}
void CFLADSView::OnFileSave()
{
// TODO: Add your command handler code here
FILE *fp;
double dt;
int m;
// CString string1,string2;
if(theApp.FSTATE==FileNewCreate)
{
OnFileSaveIn();
return;
}
switch(theApp.ControlMode)
{
case MainControl_Window:
case Set_Window:
case Test_Window:
case Info_Window:
case Warn_Window: theApp.SaveHwl(theApp.HwlFileNameAll);
theApp.SavePWData();
theApp.SaveWeekSet();
theApp.SaveWarnSet();
theApp.RLPass=0;
if(theApp.ControlMode==Set_Window)
{
if(theApp.ver_sum!=0)
{
if(theApp.ver!=theApp.old_ver)
{
theApp.SaveVerData();
// string1=_T("\\DiskC\\flads.exe"); //中文
// string2=_T("\\DiskC\\flads.bak"); //中文
// CFile::Rename( string1, string2 );
// Sleep(500);
//
// string1=_T("\\DiskC\\flws.exe"); //英文
// string2=_T("\\DiskC\\flads.exe"); //中文
// CFile::Rename( string1, string2 );
// Sleep(500);
// string1=_T("\\DiskC\\flads.bak"); //英文
// string2=_T("\\DiskC\\flws.exe"); //中文
// CFile::Rename( string1, string2 );
theApp.old_ver=theApp.ver;
}
theApp.ver_sum=0;
}
}
break;
case Curve_Window: if(theApp.FSTATE==FileOpen)
{
theApp.SaveTdx(theApp.TdxFileName);
}else
{
OnFileSave();
}
break;
case Para_Window: theApp.SavePara(theApp.pidfilename);
break;
case Plc_Window: theApp.yxtask.SaveFile();
break;
default: break;
}
}
void CFLADSView::OnAllclear()
{//全部清除
// TODO: Add your command handler code here
CMainFrame* m_pMainWnd=(CMainFrame*)AfxGetMainWnd();
switch(theApp.ControlMode)
{
case Info_Window: //信息窗
if(theApp.m_UserPower.KeepTime>0)
{
if( theApp.m_UserPower.Operators[theApp.m_UserPower.CurOperatorid].info_enable!=0)
{
theApp.ClearRecord();
theApp.SoePage=0;
}else
{
AfxMessageBox(_T("No Power!"));
}
}else
{//请登录
m_pMainWnd->SendMessage(WM_COMMAND,IDC_LOGON);
}
break;
case Warn_Window: //告警窗
if(theApp.m_UserPower.KeepTime>0)
{
if( theApp.m_UserPower.Operators[theApp.m_UserPower.CurOperatorid].warn_enable!=0)
{
theApp.ClearWarnRecord();
theApp.WarnPage=0;
}else
{
AfxMessageBox(_T("No Power!"));
}
}else
{//请登录
m_pMainWnd->SendMessage(WM_COMMAND,IDC_LOGON);
}
break;
}
pDlg->PostMessage(WM_TIMER);
}
void CFLADSView::OnDnpage()
{//向下翻页
// TODO: Add your command handler code here
switch(theApp.ControlMode)
{
case Info_Window://信息窗
theApp.SoePage+=20;
if(theApp.SoePage>=199)theApp.SoePage=199;
break;
case Warn_Window://告警窗
theApp.WarnPage+=20;
if(theApp.WarnPage>=199)theApp.WarnPage=199;
break;
}
pDlg->PostMessage(WM_TIMER);
}
void CFLADSView::OnUppage()
{//向上翻页
// TODO: Add your command handler code here
switch(theApp.ControlMode)
{
case Info_Window://信息窗
if(theApp.SoePage>=20) theApp.SoePage=theApp.SoePage-20;
else theApp.SoePage=0;
break;
case Warn_Window://告警窗
if(theApp.WarnPage>=20) theApp.WarnPage=theApp.WarnPage-20;
else theApp.WarnPage=0;
break;
}
pDlg->PostMessage(WM_TIMER);
}
void CFLADSView::OnStartSample()
{//开始采样
// TODO: Add your command handler code here
pDlg->PostMessage(WM_STARTSAMPLE);
}
void CFLADSView::OnStopSample()
{//停止采样
// TODO: Add your command handler code here
pDlg->PostMessage(WM_STOPSAMPLE);
}
void CFLADSView::OnLevel()
{//水平
// TODO: Add your command handler code here
pDlg->PostMessage(WM_LEVELPLAY);
}
void CFLADSView::OnVerity()
{//垂直
// TODO: Add your command handler code here
pDlg->PostMessage(WM_VERTYPLAY);
}
void CFLADSView::OnEsc()
{//取消
// TODO: Add your command handler code here
pDlg->PostMessage(WM_ESCFILE);
}
void CFLADSView::OnLogonSet()
{
// TODO: Add your command handler code here
CLogonDlg dlg;
theApp.logontype=0;
dlg.DoModal();
}
void CFLADSView::OnLogonPara()
{
// TODO: Add your command handler code here
CLogonDlg dlg;
theApp.logontype=1;
dlg.DoModal();
}
void CFLADSView::OnLogonExit()
{
// TODO: Add your command handler code here
CLogonDlg dlg;
theApp.logontype=2;
dlg.DoModal();
}
void CFLADSView::OnPlc()
{//PLC设置窗
// TODO: Add your command handler code here
if(theApp.m_UserPower.KeepTime>0)
{
if( theApp.m_UserPower.Operators[theApp.m_UserPower.CurOperatorid].plc_enable!=0)
{
CMainFrame* m_pMainWnd=(CMainFrame*)AfxGetMainWnd();
m_pMainWnd->m_wndToolBar.LoadToolBar(IDR_PARAFRAME);
m_pMainWnd->pFladsView=this;
pDlg->DestroyWindow();
if(pDlg!=NULL) delete pDlg;
pDlg = new CPlcWndDlg;
pDlg->Create(IDD_PLC_FORM,this);
pDlg->ShowWindow(SW_SHOWMAXIMIZED);
return;
}else
{
AfxMessageBox(_T("No Power!"));
}
}else
{//请登录
CMainFrame* m_pMainWnd=(CMainFrame*)AfxGetMainWnd();
m_pMainWnd->SendMessage(WM_COMMAND,IDC_LOGON);
}
/* CLogonDlg dlg;
theApp.logontype=3;
dlg.DoModal();
if(theApp.pass_plc==888888)
{
CMainFrame* m_pMainWnd=(CMainFrame*)AfxGetMainWnd();
m_pMainWnd->m_wndToolBar.LoadToolBar(IDR_PARAFRAME);
m_pMainWnd->pFladsView=this;
pDlg->DestroyWindow();
if(pDlg!=NULL) delete pDlg;
pDlg = new CPlcWndDlg;
pDlg->Create(IDD_PLC_FORM,this);
pDlg->ShowWindow(SW_SHOWMAXIMIZED);
}*/
}
void CFLADSView::OnFlashPlc()
{
switch(theApp.ControlMode)
{
case Plc_Window : pDlg->PostMessage(WM_TIMER);
break;
}
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -