📄 apron.c
字号:
DEPENDENCIES
None.
PARAMETERS
pMe [in] : Pointer to the Application's structure
RETURN VALUE
TRUE : On Success.
FALSE : On Failure.
SIDE EFFECTS
None.
======================================================================*/
static boolean apron_AppStart(
apron * pMe)
{
pMe->appState = APRON_STATE_ENTRY;
return (apron_SVGViewerCore(pMe, APRON_EVENT_STARTUP, EVT_USER, 0, 0));
}
/*======================================================================
FUNCTION
apron_SVGViewerCore
DESCRIPTION
This is a Top Level function that manages the states of the
Application. Handles even the invalid states.
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 : When the Application's Event cannot be handled.
SIDE EFFECTS
None.
======================================================================*/
static boolean apron_SVGViewerCore(
apron * pMe,
apron_app_event_enum appEvent,
AEEEvent eCode,
uint16 wParam,
uint32 dwParam)
{
boolean status = FALSE;
switch(appEvent)
{
case APRON_EVENT_NONE:
break;
case APRON_EVENT_UNKNOWN:
appEvent = apron_GetStateEvent(pMe, pMe->appState, eCode, wParam, dwParam);
break;
default:
break;
}
if((APRON_EVENT_UNKNOWN != appEvent) &&
(APRON_EVENT_NONE != appEvent))
{
switch(pMe->appState)
{
case APRON_STATE_ENTRY:
status = apron_StateEntry(pMe, appEvent, eCode, wParam, dwParam);
break;
case APRON_STATE_OPTIONS_MENU:
status = apron_StateOptionsMenu(pMe, appEvent, eCode, wParam, dwParam);
break;
case APRON_STATE_HELP:
status = apron_StateHelp(pMe, appEvent, eCode, wParam, dwParam);
break;
case APRON_STATE_ABOUT:
status = apron_StateAbout(pMe, appEvent, eCode, wParam, dwParam);
break;
case APRON_STATE_CONTENT_MENU:
status = apron_StateContentMenu(pMe, appEvent, eCode, wParam, dwParam);
break;
case APRON_STATE_CONTENT_PLAY:
status = apron_StateContentPlay(pMe, appEvent, eCode, wParam, dwParam);
break;
case APRON_STATE_CONTENT_STOP:
status = apron_StateContentStop(pMe, appEvent, eCode, wParam, dwParam);
break;
case APRON_STATE_CONTENT_PAUSE:
status = apron_StateContentPause(pMe, appEvent, eCode, wParam, dwParam);
break;
default:
apron_StateInvalid(pMe, appEvent, eCode, wParam, dwParam);
status = FALSE;
break;
}
}
return (status);
}
/*======================================================================
FUNCTION
apron_StateEntry
DESCRIPTION
This function manages the Application in *Initial* state.
DEPENDENCIES
This function uses the following definitions:
1. APRON_SPLASH_SCREEN_TIMER
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 : When the Application's Event cannot be handled.
SIDE EFFECTS
None.
======================================================================*/
static boolean apron_StateEntry(
apron * pMe,
apron_app_event_enum appEvent,
AEEEvent eCode,
uint16 wParam,
uint32 dwParam)
{
boolean status = FALSE;
switch(appEvent)
{
case APRON_EVENT_STARTUP:
{
uint32 timeT1 = 0;
uint32 timeT2 = 0;
apron_DisplaySplashScreen(pMe);
timeT1 = GETUPTIMEMS(); /* Timer Start */
if(TRUE != apron_BuildContentMenu(pMe, APRON_CONTENT_DIRECTORY))
{
DBGPRINTF("APRON: Unable to Build Main/Content Menu");
//TODO: Show PopUp
//TODO: Do CleanUp
return (FALSE);
}
apron_SetAllMenuProperties(pMe);
timeT2 = GETUPTIMEMS(); /* Timer Stop */
//TODO: Re-check the condition - may need some buffer
if(APRON_SPLASH_SCREEN_TIMER > (timeT2 - timeT1))
{
// Set the callback timer to call this function again
ISHELL_SetTimer(pMe->pShell, APRON_SPLASH_SCREEN_TIMER, (PFNNOTIFY)apron_DisplayContentMenu, (void *)pMe);
}else
{
apron_DisplayContentMenu(pMe);
}
}
status = TRUE;
break;
case APRON_EVENT_TIMEOUT:
status = apron_TransitStateToContentMenu(pMe);
break;
default:
status = FALSE;
break;
}
return (status);
}
/*======================================================================
FUNCTION
apron_StateOptionsMenu
DESCRIPTION
This function manages the Application in *Options* 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_StateOptionsMenu(
apron * pMe,
apron_app_state_enum appEvent,
AEEEvent eCode,
uint16 wParam,
uint32 dwParam)
{
uint16 currentId = 0;
boolean status = FALSE;
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, FALSE);
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, FALSE);
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, FALSE);
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, FALSE);
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, FALSE);
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, FALSE);
break;
default:
break;
}
status = TRUE;
switch(appEvent)
{
case APRON_EVENT_OPTIONS_CONTEXT_MENU_TOGGLE:
apron_ToggleMenu(pMe->pOptionsMenu);
apron_ToggleMenu(pMe->pContextMenu);
break;
case APRON_EVENT_POINTER_SENSITIVITY_SET:
case APRON_EVENT_PAN_SENSITIVITY_SET:
case APRON_EVENT_ZOOM_SENSITIVITY_SET:
case APRON_EVENT_ROTATE_SENSITIVITY_SET:
case APRON_EVENT_USER_EVENT_TYPE_SET:
case APRON_EVENT_FRAMERATE_SET:
apron_BuildOptionsMenu(pMe, appEvent);
apron_DisplayMenu(pMe->pOptionsMenu, TRUE);
apron_DisplayMenu(pMe->pContextMenu, TRUE);
apron_EnableMenu(pMe->pOptionsMenu, TRUE);
apron_EnableMenu(pMe->pContextMenu, FALSE);
break;
case APRON_EVENT_SEEK_INTERVAL_SET:
apron_BuildOptionsMenu(pMe, appEvent);
ITEXTCTL_SetActive(pMe->pTextInputMenu, TRUE);
ISTATIC_Redraw(pMe->pReadOnlyMenu);
apron_DisplayMenu(pMe->pContextMenu, TRUE);
apron_EnableMenu(pMe->pContextMenu, FALSE);
IDISPLAY_Update(pMe->pDisplay);
break;
case APRON_EVENT_SEEK_INTERVAL_SET_DONE:
ITEXTCTL_SetSelection(pMe->pTextInputMenu, TC_SEL_END);
break;
case APRON_EVENT_POINTER_SENSITIVITY_HIGH:
pMe->appOptions.pointerSensitivity = APRON_SENSITIVITY_POINTER_HIGH;
break;
case APRON_EVENT_POINTER_SENSITIVITY_MEDIUM:
pMe->appOptions.pointerSensitivity = APRON_SENSITIVITY_POINTER_MEDIUM;
break;
case APRON_EVENT_POINTER_SENSITIVITY_LOW:
pMe->appOptions.pointerSensitivity = APRON_SENSITIVITY_POINTER_LOW;
break;
case APRON_EVENT_PAN_SENSITIVITY_HIGH:
pMe->appOptions.panSensitivity = APRON_SENSITIVITY_PAN_HIGH;
break;
case APRON_EVENT_PAN_SENSITIVITY_MEDIUM:
pMe->appOptions.panSensitivity = APRON_SENSITIVITY_PAN_MEDIUM;
break;
case APRON_EVENT_PAN_SENSITIVITY_LOW:
pMe->appOptions.panSensitivity = APRON_SENSITIVITY_PAN_LOW;
break;
case APRON_EVENT_CONTENT_MENU:
if(ITEXTCTL_IsActive(pMe->pTextInputMenu))
{
double newSeekInterval;
newSeekInterval = WSTRTOFLOAT(ITEXTCTL_GetTextPtr(pMe->pTextInputMenu));
//Limit Values
if(newSeekInterval > APRON_SEEK_INTERVAL_MAX)
{
newSeekInterval = APRON_SEEK_INTERVAL_MAX;
}else if(newSeekInterval < APRON_SEEK_INTERVAL_MIN)
{
newSeekInterval = APRON_SEEK_INTERVAL_MIN;
}else
{
;
}
pMe->appOptions.seekInterval = (uint16) newSeekInterval;
ITEXTCTL_SetActive(pMe->pTextInputMenu, FALSE);
ITEXTCTL_Redraw(pMe->pTextInputMenu);
}
apron_EnableMenu(pMe->pContextMenu, FALSE);
apron_EnableMenu(pMe->pOptionsMenu, FALSE);
status = apron_TransitStateToContentMenu(pMe);
break;
case APRON_EVENT_USER_EVENT_POINTER:
pMe->appOptions.userEventType = APRON_USER_EVENT_TYPE_POINTER;
break;
case APRON_EVENT_USER_EVENT_FOCUS:
pMe->appOptions.userEventType = APRON_USER_EVENT_TYPE_FOCUS;
break;
case APRON_EVENT_FRAMERATE_AUTO:
pMe->appOptions.frameInterval = (int32)(0);
break;
case APRON_EVENT_FRAMERATE_96:
pMe->appOptions.frameInterval = (int32)(1000.0f / APRON_FRAMERATE_96);
break;
case APRON_EVENT_FRAMERATE_48:
pMe->appOptions.frameInterval = (int32)(1000.0f / APRON_FRAMERATE_48);
break;
case APRON_EVENT_FRAMERATE_24:
pMe->appOptions.frameInterval = (int32)(1000.0f / APRON_FRAMERATE_24);
break;
case APRON_EVENT_FRAMERATE_12:
pMe->appOptions.frameInterval = (int32)(1000.0f / APRON_FRAMERATE_12);
break;
case APRON_EVENT_FRAMERATE_6:
pMe->appOptions.frameInterval = (int32)(1000.0f / APRON_FRAMERATE_6);
break;
case APRON_EVENT_FRAMERATE_3:
pMe->appOptions.frameInterval = (int32)(1000.0f / APRON_FRAMERATE_3);
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -