void ProcSelectChanged() { int currentSelected = ICONVIEW_GetSel(hIconView); if (currentSelected == 0) { WM_BringToTop(hWinIn); WM_Paint(hWinIn); /*xTaskCreate(scanClothesChanged, "clothes", 300, NULL, 1, NULL);*/ } else { WM_BringToTop(hWinOut); WM_Paint(hWinOut); } }
/** * @brief Callback function of the File Control page * @param pMsg: pointer to data structure of type WM_MESSAGE * @retval None */ static void _cbFileControl(WM_MESSAGE * pMsg) { WM_HWIN hItem; int NCode; int Id; int result; switch (pMsg->MsgId) { case WM_INIT_DIALOG: /* Initialization of 'Brightness' */ hItem = WM_GetDialogItem(pMsg->hWin, ID_FOLDER_CAPTION); TEXT_SetFont(hItem, GUI_FONT_13B_1); hItem = WM_GetDialogItem(pMsg->hWin, ID_FOLDER); EDIT_SetText(hItem, (char *)capture_folder); break; case WM_NOTIFY_PARENT: Id = WM_GetId(pMsg->hWinSrc); NCode = pMsg->Data.v; switch(Id) { case ID_BROWSE: /* Notifications sent by 'Radio' */ switch(NCode) { case WM_NOTIFICATION_RELEASED: pFileInfo->pfGetData = k_GetData; pFileInfo->pMask = acMask_folder; BSP_SD_Init(); SD_Configured = 1; chooser_select_folder = CHOOSEFILE_Create(CAMERA_hWin, 20, 20, 200, 150, apDrives, GUI_COUNTOF(apDrives), 0, "Select a folder", 0, pFileInfo); result = GUI_ExecCreatedDialog(chooser_select_folder); if (result == 0) { if(((pFileInfo->pRoot[0] == '0' ) || (pFileInfo->pRoot[0] == '1' ))) { hItem = WM_GetDialogItem(hDialogFileControl, ID_FOLDER); EDIT_SetText(hItem, (char *)pFileInfo->pRoot); chooser_select_folder = 0; WM_InvalidateWindow(hDialogFileControl); WM_Paint(hDialogFileControl); strncpy((char *)(CAMERA_SAVE_PATH),pFileInfo->pRoot , FILEMGR_FULL_PATH_SIZE); strncpy((char *)capture_folder,pFileInfo->pRoot , FILEMGR_FULL_PATH_SIZE); } } break; } break; } break; default: WM_DefaultProc(pMsg); break; } }
/** * @brief Start play * @param filename: pointer to the video file name * @retval None */ static uint8_t _StartPlay(GUI_MOVIE_HANDLE *hmovie, char * filename, FIL * file, uint16_t x0, uint16_t y0) { static char tmp[FILEMGR_FILE_NAME_SIZE]; int ms, frames; uint32_t duration; WM_HWIN hItem; if(f_open(file, filename, FA_OPEN_EXISTING | FA_READ) == FR_OK) { PrevFrameIndex = 0; LostFrames = 0; previous_total = 0; GUI_MOVIE_GetInfoEx(_GetData, file, &Video_Info); *hmovie = GUI_MOVIE_CreateEx(_GetData, file, _cbNotify) ; GUI_MOVIE_SetPeriod (*hmovie, VIDEO_FRAME_TIME); if((Video_Info.xSize == 0) || (Video_Info.ySize == 0) || (Video_Info.xSize > 1024) || (Video_Info.ySize > 768)) { GUI_MOVIE_Delete(*hmovie); return 1; } GUI_MOVIE_Show(*hmovie, ((LCD_GetXSize() - Video_Info.xSize)/2), ((LCD_GetYSize() - Video_Info.ySize)/2), 0); hTimer = WM_CreateTimer(playbackwin, 0, 1000, 0); /* Update video total time */ hItem = WM_GetDialogItem(playbackwin, ID_TIME); ms = Video_Info.msPerFrame; frames = Video_Info.NumFrames; duration = (frames * ms)/1000; sprintf((char *)tmp , "%02lu:%02lu", duration/60, duration%60 ); TEXT_SetText(hItem, tmp); WM_InvalidateWindow(playbackwin); elapsed_time = 0; hItem = WM_GetDialogItem(playbackwin, ID_VIDEO_NAME); FILEMGR_GetFileOnly (tmp, filename); TEXT_SetText(hItem, tmp); hItem = WM_GetDialogItem(playbackwin, ID_ELAPSED_TIME); TEXT_SetText(hItem, "00:00"); WM_InvalidateWindow(hItem); WM_Paint(hItem); } return 0; }
void CreateButton(WM_HWIN Win1,PDesktopButton pButton,int cx,int cy) { int i,x,y; int top = 10,left = 0; int size = 40; int space = 20; int bmsize = 32; int width = 480; int height = 272; x = left; y = top; //sizeof(pButton)/sizeof(pButton[0]) for(i = 0;i < 20;i++) { if(pButton[i].title[0] == 0) break; if(y + size < height) { pButton[i].button = BUTTON_CreateAsChild(x,y,size,size,Win1,10,WM_CF_SHOW); BUTTON_SetBitmapEx(pButton[i].button,0,pButton[i].hBitMap_1,(size - bmsize) / 2, 4); BUTTON_SetBitmapEx(pButton[i].button,1,pButton[i].hBitMap_2,(size - bmsize) / 2, 4); BUTTON_SetText(pButton[i].button,pButton[i].title); BUTTON_SetTextAlign(pButton[i].button,GUI_TA_BOTTOM | GUI_TA_HCENTER); //BUTTON_SetFont(pButton[i].button,&GUI_Font8x12_ASCII); //BUTTON_SetBkColor(pButton[i].button,0,GUI_GetBkColor()); WM_Paint(pButton[i].button); } x += size + space; if(x > width) { x = left; y += size + space; } } }
/** * @brief Callback routine of the Benchmark 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; WM_HWIN hGraph; int cpu_speed = 0; char temp[50]; WM_CALLBACK *_cb; switch (pMsg->MsgId) { case WM_INIT_DIALOG: /* Initialization of 'CPU' */ hItem = pMsg->hWin; FRAMEWIN_SetFont(hItem, GUI_FONT_13HB_ASCII); FRAMEWIN_AddCloseButton(hItem, FRAMEWIN_BUTTON_RIGHT, 0); hItem = TEXT_CreateEx(10, 20, 100, 25, pMsg->hWin, WM_CF_SHOW,0, 0x123,""); TEXT_SetFont(hItem, GUI_FONT_13B_1); TEXT_SetTextColor(hItem, 0x00804000); TEXT_SetText(hItem, "CPU Usage %:"); hItem = WM_GetDialogItem(pMsg->hWin, ID_BENCH_CPU); TEXT_SetFont(hItem, GUI_FONT_16B_ASCII); TEXT_SetTextColor(hItem, GUI_DARKRED); hItem = WM_GetDialogItem(pMsg->hWin, ID_CPU_GRAPH); FRAMEWIN_SetBarColor(hItem, 0, GUI_DARKGRAY); FRAMEWIN_SetBarColor(hItem, 1, GUI_DARKGRAY); hGraph = GRAPH_CreateEx(10, 35, 300, 95, pMsg->hWin, WM_CF_SHOW, 0, GUI_ID_GRAPH0); hData = GRAPH_DATA_YT_Create(GUI_LIGHTGREEN, 500, 0, 20); GRAPH_SetGridVis(hGraph, 1); GRAPH_SetBorder(hGraph, 20, 4, 5, 4); GRAPH_AttachData(hGraph, hData); hScale = GRAPH_SCALE_Create(20, GUI_TA_RIGHT, GRAPH_SCALE_CF_VERTICAL, 25); GRAPH_AttachScale(hGraph, hScale); GRAPH_SCALE_SetTextColor(hScale, GUI_YELLOW); GRAPH_SetGridDistX(hGraph, 25); GRAPH_SetGridDistY(hGraph, 25); WM_CreateWindowAsChild(80, 45, 354, 23, pMsg->hWin, WM_CF_SHOW | WM_CF_HASTRANS, _cbCpuWindow , 0); break; case WM_NOTIFY_PARENT: Id = WM_GetId(pMsg->hWinSrc); /* Id of widget */ NCode = pMsg->Data.v; /* Notification code */ switch (NCode) { case WM_NOTIFICATION_RELEASED: /* React only if released */ switch (Id) { case ID_BENCH_CPU: Stop_Test = 0; WM_HideWindow(pMsg->hWin); _cb = WM_GetCallback(WM_HBKWIN); WM_SetCallback(WM_HBKWIN, _ClearDesktop); cpu_speed = Run_SpeedTest(); WM_ShowWindow(pMsg->hWin); hItem = WM_GetDialogItem(pMsg->hWin, ID_BENCH_CPU); sprintf (temp, "%d Pixels/s ", cpu_speed); TEXT_SetText(hItem, temp); WM_SetCallback(WM_HBKWIN, _cb); hItem = WM_GetDialogItem(WM_HBKWIN, ID_BUTTON_BKGND); WM_InvalidateWindow(hItem); WM_InvalidateWindow(WM_HBKWIN); WM_Paint(WM_HBKWIN); break; } break; case WM_NOTIFICATION_CHILD_DELETED: Stop_Test = 1; break; } break; default: WM_DefaultProc(pMsg); break; } }
/** * @brief callback for video window * @param pMsg: pointer to a data structure of type WM_MESSAGE * @retval None */ static void _cbplaybackwin(WM_MESSAGE * pMsg) { WM_HWIN hItem; int Id, NCode; char tmp[64]; switch (pMsg->MsgId) { case WM_CREATE: SelLayer = 1; hItem = BUTTON_CreateEx(398 - 160, 442, 40, 40, pMsg->hWin, WM_CF_SHOW, 0, ID_BUTTON_BACK); WM_SetCallback(hItem, _cbButton_back); hItem = BUTTON_CreateEx(449 - 160, 442, 40, 40, pMsg->hWin, WM_CF_SHOW, 0, ID_BUTTON_STOP); WM_SetCallback(hItem, _cbButton_stop); hItem = BUTTON_CreateEx(495 - 160, 441, 40, 40, pMsg->hWin, WM_CF_SHOW, 0, PLAY_VIDEO_ID); WM_SetCallback(hItem, _cbButton_play); hItem = BUTTON_CreateEx(540 - 160, 442, 40, 40, pMsg->hWin, WM_CF_SHOW, 0, ID_BUTTON_FORE); WM_SetCallback(hItem, _cbButton_fore); hItem = SLIDER_CreateEx(72, 420, 510, 13, pMsg->hWin, WM_CF_SHOW, 0, ID_SLIDER_DURATION); SLIDER_SetBkColor(hItem, GUI_TRANSPARENT); SLIDER_SetFocusColor (hItem, 0x00DCA939); SLIDER_SetValue(hItem, 0); SLIDER_SetWidth(hItem, 0); SLIDER_SetSTSkin(hItem); hItem = BUTTON_CreateEx(568, 0, 70, 70, pMsg->hWin, WM_CF_SHOW, 0, ID_BUTTON_MENU); WM_SetCallback(hItem, _cbButton_menu); hItem = BUTTON_CreateEx(0, 410, 70, 70, pMsg->hWin, WM_CF_SHOW, 0, ID_BUTTON_EXIT_FROM_VIDEO); WM_SetCallback(hItem, _cbButton_exit1); /* Title Initialization in play list */ hItem = TEXT_CreateEx(10, 20, 100, 40, pMsg->hWin, WM_CF_SHOW, 0, ID_ELAPSED_TIME, "00:00"); TEXT_SetFont(hItem, GUI_FONT_20B_1); TEXT_SetTextColor(hItem, GUI_WHITE); /* Title Initialization in play list */ hItem = TEXT_CreateEx(50, 40, 50, 30, pMsg->hWin, WM_CF_SHOW, 0, ID_TIME, "00:00"); TEXT_SetFont(hItem, GUI_FONT_16B_1); TEXT_SetTextColor(hItem, GUI_WHITE); hItem = TEXT_CreateEx(150, 20, 350, 30, pMsg->hWin, WM_CF_SHOW, TEXT_CF_HCENTER, ID_VIDEO_NAME, "File Name"); TEXT_SetFont(hItem, GUI_FONT_20B_1); TEXT_SetTextColor(hItem, GUI_WHITE); hItem = TEXT_CreateEx(150, 48, 350, 30, pMsg->hWin, WM_CF_SHOW, TEXT_CF_HCENTER, ID_VIDEO_FORMAT, "Format : MJPEG"); TEXT_SetFont(hItem, GUI_FONT_13B_1); TEXT_SetTextColor(hItem, GUI_WHITE); hItem = TEXT_CreateEx(548, 200, 260, 20, pMsg->hWin, WM_CF_SHOW, TEXT_CF_LEFT, ID_FPS, "Rate : 20 fps"); TEXT_SetFont(hItem, GUI_FONT_13B_1); TEXT_SetTextColor(hItem, GUI_WHITE); hItem = TEXT_CreateEx(548, 220, 260, 20, pMsg->hWin, WM_CF_SHOW, TEXT_CF_LEFT, ID_FEATURES_FPU, "FPU : ON"); TEXT_SetFont(hItem, GUI_FONT_13B_1); TEXT_SetTextColor(hItem, GUI_WHITE); hItem = TEXT_CreateEx(548, 240, 260, 20, pMsg->hWin, WM_CF_SHOW, TEXT_CF_LEFT, ID_FEATURES_IC, "I-Cache : ON"); TEXT_SetFont(hItem, GUI_FONT_13B_1); TEXT_SetTextColor(hItem, GUI_WHITE); hItem = TEXT_CreateEx(548, 260, 260, 20, pMsg->hWin, WM_CF_SHOW, TEXT_CF_LEFT, ID_FEATURES_DC, "D-Cache : ON"); TEXT_SetFont(hItem, GUI_FONT_13B_1); TEXT_SetTextColor(hItem, GUI_WHITE); hItem = TEXT_CreateEx(548, 280, 260, 20, pMsg->hWin, WM_CF_SHOW, TEXT_CF_LEFT, ID_FEATURES_CPU, "MCU Load : 0%"); TEXT_SetFont(hItem, GUI_FONT_13B_1); TEXT_SetTextColor(hItem, GUI_WHITE); break; case WM_TIMER: { WM_RestartTimer(pMsg->Data.v, 1000); /* show elapsed time */ hItem = WM_GetDialogItem(pMsg->hWin, ID_ELAPSED_TIME); elapsed_time++; sprintf((char *)tmp , "%02lu:%02lu", elapsed_time/60, elapsed_time%60 ); TEXT_SetText(hItem, tmp); sprintf((char *)tmp , "MCU Load : %d%%", ((osGetCPUUsage() > 90) ? (osGetCPUUsage() - 10) : osGetCPUUsage())); hItem = WM_GetDialogItem(pMsg->hWin, ID_FEATURES_CPU); TEXT_SetText(hItem, tmp); hItem = WM_GetDialogItem(pMsg->hWin, ID_SLIDER_DURATION); SLIDER_SetValue(hItem, (GUI_MOVIE_GetFrameIndex(hvideo)* 100)/ Video_Info.NumFrames); if(step == 0) { step = ((GUI_MOVIE_GetFrameIndex(hvideo)* 100)/ Video_Info.NumFrames); } if(((GUI_MOVIE_GetFrameIndex(hvideo)* 100)/ Video_Info.NumFrames) > (100 - 2*step - 1)) { SLIDER_SetValue(hItem, 100); GUI_Exec(); } } break; case WM_DELETE: if(hTimer != 0) { WM_DeleteTimer(hTimer); hTimer = 0; } case WM_PAINT: GUI_SetColor(0xFF000000 | GUI_BLACK); GUI_SetBkColor(GUI_TRANSPARENT); GUI_Clear(); GUI_SetColor(GUI_BLACK); GUI_DrawHLine(0, 0, 640); GUI_DrawHLine(479, 0, 640); GUI_DrawLine(639, 0, 639, 480); GUI_DrawLine(0, 0, 0, 480); /* Background for total time */ GUI_SetColor(0x00DCA939); GUI_AA_FillRoundedRect((-30), 5, 90, 65, 30); /*Video Information */ GUI_AA_FillRoundedRect(150, 5, 500, 65, 30); /*H/W Information */ GUI_AA_FillRoundedRect(538, 180, 780, 320, 30); 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_FROM_VIDEO: switch(NCode) { case WM_NOTIFICATION_RELEASED: if(VideoPlayer_State != VIDEO_IDLE) { _StopPlay(&hvideo, &Video_File); } GUI_EndDialog(pMsg->hWin, 0); SelLayer = 0; GUI_SetLayerVisEx (1, 0); GUI_SelectLayer(0); WM_HideWindow(hFrame); WM_Exec(); WM_DeleteWindow(hFrame); WM_InvalidateWindow(VideoWin); break; } break; case ID_BUTTON_MENU: switch(NCode) { case WM_NOTIFICATION_RELEASED: if(VideoPlayer_State != VIDEO_IDLE) { _StopPlay(&hvideo, &Video_File); } GUI_EndDialog(pMsg->hWin, 0); SelLayer = 0; GUI_SetLayerVisEx (1, 0); GUI_SelectLayer(0); WM_DeleteWindow(hFrame); WM_HideWindow(VideoWin); WM_Exec(); WM_DeleteWindow(VideoWin); break; } break; case ID_BUTTON_STOP: switch(NCode) { case WM_NOTIFICATION_RELEASED: if(VideoPlayer_State != VIDEO_IDLE) { VideoPlayer_State = VIDEO_STOP; _StopPlay(&hvideo, &Video_File); } WM_InvalidateWindow(pMsg->hWin); break; } break; case ID_BUTTON_FORE: switch(NCode) { case WM_NOTIFICATION_RELEASED: if(VideoPlayer_State == VIDEO_PLAY) { if(file_pos < (VideoList.ptr - 1)) { file_pos++; } else { file_pos = 0; } _StopPlay(&hvideo, &Video_File); _StartPlay(&hvideo, (char *)VideoList.file[file_pos].name, &Video_File, 0, 0); } break; } break; /* Notifications sent by 'progress' Slider */ case ID_SLIDER_DURATION: if(NCode == WM_NOTIFICATION_CLICKED) { hItem = WM_GetDialogItem(pMsg->hWin, ID_SLIDER_DURATION); int32_t newpos; if(VideoPlayer_State == VIDEO_PLAY) { GUI_MOVIE_Pause(hvideo); hItem = WM_GetDialogItem(pMsg->hWin, ID_SLIDER_DURATION); newpos = (SLIDER_GetValue(hItem) * Video_Info.NumFrames)/100; GUI_MOVIE_GotoFrame(hvideo, newpos); GUI_MOVIE_Play(hvideo); elapsed_time = (Video_Info.msPerFrame * newpos)/ 1000; hItem = WM_GetDialogItem(playbackwin, ID_ELAPSED_TIME); sprintf((char *)tmp , "%02lu:%02lu", elapsed_time/60, elapsed_time%60 ); TEXT_SetText(hItem, tmp); WM_InvalidateWindow(hItem); WM_Paint(hItem); } } break; case ID_BUTTON_BACK: switch(NCode) { case WM_NOTIFICATION_RELEASED: if(VideoPlayer_State == VIDEO_PLAY) { if(file_pos > 0) { file_pos--; } else { file_pos = VideoList.ptr - 1; } _StopPlay(&hvideo, &Video_File); _StartPlay(&hvideo, (char *)VideoList.file[file_pos].name, &Video_File, 0, 0); } break; } break; case PLAY_VIDEO_ID: switch(NCode) { case WM_NOTIFICATION_RELEASED: if((VideoPlayer_State == VIDEO_IDLE) || (VideoPlayer_State == VIDEO_PAUSE)) { hTimer = WM_CreateTimer(playbackwin, 0, 1000, 0); GUI_MOVIE_Play(hvideo); VideoPlayer_State = VIDEO_PLAY; } else if(VideoPlayer_State == VIDEO_STOP) { _StartPlay(&hvideo, (char *)VideoList.file[file_pos].name, &Video_File, 0, 0); VideoPlayer_State = VIDEO_PLAY; } else { GUI_MOVIE_Pause(hvideo); VideoPlayer_State = VIDEO_PAUSE; if(hTimer != 0) { WM_DeleteTimer(hTimer); hTimer = 0; } } break; } break; } break; default: WM_DefaultProc(pMsg); break; } }
LRESULT CALLBACK WndProc( HWND hwnd, UINT uMessage, WPARAM wParam, LPARAM lParam ) { int id; int retval; Bmscr *bm; if ( code_isuserirq() ) { if ( code_checkirq( (int)GetWindowLongPtr( hwnd, GWLP_USERDATA ), (int)uMessage, (int)wParam, (int)lParam ) ) { if ( code_irqresult( &retval ) ) return retval; } } switch (uMessage) { case WM_CREATE: SetWindowLongPtr( hwnd, GWLP_USERDATA, -1 ); return 0; case WM_PALETTECHANGED: if ( wParam == (WPARAM)hwnd ) break; case WM_QUERYNEWPALETTE: bm = TrackBmscr( hwnd ); if ( bm == NULL ) break; if (bm->hpal != NULL) { // パレット変更時にもマッチングさせる int a; HDC hdc; HPALETTE opal; hdc=GetDC( hwnd ); opal=SelectPalette( hdc, bm->hpal, 0 ); a=RealizePalette( hdc ); SelectPalette( hdc, opal, 0 ); ReleaseDC( hwnd, hdc ); if ( a > 0) InvalidateRect( hwnd, NULL, TRUE ); return a; } break; case WM_PAINT: // Display 全描画 // bm = TrackBmscr( hwnd ); if ( bm != NULL ) WM_Paint( hwnd, bm ); return 0 ; case WM_GETMINMAXINFO: { LPMINMAXINFO lpmm; bm = TrackBmscr( hwnd ); if ( bm != NULL ) { lpmm = (LPMINMAXINFO)lParam; lpmm->ptMaxTrackSize.x = bm->sx + bm->framesx; lpmm->ptMaxTrackSize.y = bm->sy + bm->framesy; } break; } case WM_SIZE: bm = TrackBmscr( hwnd ); if ( bm != NULL ) { bm->wx = lParam & 0xFFFF; // xサイズ bm->wy = (lParam >> 16) & 0xFFFF; // yサイズ bm->SetScroll( bm->viewx, bm->viewy ); } break; case WM_MOUSEWHEEL: bm = TrackBmscr( hwnd ); if ( bm != NULL ) { bm->savepos[BMSCR_SAVEPOS_MOSUEZ] = LOWORD(wParam); bm->savepos[BMSCR_SAVEPOS_MOSUEW] = HIWORD(wParam); } return 0; case WM_MOUSEMOVE: bm = TrackBmscr( hwnd ); if ( bm != NULL ) { bm->savepos[BMSCR_SAVEPOS_MOSUEX] = LOWORD(lParam); bm->savepos[BMSCR_SAVEPOS_MOSUEY] = HIWORD(lParam); } return 0; case WM_LBUTTONDOWN: case WM_RBUTTONDOWN: case WM_MBUTTONDOWN: if ( code_isirq( HSPIRQ_ONCLICK ) ) { code_sendirq( HSPIRQ_ONCLICK, (int)uMessage - (int)WM_LBUTTONDOWN, (int)wParam, (int)lParam ); } break; case WM_COMMAND: if ( wParam & MESSAGE_HSPOBJ ) { id = (int)GetWindowLongPtr( hwnd, GWLP_USERDATA ); bm =curwnd->GetBmscr( id ); //Alertf( "%d,%x,%x (%d)",id,wParam,lParam , ( wParam & (MESSAGE_HSPOBJ-1)) ); bm->SendHSPObjectNotice( (int)wParam ); } return 0; case MM_MCINOTIFY: if ( wParam == MCI_NOTIFY_SUCCESSFUL ) { if ( notifyfunc != NULL ) notifyfunc( hwnd ); } return 0; #ifdef HSPWINGUIDLL case WM_QUERYENDSESSION: return TRUE; case WM_CLOSE: return 0; #else case WM_QUERYENDSESSION: case WM_CLOSE: id = (int)GetWindowLongPtr( hwnd, GWLP_USERDATA ); if ( code_isirq( HSPIRQ_ONEXIT ) ) { int iparam = 0; if ( uMessage == WM_QUERYENDSESSION ) iparam++; retval = code_sendirq( HSPIRQ_ONEXIT, iparam, id, 0 ); if ( retval == RUNMODE_INTJUMP ) retval = code_execcmd2(); // onexit goto時は実行してみる if ( retval != RUNMODE_END ) return 0; } code_puterror( HSPERR_NONE ); PostQuitMessage(0); return (uMessage == WM_QUERYENDSESSION) ? true : false; #endif case WM_DRAWITEM: if ( wParam & MESSAGE_HSPOBJ ) { id = (int)GetWindowLongPtr( hwnd, GWLP_USERDATA ); bm =curwnd->GetBmscr( id ); bm->SendHSPObjectDraw( (int)wParam, (LPDRAWITEMSTRUCT)lParam ); } break; }
void _cbWindowSetting(WM_MESSAGE* pMsg) { WM_HWIN hWin = pMsg->hWin; WM_HWIN _edit0; WM_HWIN _edit1; int edit_id = 256; int VALUE; int i = 0; switch (pMsg->MsgId) { case WM_CREATE: WIDGET_SetDefaultEffect (&WIDGET_Effect_None); EDIT_SetDefaultTextAlign(GUI_TA_HCENTER | GUI_TA_VCENTER); EDIT_SetDefaultFont(&GUI_Font28); EDIT_CreateEx(200,60,62,30,hWin,WM_CF_SHOW,0,GUI_ID_EDIT0,1);//夜间模式 EDIT_CreateEx(150,110,62,30,hWin,WM_CF_SHOW,0,GUI_ID_EDIT1,1);//音量 EDIT_CreateEx(150,160,62,30,hWin,WM_CF_SHOW,0,GUI_ID_EDIT2,1);//亮度 EDIT_CreateEx(150,210,62,30,hWin,WM_CF_SHOW,0,GUI_ID_EDIT3,2);//时区 EDIT_CreateEx(240,260,62,30,hWin,WM_CF_SHOW,0,GUI_ID_EDIT4,1);//报警音1 EDIT_CreateEx(170,310,62,30,hWin,WM_CF_SHOW,0,GUI_ID_EDIT5,1);//按键音1 EDIT_CreateEx(200,360,62,30,hWin,WM_CF_SHOW,0,GUI_ID_EDIT6,1);//单位显示 EDIT_CreateEx(200,410,62,30,hWin,WM_CF_SHOW,0,GUI_ID_EDIT7,1);//船形显示 for (i = 0; i < 8; i++) { _edit0 = WM_GetDialogItem(hWin, GUI_ID_EDIT0 + i); EDIT_SetText(_edit0,"0"); EDIT_SetpfAddKeyEx (_edit0,_cbEditAddKey); EDIT_SetBkColor(_edit0,1,GUI_LIGHTBLUE); EDIT_SetBkColor(_edit0,0,GUI_WHITE); } break; case WM_PAINT: GUI_SetBkColor (GUI_LIGHTBLUE); GUI_Clear(); for (i = 0; i < 8; i++) { _edit0 = WM_GetDialogItem(hWin, GUI_ID_EDIT0 + i); EDIT_SetTextColor(_edit0,0,GUI_BLACK); } EDIT_SetTextColor (WM_GetDialogItem(hWin, edit_id),0,GUI_WHITE); GUI_SetTextMode(GUI_TEXTMODE_TRANS); GUI_SetColor (GUI_BLACK); GUI_SetFont (&GUI_Font28); GUI_DispStringAt ("系统设置",230,10); GUI_DispStringAt ("01:夜间模式:",5,60); GUI_DispStringAt ("02:音量:",5,110); GUI_DispStringAt ("03:亮度:",5,160); GUI_DispStringAt ("04:时区:",5,210); GUI_DispStringAt ("05:报警音选择:",5,260); GUI_DispStringAt ("06:按键音:",5,310); GUI_DispStringAt ("07:单位设置:",5,360); GUI_DispStringAt ("08:船位显示:",5,410); GUI_DispStringAt ("09:船迹存储时间:",330,60); GUI_DispStringAt ("10:软件更新:",330,110); GUI_DispStringAt ("11:系统版本:",330,160); GUI_SetColor (GUI_WHITE); GUI_SetPenSize(2); GUI_DrawLine(1,50,1,470); GUI_DrawLine(1,50,673,50); GUI_DrawLine(673,50,673,470); GUI_DrawLine(1,470,673,470); break; case WM_KEY: switch (((WM_KEY_INFO*)(pMsg->Data.p))->Key) { case GUI_KEY_TAB: //判断当前焦点所在的位置,将焦点移至下一个窗口 downlistfocus++; if (downlistfocus == 369) downlistfocus = 384; if (downlistfocus == 388) downlistfocus = 256; if (downlistfocus == 257) downlistfocus = 368; //设置焦点 WM_SetFocus(WM_GetDialogItem (hWin, downlistfocus)); break; case GUI_KEY_BACKTAB: //判断当前焦点所在的位置,将焦点移至上一个窗口 downlistfocus--; if (downlistfocus == 383) downlistfocus = 368; if (downlistfocus == 367) downlistfocus = 256; if (downlistfocus == 255) downlistfocus = 387; //设置焦点 WM_SetFocus (WM_GetDialogItem(hWin, downlistfocus)); break; case GUI_KEY_RIGHT: break; case GUI_KEY_F1: break; case GUI_KEY_F2: break; case GUI_KEY_SPACE: printf ("ddsf"); break; case GUI_KEY_ENTER: break; case GUI_KEY_UP: break; case GUI_KEY_DOWN: WM_SetFocusOnNextChild(hWin); //edit_id ++; break; case GUI_KEY_LEFT: menufocus -= 5; focuschange = 0; WM_SetFocus(WM_GetDialogItem (hDlg_Menu, menufocus)); WM_Paint(hDlg_Menu); break; case GUI_KEY_MENU: WM_BringToTop (hDlg_FishMap); WM_SetFocus (hDlg_FishMap); menufocus = 368; break; } break; default: WM_DefaultProc(pMsg); } }
/** * @brief Callback routine of the dialog * @param pMsg: pointer to data structure of type WM_MESSAGE * @retval None */ static void _cbDialog(WM_MESSAGE * pMsg) { WM_HWIN hItem, Hint; GUI_RECT r; int NCode, Id; uint32_t tmp_param = 0; switch (pMsg->MsgId) { case WM_INIT_DIALOG: pFileInfo = (CHOOSEFILE_INFO *)k_malloc(sizeof(CHOOSEFILE_INFO)); CameraSettings.d32 = k_BkupRestoreParameter(CALIBRATION_CAMERA_SETTING_BKP); /* Initialization of 'Image' */ hItem = WM_GetDialogItem(pMsg->hWin, ID_IMAGE); IMAGE_SetBitmap(hItem, &bmwizard); /* Initialization of 'Effects' */ hItem = WM_GetDialogItem(pMsg->hWin, ID_TEXT); TEXT_SetFont(hItem, GUI_FONT_16B_1); /* Initialization of 'Radio' */ hItem = WM_GetDialogItem(pMsg->hWin, ID_RADIO); RADIO_SetText(hItem, "None", 0); RADIO_SetText(hItem, "B&W", 1); RADIO_SetText(hItem, "Negative", 2); RADIO_SetText(hItem, "Antique", 3); RADIO_SetText(hItem, "Blue", 4); RADIO_SetText(hItem, "Green", 5); RADIO_SetText(hItem, "Red", 6); /* Camera frame initialization */ hItem = WM_GetClientWindow(pMsg->hWin); WM_GetClientRectEx(hItem, &r); hCameraFrame = WM_CreateWindowAsChild(r.x0 + 80, r.y0 + 3, r.x1 - 159, r.y1 - 7, hItem, WM_CF_SHOW | WM_CF_LATE_CLIP, _cbCameraWindow, 0); /* Buttons initialization */ hItem = BUTTON_CreateEx(425, 181, 30, 30, pMsg->hWin, WM_CF_SHOW, 0, ID_BUTTON_CLOSE); WM_SetCallback(hItem, _cbButton_close); hItem = BUTTON_CreateEx(415, 99, 50, 50, pMsg->hWin, WM_CF_SHOW, 0, ID_BUTTON_CAPTURE); WM_SetCallback(hItem, _cbButton_capture); hItem = BUTTON_CreateEx(425, 37, 30, 30, pMsg->hWin, WM_CF_SHOW, 0, ID_BUTTON_SETTINGS); WM_SetCallback(hItem, _cbButton_settings); _Check_DefaultPath (capture_folder); FrameAvailable = 0; break; case WM_NOTIFY_PARENT: Id = WM_GetId(pMsg->hWinSrc); NCode = pMsg->Data.v; if (NCode == WM_NOTIFICATION_CHILD_DELETED) { if((pMsg->hWinSrc == chooser_select_folder) && ((pFileInfo->pRoot[0] == '0' ) || (pFileInfo->pRoot[0] == '1' ))) { hItem = WM_GetDialogItem(hDialogFileControl, ID_FOLDER); EDIT_SetText(hItem, (char *)pFileInfo->pRoot); chooser_select_folder = 0; WM_InvalidateWindow(hDialogFileControl); WM_Paint(hDialogFileControl); strncpy((char *)(CAMERA_SAVE_PATH),pFileInfo->pRoot , FILEMGR_FULL_PATH_SIZE); strncpy((char *)capture_folder,pFileInfo->pRoot , FILEMGR_FULL_PATH_SIZE); } } if(hSettings == 0) { switch(Id) { case ID_RADIO: if(NCode == WM_NOTIFICATION_VALUE_CHANGED) { hItem = WM_GetDialogItem(pMsg->hWin, ID_RADIO); if(CAMERA_GetState() != CAMERA_ERROR) { CAMERA_SelectEffect(RADIO_GetValue(hItem)); } } break; case ID_BUTTON_CLOSE: /* Notifications sent by 'Close' */ switch(NCode) { case WM_NOTIFICATION_RELEASED: k_free(pFileInfo); CAMERA_Stop(); GUI_EndDialog(pMsg->hWin, 0); break; } break; case ID_BUTTON_CAPTURE: /* Notifications sent by 'OK' */ switch(NCode) { case WM_NOTIFICATION_RELEASED: /* Show Hint */ if(CAMERA_GetState() == CAMERA_OK) { Hint = WM_CreateWindowAsChild(140, 120, 200, 32, pMsg->hWin, WM_CF_SHOW , _cbHint, 0); GUI_Exec(); if(CAMERA_GetState() == CAMERA_OK) { CAMERA_SaveToFile(capture_folder); } WM_DeleteWindow(Hint); } break; } break; case ID_BUTTON_SETTINGS: /* Notifications sent by 'Settings' */ switch(NCode) { case WM_NOTIFICATION_RELEASED: camera_disabled = 1; hSettings = GUI_CreateDialogBox(_aSettingsDialogCreate, GUI_COUNTOF(_aSettingsDialogCreate), _cbSettingsDialog, CAMERA_hWin, 0, 0); break; } break; } } break; case WM_DELETE: tmp_param = k_BkupRestoreParameter(CALIBRATION_CAMERA_SETTING_BKP); /* check if new settings have to be saved */ if(CameraSettings.d32 != tmp_param) { k_BkupSaveParameter(CALIBRATION_CAMERA_SETTING_BKP, CameraSettings.d32); } break; default: WM_DefaultProc(pMsg); break; } }