📄 curs7.c
字号:
/*************************************************************************/
/* */
/* Copyright (c) 1997 - 1999 Accelerated Technology, Inc. */
/* */
/* PROPRIETARY RIGHTS of Accelerated Technology are involved in the */
/* subject matter of this material. All manufacturing, reproduction, */
/* use, and sales rights pertaining to this subject matter are governed */
/* by the license agreement. The recipient of this software implicitly */
/* accepts the terms of the license. */
/* */
/*************************************************************************/
/*************************************************************************/
/* */
/* FILE NAME VERSION */
/* */
/* CURS7.c 1.9 */
/* */
/* COMPONENT */
/* */
/* All */
/* */
/* DESCRIPTION */
/* */
/* This file contains the ProtectRect & ProtectOff functions. */
/* */
/* AUTHOR */
/* */
/* Robert G. Burrill, Accelerated Technology, Inc. */
/* */
/* DATA STRUCTURES */
/* */
/* None */
/* */
/* FUNCTIONS */
/* */
/* None */
/* */
/* DEPENDENCIES */
/* */
/* None */
/* */
/* HISTORY */
/* */
/* NAME DATE REMARKS */
/* */
/* */
/*************************************************************************/
#include "meta_wnd.h"
#include "metconst.h" /* MetaWINDOW Constant & Stucture Definitions */
#include "metports.h" /* MetaWINDOW Port & Bitmap Definitions */
#include "grafdata.h"
#include "metmacs3.h"
/* Function ProtectRect hides the cursor only when inside the passed
rectangle boundary. If the cursor is currently within the specified
rectangle, it is removed ("hidden") until the cursor moves out of the
rectangle. If the cursor is not within the specified rectangle, it remains
visible until it is moved within the protected area.
The protection rectangle can be disabled by passing either a NULL pointer
or a NULL rectangle. */
void ProtectRect(rect *argPR)
{
#define hyperCursor 1
void HideCursor(void);
void ShowCursor(void);
void nuResume(grafMap *argGRAFMAP);
rect gblR;
rect tempR;
/* check for NULL pointer or null rect */
if ((argPR == 0) || (argPR->Xmax <= argPR->Xmin) || (argPR->Ymax <= argPR->Ymin))
{ /* turn off protect rect */
M_PAUSE(cursBlit.blitDmap); /* pause cursor */
ProtXmin = 0x7F00; /* disable protect rect, force off bitmap */
CursProtXmin = 0x7FFF;
if (gFlags & gfCurPHid) /* is cursor hidden via protect? */
{
gFlags &= ~gfCurPHid; /* flag no longer hidden via protect */
ShowCursor(); /* redisplay cursor */
}
goto PR900; /* exit */
}
tempR = *argPR;
if (globalLevel > 0)
{
/* convert from user to global */
U2GR(tempR, &gblR, 0);
ProtXmin = gblR.Xmin; /* save as new protect rect */
ProtYmin = gblR.Ymin;
ProtXmax = gblR.Xmax;
ProtYmax = gblR.Ymax;
}
else
{
ProtXmin = tempR.Xmin; /* save as new protect rect */
ProtYmin = tempR.Ymin;
ProtXmax = tempR.Xmax;
ProtYmax = tempR.Ymax;
}
M_PAUSE(cursBlit.blitDmap); /* pause cursor */
/* calculate protect rect that encompasses cursor
since hypercursor replaces the backing image with whole bytes
(doesn't combine edges) the protection rectange X values must be
byte aligned */
#ifdef hyperCursor
if (cursDoHyper != 0) /* can we hyper this kind of device? */
{
ProtXmin = ProtXmin & ~7; /* round Xmin down to nearest byte */
ProtXmax |= 7; /* round Xmax up to next byte */
}
#endif
if (gFlags & gfCurInit) /* is cursor even inited? */
{
CursProtXmin = (short) (ProtXmin - CursorImag->imWidth + CursorXoff);
CursProtYmin = (short) (ProtYmin - CursorImag->imHeight + CursorYoff);
CursProtXmax = (short) (ProtXmax + CursorXoff);
CursProtYmax = (short) (ProtYmax + CursorYoff);
/* is cursor in protected area? */
if ((CursorX < CursProtXmin) || (CursorX >= CursProtXmax) ||
(CursorY < CursProtYmin) || (CursorY >= CursProtYmax))
{ /* not in a protected area */
if (gFlags & gfCurPHid) /* as it hidden via protect? */
{
gFlags &= ~gfCurPHid; /* not hidden via protect anymore */
ShowCursor(); /* show it */
}
}
else /* cursor is in a protected area */
{
if (CursorLevel >= 0) /* is cursor visible? */
{
HideCursor(); /* yes, hide corsor and */
gFlags |= gfCurPHid; /* flag as protected */
}
}
}
PR900:
nuResume(cursBlit.blitDmap);
return;
}
/* Function ProtectOff releases the the cursor for normal movement operation.
If the cursor had been "hidden" by the previous ProtectRect call, it is
redisplayed and allowed to follow full tracking movements. */
void ProtectOff()
{
void ShowCursor(void);
void nuResume(grafMap *argGRAFMAP);
M_PAUSE(cursBlit.blitDmap); /* pause cursor */
ProtXmin = 0x7F00; /* disable protect rect, force off bitmap */
CursProtXmin = 0x7FFF;
if (gFlags & gfCurPHid) /* is cursor hidden via protect? */
{
gFlags &= ~gfCurPHid; /* flag no longer hidden via protect */
ShowCursor(); /* redisplay cursor */
}
nuResume(cursBlit.blitDmap);
return;
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -