📄 mode_m.c
字号:
#ifdef D_MODE_STATIC_MENU
#include <stdio.h>
#include <string.h>
#include "sysdefs.h"
#include "..\..\..\ui\menu_sys\ms_wdgt.h"
#include "..\..\..\ui\menu_sys\ms_lib.h"
#include "..\..\..\ui\menu_sys\osd_drv.h"
#include "..\..\..\decoder\osdrendr.h"
#include "..\..\..\decoder\osdlayou.h"
#ifdef FONT32X24 //DM0605
#include "..\..\..\customer\dragon\strings\strings.h"
#else
#include "..\..\..\ui\strings\strings.h"
#endif
#include "menu_var.h"
#include "..\..\..\playcore\ps\ps.h"
#include "..\..\..\playcore\coremain\coregdef.h"
#include "..\..\..\playcore\coremain\coremain.h"
#include "..\..\..\playcore\PlayMode\playmode.h"
#include "..\..\..\kernel\eventdef.h"
#ifdef D_PICTURE_CD_ENABLED
extern BOOL b_enable_auto_slideshow;
#endif
// Define this to use the roving MS_EDIT's instead of separate ones for each menu item
#define D_ROVER
// REMINDER This is not needed if we don't use oHWLimit
#include "..\..\..\Decoder\decoder.h"
#include "mode.h"
//AW0117:first I declare them before use them
void display_titles( BOOL iFocus );
void display_chapters(void);
void display_tracks(BOOL iFocus);
static void clear_all_action(void);
extern BOOL g_in_full_stop;
// Static text positions
// Widget positions
static const MS_POS screen_pos = {104, 72, 504+48, MS_MAX_LINES_BIGMM};
static const MS_POS dialog_pos ={0,MS_LINE_1, 504+48, MS_MAX_LINES_BIGMM -MS_LINE_3}; //dm
static const MS_POS mode_choice_pos = {200, MS_LINE_1 ,296, MS_LINE_HEIGHT};
static const MS_POS repeat_choice_pos = {200, MS_LINE_2, 296, MS_LINE_HEIGHT};
static const MS_POS dont_care_pos = {200, MS_LINE_0, 0, 0};
#ifdef D_PROGRAM_SingleKey
static const MS_POS screen_prg_pos = {104, MS_LINE_2, 504+48, MS_LINE_4};
#endif //dm
// Number of program items
typedef enum { //aw0921
UP_DIRECTION=0,
DOWN_DIRECTION,
LEFT_DIRECTION,
RIGHT_DIRECTION,
} DIRECTION;
DIRECTION direction=0;
int title_rover=0, chapter_rover=0;
#define MAX_DISPLAY_ITEMS 16
// Screen position information for program section
#define MSM_SPACING 8
#define MSM_ITEM_COLUMN_1 MSM_SPACING + MSM_SPACING
#define MSM_ITEM_NUMBER_WIDTH 32
#define MSM_TITLE_WIDTH 32
#define MSM_CHAPTER_WIDTH 32
#define MSM_TRACK_NUMBER_WIDTH 48
// Note that MSM_TITLE_WIDTH + MSM_SPACING + MSM_CHAPTER_WIDTH > MSM_TRACK_NUMBER_WIDTH,
// so that is what we use to determine MSM_PROGRAM_ITEM_WIDTH
#define MSM_PROGRAM_ITEM_WIDTH (MSM_SPACING + MSM_ITEM_NUMBER_WIDTH + MSM_SPACING + MSM_TITLE_WIDTH + MSM_SPACING + MSM_CHAPTER_WIDTH + MSM_SPACING + MSM_SPACING)
// (72)
#define TITLE_OFFSET (MSM_SPACING + MSM_ITEM_NUMBER_WIDTH + MSM_SPACING)
#define CHAPTER_OFFSET (TITLE_OFFSET + MSM_TITLE_WIDTH + MSM_SPACING)
// Maximum number of digits for each value in the program section
#define MAX_ITEM_NUMBER_DIGITS 2
#define MAX_TITLE_DIGITS 2
#define MAX_CHAPTER_DIGITS 2
#define MAX_TRACK_NUMBER_DIGITS 3
// Number of program items per column
#define ITEMS_PER_COLUMN 4
#define ITEMS_PER_ROW (MAX_DISPLAY_ITEMS / ITEMS_PER_COLUMN)
#define FIRST_ITEM_LINE 0//MS_LINE_0//AW0116:change from 0 to 1
#define FOR_ALL_ITEMS(_iItemNum_) for ( (_iItemNum_) = 0; (_iItemNum_) < MAX_DISPLAY_ITEMS; (_iItemNum_)++ )
#define ITEM_NUMBER_POS_X(_iItemNum_) \
(unsigned short ) ((((_iItemNum_) / ITEMS_PER_COLUMN) * MSM_PROGRAM_ITEM_WIDTH) + MSM_SPACING + MSM_SPACING)
/* e.g.,
0 .. 3 = 16
4 .. 7 = 88
8 .. 11 = 160
12 ..15 = 232
*/
#define ITEM_NUMBER_POS_Y(_iItemNum_) \
(unsigned short ) (((_iItemNum_) % ITEMS_PER_COLUMN + FIRST_ITEM_LINE) * MS_LINE_HEIGHT)
/* e.g.,
0, 3, 6, 9 = MENU_LINE_0
1, 4, 7, 10 = MENU_LINE_1
2, 5, 8, 11 = MENU_LINE_1
*/
#define static_const_MS_STATIC(_mssItemNum_, _iItemNum_, _S_STR_) \
static const MS_STATIC _mssItemNum_ = \
{ \
{ \
0, \
ALIGN_CENTER, \
I_COLOR, \
{ITEM_NUMBER_POS_X(_iItemNum_), ITEM_NUMBER_POS_Y(_iItemNum_), MSM_ITEM_NUMBER_WIDTH, MS_LINE_HEIGHT}, \
NO_PARENT, \
static_user_op \
}, \
\
(void *)_S_STR_ \
};
#define static_const_MS_STATIC_ASCII(_mssItemNum_, _iItemNum_, _str_) \
static const MS_STATIC _mssItemNum_ = \
{ \
{ \
MS_ASCII, \
ALIGN_CENTER, \
I_COLOR, \
{ITEM_NUMBER_POS_X(_iItemNum_), ITEM_NUMBER_POS_Y(_iItemNum_), MSM_ITEM_NUMBER_WIDTH, MS_LINE_HEIGHT}, \
NO_PARENT, \
static_user_op \
}, \
\
(void *)_str_ \
};
static_const_MS_STATIC(mssItemNum1, 0, S_1)
static_const_MS_STATIC(mssItemNum2, 1, S_2)
static_const_MS_STATIC(mssItemNum3, 2, S_3)
static_const_MS_STATIC(mssItemNum4, 3, S_4)
static_const_MS_STATIC(mssItemNum5, 4, S_5)
static_const_MS_STATIC(mssItemNum6, 5, S_6)
static_const_MS_STATIC(mssItemNum7, 6, S_7)
static_const_MS_STATIC(mssItemNum8, 7, S_8)
static_const_MS_STATIC(mssItemNum9, 8, S_9)
static_const_MS_STATIC_ASCII(mssItemNum10, 9, "10")
static_const_MS_STATIC_ASCII(mssItemNum11, 10, "11")
static_const_MS_STATIC_ASCII(mssItemNum12, 11, "12")
static_const_MS_STATIC_ASCII(mssItemNum13, 12, "13")
static_const_MS_STATIC_ASCII(mssItemNum14, 13, "14")
static_const_MS_STATIC_ASCII(mssItemNum15, 14, "15")
static_const_MS_STATIC_ASCII(mssItemNum16, 15, "16")
// Bit values for wState
#define MSM_INITIALIZED 0x0001
#define PROGRAM_DIALOG_OPEN 0x0002
#define PROGRAM_ITEMS_INITIALIZED 0x0004
typedef char SZ_TITLE[MAX_TITLE_DIGITS + 1];
// Note that we use MAX_TRACK_NUMBER_DIGITS instead of MAX_CHAPTER_DIGITS
// because we use sz_chapter for tracks with CDDA/VCD/SVCD discs
typedef char SZ_CHAPTER[MAX_TRACK_NUMBER_DIGITS + 1];
typedef struct _msm
{
int iItemNum;
int iLastSelectableItemNum;
WORD wState;
SZ_TITLE sz_title[MAX_DISPLAY_ITEMS];
SZ_CHAPTER sz_chapter[MAX_DISPLAY_ITEMS];
#ifdef D_ROVER
MS_EDIT *mseTitleRover;
MS_EDIT *mseChapterRover;
MS_EDIT *mseTrackRover;
#else
MS_EDIT *mseTitle[MAX_DISPLAY_ITEMS];
MS_EDIT *mseChapter[MAX_DISPLAY_ITEMS];
#endif // D_ROVER
} MSM;
MSM gmsm = { 0, 0, PM_PLAYBACK_NORMAL };
#define sz_track sz_chapter
#ifdef D_ROVER
#else
#define mseTrack mseChapter
#endif
unsigned short item_number_pos_x( int iItemNum )
{
return ITEM_NUMBER_POS_X(iItemNum);
}
#define title_pos_x( _iItemNum_ ) ( item_number_pos_x( _iItemNum_ ) + MSM_ITEM_NUMBER_WIDTH + MSM_SPACING )
#define chapter_pos_x( _iItemNum_ ) ( title_pos_x( _iItemNum_ ) + MSM_TITLE_WIDTH + MSM_SPACING )
#define track_pos_x title_pos_x
#define ITEM_NUMBER_POS_Y(_iItemNum_) \
(unsigned short ) (((_iItemNum_) % ITEMS_PER_COLUMN + FIRST_ITEM_LINE) * MS_LINE_HEIGHT)
unsigned short item_number_pos_y( int iItemNum )
{
return ITEM_NUMBER_POS_Y(iItemNum);
}
#define item_pos_y item_number_pos_y
#define title_pos_y item_number_pos_y
#define chapter_pos_y item_number_pos_y
#define track_pos_y item_number_pos_y
#define ROW_OFFSET(_pWidget_) (_pWidget_->pos.y / MS_LINE_HEIGHT - FIRST_ITEM_LINE)
int item_number(MS_WIDGET *widget, int xOffset)
{
// which row: 0..2
int iRowOffset = ROW_OFFSET(widget);
// which column: 0..3
int iColumnOffset = (widget->pos.x - TITLE_OFFSET) / MSM_PROGRAM_ITEM_WIDTH;
return (iColumnOffset * ITEMS_PER_COLUMN + iRowOffset);
}
#define title_item_number(_pWidget_) item_number((_pWidget_), TITLE_OFFSET)
#define chapter_item_number(_pWidget_) item_number((_pWidget_), CHAPTER_OFFSET)
#define track_item_number title_item_number
#define W_INVALID_PROGRAMLISTENTRY 0xffff
#ifdef D_ROVER
static MS_UOP title_override_user_op(MS_WIDGET *widget, MS_UOP uop, char param);
static MS_UOP chapter_override_user_op(MS_WIDGET *widget, MS_UOP uop, char param);
static MS_UOP track_override_user_op(MS_WIDGET *widget, MS_UOP uop, char param);
void mode_clear_program_list(void)
{
int iItemNum;
FOR_ALL_ITEMS( iItemNum )
{
if ( g_disc_type == DEC_DISC_TYPE_DVD_VIDEO )
{
strcpy( gmsm.sz_title[iItemNum], "--");
strcpy( gmsm.sz_chapter[iItemNum], "--");
}
else
{
strcpy( gmsm.sz_track[iItemNum], "---");
}
}
mode_set_private_program_size(0);
}
//
// Assign the members of an msEdit for the specified item number
void init_title_edit( MS_EDIT *msEdit, int iItemNum )
{
MS_WIDGET *widget = (MS_WIDGET *) msEdit;
if ( (gmsm.wState & PROGRAM_ITEMS_INITIALIZED) == 0 )
{
widget->pos.w = MSM_TITLE_WIDTH;
widget->pos.h = MS_LINE_HEIGHT;
widget->user_op = title_override_user_op;
MS_add_item(dialog_box, widget, 1);
FOR_ALL_ITEMS(iItemNum)
{
//AW0111:check the original program list out when init the track_edit
//BYTE Chapter_Num=PM_GetProgramListEntry(iItemNum)&0x00FF;
BYTE Title_Num=(PM_GetProgramListEntry(iItemNum+1)>>8)&0x00FF;
char str_title[3]="--\0";
// char str_chapter[3]="--\0";
char ten_title=Title_Num/10,single_title=Title_Num%10;
//char ten_chapter=Chapter_Num/10,single_chapter=Chapter_Num%10;
if(iItemNum<mode_get_private_program_size())
{
if(Title_Num>0&&Title_Num<10)
{
str_title[0]=num_to_ch(single_title);
str_title[1]='-';
str_title[2]=0;
}
else if(Title_Num==0)
{
str_title[0]=str_title[1]='-';
str_title[2]=0;
}
else
{
str_title[0]=num_to_ch(ten_title);
str_title[1]=num_to_ch(single_title);
str_title[2]=0;
}
}
else
{
str_title[0]='-';
str_title[1]='-';
str_title[2]=0;
}
strcpy( gmsm.sz_title[iItemNum], str_title);//AW0111
}
iItemNum = 0;
}
widget->pos.x = title_pos_x(iItemNum);
widget->pos.y = title_pos_y(iItemNum);
msEdit->present.text = gmsm.sz_title[iItemNum];
msEdit->current_num = 0;
}
//
// Assign the members of an msEdit for the specified item number
void init_chapter_edit( MS_EDIT *msEdit, int iItemNum )
{
MS_WIDGET *widget = (MS_WIDGET *) msEdit;
if ( (gmsm.wState & PROGRAM_ITEMS_INITIALIZED) == 0 )
{
widget->pos.w = MSM_CHAPTER_WIDTH;
widget->pos.h = MS_LINE_HEIGHT;
widget->user_op = chapter_override_user_op;
MS_add_item(dialog_box, widget, 0);
FOR_ALL_ITEMS(iItemNum)
{
//AW0111:check the original program list out when init the track_edit
BYTE Chapter_Num=PM_GetProgramListEntry(iItemNum+1)&0x00FF;
//BYTE Title_Num=(PM_GetProgramListEntry(iItemNum)>>8)&0x00FF;
//char str_title[3]="--\0",
char str_chapter[3]="--\0";
//char ten_title=Title_Num/10,single=Title_Num%10;
char ten_chapter=Chapter_Num/10,single_chapter=Chapter_Num%10;
if(iItemNum<mode_get_private_program_size())
{
if(Chapter_Num<10&&Chapter_Num>0)
{
str_chapter[0]=num_to_ch(single_chapter);
str_chapter[1]='-';
str_chapter[2]=0;
}
else if(Chapter_Num==0)
{
str_chapter[0]='-';
str_chapter[1]='-';
str_chapter[2]=0;
}
else
{
str_chapter[0]=num_to_ch(ten_chapter);
str_chapter[1]=num_to_ch(single_chapter);
str_chapter[2]=0;
}
}
else
{
str_chapter[0]='-';
str_chapter[1]='-';
str_chapter[2]=0;
}
strcpy( gmsm.sz_chapter[iItemNum], str_chapter);
}
iItemNum = 0;
}
widget->pos.x = chapter_pos_x(iItemNum);
widget->pos.y = chapter_pos_y(iItemNum);
msEdit->present.text = gmsm.sz_chapter[iItemNum];
msEdit->current_num = 0;
}
//
// Assign the members of an msEdit for the specified item number
void init_track_edit( MS_EDIT *msEdit, int iItemNum )
{
MS_WIDGET *widget = (MS_WIDGET *) msEdit;
if ( (gmsm.wState & PROGRAM_ITEMS_INITIALIZED) == 0 )
{
widget->pos.w = MSM_TRACK_NUMBER_WIDTH;
widget->pos.h = MS_LINE_HEIGHT;
widget->user_op = track_override_user_op;
MS_add_item(dialog_box, widget, 1);
FOR_ALL_ITEMS(iItemNum)
{
//AW0111:check the original program list out when init the track_edit
//Aw0117:notice the core does not use the first 0 entry
WORD Track_Num=PM_GetProgramListEntry(iItemNum+1);
char str[4]="---\0";
char hundrend=Track_Num/100,ten=(Track_Num%100)/10,single=(Track_Num%100)%10;
if(iItemNum<mode_get_private_program_size())
{
if(g_disc_type!=DEC_DISC_TYPE_CDDA)
{
if(Track_Num>=2) Track_Num--;
else Track_Num=0;
hundrend=Track_Num/100;
ten=(Track_Num%100)/10;
single=(Track_Num%100)%10;
}
if(Track_Num>=100&&Track_Num<=999)
{
str[0]=num_to_ch(hundrend);
str[1]=num_to_ch(ten);
str[2]=num_to_ch(single);
str[3]=0;
}
else
{
if(Track_Num>=10&&Track_Num<100)
{
str[0]=num_to_ch(ten);
str[1]=num_to_ch(single);
str[2]='-';
str[3]=0;
}
else
{
if(Track_Num>0&&Track_Num<10)
{
str[0]=num_to_ch(single);
str[1]='-';
str[2]='-';
str[3]=0;
}
}
}
}
else
{
str[0]='-';
str[1]='-';
str[2]='-';
str[3]=0;
}
strcpy( gmsm.sz_track[iItemNum], str);
}
iItemNum = 0;
}
widget->pos.x = track_pos_x(iItemNum);
widget->pos.y = track_pos_y(iItemNum);
msEdit->present.text = gmsm.sz_track[iItemNum];
msEdit->current_num = 0;
}
#endif // D_ROVER
#define CLEAR_MS_EDIT(_pmsEdit_) edit_user_op( ((MS_WIDGET *)(_pmsEdit_)), MS_UOP_CLEAR, 0 )
void ClearTitleItem( int iItemNum )
{
if ( g_ui_active_menu_id == MODE_MENU_ID )
{
#ifdef D_ROVER
init_title_edit( gmsm.mseTitleRover, iItemNum );
CLEAR_MS_EDIT( gmsm.mseTitleRover );
#else
CLEAR_MS_EDIT( gmsm.mseTitle[iItemNum] );
#endif // D_ROVER
}
else
{
strcpy( gmsm.sz_title[iItemNum], "--");
}
}
void ClearChapterItem( int iItemNum )
{
if ( g_ui_active_menu_id == MODE_MENU_ID )
{
#ifdef D_ROVER
init_chapter_edit( gmsm.mseChapterRover, iItemNum );
CLEAR_MS_EDIT( gmsm.mseChapterRover );
#else
CLEAR_MS_EDIT( gmsm.mseChapter[iItemNum] );
#endif // D_ROVER
}
else
{
strcpy( gmsm.sz_chapter[iItemNum], "--");
}
}
void ClearTrackItem( int iItemNum )
{
if ( g_ui_active_menu_id == MODE_MENU_ID )
{
#ifdef D_ROVER
init_track_edit( gmsm.mseTrackRover, iItemNum );
CLEAR_MS_EDIT( gmsm.mseTrackRover );
#else
CLEAR_MS_EDIT( gmsm.mseTrack[iItemNum] );
#endif // D_ROVER
}
else
{
strcpy( gmsm.sz_track[iItemNum], "---");
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -