📄 curs0.c
字号:
cursBlist.Ymin = (short) (CursorY - CursorYoff);
#ifdef hyperCursor /* can we hyper this kind of device ? */
if (cursDoHyper != 0)
{
/* mwMoveCurEGA(cursBlist.Xmin,cursBlist.Ymin);*/
goto scExit; /* exit */
}
#endif
/* Calculate the cursor rectangle */
cursBlist.Xmax = cursBlist.Xmin + CursorImag->imWidth;
cursBlist.Ymax = cursBlist.Ymin + CursorImag->imHeight;
/* Read the current backing area into the cursor save buffer */
(cursBlit.blitDmap->prRdImg)(cursBlit.blitDmap, &CursorSave,
cursBlist.Ymax, cursBlist.Xmax, cursBlist.Ymin, cursBlist.Xmin);
/* Display the current cursor using transparent replace
'CursorMask' defines the backcolor part of the cursor
'CursorImag' defines the forecolor part of the cursor */
cursBlit.blitRop = 16; /* transparent replace */
cursWBlit.blitSmap = (unsigned long) CursorMask;
cursBlit.blitFore = CursBackColor;
/* fill in write image blit record */
cursWBlit.blitRsv = cursBlit.blitRsv;
cursWBlit.blitAlloc = cursBlit.blitAlloc;
cursWBlit.blitFlags = cursBlit.blitFlags;
cursWBlit.blitRop = cursBlit.blitRop;
cursWBlit.blitCnt = cursBlit.blitCnt;
cursWBlit.blitMask = cursBlit.blitMask;
cursWBlit.blitPatl = cursBlit.blitPatl;
cursWBlit.blitDmap = cursBlit.blitDmap;
cursWBlit.blitRegn = cursBlit.blitRegn;
cursWBlit.blitClip = cursBlit.blitClip;
cursWBlit.blitBack = cursBlit.blitBack;
cursWBlit.blitFore = cursBlit.blitFore;
cursWBlit.blitList = cursBlit.blitList;
(cursBlit.blitDmap->prWrImg)(&cursWBlit);
cursWBlit.blitSmap = (unsigned long) CursorImag;
cursWBlit.blitFore = CursForeColor;
(cursBlit.blitDmap->prWrImg)(&cursWBlit);
}
}
scExit:
nuResume(cursBlit.blitDmap);
return;
}
/* Function MoveCursor updates the cursor cursor position to the specified
X,Y location. If the cursor is visible, the cursor is erased and redrawn at
the new specified X,Y position. If the cursor is not visible, the cursor
position register is updated but no screen updates take place. */
void MoveCursor (int argMCX, int argMCY)
{
void nuMoveCursor(int gblX, int gblY);
short gblX;
short gblY;
if (globalLevel > 0)
{
/* convert from user to global */
U2GP(argMCX, argMCY, &gblX, &gblY, 1);
}
else
{
gblX = argMCX;
gblY = argMCY;
}
nuMoveCursor(gblX, gblY);
return;
}
/* Function CursorStyle prepares a cursor image for cursor operations.
argCURNO defines the cursor style number 0 thru 7. If argCURNO is -1, then
the current cursor number is re-selected.
If the cursor is visible, the original cursor is removed and replaced with
the new specified cursor style. If the cursor is not visible, the
cursor style is modified and will be displayed when the ShowCursor
procedure displays it. */
void CursorStyle (int argCURNO)
{
void mwInitShftCurs(image *srcMASK, image *srcIMAG);
void nuResume(grafMap *argGRAFMAP);
short grafErrValue; /* error value */
if ((argCURNO < 0) || (argCURNO > 7)) /* must be 0 - 7 */
{
if (argCURNO != -1) /* if -1, don't post error */
{
grafErrValue = c_CursorSt + c_BadCursNbr;
nuGrafErr(grafErrValue); /* report error */
}
argCURNO = CursorNumbr & 7; /* use existing cursor */
}
/* pause the cursor from responding to interrupts
this locks a semaphore to avoid re-entrancy */
M_PAUSE(cursBlit.blitDmap);
CursorNumbr = argCURNO; /* update cursor number */
HideCursor();
CursorMask = (IMAGSTRUCT *) CursorTable[argCURNO][0]; /* lookup the cursor background image */
CursorImag = (IMAGSTRUCT *) CursorTable[argCURNO][1]; /* lookup the cursor background image */
CursorXoff = CursorTable[argCURNO][2]; /* lookup the hot spots */
CursorYoff = CursorTable[argCURNO][3];
#ifdef hyperCursor
/* precompute shifted cases of cursor images */
if (cursDoHyper != 0) /* can we hyper this kind of device ? */
{ /* yes */
cursImagHeightM1 = CursorImag->imHeight - 1;
cursImagBytesM1 = CursorImag->imBytes;
mwInitShftCurs((image *)CursorMask,(image *)CursorImag);
/* since hypercursor replaces the backing image with whole bytes
(doesn't combine edges) the protection rectange X values must be
byte aligned */
CursProtXmin = ProtXmin & (~7); /* round Xmin down to nearest byte */
CursProtXmax = ProtXmax | 7; /* round Xmax up to next byte */
goto CS600;
}
#endif
/* calculate a protection rectangle that will encompase the cursor */
CursProtXmin = ProtXmin; /* get protect rect */
CursProtXmax = ProtXmax;
CS600:
CursProtXmin = (short) (CursProtXmin - CursorImag->imWidth + CursorXoff);
CursProtYmin = (short) (ProtYmin - CursorImag->imHeight + CursorYoff);
CursProtXmax += (short)CursorXoff;
CursProtYmax = (short) (ProtYmax + CursorYoff);
/* check to see if this cursor is in a protected area */
if ((CursorX < CursProtXmin) || (CursorX >= CursProtXmax) ||
(CursorY < CursProtYmin) || (CursorY >= CursProtYmax))
{ /* not in a protected area */
ShowCursor(); /* turn on the cursor */
}
else /* cursor is in a protected area */
{
if (gFlags & gfCurPHid) /* is cursor already hidden? */
{
ShowCursor();
}
else
{
gFlags |= gfCurPHid; /* no, flag as hidden */
}
}
nuResume(cursBlit.blitDmap);
return;
}
/* CursorBitmap sets the bitmap to be used for cursor tracking. */
void CursorBitmap (grafMap *argBMAP)
{
short cursBMapDevTech;
HideCursor(); /* hide on current bitmap */
cursBlit.blitDmap = argBMAP; /* set cursor blit record dest grafmap */
#ifdef FIXUP386
cursBmap = argBMAP; /* save it here too */
#endif
/* set cursor clip rect to cursor bitmap limits */
cursClip.Xmin = 0;
cursClip.Ymin = 0;
cursClip.Xmax = argBMAP->pixWidth - 1;
cursClip.Ymax = argBMAP->pixHeight - 1;
cursDoHyper = 0;
#ifdef hyperCursor
cursBMapDevTech = argBMAP->devTech;
if ((cursBMapDevTech >= dtEGA) && (cursBMapDevTech <= dtVGA) &&
(argBMAP->mapWinType <=2)) /* can we hyper this kind of device? */
{
cursDoHyper++; /* yes */
cursBMapYmax = argBMAP->pixHeight- 1;
cursBMapBytesM1 = argBMAP->pixBytes - 1;
cursBMapRowTbl = argBMAP->mapTable[0];
oldBuff->pntr = (long) *(argBMAP->mapTable[0] + argBMAP->pixHeight);
newBuff->pntr = oldBuff->pntr + 3*32*16; /* 3*(32 rows)*(16 bytes/row) */
}
#endif
CursorStyle(-1); /* re-init current cursor style */
ShowCursor();
return;
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -