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

📄 sub2handler.c

📁 神龙卡开发原代码
💻 C
字号:
 /* * C Source file for sub2handler * Copyright (c) Sigma Designs 2002-2003.  All Rights Reserved. */#include<string.h>#include "OsdWindow.h"#include "sub2handler.h"void UnHiliteSel(OSD_WINDOW *wPtr,GR_RECT *rect){	// Unhilite current	if (curSub2 == &parental[0] || curSub2 == &region[0]) {		rect->x = SUB2_XPOS + ((sub2Sel%2)*SUB2_NUM_OFF);	}	rect->y = curSub2[sub2Sel].y;	DrawUnHilite(wPtr, rect);	}static void HiliteSel(OSD_WINDOW *wPtr,GR_RECT *rect){	if (curSub2 == &parental[0] || curSub2 == &region[0]) {		rect->x = SUB2_XPOS + ((sub2Sel%2)*SUB2_NUM_OFF);				}	rect->y = curSub2[sub2Sel].y;	DrawHilite(wPtr, rect);	}void Sub2KeydownHandler(OSD_WINDOW *wPtr,DATA_POINTER ptr){	GR_EVENT *event;	GR_RECT rect;	int tmp, tmpinc;		rect.x = SUB2_XPOS;	if (curSub2 == &parental[0] || curSub2 == &region[0]) {		rect.width = SUB2_NUM_WIDTH;		tmpinc = 2;	}	else {		rect.width = SUB2_WIDTH; 		tmpinc = 1;	}	rect.height = SUB2_HEIGHT;    event=wPtr->lastevent;		switch(event->keystroke.ch) {	case SHOW_UP_KEYDOWN:	SelectNext_Label:			// Find next enabled 		tmp = sub2Sel - tmpinc;		while (tmp >= 0) {			if (curSub2[tmp].enabled)				break;			tmp -= tmpinc;		}		if (tmp >= 0) {	UpdateHilite_Label:						UnHiliteSel(wPtr,&rect);					// Hilite next one			sub2Sel = tmp;			HiliteSel(wPtr,&rect);		}		break;				case SHOW_RIGHT_KEYDOWN:		if (tmpinc != 2)			break;		tmpinc = 1;				// fall through			case SHOW_DOWN_KEYDOWN:		// Find next enabled 				tmp = sub2Sel+tmpinc;			while (tmp < sub2Items) {			if (curSub2[tmp].enabled)				goto UpdateHilite_Label;			tmp += tmpinc;		}				break;			case SHOW_LEFT_KEYDOWN:		// Unhilite current sub1Sel		if (tmpinc == 2) {			if ((sub2Sel % 2) != 0) {				tmpinc = 1;				goto SelectNext_Label;			}		}		goto MapSub1_Label;			case SHOW_ENTER_KEYDOWN:		if (curSub2 == parental) {			//Check password			struct {				int *selected, sub2Sel;			} a;						a.selected = &curSub1->selected;			a.sub2Sel = sub2Sel;			UnHiliteSel(wPtr,&rect);			MapPwdChkHandler(wPtr, (DATA_POINTER) &a);			break;		}				curSub1->selected = sub2Sel;						if (curSub2 == tvOut || curSub2 == hdOut || curSub2 == dviOut)			SaveSettings(wPtr);				MapSub1_Label:		UnHiliteSel(wPtr,&rect);		// Go back to sub1handler and tell it redisplay updated sub2Item selections		MapSub1Handler(wPtr, NULL, 0);		break;	// Quit	case SHOW_SETUP_KEYDOWN:		SaveSettings(wPtr);		MapMainWindow(wPtr, (DATA_POINTER)GR_TRUE);		break;			default:		break;	}}intMapSub2Handler(OSD_WINDOW *wPtr, SUB_ITEM *pSub1, END_ITEM *pSub2, int items){	GR_RECT rect;	int i;		if (pSub2 && items) {		sub2Items = items;		// refind enabled item		sub2Sel = -1;		curSub2 = pSub2;		curSub1 = pSub1;		for (i=0; i<sub2Items; i++)			if (curSub2[i].enabled) {				sub2Sel = i;				break;			}		if (sub2Sel != -1) {					// Found enabled item, so switch handler			wPtr->KbdHandler=Sub2KeydownHandler;			wPtr->KbdHandler_dptr=NULL;					// Redraw,			if (pSub2 == &parental[0] || pSub2 == &region[0])				rect.width = SUB2_NUM_WIDTH;			else				rect.width = SUB2_WIDTH;			rect.x = SUB2_XPOS; rect.y = curSub2[sub2Sel].y; rect.height = SUB2_HEIGHT;			DrawHilite(wPtr, &rect);						return 0;		}			}	return -1;	// no enabled item found}void DrawSub2Menu(OSD_WINDOW *wPtr, END_ITEM *pSub2, int items){	int i;	GR_RECT rect;	// Clear sub1 background	ClearSub2Background(wPtr);		if (pSub2 == &parental[0] || pSub2 == &region[0]) {		for (i=0; i<items; i++) {			rect.x = SUB2_XPOS + ((i%2)*SUB2_NUM_OFF); rect.y = pSub2->y; 			rect.width = SUB2_NUM_WIDTH;  rect.height = SUB2_HEIGHT;			DrawButton(wPtr, &rect);				GrText(wPtr->wid, wPtr->gc, SUB2_XPOS+14+((i%2)*SUB2_NUM_OFF), pSub2->y+SUB_TEXT_YPOS, pSub2->text,-1, GR_TFASCII);			pSub2++;						}	}	else {		for (i=0; i<items; i++) {			rect.x = SUB2_XPOS; rect.y = pSub2->y; rect.width = SUB2_WIDTH;  rect.height = SUB2_HEIGHT;			DrawButton(wPtr, &rect);					if (pSub2->enabled)				GrSetGCForeground (wPtr->gc, MWPALINDEX(255));			else				GrSetGCForeground (wPtr->gc, MWPALINDEX(PALINDEX_DISABLE));						GrText(wPtr->wid, wPtr->gc, SUB2_XPOS+14, pSub2->y+SUB_TEXT_YPOS, pSub2->text,-1, GR_TFASCII);			pSub2++;		}		}		GrSetGCForeground (wPtr->gc, MWPALINDEX(255));}void ClearSub2Background(OSD_WINDOW *wPtr){	GrFillRect(wPtr->wid, wPtr->gc_pal0, SUB2_XPOS, SUB2_YPOS, SUB2_WIDTH, 300);		return;}

⌨️ 快捷键说明

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