📄 nmosd.c
字号:
/*===============================================================
*
* Copyright (C) 2003 ALi Corp. All Rights Reserved.
*
* File: NMOSD.c
*
* Contents: The functions of normal functino show osd.
* Use the new GUI lib
*
* History:
* Date By Reason
* =========== ====== ====================
* 07/02/2003 Haiyuan Create
* 07/05/2003 Lily Ma Add
* 07/06/2003 bond Add
****************************************************************/
#include <comsub.h>
#include <ui.h>
#include <nv.h>
#include <osd.h>
#include <ui_sub.h>
#include <panel.h>
#include <rscstruc.h>
#include <resource.h>
#include <platform.h>
#include <fileopen.h>
#include "normal.h"
#include "NMOSD.h"
#include "../fileopenmenu/GuiControl.h"
#include <setupfunc.h>
#include<guiddi.h>
#include <gui.h>
#include <UIOSD.h>
//030807-01lily:lastplay
DISCLASTPLAY DISCLASTPLAYINFO;
UIBOOKMARK UiBookMark[MAXMARKNUMBER+1];
//end 030807-01lily:lastplay
extern const UINT GUI_LANGUAGEID[13];
extern WORD modeGuiType;
extern BYTE bShowNPswitch;
extern BYTE PLPassWdPos;
extern BYTE PLPassWdCnt;
extern BYTE PLPassWord[];
extern BYTE HLValidKeyProcessing;//30929-01mi
BOOL bIsRegionErrShow = FALSE; //if region error is already show on OSD
ModeBox modebox={
{MODEBOXLEFT,MODEBOXTOP,MODEBOXRIGHT,MODEBOXBOTTOM,241,61/*31*/,104/*128*/},//bond modify 031013
{0,{MODEICONLEFT+MODEICONWIDTH,MODEBOXTOP,MODETEXTRIGHT,MODEBOXBOTTOM,241,255,255},DT_RIGHT|DT_SINGLELINE|DT_VCENTER,30,NULL},
{NULL,MODEICONLEFT,MODEICONTOP,MODEICONWIDTH,MODEICONHEIGHT}
};
//----for console audio item---------------------
BaseRect consoleAudioItemBr=
{
{MODEBOXLEFT,MODEBOXTOP,MODEBOXRIGHT,MODEBOXBOTTOM},
241,61,104
};
BaseBmp consoleAudioItemBb;
MLineConsItem consoleAudioItem=
{
&consoleAudioItemBr,//baserect
&consoleAudioItemBb,//basebmp
3,
0,
{
{'2','.','K','O','R','\0','\0'},
{'\0','U','\0','N','\0','K','\0','N','\0','O','\0','W','\0','\0'},
{'\0','\0','\0','\0','\0','\0','\0','\0','\0','\0','\0','\0','\0','\0','\0','\0'}
}
};
//--end for console audio item---------------------
EXTERN BYTE bNVSpSwOnOff;
extern WORD GetCurrentListID(void);
/*----------------------------------------------------------------------------
* Function name: UiSubFuncBasalInit
* Arguments:
* Return value: None
* Remark: This function Init the NORMAL screen (main screen) for out call
*----------------------------------------------------------------------------*/
void UiSubFuncBasalInit(void)
{
gui_hdc=CreateDC("DISPLAY", "OSD", NULL, NULL);
SetBkMode(gui_hdc,TRANSPARENT);
modeGuiType =0;
}
/*----------------------------------------------------------------------------
* Function name: DrawBaseRect/DrawBREdge/DrawBaseBmp/DrawBaseString
* Arguments:
* Return value: None
* Remark: These function draw basal rectangle,line,bmp and string
*----------------------------------------------------------------------------*/
void DrawBaseRect(HDC hdc,lpBaseRect br)
{
#if 0
HBRUSH hbr;
COLORREF temp;
hbr=CreateSolidBrush(GetColorInDef256Palette(br->bkColor));
FillRect(hdc,&br->rect,hbr);
DeleteObject((HGDIOBJ)hbr);
#endif
DrawBREdge(hdc,br);
}
#if 0
void DrawRectBottEdge(HDC hdc,const lpMarkSrch srchBox)
{
HPEN bottPen,oldPen;
bottPen = CreatePen(PS_SOLID, srchBox->botthigh, GetColorInDef256Palette(srchBox->bottEdgeClr));
oldPen=(HPEN)SelectObject(hdc,(HGDIOBJ)bottPen);
MoveToEx(hdc, srchBox->upleft_x, srchBox->upleft_y+srchBox->high, NULL);
LineTo(hdc,srchBox->upleft_x+srchBox->width-1,srchBox->upleft_y+srchBox->high);
SelectObject(hdc, (HGDIOBJ)oldPen);
DeleteObject((HGDIOBJ)bottPen);
}
#endif
void DrawBREdge(HDC hdc,lpBaseRect br)
{
GUI_CreateButtonControl2(hdc, &(br->rect), GetColorInDef256Palette(br->bkColor), GetColorInDef256Palette(br->leftEdgeColor), GetColorInDef256Palette(br->rightEdgeColor), CL_BKNOCARE, "", NORMAL_STRING, 0, 0);
#if 0
HPEN leftPen,rightPen,oldPen;
int bLeft,bTop,bRight,bBottom;
bLeft = br->rect.left;
bTop = br->rect.top;
bRight = br->rect.right;
bBottom = br->rect.bottom;
leftPen = CreatePen(PS_SOLID, 1, GetColorInDef256Palette(br->leftEdgeColor));
rightPen = CreatePen(PS_SOLID, 1, GetColorInDef256Palette(br->rightEdgeColor));
oldPen=(HPEN)SelectObject(hdc,(HGDIOBJ)leftPen);
MoveToEx(hdc, 1 + bLeft , 1 + bTop, NULL);
LineTo(hdc,bRight-2,1+bTop);
MoveToEx(hdc, 1 + bLeft , 1 + bTop, NULL);
LineTo(hdc,1+bLeft,bBottom-2);
SelectObject(hdc,(HGDIOBJ)rightPen);
MoveToEx(hdc, bRight-1,bBottom -1, NULL);
LineTo(hdc,bLeft-1,bBottom-1);
MoveToEx(hdc, bRight-1,bBottom -1, NULL);
LineTo(hdc,bRight-1,bTop);
SelectObject(hdc,(HGDIOBJ)leftPen);
MoveToEx(hdc, 0 + bLeft , 0 + bTop, NULL);
LineTo(hdc,bRight,bTop);
MoveToEx(hdc, 0 + bLeft , 0 + bTop, NULL);
LineTo(hdc,bLeft,bBottom);
SelectObject(hdc,(HGDIOBJ)rightPen);
MoveToEx(hdc, bRight,bBottom , NULL);
LineTo(hdc,bLeft-1,bBottom);
MoveToEx(hdc, bRight, bBottom , NULL);
LineTo(hdc,bRight,bTop-1);
SelectObject(hdc, (HGDIOBJ)oldPen);
DeleteObject((HGDIOBJ)leftPen);
DeleteObject((HGDIOBJ)rightPen);
#endif
}
void DrawBaseBmp(HDC hdc,lpBaseBmp lpbmp)
{
HBITMAP hbmp;
hbmp=LoadBitmap(NULL,GET_IMNAME(lpbmp->BmpID));
TransparentImage(hdc, lpbmp->upperleftx, lpbmp->upperlefty, 0, 0, hbmp, 0, 0, lpbmp->width, lpbmp->height, GetColorInDef256Palette(255));
DeleteObject((HGDIOBJ)hbmp);
}
void DrawLoadBmp(HDC hdc,lpBaseBmp lpbmp)
{
HBITMAP hbmp;
hbmp=LoadBitmap(NULL, GET_IMNAME(lpbmp->BmpID));
SetImage(hdc, lpbmp->upperleftx, lpbmp->upperlefty, 0, 0, hbmp, 0, 0, lpbmp->width, lpbmp->height);
DeleteObject((HGDIOBJ)hbmp);
}
void DrawBaseStr(HDC hdc,lpBaseStr lpstring)
{
RECT rect;
HBRUSH hbr;
WORD left,right,top,bottom;
BYTE i;
UINT arrformat;
BaseBmp bgbmp;
bgbmp.BmpID=IM_GUI_ICON_BACK;
bgbmp.width=2;
bgbmp.height=56;
SetRect(&rect, lpstring->rect.left, lpstring->rect.top, lpstring->rect.right,lpstring->rect.bottom);
SetTextColor(hdc,GetColorInDef256Palette(lpstring->crColor));
DrawText(hdc, lpstring->str, -1, &rect, lpstring->uFormat);
//draw arrow icon on both side of number
if(lpstring->strAccessory==STR_ARROW_RL_SHOW)
{
//draw left arrow icon of num
SetRect(&rect,lpstring->rect.left-7, lpstring->rect.top,lpstring->rect.left-1,lpstring->rect.bottom);
DrawSmallArrow(hdc, &rect, lpstring->crColor, lpstring->uFormat,ARROW_LEFT);
//draw right arrow icon of num
SetRect(&rect,lpstring->rect.right+1, lpstring->rect.top,lpstring->rect.right+1+7,lpstring->rect.bottom);
DrawSmallArrow(hdc, &rect, lpstring->crColor, lpstring->uFormat,ARROW_RIGHT);
}
else if(lpstring->strAccessory==STR_ARROW_HIDE)
{
SetRect(&rect,lpstring->rect.left-7, lpstring->rect.top,lpstring->rect.left-1,lpstring->rect.bottom);
//GUI_CreateLeftMidRightBitmap(hdc,&rect,IM_GUI_ICON_BACK,IM_GUI_ICON_BACK,IM_GUI_ICON_BACK,TRUE);
spellBoxWithBkbmp(hdc,&rect,&bgbmp);
SetRect(&rect,lpstring->rect.right+1, lpstring->rect.top,lpstring->rect.right+1+7,lpstring->rect.bottom);
//GUI_CreateLeftMidRightBitmap(hdc,&rect,IM_GUI_ICON_BACK,IM_GUI_ICON_BACK,IM_GUI_ICON_BACK,TRUE);
spellBoxWithBkbmp(hdc,&rect,&bgbmp);
}
else if(lpstring->strAccessory==STR_ARROW_UD_SHOW)
{
//draw up arrow
SetRect(&rect,lpstring->rect.left, lpstring->rect.top,lpstring->rect.right,lpstring->rect.top+16);
DrawSmallArrow(hdc, &rect, lpstring->crColor, lpstring->uFormat,ARROW_UP);
//draw down arrow
SetRect(&rect,lpstring->rect.left, lpstring->rect.bottom-16,lpstring->rect.right,lpstring->rect.bottom);
DrawSmallArrow(hdc, &rect, lpstring->crColor, lpstring->uFormat,ARROW_DOWN);
}
else if(lpstring->strAccessory==STR_ARROW_INRECT_R_UDSHOW)
{
arrformat=DT_SINGLELINE|DT_VCENTER|DT_CENTER|DT_CHARCLIP;
SetRect(&rect,lpstring->rect.right-20, lpstring->rect.top,lpstring->rect.right,lpstring->rect.bottom);
DrawSmallArrow(hdc, &rect, lpstring->crColor, arrformat,ARROW_UPDOWN);
}
}
void DrawBaseString(HDC hdc,lpBaseString lpstring,LPBYTE testbuf)
{
RECT rect;
HBRUSH hbr;
SetRect(&rect, lpstring->rect.rect.left, lpstring->rect.rect.top, lpstring->rect.rect.right,lpstring->rect.rect.bottom);
hbr=CreateSolidBrush(GetColorInDef256Palette(lpstring->rect.bkColor));
InflateRect(&rect, 0, -2);
FillRect(hdc,&rect,hbr);
DeleteObject((HGDIOBJ)hbr);
SetTextColor(hdc,GetColorInDef256Palette(lpstring->crColor));
DrawText(hdc, testbuf, -1, &rect, lpstring->uFormat);
}
/*----------------------------------------------------------------------------
* Function name: GetModeStr
* Arguments: UINT strtype,UINT num1,UINT num2,LPBYTE testbuf
* Return value: None
* Remark: This function get the whole string into testbuf by the method indicated by strtype
*----------------------------------------------------------------------------*/
void GetModeStr(UINT strtype,UINT num1,UINT num2,LPBYTE testbuf)
{
int pos1,pos2,pos3;
UINT temp,temp1;
switch(strtype)
{
case MODESTR_BMNUMSELECT:
testbuf[0]=0x00;
testbuf[1]=0x23;//'#'
pos1=LoadText(RS_MPLAYER_1+num1-1, &testbuf[2],30);
testbuf[pos1++]=0x00;
testbuf[pos1++]=0x20;//' '
testbuf[pos1++]=0x00;
testbuf[pos1++]=0x3a;//':'
pos2=LoadText(RS_MPLAYER_1+num2-1, &testbuf[pos1],30);
pos2=pos1+pos2-2;
testbuf[pos2++]=0x00;
testbuf[pos2++]=0x2f;
LoadText(RS_MPLAYER_1+MAXMARKNUMBER-1, &testbuf[pos2],30);
break;
case MODESTR_NUMSELECT:
if(num1<10)
{
if(num1==0)
num1=10;
pos1=LoadText(RS_MPLAYER_1+num1-1, testbuf,30);
}
else
{
if ((num1>=10)&&(num1<100))
{
temp=num1/10;
pos1=LoadText(RS_MPLAYER_1+temp-1, testbuf,30);
temp=num1%10;
if(temp!=0)
pos2=LoadText(RS_MPLAYER_1+temp-1, &testbuf[pos1-2],30);
else
pos2=LoadText(RS_MPLAYER_0, &testbuf[pos1-2],30);
pos1=pos1+pos2-2;
}
else
{
temp=num1/100;
pos1=LoadText(RS_MPLAYER_1+temp-1, testbuf,30);
temp1=num1%100;
temp=temp1/10;
if(temp!=0)
pos2=LoadText(RS_MPLAYER_1+temp-1, &testbuf[pos1-2],30);
else
pos2=LoadText(RS_MPLAYER_0, &testbuf[pos1-2],30);
temp=temp1%10;
if(temp!=0)
pos3=LoadText(RS_MPLAYER_1+temp-1, &testbuf[pos1+pos2-4],30);
else
pos3=LoadText(RS_MPLAYER_0, &testbuf[pos1+pos2-4],30);
pos1=pos1+pos2+pos3-4;
}
}
testbuf[pos1-2]=0x00;
testbuf[pos1-1]=0x2f;
if(num2<10)
{
if(num2==0)
num2=10;
LoadText(RS_MPLAYER_1+num2-1, &testbuf[pos1],30);
}
else
{
if ((num2>=10)&&(num2<100))
{
temp=num2/10;
pos2=LoadText(RS_MPLAYER_1+temp-1, &testbuf[pos1],30);
temp=num2%10;
if(temp!=0)
LoadText(RS_MPLAYER_1+temp-1, &testbuf[pos1+pos2-2],30);
else
LoadText(RS_MPLAYER_0, &testbuf[pos1+pos2-2],30);
}
else
{
temp=num2/100;
pos2=LoadText(RS_MPLAYER_1+temp-1, &testbuf[pos1],30);
temp1=num2%100;
temp=temp1/10;
pos2=pos2-2;
if(temp!=0)
pos3=LoadText(RS_MPLAYER_1+temp-1, &testbuf[pos1+pos2],30);
else
pos3=LoadText(RS_MPLAYER_1+temp-1, &testbuf[pos1+pos2],30);
temp=temp1%10;
if(temp!=0)
LoadText(RS_MPLAYER_1+temp-1, &testbuf[pos1+pos2+pos3-2],30);
else
LoadText(RS_MPLAYER_0, &testbuf[pos1+pos2+pos3-2],30);
}
}
break;
case MODESTR_NUMSTR:
if(num1<10)
{
if(num1==0)
num1=10;
pos1=LoadText(RS_MPLAYER_1+num1-1, testbuf,30);
}
else
{
temp=num1/10;
pos1=LoadText(RS_MPLAYER_1+temp-1, testbuf,30);
temp=num1%10;
if(temp!=0)
pos2=LoadText(RS_MPLAYER_1+temp-1, &testbuf[pos1-2],30);
else
pos2=LoadText(RS_MPLAYER_0, &testbuf[pos1-2],30);
pos1=pos1+pos2-2;
}
if(num2==RS_GUI_OTHERS)
{
testbuf[pos1-2]=0x00;
testbuf[pos1-1]=0x00;
}
else
{
testbuf[pos1-2]=0x00;
testbuf[pos1-1]=0x2e;
LoadText(num2, &testbuf[pos1],30);
}
break;
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -