📄 apron.c
字号:
break;
case APRON_EVENT_FRAMERATE_1:
pMe->appOptions.frameInterval = (int32)(1000.0f / APRON_FRAMERATE_1);
break;
case APRON_EVENT_FRAMERATE_POINT5:
pMe->appOptions.frameInterval = (int32)(1000.0f / APRON_FRAMERATE_POINT5);
break;
case APRON_EVENT_FRAMERATE_POINT25:
pMe->appOptions.frameInterval = (int32)(1000.0f / APRON_FRAMERATE_POINT25);
break;
//TODO: Add Zoom/Rotate/Repeat Play
case APRON_EVENT_END:
default:
status = FALSE;
break;
}
switch(appEvent)
{
case APRON_EVENT_POINTER_SENSITIVITY_HIGH:
case APRON_EVENT_POINTER_SENSITIVITY_MEDIUM:
case APRON_EVENT_POINTER_SENSITIVITY_LOW:
currentId = apron_GetCurrentOption(pMe, APRON_EVENT_POINTER_SENSITIVITY_SET);
apron_SetSelection(pMe->pOptionsMenu, currentId, TRUE);
break;
case APRON_EVENT_PAN_SENSITIVITY_HIGH:
case APRON_EVENT_PAN_SENSITIVITY_MEDIUM:
case APRON_EVENT_PAN_SENSITIVITY_LOW:
currentId = apron_GetCurrentOption(pMe, APRON_EVENT_PAN_SENSITIVITY_SET);
apron_SetSelection(pMe->pOptionsMenu, currentId, TRUE);
break;
case APRON_EVENT_ROTATE_SENSITIVITY_HIGH:
case APRON_EVENT_ROTATE_SENSITIVITY_MEDIUM:
case APRON_EVENT_ROTATE_SENSITIVITY_LOW:
currentId = apron_GetCurrentOption(pMe, APRON_EVENT_ROTATE_SENSITIVITY_SET);
apron_SetSelection(pMe->pOptionsMenu, currentId, TRUE);
break;
case APRON_EVENT_ZOOM_SENSITIVITY_HIGH:
case APRON_EVENT_ZOOM_SENSITIVITY_MEDIUM:
case APRON_EVENT_ZOOM_SENSITIVITY_LOW:
currentId = apron_GetCurrentOption(pMe, APRON_EVENT_ZOOM_SENSITIVITY_SET);
apron_SetSelection(pMe->pOptionsMenu, currentId, TRUE);
break;
case APRON_EVENT_USER_EVENT_POINTER:
case APRON_EVENT_USER_EVENT_FOCUS:
currentId = apron_GetCurrentOption(pMe, APRON_EVENT_USER_EVENT_TYPE_SET);
apron_SetSelection(pMe->pOptionsMenu, currentId, TRUE);
break;
case APRON_EVENT_FRAMERATE_AUTO:
case APRON_EVENT_FRAMERATE_96:
case APRON_EVENT_FRAMERATE_48:
case APRON_EVENT_FRAMERATE_24:
case APRON_EVENT_FRAMERATE_12:
case APRON_EVENT_FRAMERATE_6:
case APRON_EVENT_FRAMERATE_3:
case APRON_EVENT_FRAMERATE_1:
case APRON_EVENT_FRAMERATE_POINT5:
case APRON_EVENT_FRAMERATE_POINT25:
currentId = apron_GetCurrentOption(pMe, APRON_EVENT_FRAMERATE_SET);
apron_SetSelection(pMe->pOptionsMenu, currentId, TRUE);
break;
default:
break;
}
//TODO: Chek the return value
return (status);
}
/*======================================================================
FUNCTION
apron_StateHelp
DESCRIPTION
This function manages the Application in *Help* state.
DEPENDENCIES
None.
PARAMETERS
pMe [in] : Pointer to the Application's structure
appEvent [in] : Application Defined Event.
eCode [in] : BREW Event.
wParam [in] : AVK keycode.
dwParam [in] : Bitflags for modifier keys
RETURN VALUE
TRUE : On Success.
FALSE : On Failure:
1. When the Application's Event cannot be handled.
2. When the Application has to be ended.
SIDE EFFECTS
None.
======================================================================*/
static boolean apron_StateHelp(
apron * pMe,
apron_app_state_enum appEvent,
AEEEvent eCode,
uint16 wParam,
uint32 dwParam)
{
boolean status = FALSE;
switch(appEvent)
{
case APRON_EVENT_CONTENT_MENU:
status = apron_TransitStateToContentMenu(pMe);
break;
case APRON_EVENT_END:
default:
status = FALSE;
break;
}
//TODO: Check the return value
return (status);
}
/*======================================================================
FUNCTION
apron_StateAbout
DESCRIPTION
This function manages the Application in *Help* state.
DEPENDENCIES
None.
PARAMETERS
pMe [in] : Pointer to the Application's structure
appEvent [in] : Application Defined Event.
eCode [in] : BREW Event.
wParam [in] : AVK keycode.
dwParam [in] : Bitflags for modifier keys
RETURN VALUE
TRUE : On Success.
FALSE : On Failure:
1. When the Application's Event cannot be handled.
2. When the Application has to be ended.
SIDE EFFECTS
None.
======================================================================*/
static boolean apron_StateAbout(
apron * pMe,
apron_app_state_enum appEvent,
AEEEvent eCode,
uint16 wParam,
uint32 dwParam)
{
boolean status = FALSE;
switch(appEvent)
{
case APRON_EVENT_CONTENT_MENU:
status = apron_TransitStateToContentMenu(pMe);
break;
case APRON_EVENT_END:
default:
status = FALSE;
break;
}
//TODO: Chek the return value
return (status);
}
/*======================================================================
FUNCTION
apron_StateContentMenu
DESCRIPTION
This function manages the Application in *Content Menu* state.
DEPENDENCIES
None.
PARAMETERS
pMe [in] : Pointer to the Application's structure
appEvent [in] : Application Defined Event.
eCode [in] : BREW Event.
wParam [in] : AVK keycode.
dwParam [in] : Bitflags for modifier keys
RETURN VALUE
TRUE : On Success.
FALSE : On Failure:
1. When the Application's Event cannot be handled.
2. When the Application has to be ended.
SIDE EFFECTS
None.
======================================================================*/
static boolean apron_StateContentMenu(
apron * pMe,
apron_app_state_enum appEvent,
AEEEvent eCode,
uint16 wParam,
uint32 dwParam)
{
boolean status = FALSE;
switch(appEvent)
{
case APRON_EVENT_CONTENT_CONTEXT_MENU_TOGGLE:
apron_ToggleMenu(pMe->pContentMenu);
apron_ToggleMenu(pMe->pContextMenu);
status = TRUE;
break;
case APRON_EVENT_OPEN:
status = apron_TransitStateToContentPlay(pMe, APRON_CONTENT_ORDER_NEW, wParam);
break;
case APRON_EVENT_OPTIONS_MENU:
{
apron_BuildContextMenu(pMe, APRON_STATE_OPTIONS_MENU);
pMe->appState = APRON_STATE_OPTIONS_MENU;
apron_EnableMenu(pMe->pContextMenu, TRUE);
}
break;
case APRON_EVENT_HELP:
{
IFile * pFile = NULL;
AECHAR helpTitle[APRON_MAX_FILE_NAME];
AEERect staticRect;
if(SUCCESS != ISHELL_CreateInstance(pMe->pShell, AEECLSID_FILEMGR, (void**)(&pMe->pFileMgr)))
{
DBGPRINTF("Apron: FileMgr CreateInstance Failed");
return (FALSE);
}
// Open the file.
pFile = IFILEMGR_OpenFile(pMe->pFileMgr, APRON_HELP_FILE, _OFM_READ);
if(NULL == pFile)
{
DBGPRINTF("Apron: Open Help File Failed");
return (FALSE);
}
ISTATIC_Reset(pMe->pReadOnlyMenu);
IMENUCTL_GetRect(pMe->pContentMenu, &staticRect);
ISTATIC_SetRect(pMe->pReadOnlyMenu, &staticRect);
apron_DisplayMenu(pMe->pContentMenu, FALSE);
apron_EnableMenu(pMe->pContextMenu, FALSE);
pMe->appState = APRON_STATE_HELP;
IFILEMGR_Release(pMe->pFileMgr);
pMe->pFileMgr = NULL;
ISHELL_LoadResString(pMe->pShell, APRON_RES_FILE, IDS_HELP_TITLE, helpTitle, sizeof(helpTitle));
ISTATIC_SetText(pMe->pReadOnlyMenu, helpTitle, NULL, AEE_FONT_BOLD, AEE_FONT_NORMAL);
ISTATIC_SetTextEx(pMe->pReadOnlyMenu, NULL, (IAStream *)pFile, FALSE);
IFILE_Release(pFile);
ISTATIC_SetActive(pMe->pReadOnlyMenu, TRUE);
ISTATIC_Redraw(pMe->pReadOnlyMenu);
IDISPLAY_Update(pMe->pDisplay);
}
break;
case APRON_EVENT_ABOUT:
{
AECHAR aboutTitle[APRON_MAX_FILE_NAME];
char buf[APRON_MAX_FILE_NAME];
AEERect staticRect;
ISTATIC_Reset(pMe->pReadOnlyMenu);
IMENUCTL_GetRect(pMe->pContentMenu, &staticRect);
ISTATIC_SetRect(pMe->pReadOnlyMenu, &staticRect);
apron_DisplayMenu(pMe->pContentMenu, FALSE);
apron_EnableMenu(pMe->pContextMenu, FALSE);
pMe->appState = APRON_STATE_ABOUT;
ISHELL_LoadResString(pMe->pShell, APRON_RES_FILE, IDS_ABOUT_TITLE, aboutTitle, sizeof(aboutTitle));
ISTATIC_SetText(pMe->pReadOnlyMenu, aboutTitle, NULL, AEE_FONT_BOLD, AEE_FONT_NORMAL);
SNPRINTF(buf, sizeof(buf), "%s : %s", APRON_CODE_NAME, APRON_VERSION_NUMBER);
ISTATIC_SetTextEx(pMe->pReadOnlyMenu, (byte *)buf, NULL, TRUE);
SNPRINTF(buf, sizeof(buf), "\n%s", APRON_COPYRIGHT_NOTICE);
ISTATIC_SetTextEx(pMe->pReadOnlyMenu, (byte *)buf, NULL, TRUE);
ISTATIC_SetActive(pMe->pReadOnlyMenu, TRUE);
ISTATIC_Redraw(pMe->pReadOnlyMenu);
IDISPLAY_Update(pMe->pDisplay);
}
break;
case APRON_EVENT_END:
ISHELL_CloseApplet(pMe->pShell, FALSE);
status = FALSE;
break;
default:
status = FALSE;
break;
}
//TODO: Chek the return value
return (status);
}
/*======================================================================
FUNCTION
apron_StateInvalid
DESCRIPTION
This function manages the Application in *Invalid* state. It is
responsible for bringing Application to a valid (ContentMenu) state.
DEPENDENCIES
None.
PARAMETERS
pMe [in] : Pointer to the Application's structure
appEvent [in] : Application Defined Event.
eCode [in] : BREW Event.
wParam [in] : AVK keycode.
dwParam [in] : Bitflags for modifier keys
RETURN VALUE
TRUE : Always.
SIDE EFFECTS
None.
======================================================================*/
static boolean apron_StateInvalid(
apron * pMe,
apron_app_state_enum appEvent,
AEEEvent eCode,
uint16 wParam,
uint32 dwParam)
{
boolean status = FALSE;
status = TRUE;
apron_TransitStateToContentMenu(pMe);
return (status);
}
/*======================================================================
FUNCTION
apron_StateContentPlay
DESCRIPTION
This function manages the Application in *Play* state.
DEPENDENCIES
None.
PARAMETERS
pMe [in] : Pointer to the Application's structure
appEvent [in] : Application Defined Event.
eCode [in] : BREW Event.
wParam [in] : AVK keycode.
dwParam [in] : Bitflags for modifier keys
RETURN VALUE
TRUE : On Success.
FALSE : On Failure:
1. When the Application's Event cannot be handled.
2. When the Application has to be ended.
SIDE EFFECTS
None.
======================================================================*/
static boolean apron_StateContentPlay(
apron * pMe,
apron_app_state_enum appEvent,
AEEEvent eCode,
uint16 wParam,
uint32 dwParam)
{
int retStatus = EBADPARM;
boolean status = FALSE;
status = TRUE;
switch(appEvent)
{
case APRON_EVENT_CONTENT_MENU:
retStatus = IMEDIA_Stop(pMe->pMediaSVG);
if(SUCCESS == retStatus)
{
IMEDIA_Release(pMe->pMediaSVG);
pMe->pMediaSVG = NULL;
statu
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -