/** * @brief Game window Startup * @param hWin: pointer to the parent handle. * @param xpos: X position * @param ypos: Y position * @retval None */ void VNC_SERVER_StatusChanged (uint8_t status) { WM_HWIN hItem; hItem = WM_GetDialogItem(hVncWin, ID_VNC_CONNECTION); switch (status) { case VNC_IDLE: case VNC_LINK_DOWN: case VNC_ERROR: IMAGE_SetBitmap(hItem, &bmconnection_ko); WM_InvalidateWindow(hItem); WM_Update(hItem); break; case VNC_LINK_UP: case VNC_WAIT_FOR_ADDRESS: IMAGE_SetGIF(hItem, vnc_connection, sizeof(vnc_connection)); WM_InvalidateWindow(hItem); WM_Update(hItem); break; case VNC_ADDRESS_ASSIGNED: case VNC_CONN_ESTABLISHED: IMAGE_SetBitmap(hItem, &bmconnection_ok); hItem = WM_GetDialogItem(hVncWin, START_VNC); WM_InvalidateWindow(hItem); WM_Update(hItem); break; default: break; } }
/** * @brief Callback routine of the main dialog * @param pMsg: pointer to data structure of type WM_MESSAGE * @retval None */ static void _cbDialog(WM_MESSAGE * pMsg) { WM_HWIN hItem; int Id, NCode; switch (pMsg->MsgId) { case WM_INIT_DIALOG: hItem = WM_GetDialogItem(pMsg->hWin, ID_EQUAL); IMAGE_SetBitmap(hItem, &bmframe0); hItem = BUTTON_CreateEx(700, 0, 100, 100, pMsg->hWin, WM_CF_SHOW, 0, ID_BUTTON_EXIT); WM_SetCallback(hItem, _cbButton_exit); hItem = BUTTON_CreateEx(540, 350, 80, 80, pMsg->hWin, WM_CF_SHOW, 0, ID_RECORD_PAUSE); WM_SetCallback(hItem, _cbButton_pause); hItem = BUTTON_CreateEx(320, 350, 80, 80, pMsg->hWin, WM_CF_SHOW, 0, ID_RECORD_STOP); WM_SetCallback(hItem, _cbButton_stop); hItem = BUTTON_CreateEx(430, 350, 80, 80, pMsg->hWin, WM_CF_SHOW, 0, ID_RECORD_REC_CANCEL_PLAY); WM_SetCallback(hItem, _cbButton_record); hItem = WM_GetDialogItem(pMsg->hWin, ID_FILENAMECAPTION); TEXT_SetFont(hItem, &GUI_FontLubalGraph24B); hItem = WM_GetDialogItem(pMsg->hWin, ID_FILENAME); TEXT_SetFont(hItem, &GUI_FontLubalGraph24B); hItem = WM_GetDialogItem(pMsg->hWin, ID_ELAPSED_TIME); TEXT_SetFont(hItem, &GUI_FontLubalGraph20); if((module_prop[k_ModuleGetIndex(&audio_player_board)].in_use) || (k_StorageGetStatus(USB_DISK_UNIT) == 0)) { if(module_prop[k_ModuleGetIndex(&audio_player_board)].in_use) { hItem = WM_GetDialogItem(pMsg->hWin, ID_FILENAMECAPTION); TEXT_SetText(hItem, ">>>"); hItem = WM_GetDialogItem(pMsg->hWin, ID_FILENAME); TEXT_SetText(hItem, "Audio IF busy"); } if (k_StorageGetStatus(USB_DISK_UNIT) == 0) { hItem = WM_GetDialogItem(pMsg->hWin, ID_FILENAMECAPTION); TEXT_SetText(hItem, ">>>"); hItem = WM_GetDialogItem(pMsg->hWin, ID_FILENAME); TEXT_SetText(hItem, "USB NOT ready"); } RecorderMode = RECORDER_MODE_REC_DISABLED; hItem = WM_GetDialogItem(pMsg->hWin, ID_RECORD_STOP); WM_DisableWindow(hItem); hItem = WM_GetDialogItem(pMsg->hWin, ID_RECORD_REC_CANCEL_PLAY); WM_DisableWindow(hItem); hItem = WM_GetDialogItem(pMsg->hWin, ID_RECORD_PAUSE); WM_DisableWindow(hItem); } else { RecorderMode = RECORDER_MODE_REC_IDLE; WM_CreateWindowAsChild(0, 100, 10, 10, pMsg->hWin, WM_CF_SHOW | WM_CF_HASTRANS, _cbAudioProcess, 0); } WM_CreateWindowAsChild(799, 460, 1, 1, pMsg->hWin, WM_CF_SHOW | WM_CF_HASTRANS, _cbMediaConnection , 0); break; case WM_PAINT: GUI_DrawBitmap(&bmrecorder, 60, 120); GUI_SetColor(GUI_STCOLOR_LIGHTBLUE); GUI_FillEllipse(470, 430, 214, 140); GUI_SetColor(GUI_WHITE); GUI_FillEllipse(470, 435, 214, 140); break; case WM_NOTIFY_PARENT: Id = WM_GetId(pMsg->hWinSrc); /* Id of widget */ NCode = pMsg->Data.v; /* Notification code */ switch(Id) { case ID_BUTTON_EXIT: switch(NCode) { case WM_NOTIFICATION_RELEASED: if(module_prop[k_ModuleGetIndex(&audio_player_board)].in_use == 0) { AUDIO_RECORDER_DeInit(); } GUI_EndDialog(pMsg->hWin, 0); break; } break; case ID_RECORD_PAUSE: switch(NCode) { case WM_NOTIFICATION_RELEASED: if((AUDIO_RECORDER_GetState() == AUDIO_RECORDER_PLAY_PAUSE)|| (AUDIO_RECORDER_GetState() == AUDIO_RECORDER_RECORD_PAUSE)) { AUDIO_RECORDER_PauseResume(); hItem = WM_GetDialogItem(pMsg->hWin, ID_EQUAL); IMAGE_SetGIF(hItem, equal, sizeof(equal)); WM_InvalidateWindow(hItem); WM_Update(hItem); } else if((AUDIO_RECORDER_GetState() == AUDIO_RECORDER_PLAYING)|| (AUDIO_RECORDER_GetState() == AUDIO_RECORDER_RECORDING)) { AUDIO_RECORDER_PauseResume(); hItem = WM_GetDialogItem(pMsg->hWin, ID_EQUAL); IMAGE_SetBitmap(hItem, &bmframe0); WM_InvalidateWindow(hItem); WM_Update(hItem); } break; } break; case ID_RECORD_STOP: switch(NCode) { case WM_NOTIFICATION_RELEASED: if( RecorderMode == RECORDER_MODE_RECORDING) { AUDIO_RECORDER_StopRec(); RecorderMode = RECORDER_MODE_PLAY_IDLE; } else if( RecorderMode == RECORDER_MODE_PLAYING) { AUDIO_RECORDER_StopPlayer(); RecorderMode = RECORDER_MODE_PLAY_IDLE; } else if( RecorderMode == RECORDER_MODE_PLAY_IDLE) { RecorderMode = RECORDER_MODE_REC_IDLE; } hItem = WM_GetDialogItem(pMsg->hWin, ID_RECORD_REC_CANCEL_PLAY); WM_InvalidateWindow(hItem); WM_Update(hItem); hItem = WM_GetDialogItem(pMsg->hWin, ID_RECORD_STOP); WM_InvalidateWindow(hItem); WM_Update(hItem); hItem = WM_GetDialogItem(pMsg->hWin, ID_RECORD_PAUSE); WM_InvalidateWindow(hItem); WM_Update(hItem); break; } break; case ID_RECORD_REC_CANCEL_PLAY: switch(NCode) { case WM_NOTIFICATION_RELEASED: /* Start Recored */ if( RecorderMode == RECORDER_MODE_REC_IDLE) { _BuildFileName(); hItem = WM_GetDialogItem(hMainWin, ID_FILENAMECAPTION); TEXT_SetText(hItem, "File : "); WM_InvalidateWindow(hItem); WM_Update(hItem); hItem = WM_GetDialogItem(hMainWin, ID_FILENAME); TEXT_SetText(hItem, FileName); WM_InvalidateWindow(hItem); WM_Update(hItem); AUDIO_RECORDER_SelectFile(FileName, FA_CREATE_ALWAYS | FA_WRITE); AUDIO_RECORDER_StartRec(DEFAULT_AUDIO_IN_FREQ); RecorderMode = RECORDER_MODE_RECORDING; hItem = WM_GetDialogItem(pMsg->hWin, ID_EQUAL); IMAGE_SetGIF(hItem, equal, sizeof(equal)); WM_InvalidateWindow(hItem); WM_Update(hItem); } /* Cancel */ else if( RecorderMode == RECORDER_MODE_RECORDING) { AUDIO_RECORDER_StopRec(); RecorderMode = RECORDER_MODE_REC_IDLE; AUDIO_RECORDER_RemoveAudioFile(FileName); } /* Start Play */ else if( RecorderMode == RECORDER_MODE_PLAY_IDLE) { RecorderMode = RECORDER_MODE_PLAYING; AUDIO_RECORDER_SelectFile(FileName, FA_OPEN_EXISTING | FA_READ); AUDIO_RECORDER_Play(DEFAULT_AUDIO_IN_FREQ); hItem = WM_GetDialogItem(pMsg->hWin, ID_EQUAL); IMAGE_SetGIF(hItem, equal, sizeof(equal)); WM_InvalidateWindow(hItem); WM_Update(hItem); } hItem = WM_GetDialogItem(pMsg->hWin, ID_RECORD_REC_CANCEL_PLAY); WM_InvalidateWindow(hItem); WM_Update(hItem); hItem = WM_GetDialogItem(pMsg->hWin, ID_RECORD_STOP); WM_InvalidateWindow(hItem); WM_Update(hItem); hItem = WM_GetDialogItem(pMsg->hWin, ID_RECORD_PAUSE); WM_InvalidateWindow(hItem); WM_Update(hItem); break; } break; } break; default: WM_DefaultProc(pMsg); break; } }
/** * @brief Callback routine of dialog * @param pMsg: pointer to data structure of type WM_MESSAGE * @retval None */ static void _cbDialog(WM_MESSAGE * pMsg) { WM_HWIN hItem; int Id, NCode; TREEVIEW_ITEM_Handle hTreeView; TREEVIEW_ITEM_INFO Info; GUI_PID_STATE State; switch (pMsg->MsgId) { case WM_INIT_DIALOG: pFileList = (FILELIST_FileTypeDef *)k_malloc(sizeof(FILELIST_FileTypeDef)); pFileList->ptr = 0; hPopUp = WM_CreateWindowAsChild(0, 26, LCD_GetXSize(), LCD_GetYSize()-26, pMsg->hWin, WM_CF_SHOW | WM_CF_HASTRANS , _cbPopup, 0); WM_BringToBottom(hPopUp); hItem = pMsg->hWin; FRAMEWIN_AddCloseButton(hItem, FRAMEWIN_BUTTON_RIGHT, 0); hItem = WM_GetDialogItem(pMsg->hWin, ID_IMAGE_0); IMAGE_SetGIF(hItem, acfolder, sizeof(acfolder)); WM_CreateWindowAsChild(639, 460, 1, 1, pMsg->hWin, WM_CF_SHOW | WM_CF_HASTRANS, _cbMediaConnection , 0); _RefreshBrowser(pMsg->hWin); break; case WM_NOTIFY_PARENT: Id = WM_GetId(pMsg->hWinSrc); /* Id of widget */ NCode = pMsg->Data.v; /* Notification code */ switch (NCode) { case WM_NOTIFICATION_CHILD_DELETED: k_free(pFileList); if(hFileInfo != 0) { hFileInfo = 0; } break; case WM_NOTIFICATION_CLICKED: /* React only if released */ switch (Id) { case ID_TREEVIEW: hTreeView = TREEVIEW_GetSel(pMsg->hWinSrc); TREEVIEW_ITEM_GetInfo(hTreeView, &Info); if(Info.IsNode == 0) { GUI_TOUCH_GetState(&State); State.x += 20; State.y-= 50; if(State.y > 150) { State.y -= 70; } _FindFullPath(pMsg->hWinSrc, hTreeView, SelectedFileName); /* Create popup menu after touching the display */ _OpenPopup(hPopUp, _aMenuItems, GUI_COUNTOF(_aMenuItems), State.x, State.y); } break; case ID_BUTTON_REFRESH: _RefreshBrowser (pMsg->hWin); break; } break; } break; default: WM_DefaultProc(pMsg); break; } }