wpi_win.c
来自「开放源码的编译器open watcom 1.6.0版的源代码」· C语言 代码 · 共 473 行 · 第 1/2 页
C
473 行
if( pt ) {
pt->x = qmsg.pt.x;
pt->y = qmsg.pt.y;
}
} /* _wpi_getqmsgvalues */
void _wpi_setrectvalues( WPI_RECT *rect, WPI_RECTDIM left, WPI_RECTDIM top,
WPI_RECTDIM right, WPI_RECTDIM bottom )
/***********************************************************************/
{
rect->left = left;
rect->right = right;
rect->top = top;
rect->bottom = bottom;
} /* _wpi_setrectvalues */
void _wpi_setwrectvalues( WPI_RECT *rect, WPI_RECTDIM left, WPI_RECTDIM top,
WPI_RECTDIM right, WPI_RECTDIM bottom)
/***********************************************************************/
{
rect->left = left;
rect->right = right;
rect->top = top;
rect->bottom = bottom;
} /* _wpi_setwrectvalues */
void _wpi_getrectvalues( WPI_RECT rect, WPI_RECTDIM *left, WPI_RECTDIM *top,
WPI_RECTDIM *right, WPI_RECTDIM *bottom )
/***********************************************************************/
{
if( left ) *left = rect.left;
if( right ) *right = rect.right;
if( top ) *top = rect.top;
if( bottom ) *bottom = rect.bottom;
} /* _wpi_getrectvalues */
void _wpi_getwrectvalues( WPI_RECT rect, WPI_RECTDIM *left, WPI_RECTDIM *top,
WPI_RECTDIM *right, WPI_RECTDIM *bottom)
/***********************************************************************/
{
if( left ) *left = rect.left;
if( right ) *right = rect.right;
if( top ) *top = rect.top;
if( bottom ) *bottom = rect.bottom;
} /* _wpi_getwrectvalues */
void _wpi_setintrectvalues( WPI_RECT *rect, int left, int top, int right,
int bottom )
/***********************************************************************/
{
rect->left = left;
rect->right = right;
rect->top = top;
rect->bottom = bottom;
} /* _wpi_setintrectvalues */
void _wpi_setintwrectvalues( WPI_RECT *rect, int left, int top, int right,
int bottom)
/***********************************************************************/
{
rect->left = left;
rect->right = right;
rect->top = top;
rect->bottom = bottom;
} /* _wpi_setintwrectvalues */
void _wpi_getintwrectvalues( WPI_RECT rect, int *left, int *top, int *right,
int *bottom)
/***********************************************************************/
{
if( left ) *left = rect.left;
if( right ) *right = rect.right;
if( top ) *top = rect.top;
if( bottom ) *bottom = rect.bottom;
} /* _wpi_getintwrectvalues */
void _wpi_getintrectvalues( WPI_RECT rect, int *left, int *top, int *right,
int *bottom )
/***********************************************************************/
{
if( left ) *left = rect.left;
if( right ) *right = rect.right;
if( top ) *top = rect.top;
if( bottom ) *bottom = rect.bottom;
} /* _wpi_getintrectvalues */
void _wpi_getcurrpos( WPI_PRES pres, WPI_POINT *pt )
/**************************************************/
{
POINT new_pt;
GetCurrentPositionEx( pres, &new_pt );
pt->x = new_pt.x;
pt->y = new_pt.y;
} /* _wpi_getcurrpos */
void _wpi_suspendthread( UINT thread_id, WPI_QMSG *msg )
/******************************************************/
{
thread_id = thread_id; // not used in windows
for( ;; ) {
_wpi_getmessage( NULL, msg, NULL, NULL, NULL );
if( _wpi_ismessage( (*msg), WM_QUIT ) ) {
break;
}
}
} /* _wpi_suspendthread */
void _wpi_setmaxtracksize( WPI_MINMAXINFO _W386FAR *info, int width, int height )
/*******************************************************************************/
{
info->ptMaxSize.x = width;
info->ptMaxSize.y = height;
} /* _wpi_setmaxtracksize */
void _wpi_setmintracksize( WPI_MINMAXINFO _W386FAR *info, int width, int height )
/*******************************************************************************/
{
info->ptMinTrackSize.x = width;
info->ptMinTrackSize.y = height;
} /* _wpi_setmaxtracksize */
void _wpi_getbmphdrvalues( WPI_BITMAPINFOHEADER bmih, ULONG *size,
int *cx, int *cy, short *planes, short *bc, int *comp,
int *size_image, int *xpels, int *ypels, int *used, int *important )
/******************************************************************************/
{
if( size ) *size = bmih.biSize;
if( cx ) *cx = bmih.biWidth;
if( cy ) *cy = bmih.biHeight;
if( planes ) *planes = bmih.biPlanes;
if( bc ) *bc = bmih.biBitCount;
if( comp ) *(comp) = bmih.biCompression;
if( size_image ) *size_image = bmih.biSizeImage;
if( xpels ) *xpels = bmih.biXPelsPerMeter;
if( ypels ) *ypels = bmih.biYPelsPerMeter;
if( used ) *used = bmih.biClrUsed;
if( important ) *important = bmih.biClrImportant;
} /* _wpi_getbmphdrvalues */
void _wpi_setbmphdrvalues( WPI_BITMAPINFOHEADER *bmih, ULONG size,
int cx, int cy, short planes, short bc, int comp,
int size_image, int xpels, int ypels, int used, int important )
/*************************************************************************/
{
bmih->biSize = size;
bmih->biWidth = cx;
bmih->biHeight = cy;
bmih->biPlanes = planes;
bmih->biBitCount = bc;
bmih->biCompression = comp;
bmih->biSizeImage = size_image;
bmih->biXPelsPerMeter = xpels;
bmih->biYPelsPerMeter = ypels;
bmih->biClrUsed = used;
bmih->biClrImportant = important;
} /* _wpi_setbmphdrvalues */
void _wpi_gettextextent( WPI_PRES pres, LPSTR string, int len_string,
int *width, int *height )
/***************************************************************************/
{
SIZE size;
GetTextExtentPoint( pres, string, len_string, &size );
*width = (int)size.cx;
*height = (int)size.cy;
} /* _wpi_gettextextent */
void _wpi_getrestoredrect( HWND hwnd, WPI_RECT *prect )
/*****************************************************/
{
WINDOWPLACEMENT place;
place.length = sizeof( WINDOWPLACEMENT );
GetWindowPlacement( hwnd, &place );
CopyRect( prect, &place.rcNormalPosition );
} /* _wpi_getrestoredrect */
void _wpi_setrestoredrect( HWND hwnd, WPI_RECT *prect )
/*****************************************************/
{
WINDOWPLACEMENT place;
place.length = sizeof( WINDOWPLACEMENT );
CopyRect( &place.rcNormalPosition, (prect) );
place.showCmd = SW_SHOWNORMAL;
SetWindowPlacement( (hwnd), &place );
} /* _wpi_setrestoredrect */
void _wpi_setrgbquadvalues( WPI_RGBQUAD *rgb, BYTE red, BYTE green,
BYTE blue, BYTE option )
/**************************************************************************/
{
rgb->rgbRed = red;
rgb->rgbGreen = green;
rgb->rgbBlue = blue;
rgb->rgbReserved = option;
} /* _wpi_setrgbquadvalues */
int _wpi_dlg_command( HWND dlg_hld, WPI_MSG *msg, WPI_PARAM1 *parm1,
WPI_PARAM2 *parm2 )
/*****************************************************************************/
{
dlg_hld = dlg_hld;
parm1 = parm1;
parm2 = parm2;
if( *msg == WM_COMMAND ) {
return( TRUE );
}
return( FALSE );
} /* _wpi_dlg_command */
int _wpi_getmetricpointsize( WPI_PRES pres, WPI_TEXTMETRIC *tm,
int *pix_size, int *match_num )
/*************************************************************************/
{
int logpixelsy;
int pointsize;
*pix_size = _wpi_metricheight( *tm ) - _wpi_metricileading( *tm );
*match_num = 0;
logpixelsy = GetDeviceCaps( pres, LOGPIXELSY );
pointsize = (int)((float)( (float)( (*pix_size) * 72.0 ) /
(float)logpixelsy ) + .5 );
return( pointsize );
} /* _wpi_getmetricpointsize */
⌨️ 快捷键说明
复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?