|
|
|
|
|
|
|
|
|
|
|
|
|
|
//#include "stdafx.h"
|
|
|
|
|
#include "display.h"
|
|
|
|
|
#include "commport.h"
|
|
|
|
|
|
|
|
|
|
extern SIO_PARAM_DEF SioParam[];
|
|
|
|
|
|
|
|
|
|
extern int iCurDevIdx;
|
|
|
|
|
// extern DEV_DEF DevParam[];
|
|
|
|
|
|
|
|
|
|
#ifdef _WIN32
|
|
|
|
|
HWND hMainWnd;
|
|
|
|
|
#endif
|
|
|
|
|
|
|
|
|
|
int RealDataDispFlag;
|
|
|
|
|
|
|
|
|
|
int CurPort;
|
|
|
|
|
int DispType = 0;
|
|
|
|
|
|
|
|
|
|
int ListIndex = 0; // <20><>ʾ<EFBFBD><CABE><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ʼ
|
|
|
|
|
int ItemNumOfPage; // ҳ<><D2B3>ʾ<EFBFBD><CABE>Ŀ<EFBFBD><C4BF>
|
|
|
|
|
|
|
|
|
|
#ifdef _WIN32
|
|
|
|
|
|
|
|
|
|
COLORREF dwColorVal[16] = // <20><>ʾ<EFBFBD><CABE>ɫ<EFBFBD><C9AB><EFBFBD><EFBFBD>
|
|
|
|
|
{
|
|
|
|
|
RGB(255,255,255), RGB(128,128,128),
|
|
|
|
|
RGB(255, 0, 0), RGB(255,255, 0),
|
|
|
|
|
RGB( 0,255, 0), RGB( 0,255,255),
|
|
|
|
|
RGB( 0, 0,255), RGB(255, 0,255),
|
|
|
|
|
RGB(192,192,192), RGB( 0, 0, 0),
|
|
|
|
|
RGB(128, 0, 0), RGB(128,128, 0),
|
|
|
|
|
RGB( 0,128, 0), RGB( 0,128,128),
|
|
|
|
|
RGB( 0, 0,128), RGB(128, 0,128)
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
void RealAiDataDisp( HDC hdc )
|
|
|
|
|
{
|
|
|
|
|
UINT xWd, yHg, lineh, tmp;
|
|
|
|
|
int i, j, total, idx, itemofline;
|
|
|
|
|
char szbuf[256];
|
|
|
|
|
RECT rc;
|
|
|
|
|
AI_DEF *aiptr;
|
|
|
|
|
|
|
|
|
|
float sp;
|
|
|
|
|
int pos[6];
|
|
|
|
|
|
|
|
|
|
GetClientRect( hMainWnd, &rc );
|
|
|
|
|
|
|
|
|
|
itemofline = 2;
|
|
|
|
|
|
|
|
|
|
CaculateWH( hdc, &xWd, &yHg, (char*)"<EFBFBD>о<EFBFBD>" );
|
|
|
|
|
lineh = yHg + 5;
|
|
|
|
|
|
|
|
|
|
rc.top = 10;
|
|
|
|
|
|
|
|
|
|
SetTextColor( hdc, dwColorVal[BLUE] );
|
|
|
|
|
|
|
|
|
|
// <20><>ʾ<EFBFBD><CABE><EFBFBD><EFBFBD>
|
|
|
|
|
sprintf( szbuf,"<EFBFBD>˿<EFBFBD>%02d ʵʱң<CAB1><D2A3><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ϣ", CurPort + 1 );
|
|
|
|
|
DrawText(hdc, (CONST WCHAR*)szbuf, strlen(szbuf), &rc, DT_CENTER );
|
|
|
|
|
rc.top += (lineh + 5);
|
|
|
|
|
|
|
|
|
|
SetTextColor( hdc, dwColorVal[BLACK] );
|
|
|
|
|
|
|
|
|
|
// <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ʾλ<CABE><CEBB>
|
|
|
|
|
pos[0] = 0;
|
|
|
|
|
pos[3] = rc.right / 2;
|
|
|
|
|
|
|
|
|
|
tmp = 0;
|
|
|
|
|
CaculateWH( hdc, &xWd, &yHg, (char*)"<EFBFBD><EFBFBD><EFBFBD><EFBFBD>" );
|
|
|
|
|
tmp += xWd;
|
|
|
|
|
|
|
|
|
|
pos[1] = pos[0] + xWd;
|
|
|
|
|
pos[4] = pos[3] + xWd;
|
|
|
|
|
|
|
|
|
|
CaculateWH( hdc, &xWd, &yHg, (char*)"<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>" );
|
|
|
|
|
tmp += xWd;
|
|
|
|
|
|
|
|
|
|
pos[2] = pos[1] + xWd;
|
|
|
|
|
pos[5] = pos[4] + xWd;
|
|
|
|
|
|
|
|
|
|
CaculateWH( hdc, &xWd, &yHg, (char*)"<EFBFBD><EFBFBD><EFBFBD><EFBFBD>ԭֵ" );
|
|
|
|
|
tmp += xWd;
|
|
|
|
|
sp = ((float)rc.right - (float)tmp*itemofline) / (itemofline*4);
|
|
|
|
|
pos[0] += (int)sp;
|
|
|
|
|
pos[1] += (int)(sp*2);
|
|
|
|
|
pos[2] += (int)(sp*3);
|
|
|
|
|
pos[3] += (int)(sp);
|
|
|
|
|
pos[4] += (int)(sp*2);
|
|
|
|
|
pos[5] += (int)(sp*3);
|
|
|
|
|
|
|
|
|
|
// <20><>ʾ<EFBFBD><CABE>Ŀ<EFBFBD><C4BF><EFBFBD><EFBFBD>
|
|
|
|
|
for ( i = 0; i < itemofline; i++ )
|
|
|
|
|
{
|
|
|
|
|
sprintf( szbuf, (char*)"<EFBFBD><EFBFBD><EFBFBD><EFBFBD>" );
|
|
|
|
|
rc.left = pos[i*3];
|
|
|
|
|
DrawText( hdc, (CONST WCHAR*)szbuf, strlen(szbuf), &rc, DT_LEFT );
|
|
|
|
|
sprintf( szbuf, (char*)"<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>" );
|
|
|
|
|
rc.left = pos[i*3+1];
|
|
|
|
|
DrawText( hdc, (CONST WCHAR*)szbuf, strlen(szbuf), &rc, DT_LEFT );
|
|
|
|
|
sprintf( szbuf, (char*)"<EFBFBD><EFBFBD><EFBFBD><EFBFBD>ԭֵ" );
|
|
|
|
|
rc.left = pos[i*3+2];
|
|
|
|
|
DrawText( hdc, (CONST WCHAR*)szbuf, strlen(szbuf), &rc, DT_LEFT );
|
|
|
|
|
}
|
|
|
|
|
rc.top += lineh;
|
|
|
|
|
|
|
|
|
|
ItemNumOfPage = (rc.bottom - rc.top) / lineh;
|
|
|
|
|
|
|
|
|
|
if( !IsBaoHuPtr(CurPort) )
|
|
|
|
|
return;
|
|
|
|
|
|
|
|
|
|
// <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
|
|
|
|
total = (SioParam[CurPort].m_psBaoHu->AiNum + itemofline - 1) / itemofline;
|
|
|
|
|
|
|
|
|
|
// <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ʾ<EFBFBD><CABE><EFBFBD><EFBFBD>ʼλ<CABC><CEBB>
|
|
|
|
|
if ( total < ItemNumOfPage )
|
|
|
|
|
ListIndex = 0;
|
|
|
|
|
if ( (ListIndex + ItemNumOfPage) > total )
|
|
|
|
|
ListIndex = total - ItemNumOfPage;
|
|
|
|
|
if ( ListIndex < 0 )
|
|
|
|
|
ListIndex = 0;
|
|
|
|
|
|
|
|
|
|
// <20><>ʾ<EFBFBD><CABE><EFBFBD><EFBFBD>
|
|
|
|
|
idx = ListIndex * itemofline;
|
|
|
|
|
aiptr = (AI_DEF*)SioParam[CurPort].m_psBaoHu->AiPtr;
|
|
|
|
|
if( !aiptr )
|
|
|
|
|
return;
|
|
|
|
|
|
|
|
|
|
for ( i = 0; (i < ItemNumOfPage) && (idx < SioParam[CurPort].m_psBaoHu->AiNum); i++ )
|
|
|
|
|
{
|
|
|
|
|
for ( j = 0; j < itemofline; j++ )
|
|
|
|
|
{
|
|
|
|
|
if((idx + j) >= SioParam[CurPort].m_psBaoHu->AiNum)
|
|
|
|
|
break;
|
|
|
|
|
|
|
|
|
|
sprintf( szbuf, "%03d", idx + j + 1 );
|
|
|
|
|
rc.left = pos[j*3+0];
|
|
|
|
|
CaculateWH( hdc, &xWd, &yHg, (char*)"<EFBFBD><EFBFBD><EFBFBD><EFBFBD>" );
|
|
|
|
|
rc.right = rc.left + xWd;
|
|
|
|
|
DrawText( hdc, (CONST WCHAR*)szbuf, strlen(szbuf), &rc, DT_CENTER );
|
|
|
|
|
|
|
|
|
|
sprintf( szbuf, "ң<EFBFBD><EFBFBD>%03d", idx + j + 1 );
|
|
|
|
|
rc.left = pos[j*3+1];
|
|
|
|
|
CaculateWH( hdc, &xWd, &yHg, (char*)"<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>" );
|
|
|
|
|
rc.right = rc.left + xWd;
|
|
|
|
|
DrawText( hdc, (CONST WCHAR*)szbuf, strlen(szbuf), &rc, DT_CENTER );
|
|
|
|
|
|
|
|
|
|
sprintf( szbuf, "0x%04x", aiptr[idx+j].RawValue & 0xffff );
|
|
|
|
|
rc.left = pos[j*3+2];
|
|
|
|
|
CaculateWH( hdc, &xWd, &yHg, (char*)"<EFBFBD><EFBFBD><EFBFBD><EFBFBD>ԭֵ" );
|
|
|
|
|
rc.right = rc.left + xWd;
|
|
|
|
|
DrawText( hdc, (CONST WCHAR*)szbuf, strlen(szbuf), &rc, DT_CENTER );
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
idx += itemofline;
|
|
|
|
|
rc.top += lineh;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void RealDiDataDisp( HDC hdc )
|
|
|
|
|
{
|
|
|
|
|
UINT xWd, yHg, lineh, tmp;
|
|
|
|
|
int i, j, total, idx, itemofline;
|
|
|
|
|
char szbuf[256], stchar = 1;
|
|
|
|
|
RECT rc;
|
|
|
|
|
DI_DEF *diptr;
|
|
|
|
|
|
|
|
|
|
float sp;
|
|
|
|
|
int pos[6];
|
|
|
|
|
|
|
|
|
|
GetClientRect( hMainWnd, &rc );
|
|
|
|
|
|
|
|
|
|
CaculateWH( hdc, &xWd, &yHg, (char*)"<EFBFBD>о<EFBFBD>" );
|
|
|
|
|
lineh = yHg + 5;
|
|
|
|
|
|
|
|
|
|
itemofline = 2;
|
|
|
|
|
|
|
|
|
|
rc.top = 10;
|
|
|
|
|
|
|
|
|
|
SetTextColor( hdc, dwColorVal[BLUE] );
|
|
|
|
|
|
|
|
|
|
// <20><>ʾ<EFBFBD><CABE><EFBFBD><EFBFBD>
|
|
|
|
|
sprintf( szbuf,"<EFBFBD>˿<EFBFBD>%02d ʵʱң<CAB1><D2A3><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ϣ", CurPort + 1 );
|
|
|
|
|
DrawText(hdc, (CONST WCHAR*)szbuf, strlen(szbuf), &rc, DT_CENTER );
|
|
|
|
|
rc.top += (lineh + 5);
|
|
|
|
|
|
|
|
|
|
SetTextColor( hdc, dwColorVal[BLACK] );
|
|
|
|
|
|
|
|
|
|
// <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ʾλ<CABE><CEBB>
|
|
|
|
|
pos[0] = 0;
|
|
|
|
|
pos[3] = rc.right / 2;
|
|
|
|
|
|
|
|
|
|
tmp = 0;
|
|
|
|
|
CaculateWH( hdc, &xWd, &yHg, (char*)"<EFBFBD><EFBFBD><EFBFBD><EFBFBD>" );
|
|
|
|
|
tmp += xWd;
|
|
|
|
|
|
|
|
|
|
pos[1] = pos[0] + xWd;
|
|
|
|
|
pos[4] = pos[3] + xWd;
|
|
|
|
|
|
|
|
|
|
CaculateWH( hdc, &xWd, &yHg, (char*)"<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>" );
|
|
|
|
|
tmp += xWd;
|
|
|
|
|
|
|
|
|
|
pos[2] = pos[1] + xWd;
|
|
|
|
|
pos[5] = pos[4] + xWd;
|
|
|
|
|
|
|
|
|
|
CaculateWH( hdc, &xWd, &yHg, (char*)"״̬" );
|
|
|
|
|
tmp += xWd;
|
|
|
|
|
sp = ((float)rc.right - (float)tmp*itemofline) / (itemofline*4);
|
|
|
|
|
pos[0] += (int)sp;
|
|
|
|
|
pos[1] += (int)(sp*2);
|
|
|
|
|
pos[2] += (int)(sp*3);
|
|
|
|
|
pos[3] += (int)(sp);
|
|
|
|
|
pos[4] += (int)(sp*2);
|
|
|
|
|
pos[5] += (int)(sp*3);
|
|
|
|
|
|
|
|
|
|
// <20><>ʾ<EFBFBD><CABE>Ŀ<EFBFBD><C4BF><EFBFBD><EFBFBD>
|
|
|
|
|
for ( i = 0; i < itemofline; i++ )
|
|
|
|
|
{
|
|
|
|
|
sprintf( szbuf, (char*)"<EFBFBD><EFBFBD><EFBFBD><EFBFBD>" );
|
|
|
|
|
rc.left = pos[i*3+0];
|
|
|
|
|
DrawText( hdc, (CONST WCHAR*)szbuf, strlen(szbuf), &rc, DT_LEFT );
|
|
|
|
|
|
|
|
|
|
sprintf( szbuf, (char*)"<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>" );
|
|
|
|
|
rc.left = pos[i*3+1];
|
|
|
|
|
DrawText( hdc, (CONST WCHAR*)szbuf, strlen(szbuf), &rc, DT_LEFT );
|
|
|
|
|
|
|
|
|
|
sprintf( szbuf, (char*)"״̬" );
|
|
|
|
|
rc.left = pos[i*3+2];
|
|
|
|
|
DrawText( hdc, (CONST WCHAR*)szbuf, strlen(szbuf), &rc, DT_LEFT );
|
|
|
|
|
}
|
|
|
|
|
rc.top += lineh;
|
|
|
|
|
|
|
|
|
|
ItemNumOfPage = (rc.bottom - rc.top) / lineh;
|
|
|
|
|
|
|
|
|
|
if( !IsBaoHuPtr(CurPort) )
|
|
|
|
|
return;
|
|
|
|
|
|
|
|
|
|
// <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
|
|
|
|
total = (SioParam[CurPort].m_psBaoHu->DiNum + itemofline - 1) / itemofline;
|
|
|
|
|
|
|
|
|
|
// <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ʾ<EFBFBD><CABE><EFBFBD><EFBFBD>ʼλ<CABC><CEBB>
|
|
|
|
|
if ( total < ItemNumOfPage )
|
|
|
|
|
ListIndex = 0;
|
|
|
|
|
if ( (ListIndex + ItemNumOfPage) > total )
|
|
|
|
|
ListIndex = total - ItemNumOfPage;
|
|
|
|
|
if ( ListIndex < 0 )
|
|
|
|
|
ListIndex = 0;
|
|
|
|
|
|
|
|
|
|
// <20><>ʾ<EFBFBD><CABE><EFBFBD><EFBFBD>
|
|
|
|
|
idx = ListIndex * itemofline;
|
|
|
|
|
diptr = (DI_DEF*)SioParam[CurPort].m_psBaoHu->DiPtr;
|
|
|
|
|
if( !diptr )
|
|
|
|
|
return;
|
|
|
|
|
|
|
|
|
|
for ( i = 0; (i < ItemNumOfPage) && (idx < SioParam[CurPort].m_psBaoHu->DiNum); i++ )
|
|
|
|
|
{
|
|
|
|
|
for ( j = 0; j < itemofline; j++ )
|
|
|
|
|
{
|
|
|
|
|
if((idx + j) >= SioParam[CurPort].m_psBaoHu->DiNum)
|
|
|
|
|
break;
|
|
|
|
|
|
|
|
|
|
sprintf( szbuf, "%03d", idx + j + 1 );
|
|
|
|
|
rc.left = pos[j*3+0];
|
|
|
|
|
CaculateWH( hdc, &xWd, &yHg, (char*)"<EFBFBD><EFBFBD><EFBFBD><EFBFBD>" );
|
|
|
|
|
rc.right = rc.left + xWd;
|
|
|
|
|
DrawText( hdc, (CONST WCHAR*)szbuf, strlen(szbuf), &rc, DT_CENTER );
|
|
|
|
|
|
|
|
|
|
sprintf( szbuf, "ң<EFBFBD><EFBFBD>%03d", idx + j + 1 );
|
|
|
|
|
rc.left = pos[j*3+1];
|
|
|
|
|
CaculateWH( hdc, &xWd, &yHg, (char*)"<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>" );
|
|
|
|
|
rc.right = rc.left + xWd;
|
|
|
|
|
DrawText( hdc, (CONST WCHAR*)szbuf, strlen(szbuf), &rc, DT_CENTER );
|
|
|
|
|
|
|
|
|
|
sprintf( szbuf, "%s", diptr[idx+j].Status ? (char*)"<EFBFBD><EFBFBD>" : (char*)"<EFBFBD><EFBFBD>" );
|
|
|
|
|
rc.left = pos[j*3+2];
|
|
|
|
|
CaculateWH( hdc, &xWd, &yHg, (char*)"״̬" );
|
|
|
|
|
rc.right = rc.left + xWd;
|
|
|
|
|
DrawText( hdc, (CONST WCHAR*)szbuf, strlen(szbuf), &rc, DT_CENTER );
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
idx += itemofline;
|
|
|
|
|
rc.top += lineh;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void RealPiDataDisp( HDC hdc )
|
|
|
|
|
{
|
|
|
|
|
UINT xWd, yHg, lineh, tmp;
|
|
|
|
|
int i, j, total, idx, itemofline;
|
|
|
|
|
char szbuf[256];
|
|
|
|
|
RECT rc;
|
|
|
|
|
PI_DEF *piptr;
|
|
|
|
|
|
|
|
|
|
float sp;
|
|
|
|
|
int pos[6];
|
|
|
|
|
|
|
|
|
|
GetClientRect( hMainWnd, &rc );
|
|
|
|
|
itemofline = 2;
|
|
|
|
|
|
|
|
|
|
CaculateWH( hdc, &xWd, &yHg, (char*)"<EFBFBD>о<EFBFBD>" );
|
|
|
|
|
lineh = yHg + 5;
|
|
|
|
|
|
|
|
|
|
rc.top = 10;
|
|
|
|
|
|
|
|
|
|
SetTextColor( hdc, dwColorVal[BLUE] );
|
|
|
|
|
|
|
|
|
|
// <20><>ʾ<EFBFBD><CABE><EFBFBD><EFBFBD>
|
|
|
|
|
sprintf( szbuf,"<EFBFBD>˿<EFBFBD>%02d ʵʱ<CAB5><CAB1><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ϣ", CurPort + 1 );
|
|
|
|
|
DrawText(hdc, (CONST WCHAR*)szbuf, strlen(szbuf), &rc, DT_CENTER );
|
|
|
|
|
rc.top += (lineh + 5);
|
|
|
|
|
|
|
|
|
|
SetTextColor( hdc, dwColorVal[BLACK] );
|
|
|
|
|
|
|
|
|
|
// <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ʾλ<CABE><CEBB>
|
|
|
|
|
pos[0] = 0;
|
|
|
|
|
pos[3] = rc.right / 2;
|
|
|
|
|
|
|
|
|
|
tmp = 0;
|
|
|
|
|
CaculateWH( hdc, &xWd, &yHg, (char*)"<EFBFBD><EFBFBD><EFBFBD><EFBFBD>" );
|
|
|
|
|
tmp += xWd;
|
|
|
|
|
|
|
|
|
|
pos[1] = pos[0] + xWd;
|
|
|
|
|
pos[4] = pos[3] + xWd;
|
|
|
|
|
|
|
|
|
|
CaculateWH( hdc, &xWd, &yHg, (char*)"<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>" );
|
|
|
|
|
tmp += xWd;
|
|
|
|
|
|
|
|
|
|
pos[2] = pos[1] + xWd;
|
|
|
|
|
pos[5] = pos[4] + xWd;
|
|
|
|
|
|
|
|
|
|
CaculateWH( hdc, &xWd, &yHg, (char*)"<EFBFBD><EFBFBD><EFBFBD><EFBFBD>ԭֵ" );
|
|
|
|
|
tmp += xWd;
|
|
|
|
|
sp = ((float)rc.right - (float)tmp*itemofline) / (itemofline*4);
|
|
|
|
|
pos[0] += (int)sp;
|
|
|
|
|
pos[1] += (int)(sp*2);
|
|
|
|
|
pos[2] += (int)(sp*3);
|
|
|
|
|
pos[3] += (int)(sp);
|
|
|
|
|
pos[4] += (int)(sp*2);
|
|
|
|
|
pos[5] += (int)(sp*3);
|
|
|
|
|
|
|
|
|
|
// <20><>ʾ<EFBFBD><CABE>Ŀ<EFBFBD><C4BF><EFBFBD><EFBFBD>
|
|
|
|
|
for ( i = 0; i < itemofline; i++ )
|
|
|
|
|
{
|
|
|
|
|
sprintf( szbuf, (char*)"<EFBFBD><EFBFBD><EFBFBD><EFBFBD>" );
|
|
|
|
|
rc.left = pos[i*3+0];
|
|
|
|
|
DrawText( hdc, (CONST WCHAR*)szbuf, strlen(szbuf), &rc, DT_LEFT );
|
|
|
|
|
|
|
|
|
|
sprintf( szbuf, (char*)"<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>" );
|
|
|
|
|
rc.left = pos[i*3+1];
|
|
|
|
|
DrawText( hdc, (CONST WCHAR*)szbuf, strlen(szbuf), &rc, DT_LEFT );
|
|
|
|
|
|
|
|
|
|
sprintf( szbuf, (char*)"<EFBFBD><EFBFBD><EFBFBD><EFBFBD>ԭֵ" );
|
|
|
|
|
rc.left = pos[i*3+2];
|
|
|
|
|
DrawText( hdc, (CONST WCHAR*)szbuf, strlen(szbuf), &rc, DT_LEFT );
|
|
|
|
|
}
|
|
|
|
|
rc.top += lineh;
|
|
|
|
|
|
|
|
|
|
ItemNumOfPage = (rc.bottom - rc.top) / lineh;
|
|
|
|
|
|
|
|
|
|
if( !IsBaoHuPtr(CurPort) )
|
|
|
|
|
return;
|
|
|
|
|
|
|
|
|
|
// <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
|
|
|
|
total = (SioParam[CurPort].m_psBaoHu->PiNum + itemofline - 1) / itemofline;
|
|
|
|
|
|
|
|
|
|
// <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ʾ<EFBFBD><CABE><EFBFBD><EFBFBD>ʼλ<CABC><CEBB>
|
|
|
|
|
if ( total < ItemNumOfPage )
|
|
|
|
|
ListIndex = 0;
|
|
|
|
|
if ( (ListIndex + ItemNumOfPage) > total )
|
|
|
|
|
ListIndex = total - ItemNumOfPage;
|
|
|
|
|
if ( ListIndex < 0 )
|
|
|
|
|
ListIndex = 0;
|
|
|
|
|
|
|
|
|
|
// <20><>ʾ<EFBFBD><CABE><EFBFBD><EFBFBD>
|
|
|
|
|
idx = ListIndex * itemofline;
|
|
|
|
|
piptr = (PI_DEF*)SioParam[CurPort].m_psBaoHu->PiPtr;
|
|
|
|
|
if( !piptr )
|
|
|
|
|
return;
|
|
|
|
|
|
|
|
|
|
for ( i = 0; (i < ItemNumOfPage) && (idx < SioParam[CurPort].m_psBaoHu->PiNum); i++ )
|
|
|
|
|
{
|
|
|
|
|
for ( j = 0; j < itemofline; j++ )
|
|
|
|
|
{
|
|
|
|
|
if((idx + j) >= SioParam[CurPort].m_psBaoHu->PiNum)
|
|
|
|
|
break;
|
|
|
|
|
|
|
|
|
|
sprintf( szbuf, "%03d", idx + j + 1 );
|
|
|
|
|
rc.left = pos[j*3+0];
|
|
|
|
|
CaculateWH( hdc, &xWd, &yHg, (char*)"<EFBFBD><EFBFBD><EFBFBD><EFBFBD>" );
|
|
|
|
|
rc.right = rc.left + xWd;
|
|
|
|
|
DrawText( hdc, (CONST WCHAR*)szbuf, strlen(szbuf), &rc, DT_CENTER );
|
|
|
|
|
|
|
|
|
|
sprintf( szbuf, "<EFBFBD><EFBFBD><EFBFBD><EFBFBD>%03d", idx + j + 1);
|
|
|
|
|
rc.left = pos[j*3+1];
|
|
|
|
|
CaculateWH( hdc, &xWd, &yHg, (char*)"<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>" );
|
|
|
|
|
rc.right = rc.left + xWd;
|
|
|
|
|
DrawText( hdc, (CONST WCHAR*)szbuf, strlen(szbuf), &rc, DT_CENTER );
|
|
|
|
|
|
|
|
|
|
sprintf( szbuf, "0x%08x", piptr[idx+j].RawValue );
|
|
|
|
|
rc.left = pos[j*3+2];
|
|
|
|
|
CaculateWH( hdc, &xWd, &yHg, (char*)"<EFBFBD><EFBFBD><EFBFBD><EFBFBD>ԭֵ" );
|
|
|
|
|
// wen 2004.11.19 <20><>ʾ<EFBFBD>ij<EFBFBD><C4B3><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ƶ<EFBFBD>1.5<EFBFBD><EFBFBD>
|
|
|
|
|
//rc.right = rc.left + xWd;
|
|
|
|
|
//DrawText( hdc, szbuf, strlen(szbuf), &rc, DT_CENTER );
|
|
|
|
|
rc.right = rc.left + xWd/4*6;
|
|
|
|
|
DrawText( hdc, (CONST WCHAR*)szbuf, strlen(szbuf), &rc, DT_LEFT );
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
idx += itemofline;
|
|
|
|
|
rc.top += lineh;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void WatchDataDisp( HDC hdc )
|
|
|
|
|
{
|
|
|
|
|
#if 0
|
|
|
|
|
UINT xWd, yHg, lineh;
|
|
|
|
|
int i, j, total, idx, type;
|
|
|
|
|
char szbuf[256];
|
|
|
|
|
RECT rc;
|
|
|
|
|
|
|
|
|
|
GetClientRect( hMainWnd, &rc );
|
|
|
|
|
|
|
|
|
|
CaculateWH( hdc, &xWd, &yHg, (char*)"<EFBFBD>о<EFBFBD>" );
|
|
|
|
|
lineh = yHg + 5;
|
|
|
|
|
|
|
|
|
|
rc.top = 10;
|
|
|
|
|
|
|
|
|
|
if ( DevParam[iCurDevIdx].WatchDispLine.LineCnt == 0 )
|
|
|
|
|
{
|
|
|
|
|
sprintf( szbuf, "<EFBFBD><EFBFBD>ǰû<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>....." );
|
|
|
|
|
DrawText(hdc, (CONST WCHAR*)szbuf, strlen(szbuf), &rc, DT_LEFT );
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
ItemNumOfPage = (rc.bottom - rc.top) / lineh;
|
|
|
|
|
|
|
|
|
|
total = DevParam[iCurDevIdx].WatchDispLine.LineCnt;
|
|
|
|
|
if ( RealDataDispFlag )
|
|
|
|
|
ListIndex = 100000;
|
|
|
|
|
|
|
|
|
|
// <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ʾ<EFBFBD><CABE><EFBFBD><EFBFBD>ʼλ<CABC><CEBB>
|
|
|
|
|
if ( total < ItemNumOfPage )
|
|
|
|
|
ListIndex = 0;
|
|
|
|
|
if ( (ListIndex + ItemNumOfPage) > total )
|
|
|
|
|
ListIndex = total - ItemNumOfPage;
|
|
|
|
|
if ( ListIndex < 0 )
|
|
|
|
|
ListIndex = 0;
|
|
|
|
|
|
|
|
|
|
// Ѱ<><D1B0><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ʼλ<CABC><CEBB>
|
|
|
|
|
idx = DevParam[iCurDevIdx].WatchDispLine.Rear - total;
|
|
|
|
|
if ( idx < 0 )
|
|
|
|
|
idx += MAX_DISP_LINE;
|
|
|
|
|
|
|
|
|
|
// <20><>ʾ<EFBFBD><CABE>ʼλ<CABC><CEBB>
|
|
|
|
|
idx += ListIndex;
|
|
|
|
|
|
|
|
|
|
for ( i = 0; i < min(ItemNumOfPage, total); i++ )
|
|
|
|
|
{
|
|
|
|
|
j = (idx + i) % MAX_DISP_LINE;
|
|
|
|
|
|
|
|
|
|
type = DevParam[iCurDevIdx].WatchDispLine.Line[j][0];
|
|
|
|
|
if ( type == 'R' ) // <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
|
|
|
|
SetTextColor( hdc, dwColorVal[BLUE] );
|
|
|
|
|
else
|
|
|
|
|
SetTextColor( hdc, dwColorVal[MAGENTA] );
|
|
|
|
|
|
|
|
|
|
strcpy( szbuf, (char*)&DevParam[iCurDevIdx].WatchDispLine.Line[j][1] );
|
|
|
|
|
|
|
|
|
|
DrawText( hdc, (CONST WCHAR*)szbuf, strlen(szbuf), &rc, DT_LEFT );
|
|
|
|
|
|
|
|
|
|
rc.top += lineh;
|
|
|
|
|
}
|
|
|
|
|
#endif
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
//***************************************************************
|
|
|
|
|
//* <09><><EFBFBD><EFBFBD><EFBFBD>庯<EFBFBD><E5BAAF>? *
|
|
|
|
|
//***************************************************************
|
|
|
|
|
HFONT NewFont( int nFSize )
|
|
|
|
|
{
|
|
|
|
|
/*
|
|
|
|
|
WCHAR typeface[32] = (WCHAR *)"<EFBFBD><EFBFBD><EFBFBD><EFBFBD>";
|
|
|
|
|
|
|
|
|
|
LOGFONT LogFont = { 0, 0, 0, 0,
|
|
|
|
|
400,
|
|
|
|
|
0,
|
|
|
|
|
0,
|
|
|
|
|
0,
|
|
|
|
|
DEFAULT_CHARSET,
|
|
|
|
|
//OUT_STROKE_PRECIS,
|
|
|
|
|
OUT_STRING_PRECIS,
|
|
|
|
|
CLIP_DEFAULT_PRECIS,
|
|
|
|
|
PROOF_QUALITY,
|
|
|
|
|
DEFAULT_PITCH,
|
|
|
|
|
typeface
|
|
|
|
|
//"<22><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>"
|
|
|
|
|
//"<22><><EFBFBD><EFBFBD>"
|
|
|
|
|
//"<22><><EFBFBD><EFBFBD>"
|
|
|
|
|
//"<22><>Բ"
|
|
|
|
|
//"<22><><EFBFBD><EFBFBD>_GB2312"
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
LogFont.lfWidth = (LONG)((float)nFSize*.618);
|
|
|
|
|
|
|
|
|
|
LogFont.lfHeight = (LONG)nFSize;
|
|
|
|
|
|
|
|
|
|
strcpy( LogFont.lfFaceName, "Lee<EFBFBD><EFBFBD><EFBFBD><EFBFBD>" );
|
|
|
|
|
return( CreateFontIndirect( &LogFont ));*/
|
|
|
|
|
return NULL;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void DataDisp( HWND hWnd )
|
|
|
|
|
{
|
|
|
|
|
HDC hdc;
|
|
|
|
|
HFONT hFont;
|
|
|
|
|
int nFSize;
|
|
|
|
|
|
|
|
|
|
hdc = GetDC( hWnd );
|
|
|
|
|
|
|
|
|
|
if( WATCH_DATA_DISP != DispType)
|
|
|
|
|
nFSize = 16;
|
|
|
|
|
else
|
|
|
|
|
nFSize = 12;
|
|
|
|
|
|
|
|
|
|
hFont = (HFONT)SelectObject( hdc, NewFont( nFSize ) );
|
|
|
|
|
|
|
|
|
|
if( !IsBaoHuPtr(CurPort) )
|
|
|
|
|
return;
|
|
|
|
|
|
|
|
|
|
switch( DispType )
|
|
|
|
|
{
|
|
|
|
|
case AI_DATA_DISP:
|
|
|
|
|
if(PROV_PROTOCOL != SioParam[CurPort].m_psBaoHu->PortType)
|
|
|
|
|
RealAiDataDisp( hdc );
|
|
|
|
|
break;
|
|
|
|
|
|
|
|
|
|
case DI_DATA_DISP:
|
|
|
|
|
if(PROV_PROTOCOL != SioParam[CurPort].m_psBaoHu->PortType)
|
|
|
|
|
RealDiDataDisp( hdc );
|
|
|
|
|
break;
|
|
|
|
|
|
|
|
|
|
case PI_DATA_DISP:
|
|
|
|
|
if(PROV_PROTOCOL != SioParam[CurPort].m_psBaoHu->PortType)
|
|
|
|
|
RealPiDataDisp( hdc );
|
|
|
|
|
break;
|
|
|
|
|
|
|
|
|
|
case WATCH_DATA_DISP:
|
|
|
|
|
WatchDataDisp( hdc );
|
|
|
|
|
break;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
DeleteObject( SelectObject(hdc, hFont) );
|
|
|
|
|
|
|
|
|
|
ReleaseDC( hWnd, hdc );
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
//***************************************************************
|
|
|
|
|
//* <20><><EFBFBD><EFBFBD><EFBFBD>ִ<EFBFBD><D6B4><EFBFBD>ʾ<EFBFBD><CABE><EFBFBD>Ⱥ߶<CDB8> *
|
|
|
|
|
//***************************************************************
|
|
|
|
|
void CaculateWH( HDC hdc, UINT *xWidth, UINT *yHeight, char *szStr )
|
|
|
|
|
{
|
|
|
|
|
RECT rc;
|
|
|
|
|
|
|
|
|
|
DrawText( hdc, (CONST WCHAR*)szStr, strlen(szStr), &rc, DT_CALCRECT );
|
|
|
|
|
*xWidth = rc.right - rc.left;
|
|
|
|
|
*yHeight = rc.bottom - rc.top;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
#endif
|
|
|
|
|
|
|
|
|
|
//****************************************************************
|
|
|
|
|
//* <20><>ʾ<EFBFBD><CABE><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ҳ? *
|
|
|
|
|
//****************************************************************
|
|
|
|
|
void PageUp( void )
|
|
|
|
|
{
|
|
|
|
|
ListIndex -= ItemNumOfPage;
|
|
|
|
|
if ( ListIndex < 0 )
|
|
|
|
|
ListIndex = 0;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
//***************************************************************
|
|
|
|
|
//* <20><>ʾ<EFBFBD><CABE><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ҳ? *
|
|
|
|
|
//***************************************************************
|
|
|
|
|
void PageDown( void )
|
|
|
|
|
{
|
|
|
|
|
ListIndex += ItemNumOfPage;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
//***************************************************************
|
|
|
|
|
//* <09><>ʾ<EFBFBD>˿<EFBFBD><CBBF><EFBFBD><EFBFBD><EFBFBD>һҳ<D2BB><D2B3><EFBFBD><EFBFBD> *
|
|
|
|
|
//***************************************************************
|
|
|
|
|
void PageEnd( void )
|
|
|
|
|
{
|
|
|
|
|
ListIndex = 100000;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
//***************************************************************
|
|
|
|
|
//* <09><>ʾ<EFBFBD>˿<EFBFBD><CBBF><EFBFBD>ǰһҳ<D2BB><D2B3><EFBFBD><EFBFBD>? *
|
|
|
|
|
//***************************************************************
|
|
|
|
|
void PageHome( void )
|
|
|
|
|
{
|
|
|
|
|
ListIndex = 0;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void LineUp( void )
|
|
|
|
|
{
|
|
|
|
|
ListIndex--;
|
|
|
|
|
|
|
|
|
|
if ( ListIndex < 0 )
|
|
|
|
|
ListIndex = 0;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
//***************************************************************
|
|
|
|
|
//* <09><>ʾ<EFBFBD><CABE><EFBFBD><EFBFBD>һ<EFBFBD><D2BB>? *
|
|
|
|
|
//***************************************************************
|
|
|
|
|
void LineDown( void )
|
|
|
|
|
{
|
|
|
|
|
ListIndex++;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
int GetCurPort()
|
|
|
|
|
{
|
|
|
|
|
return CurPort;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
int IsRealDataDisp()
|
|
|
|
|
{
|
|
|
|
|
return RealDataDispFlag;
|
|
|
|
|
}
|