📄 kokoutlook.c
字号:
#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>
#ifdef _KARAOKE_ENABLE_
#define CMD_OSDINIT 0
#define CMD_UP 1
#define CMD_DOWN 2
#define CMD_LEFT 3
#define CMD_RIGHT 4
KokBox kokbox;
//----------------------------------
//--for karaoke
void ShowKaraOkeBar(HDC hdc,int stage,int value,int startX,int startY, BOOL cmd)
{
KokSetPara(&kokbox,stage, value,startX, startY);
ShowKaraOkeBarORI(hdc,cmd);
}
//<<new
void KokSetPara(lpKokBox kokbox , int volumType,int value,WORD startx,WORD starty)
{
BYTE i,j;
long imageID[MAXKOKITEMS]={IM_KARA_VOLUME,IM_KARA_ECHO,IM_KARA_KEY,IM_KARA_VOICE,IM_KARA_MELODY}; //gushun for karaoke volume
static BYTE leftString[MAXKOKITEMS][14]=
{
{'\0','V','\0','o','\0','l','\0','u','\0','m','\0','e','\0','\0'}, //gushun for karaoke volume
{'\0','E','\0','C','\0','H','\0','O','\0','\0','\0','\0','\0','\0'},
{'\0','K','\0','E','\0','Y','\0','\0','\0','\0','\0','\0','\0','\0'},
// {'\0','E','\0','F','\0','F','\0','E','\0','C','\0','T','\0','\0'},
{'\0','V','\0','O','\0','I','\0','C','\0','E','\0','\0','\0','\0'},
{'\0','M','\0','E','\0','L','\0','O','\0','D','\0','Y','\0','\0'}
};
BYTE kokstr[2][8]=
{
{'\0','1','\0'},
{'\0','b','\0','6','\0'},
};
BYTE melody[2][8]=
{
{'\0','O','\0','F','\0','F','\0','\0'},
{'\0','O','\0','N','\0','\0'}
};
BYTE voice[4][12]=
{
{'\0','O','\0','F','\0','F','\0','\0'},
{'\0','V','\0','1','\0','\0'},
{'\0','V','\0','2','\0','\0'},
{'\0','V','\0','1','\0','+','\0','V','\0','2','\0','\0'}
};
static BYTE echoStr[] = {'\0',0x20,'\0','0','\0','\0'};
static BYTE keyStr[] = {'\0','#','\0','0','\0','\0'};
//set kok box current item
kokbox->curItem=volumType;//KOK_STAGE_KEY;//KOK_STAGE_ECHO;
kokbox->kokValue=value;
// set kok box rect info
kokbox->upleftx=startx;//116;
kokbox->uplefty=starty;//47;
kokbox->width=KOK_OUTLOOK_WIDTH;
kokbox->high=KOK_OUTLOOK_HIGH;
kokbox->backgroudClr=253;
//set kok top/down ,left/right edge background bmp
kokbox->leftBmpId=IM_KARA_FRAME_LEFT;
kokbox->upBmpId=IM_KARA_FRAME_TOP;
kokbox->rightBmpId=IM_KARA_FRAME_RIGHT;
kokbox->downBmpId=IM_KARA_FRAME_DOWN;
//set kok icon bmp info
for(i=0;i<MAXKOKITEMS;i++)
{
kokbox->kokIconBmp[i].BmpID=imageID[i];
kokbox->kokIconBmp[i].upperleftx= kokbox->upleftx+10;// x offset 10
kokbox->kokIconBmp[i].upperlefty=kokbox->uplefty+4;//y offset 4
kokbox->kokIconBmp[i].width=34;
kokbox->kokIconBmp[i].height=34;
}
//set kok item Rect info
kokbox->kokItemRec.rect.left=kokbox->upleftx+50;//x offset 50 relative startx.
kokbox->kokItemRec.rect.top=kokbox->uplefty+(KOK_OUTLOOK_HIGH-30)/2;//30 is rect height
kokbox->kokItemRec.rect.right=kokbox->upleftx+50+104;//104 is rect width.
kokbox->kokItemRec.rect.bottom=kokbox->kokItemRec.rect.top+30 -1;
kokbox->kokItemRec.leftEdgeColor=220;
kokbox->kokItemRec.rightEdgeColor=220;
kokbox->kokItemRec.bkColor=212;//koraoke item name rect background color index
//set kok item name info
for(i=0;i<MAXKOKITEMS;i++)
{
kokbox->kokItemName[i].crColor=233;
kokbox->kokItemName[i].rect.left=kokbox->kokItemRec.rect.left+8;
kokbox->kokItemName[i].rect.top=kokbox->kokItemRec.rect.top;
kokbox->kokItemName[i].rect.right=kokbox->kokItemRec.rect.right-6;
kokbox->kokItemName[i].rect.bottom=kokbox->kokItemRec.rect.bottom;
for(j=0;j<14;j++)
{
kokbox->kokItemName[i].str[j]=leftString[i][j];
}
kokbox->kokItemName[i].uFormat=DT_SINGLELINE|DT_VCENTER|DT_LEFT|DT_CHARCLIP;
kokbox->kokItemName[i].strAccessory=STR_ARROW_INRECT_R_UDSHOW;
kokbox->kokItemName[i].strID=0;//no use
}
//string ahead of key/echo bar ,such as b1,b2...#1,#2... or 1,2....
if(volumType == KOK_STAGE_ECHO)
{
kokbox->barStr[0].crColor=235;
kokbox->barStr[0].rect.left=kokbox->upleftx+167;
kokbox->barStr[0].rect.top=kokbox->uplefty+2;
kokbox->barStr[0].rect.right=kokbox->barStr[0].rect.left+26;
kokbox->barStr[0].rect.bottom=kokbox->uplefty+kokbox->high-5;
if(value < 10)
{
echoStr[1] = 0x20;
echoStr[3] = '0' + value;
}
else
{
echoStr[1] = '1';
echoStr[3] = '0';
}
for(j=0;j<8;j++)
{
kokbox->barStr[0].str[j]=echoStr[j];
}
kokbox->barStr[0].uFormat=DT_SINGLELINE|DT_VCENTER|DT_RIGHT|DT_CHARCLIP;
kokbox->barStr[0].strAccessory=STR_ARROW_NOTHING;
kokbox->barStr[0].strID=0;//no use
}
else if(volumType == KOK_STAGE_KEY)
{
kokbox->barStr[1].crColor=235;
kokbox->barStr[1].rect.left=kokbox->upleftx+167;
kokbox->barStr[1].rect.top=kokbox->uplefty+2;
kokbox->barStr[1].rect.right=kokbox->barStr[1].rect.left+26;
kokbox->barStr[1].rect.bottom=kokbox->uplefty+kokbox->high-5;
if(value == 6)
{
keyStr[1] = '0';
keyStr[3] = '\0';
}
else if(value < 6)
{
keyStr[1] = 'b';
keyStr[3] = '0' + 6 - value;
}
else
{
keyStr[1] = '#';
keyStr[3] = '0' + value - 6;
}
for(j=0;j<8;j++)
{
kokbox->barStr[1].str[j]=keyStr[j];
}
kokbox->barStr[1].uFormat=DT_SINGLELINE|DT_VCENTER|DT_RIGHT|DT_CHARCLIP;
kokbox->barStr[1].strAccessory=STR_ARROW_NOTHING;
kokbox->barStr[1].strID=0;//no use
}
//set rect of echo and key bar
kokbox->EKBarRec.left=kokbox->upleftx+210;
kokbox->EKBarRec.top=kokbox->uplefty+2;
kokbox->EKBarRec.right=kokbox->EKBarRec.left+226;
kokbox->EKBarRec.bottom=kokbox->uplefty+kokbox->high-5;
//set arrow color index
kokbox->arrClrIndex=233;
//set kok echo bar bmp info
kokbox->EchoBarBmp.BmpID=IM_KARA_ECHO_BAR;
kokbox->EchoBarBmp.upperleftx=kokbox->EKBarRec.left+4;//kokbox.upleftx+216;
kokbox->EchoBarBmp.upperlefty=kokbox->EKBarRec.top+12;//kokbox.uplefty+21;
kokbox->EchoBarBmp.width=23;
kokbox->EchoBarBmp.height=16;
//set kok key bar bmp info
kokbox->KeyBarBmp[0].BmpID=IM_KARA_KEY_ICON;
kokbox->KeyBarBmp[1].BmpID=IM_KARA_KEY_ICON_SELECT;
if(volumType==KOK_STAGE_VOLUME)
kokbox->KeyBarBmp[0].upperleftx=kokbox->KeyBarBmp[1].upperleftx=kokbox->EKBarRec.left+4;
else
kokbox->KeyBarBmp[0].upperleftx=kokbox->KeyBarBmp[1].upperleftx=kokbox->EKBarRec.left+16;
kokbox->KeyBarBmp[0].upperlefty=kokbox->KeyBarBmp[1].upperlefty=kokbox->EKBarRec.top+12;
kokbox->KeyBarBmp[0].width=kokbox->KeyBarBmp[1].width=12;
kokbox->KeyBarBmp[0].height=kokbox->KeyBarBmp[1].height=16;
//set kok mellody/voice value string info
if(volumType==KOK_STAGE_MELODY||volumType==KOK_STAGE_VOICE)
{
kokbox->MVStr.crColor=236;
kokbox->MVStr.rect.left=kokbox->EKBarRec.left;
kokbox->MVStr.rect.top=kokbox->EKBarRec.top;
kokbox->MVStr.rect.right=kokbox->EKBarRec.right;
kokbox->MVStr.rect.bottom=kokbox->EKBarRec.bottom;
if(volumType==KOK_STAGE_MELODY)
{
for(j=0;j<8;j++)
{
kokbox->MVStr.str[j]=melody[value][j];
}
}
else if(volumType==KOK_STAGE_VOICE)
{
for(j=0;j<12;j++)
{
kokbox->MVStr.str[j]=voice[value][j];
}
}
kokbox->MVStr.uFormat=DT_SINGLELINE|DT_VCENTER|DT_CENTER|DT_CHARCLIP;
kokbox->MVStr.strAccessory=STR_ARROW_NOTHING;//MARK_ARROW_SHOW;//;
kokbox->MVStr.strID=0;//no use
}
}
void nmDrawBar(HDC hdc,lpBaseBmp lpbmp,BYTE StartNums,BYTE Nums,WORD space)
{
BYTE i;
BaseBmp bmp;
for(i=StartNums;i<Nums;i++)
{
bmp.BmpID=lpbmp->BmpID;
bmp.upperleftx=lpbmp->upperleftx+i*(lpbmp->width-1+space);
bmp.upperlefty=lpbmp->upperlefty;
bmp.width=lpbmp->width;
bmp.height=lpbmp->height;
DrawBaseBmp(hdc, &bmp);
}
}
//draw EKRect where are both echo and key bar located.and have left/right arrow at both sides.
void drawEKBarRect(HDC hdc,const LPRECT lprt,BYTE rectClrIndex,BYTE arrClrIndex)
{
RECT rect;
HBRUSH hbr;
UINT uFormat=DT_SINGLELINE|DT_VCENTER|DT_CENTER|DT_CHARCLIP;
SetRect(&rect, lprt->left-14, lprt->top, lprt->left-2, lprt->bottom);
DrawSmallArrow(hdc, &rect, arrClrIndex,uFormat, ARROW_LEFT_BIG);
SetRect(&rect, lprt->right+2, lprt->top,lprt->right+14,lprt->bottom);
DrawSmallArrow(hdc, &rect, arrClrIndex,uFormat, ARROW_RIGHT_BIG);
}
void drawKokBoxWithMemDc(HDC hdc,lpKokBox lpKokbox, BOOL bInit)
{
//HDC hMemDC;
//HBITMAP holdbmp;
int value,width;
KokBox memKokbox;
BYTE curItem;
curItem= lpKokbox->curItem;
value=lpKokbox->kokValue;
KokSetPara(&memKokbox, lpKokbox->curItem, value,kokbox.upleftx,kokbox.uplefty);
//hMemDC=InitMemoryDC(hdc,memKokbox.width,memKokbox.high,&holdbmp);
drawKokBox(hdc,&memKokbox);
//BitBlt(hdc, lpKokbox->upleftx, lpKokbox->uplefty, lpKokbox->width-2, lpKokbox->high, hMemDC, 0, 0, SRCCOPY);
//DelMemoryDC(hMemDC, holdbmp);
}
void drawRectEdgeWithBmp(HDC hdc,LPRECT lpRc,UINT leftBmpId,UINT upBmpId,UINT rightBmpId,UINT downBmpId)
{
BaseBmp uEdgebmp,dEdgebmp,lEdgebmp,rEdgebmp;
//draw left edge
if(leftBmpId > 0)
{
lEdgebmp.BmpID=leftBmpId;
lEdgebmp.width=2;//GetBMPWidth(HBITMAP hbmp);
lEdgebmp.height=38;
lEdgebmp.upperleftx=lpRc->left;
lEdgebmp.upperlefty=lpRc->top+2;
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -