⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 curs0.c

📁 nucleus 文件系统,内核和彩色图形系统,在小系统上非常好用
💻 C
📖 第 1 页 / 共 2 页
字号:
/*************************************************************************/
/*                                                                       */
/*         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          */
/*                                                                       */
/*      CURS0.c                                          1.9             */
/*                                                                       */
/* COMPONENT                                                             */
/*                                                                       */
/*      All                                                              */
/*                                                                       */
/* DESCRIPTION                                                           */
/*                                                                       */
/*      This file contains the HideCursor, ShowCursor, MoveCursor,       */
/* nuMoveCursor, CursorStyle and CursorBitmap 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 "metaproc.h"
#include "grafdata.h"
#include "metmacs3.h"
#include "curs_ega.h"

#ifndef FIXUP386
#define hyperCursor 1 
#endif

void CursorBitmap (grafMap *argBMAP);


/* Function HideCursor first decrements the cursor-level by 1.
If the cursor becomes hidden (cursor-level just decremented to -1),
HideCursor removes the cursor from the screen, restoring the original
backing image. Otherwise it just returns.

Each call to HideCursor should be balanced by a corresponding call to
ShowCursor. */

void HideCursor()
{
	void nuResume(grafMap *argGRAFMAP);
	WIblitRcd cursWBlit;	/* Cursor write image record */
	image *CursorSavePtr;

	/* pause the cursor from responding to interrupts
	this locks a semaphore to avoid re-entrancy */
	M_PAUSE(cursBlit.blitDmap);

	CursorLevel--;
	if (CursorLevel == -1)	/* if cursor was not just visible, exit */
	{
		/* hide the cursor */

		#ifdef	hyperCursor		/* can we hyper this kind of device ? */
		if (cursDoHyper != 0)
		{
/*			mwMoveCurEGA(-1000,-1000);*/
			goto hcExit;	/* exit */
		}
		#endif

		/* restore backing image with writeimage */
		/* calculate bounding rectangle */
		cursBlist.Xmin = (short) (CursorX - CursorXoff);
		cursBlist.Ymin = (short) (CursorY - CursorYoff);
		CursorSavePtr = (image *) &CursorSave;
		cursBlist.Xmax = (short) (cursBlist.Xmin + CursorSavePtr->imWidth);
		cursBlist.Ymax = (short) (cursBlist.Ymin + CursorSavePtr->imHeight);
		cursWBlit.blitSmap = (long) (&CursorSave);
		cursBlit.blitRop = 0;	/* rasterOp = replace */
	
		/* must disable color translation of the save buffer - 
		if it is a monochrome image, colors would be changed */
		cursBlit.blitBack = 0;
		cursBlit.blitFore = -1;

		/* 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);	/* do it */
	}
hcExit:
	nuResume(cursBlit.blitDmap);
	return;
}


/* Function ShowCursor increments the cursor-level by 1.
If the cursor becomes visible (cursor-level just incremented to 0),
the current cursor is displayed at global CursorX and CursorY.
A backing image is saved (CursorSave) before the cursor is drawn.

Initializing the cursor system is deferred until ShowCursor is called
for the first time, in order to avoid linking the init code unless
ShowCursor is used. This will occur only on the first call to ShowCursor
(gfCurInit flag in gflags is set). */

void ShowCursor()
{
	void nuResume(grafMap *argGRAFMAP);
	short grafErrValue;	/* error value */
	WIblitRcd cursWBlit;	/* Cursor write image record */

	/* pause the cursor from responding to interrupts
	this locks a semaphore to avoid re-entrancy */
	M_PAUSE(cursBlit.blitDmap);

	/* check to see if this cursor is
		1) entering a protected area
		2) exiting a protected area
		3) remaining in a protected area */

	if ((CursorX < CursProtXmin) || (CursorX >= CursProtXmax) ||
		(CursorY < CursProtYmin) || (CursorY >= CursProtYmax))
	{	/* not in a protected area */
		if (gFlags & gfCurPHid) /* were we previously protected? */
		{
			gFlags &= ~gfCurPHid;	/* clear notion of being protected */
			CursorLevel++;	/* remove the extra hide level */
		}
	}
	else	/* cursor is in a protected area */
	{
		if (!(gFlags & gfCurPHid)) /* were we previously protected? */
		{
			gFlags |= gfCurPHid;	/* no, flag as protected */
			goto scExit;	/* exit still hidden */
		}
	}

	CursorLevel++;
	if (CursorLevel > 0)	/* > 0, that's an error! */
	{
		grafErrValue = c_ShowCurs +  c_CursLevel;
		nuGrafErr(grafErrValue);	/* report error */
	}
	else
	{
		if (CursorLevel == 0)
		{	/* cursor level just went to zero, display the cursor */
			/* check to see if the cursor system has ever been called (init'd) */
			if (!(gFlags & gfCurInit))
			{	/* initialize the cursor system - set the cursor blit record */
				cursBlit.blitFlags = bfClipRect;	/* rect clipping */
				cursBlit.blitCnt = 1;	/* one rect in list */
				cursBlit.blitAlloc = sizeof(rect);	/* list = 1 rect long */
				cursBlit.blitList = (long) (&cursBlist);	/* list = *cursBlist */
				cursBlit.blitMask = -1;
				cursBlit.blitClip = &cursClip;	/* Clip = *cursClip */
				CursorLevel--;	/* make non-displayable */
				CursorBitmap(cursBlit.blitDmap); /* this will re-enter ShowCursor */
				gFlags |= gfCurInit;	/* set init'd flag */
				CursorLevel++;	/* make displayable again */
			}

			cursBlist.Xmin = (short) (CursorX - CursorXoff);

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -