/** * @brief Callback routine of the video main dialog * @param pMsg: pointer to a data structure of type WM_MESSAGE * @retval None */ static void _cbDialog(WM_MESSAGE * pMsg) { WM_HWIN hItem; int Id, NCode; static uint8_t sel = 0; switch (pMsg->MsgId) { case WM_INIT_DIALOG: memset(Video_Path, 0, 256); hItem = BUTTON_CreateEx(700, 0, 100, 100, pMsg->hWin, WM_CF_SHOW, 0, ID_BUTTON_EXIT); WM_SetCallback(hItem, _cbButton_exit); hItem = ST_AnimatedIconView_CreateEx(120, 50, LCD_GetXSize() - 220, LCD_GetYSize() - 150, pMsg->hWin, WM_CF_SHOW | WM_CF_HASTRANS , 0, ID_ICONVIEW_SUBMENU, 240, 300, 100, 5); ST_AnimatedIconView_SetDualFont(hItem, &GUI_FontLubalGraph24, &GUI_FontLubalGraph24); ST_AnimatedIconView_SetSpace(hItem, GUI_COORD_Y, 5); ST_AnimatedIconView_SetSpace(hItem, GUI_COORD_X, 25); ST_AnimatedIconView_SetFrame(hItem, GUI_COORD_Y, 10); ST_AnimatedIconView_SetFrame(hItem, GUI_COORD_X, 5); ST_AnimatedIconView_SetSel(hItem, -1); ST_AnimatedIconView_SetTextColor(hItem, ICONVIEW_CI_UNSEL, GUI_STCOLOR_LIGHTBLUE); ST_AnimatedIconView_SetBkColor(hItem, ICONVIEW_CI_UNSEL, GUI_WHITE); ST_AnimatedIconView_SetBkColor(hItem, ICONVIEW_CI_SEL, GUI_WHITE); ST_AnimatedIconView_SetDualTextColor(hItem, ICONVIEW_CI_SEL, GUI_STCOLOR_LIGHTBLUE, GUI_STCOLOR_DARKBLUE); ST_AnimatedIconView_AddIcon(hItem, open_file, 0, "Play video"); ST_AnimatedIconView_AddIcon(hItem, add_video, 0, "Open playlist"); break; case WM_PAINT: GUI_SetColor(GUI_BLACK); GUI_DrawLine(799, 0, 799, 480); 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_CLICKED: /* avoid icon view animation */ hItem = WM_GetDialogItem(pMsg->hWin, ID_ICONVIEW_SUBMENU); WM_HideWindow(hItem); break; case WM_NOTIFICATION_MOVED_OUT: hItem = WM_GetDialogItem(pMsg->hWin, ID_ICONVIEW_SUBMENU); WM_ShowWindow(hItem); break; case WM_NOTIFICATION_RELEASED: GUI_EndDialog(pMsg->hWin, 0); break; } break; case ID_ICONVIEW_SUBMENU: switch(NCode) { case WM_NOTIFICATION_RELEASED: sel = ST_AnimatedIconView_GetSel(pMsg->hWinSrc); if(sel == 0) { if(VNC_IsRunning() == 0) { /* Playlist not empty, so start play first item */ if(VideoList.ptr > 0) { GUI_SetLayerVisEx (1, 1); GUI_SelectLayer(1); playbackwin = WM_CreateWindowAsChild(0, 0, 800, 480, WM_GetDesktopWindowEx(1), WM_CF_SHOW, _cbplaybackwin , 0); WM_CreateWindowAsChild(100, 100, 600, 280, WM_GetDesktopWindowEx(1), WM_CF_SHOW | WM_CF_HASTRANS, _cbTouch , 0); GUI_SelectLayer(0); _StartPlay(&hvideo, (char *)VideoList.file[0].name, &Video_File, 0, 0); VideoPlayer_State = VIDEO_PLAY; hFrame = WM_CreateWindowAsChild(0, 0, 800, 480,pMsg->hWin, WM_CF_SHOW, _cbVideoWindow , 0); GUI_SelectLayer(1); } else {/* There is no item yet in the playlist: Show hint message */ hItem = GUI_CreateDialogBox(_aFileInfoDialogCreate, GUI_COUNTOF(_aFileInfoDialogCreate), _cbFileInfoDialog, pMsg->hWin, 100, 50); WM_MakeModal(hItem); } } else { hItem = GUI_CreateDialogBox(_aFileErrorDialogCreate, GUI_COUNTOF(_aFileErrorDialogCreate), _cbFileInfoDialog, pMsg->hWin, 100, 50); WM_MakeModal(hItem); } } else if(sel == 1) { hPlaylistWin = GUI_CreateDialogBox(_aPlaylistDialogCreate, GUI_COUNTOF(_aPlaylistDialogCreate), _cbPlaylistDialog, pMsg->hWin, 100, 50); WM_MakeModal(hPlaylistWin); } break; } break; } break; default: WM_DefaultProc(pMsg); break; } }
/** * @brief Callback routine of the dialog * @param pMsg: pointer to a data structure of type WM_MESSAGE * @retval None */ static void _cbDialog(WM_MESSAGE * pMsg) { WM_HWIN hItem; int Id, NCode; static uint8_t sel = 0; switch (pMsg->MsgId) { case WM_INIT_DIALOG: memset(Video_Path, 0, 256); hItem = BUTTON_CreateEx(574, 0, 65, 65, pMsg->hWin, WM_CF_SHOW, 0, ID_BUTTON_EXIT); WM_SetCallback(hItem, _cbButton_exit); hItem = ST_AnimatedIconView_CreateEx(100, 70, LCD_GetXSize() - 0, LCD_GetYSize() - 30, pMsg->hWin, WM_CF_SHOW | WM_CF_HASTRANS , 0, ID_ICONVIEW_SUBMENU, 200, 250, 5, 5); ST_AnimatedIconView_SetDualFont(hItem, GUI_FONT_20_1, GUI_FONT_20_1); ST_AnimatedIconView_SetSpace(hItem, GUI_COORD_Y, 5); ST_AnimatedIconView_SetSpace(hItem, GUI_COORD_X, 25); ST_AnimatedIconView_SetFrame(hItem, GUI_COORD_Y, 10); ST_AnimatedIconView_SetFrame(hItem, GUI_COORD_X, 5); ST_AnimatedIconView_SetSel(hItem, -1); ST_AnimatedIconView_SetTextColor(hItem, ICONVIEW_CI_UNSEL, 0x00DCA939); ST_AnimatedIconView_SetBkColor(hItem, ICONVIEW_CI_UNSEL, GUI_WHITE); ST_AnimatedIconView_SetBkColor(hItem, ICONVIEW_CI_SEL, GUI_WHITE); ST_AnimatedIconView_SetDualTextColor(hItem, ICONVIEW_CI_SEL, 0x00DCA939, 0x00522000); ST_AnimatedIconView_AddIcon(hItem, open_file, 0, "Play video"); ST_AnimatedIconView_AddIcon(hItem, add_video, 0, "Add to playlist"); break; case WM_PAINT: GUI_SetColor(GUI_BLACK); GUI_DrawLine(639, 0, 639, 480); 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: GUI_EndDialog(pMsg->hWin, 0); break; } break; case ID_ICONVIEW_SUBMENU: switch(NCode) { case WM_NOTIFICATION_RELEASED: sel = ST_AnimatedIconView_GetSel(pMsg->hWinSrc); if(sel == 0) { osDelay(100); /* Playlist not empty, so start play first item */ if(VideoList.ptr > 0) { GUI_SetLayerVisEx (1, 1); GUI_SelectLayer(1); playbackwin = WM_CreateWindowAsChild(-1, 0, 640, 480, WM_GetDesktopWindowEx(1), WM_CF_SHOW, _cbplaybackwin , 0); WM_CreateWindowAsChild(0, 70, 640, 300, WM_GetDesktopWindowEx(1), WM_CF_SHOW | WM_CF_HASTRANS, _cbTouch , 0); GUI_SelectLayer(0); _StartPlay(&hvideo, (char *)VideoList.file[0].name, &Video_File, 0, 0); VideoPlayer_State = VIDEO_PLAY; hFrame = WM_CreateWindowAsChild(-1, 0, 640, 480,pMsg->hWin, WM_CF_SHOW, _cbVideoWindow , 0); GUI_SelectLayer(1); } else {/* There is no item yet in the playlist: Show hint message */ hItem = GUI_CreateDialogBox(_aFileInfoDialogCreate, GUI_COUNTOF(_aFileInfoDialogCreate), _cbFileInfoDialog, pMsg->hWin, 100, 80); WM_MakeModal(hItem); } } else /* Add file to playlist icon item action */ { hItem = GUI_CreateDialogBox(_aPlaylistDialogCreate, GUI_COUNTOF(_aPlaylistDialogCreate), _cbPlaylistDialog, pMsg->hWin, 100, 80); WM_MakeModal(hItem); } break; } break; } break; default: WM_DefaultProc(pMsg); break; } }
/** * @brief Callback routine of desktop window. * @param pMsg: pointer to data structure of type WM_MESSAGE * @retval None */ static void _cbBk(WM_MESSAGE * pMsg) { uint32_t NCode, Id; uint8_t sel; switch (pMsg->MsgId) { case WM_PAINT: GUI_SetBkColor(GUI_WHITE); GUI_Clear(); /*H/W Information */ GUI_SetColor(0x007B10D3); GUI_AA_FillRoundedRect(520, 220, 780, 478, 30); GUI_DrawBitmap(&bmF7Logo, 530, 240); break; case WM_NOTIFY_PARENT: Id = WM_GetId(pMsg->hWinSrc); NCode = pMsg->Data.v; switch (NCode) { case WM_NOTIFICATION_RELEASED: if (Id == ID_ICONVIEW_MENU) { sel = ST_AnimatedIconView_GetSel(pMsg->hWinSrc); if(sel < k_ModuleGetNumber()) { ST_AnimatedIconView_SetSel(pMsg->hWinSrc, -1); if(module_active == 0) { module_prop[sel].module->startup(pMsg->hWin, 0, 0); if(sel != 5) { module_active = 1; } sel = 0; } } else { WM_InvalidateWindow (pMsg->hWinSrc); } } break; case WM_NOTIFICATION_CHILD_DELETED: module_active = 0; break; default: break; } break; default: WM_DefaultProc(pMsg); } }