/********************************************************************* * * 初始化对话框 * * Function description * This routine is called by the GRAPH object before anything is drawn * and after the last drawing operation. */ static void OSC_InitDialog (WM_MESSAGE* pMsg) { int ButtonNum = sizeof (g_GraphButton) / sizeof (BUTTON_struct);//元素数量 BUTTON_struct* p = (BUTTON_struct *)(&g_GraphButton); WM_HWIN hWin = pMsg->hWin; for (int i = 0; i < ButtonNum; i++ , p++) BUTTON_SetFont(WM_GetDialogItem(hWin, p->ID), &GUI_Font16B_ASCII); }
static void Button_Init(WM_HWIN hItem) { BUTTON_SetFont(hItem, GUI_FONT_24_ASCII); BUTTON_SetSkinClassic(hItem); BUTTON_SetFocussable(hItem, DISABLE); WIDGET_SetEffect(hItem, &WIDGET_Effect_3D); }
void _TestCalibration(void) { int IdleCnt=0; BUTTON_Handle hButton; GUI_SetBkColor(GUI_RED); GUI_SetColor(GUI_WHITE); GUI_Clear(); hButton = BUTTON_Create( 225, 15, 80, 40, 1, BUTTON_CF_SHOW ); BUTTON_SetText (hButton, "ABORT"); BUTTON_SetFont (hButton, &GUI_FontComic18B_ASCII); while ((IdleCnt<50) && (GUI_GetKey()==0)) { static GUI_PID_STATE StateLast; GUI_PID_STATE State; GUI_TOUCH_GetState(&State); if ((StateLast.Pressed != State.Pressed) && (State.Pressed == 0)) { GUI_Clear(); } if ((StateLast.x != State.x) || ((StateLast.y != State.y))) { if (State.Pressed) { GUI_FillCircle(State.x, State.y, 5); } StateLast = State; } if (State.Pressed) { IdleCnt =0; } else { IdleCnt++; } GUI_Delay (100); } EDIT_Delete(hButton); }
void InitDialog_LimT(WM_MESSAGE * pMsg) { int i; WM_HWIN hWin = pMsg->hWin; // //FRAMEWIN // FRAMEWIN_AddCloseButton(hWin, FRAMEWIN_BUTTON_RIGHT, 0); FRAMEWIN_AddMaxButton(hWin, FRAMEWIN_BUTTON_RIGHT, 1); FRAMEWIN_AddMinButton(hWin, FRAMEWIN_BUTTON_RIGHT, 2); for(i=GUI_ID_BUTTON_TCOMM;i<GUI_ID_BUTTON_TMAIN+1;i++) { BUTTON_SetFont(WM_GetDialogItem(hWin,i),&GUI_FontHZ_SongTi_16); } LISTVIEW_SetAutoScrollV(WM_GetDialogItem(hWin,GUI_ID_LISTVIEW_RESULT_T),1); LISTVIEW_SetFont(WM_GetDialogItem(hWin,GUI_ID_LISTVIEW_RESULT_T),&GUI_FontHZ_SongTi_16); LISTVIEW_SetRowHeight(WM_GetDialogItem(hWin,GUI_ID_LISTVIEW_RESULT_T),20); // 60 LISTVIEW_AddColumn(WM_GetDialogItem(hWin,GUI_ID_LISTVIEW_RESULT_T),20,"O",GUI_TA_VCENTER|GUI_TA_LEFT); LISTVIEW_AddColumn(WM_GetDialogItem(hWin,GUI_ID_LISTVIEW_RESULT_T),20,"M",GUI_TA_VCENTER|GUI_TA_LEFT); LISTVIEW_AddColumn(WM_GetDialogItem(hWin,GUI_ID_LISTVIEW_RESULT_T),50,"D",GUI_TA_VCENTER|GUI_TA_LEFT); LISTVIEW_AddColumn(WM_GetDialogItem(hWin,GUI_ID_LISTVIEW_RESULT_T),50,"V1",GUI_TA_VCENTER|GUI_TA_LEFT); LISTVIEW_AddColumn(WM_GetDialogItem(hWin,GUI_ID_LISTVIEW_RESULT_T),50,"V2",GUI_TA_VCENTER|GUI_TA_LEFT); LISTVIEW_AddColumn(WM_GetDialogItem(hWin,GUI_ID_LISTVIEW_RESULT_T),50,"Res",GUI_TA_VCENTER|GUI_TA_LEFT); LISTVIEW_AddColumn(WM_GetDialogItem(hWin,GUI_ID_LISTVIEW_RESULT_T),2,"---",GUI_TA_VCENTER|GUI_TA_LEFT); // LISTBOX_SetBkColor(WM_GetDialogItem(hWin,GUI_ID_LISTVIEW0),0,0xffffff); }
/********************************************************************* * * GUIDEMO_main(): Small version of the demo * ********************************************************************** */ void GUIDEMO_main(void) { #if GUI_WINSUPPORT int i; #endif #if GUI_WINSUPPORT #if LCD_NUM_DISPLAYS > 1 FRAMEWIN_CreateAsChild(10, 10, 100, 100, WM_GetDesktopWindowEx(1), "Display 1", NULL, WM_CF_SHOW); GUI_Delay(1000); #endif WM_SetCreateFlags(WM_CF_MEMDEV); /* Automatically use memory devices on all windows */ _ButtonSizeX = 27; _ButtonSizeY = 14; _ahButton[0] = BUTTON_Create(LCD_GetXSize() - _ButtonSizeX * 2 - 5, LCD_GetYSize() - _ButtonSizeY - 3, _ButtonSizeX, _ButtonSizeY, 'H' , WM_CF_SHOW | WM_CF_STAYONTOP | WM_CF_MEMDEV); _ahButton[1] = BUTTON_Create(LCD_GetXSize() - _ButtonSizeX - 3, LCD_GetYSize() - _ButtonSizeY - 3, _ButtonSizeX, _ButtonSizeY, 'N' , WM_CF_SHOW | WM_CF_STAYONTOP | WM_CF_MEMDEV); BUTTON_SetFont(_ahButton[0], &GUI_Font8_ASCII); BUTTON_SetFont(_ahButton[1], &GUI_Font8_ASCII); BUTTON_SetText(_ahButton[0], "Stop"); BUTTON_SetText(_ahButton[1], "Next"); _UpdateCmdWin(); WM_ExecIdle(); #endif /* Show Intro */ GUIDEMO_Intro(); /* Run the individual demos ! */ for (_iTest = 0; _apfTest[_iTest]; _iTest++) { GUI_CONTEXT ContextOld; GUI_SaveContext(&ContextOld); _iTestMinor = 0; _UpdateCmdWin(); (*_apfTest[_iTest])(); _CmdNext = 0; GUI_RestoreContext(&ContextOld); } /* Cleanup */ #if GUI_WINSUPPORT for (i = 0; i < countof(_ahButton); i++) { BUTTON_Delete(_ahButton[i]); } #endif }
/********************************************************************* * * _CreateLButton */ static WM_HWIN _CreateLButton(const char* pText, int x, int w, int h, WM_HWIN hParent, int Id) { WM_HWIN hButton; GUI_RECT Rect; WM_GetClientRectEx(hParent, &Rect); hButton = BUTTON_CreateEx(x, Rect.y1 - h + 1, w, h, hParent, WM_CF_SHOW | WM_CF_ANCHOR_BOTTOM, 0, Id); BUTTON_SetText(hButton, pText); BUTTON_SetFont(hButton, &GUI_Font8_ASCII); return hButton; }
/*---------------------------------------------------------------------------* * Routine: _cbDialog *---------------------------------------------------------------------------* * Description: * Callback function used by emWin to process events for the active window. * Inputs: * WM_MESSAGE *pMsg -- message structure for current dialog. *---------------------------------------------------------------------------*/ static void _cbDialog(WM_MESSAGE * pMsg) { WM_HWIN hItem; int Id, NCode; T_keyboardMapping *p = G_keypadCurrentMapping; switch (pMsg->MsgId) { case WM_INIT_DIALOG: // // Initialization of 'Window' // hItem = pMsg->hWin; G_window = hItem; WINDOW_SetBkColor(hItem, KEYBOARD_BACKGROUND_COLOR); //BUTTON_SetDefaultBkColor(KEY_BACKGROUND_COLOR, BUTTON_CI_UNPRESSED); EDIT_SetDefaultFont(&KEYBOARD_DEFAULT_FONT); hItem = WM_GetDialogItem(pMsg->hWin, ID_TEXT_BOX); EDIT_SetMaxLen(hItem, MAX_NUMBER_OF_CHARS); EDIT_SetText(hItem, G_textBox); EDIT_SetFont(hItem, &KEYBOARD_DEFAULT_FONT); G_textBoxIndex = EDIT_GetNumChars(hItem); hItem = WM_GetDialogItem(pMsg->hWin, ID_MESSAGE); TEXT_SetFont(hItem, &KEYBOARD_DEFAULT_FONT); TEXT_SetTextColor(hItem, GUI_BLACK); TEXT_SetBkColor(hItem, KEYBOARD_BACKGROUND_COLOR); TEXT_SetText(hItem, G_message); TEXT_SetTextAlign(hItem, GUI_TA_TOP); while (p->iID) { hItem = WM_GetDialogItem(pMsg->hWin, p->iID); BUTTON_SetFont(hItem, &KEYBOARD_DEFAULT_FONT); BUTTON_SetTextColor(hItem, BUTTON_CI_UNPRESSED, GUI_BLACK); BUTTON_SetTextColor(hItem, BUTTON_CI_PRESSED, GUI_BLACK); BUTTON_SetBkColor(hItem, BUTTON_CI_UNPRESSED, KEY_BACKGROUND_COLOR); BUTTON_SetBkColor(hItem, BUTTON_CI_PRESSED, GUI_LIGHTGRAY); //BUTTON_SetSkin(hItem, BUTTON_SKIN_FLEX); p++; } WM_MakeModal(pMsg->hWin); setNewButtonText(pMsg, 0, 0); break; case WM_NOTIFY_PARENT: Id = WM_GetId(pMsg->hWinSrc); NCode = pMsg->Data.v; if (!IKeyboardHandleEvent(pMsg, NCode, Id)) { // Special cases go here // Nothing happens otherwise } case WM_POST_PAINT: // Make sure the all presses up til now are gone TouchscreenClearPresses(); break; default: WM_DefaultProc(pMsg); break; } }
/** * @brief Callback routine of the alarm dialog * @param pMsg: pointer to a data structure of type WM_MESSAGE * @retval None */ static void _cbAlarmDialog(WM_MESSAGE * pMsg) { WM_HWIN hItem; int Id, NCode; char temp[50]; uint8_t asec, amin, ahour; switch (pMsg->MsgId) { case WM_INIT_DIALOG: /* Initialization of 'Alarm' */ hItem = pMsg->hWin; FRAMEWIN_SetFont(hItem, GUI_FONT_13HB_ASCII); hItem = WM_GetDialogItem(pMsg->hWin, ID_ALARM); TEXT_SetFont(hItem, GUI_FONT_13HB_ASCII); /* Initialization of 'Image' */ hItem = WM_GetDialogItem(pMsg->hWin, ID_IMAGE_INFO); IMAGE_SetBitmap(hItem, &bmalarmclock); /* Initialization of 'Time' */ hItem = WM_GetDialogItem(pMsg->hWin, ID_TIME); ahour = RTC_AlarmStructure.RTC_AlarmTime.RTC_Hours; amin = RTC_AlarmStructure.RTC_AlarmTime.RTC_Minutes; asec = RTC_AlarmStructure.RTC_AlarmTime.RTC_Seconds; sprintf (temp, "%02d:%02d:%02d", ahour, amin, asec); TEXT_SetText(hItem, temp); TEXT_SetFont(hItem, GUI_FONT_24B_ASCII); TEXT_SetTextColor(hItem, GUI_BROWN); /* Initialization of 'Close' */ hItem = WM_GetDialogItem(pMsg->hWin, ID_BUTTON_INFO_CLOSE); BUTTON_SetFont(hItem, GUI_FONT_13HB_ASCII); 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_BUTTON_INFO_CLOSE: GUI_EndDialog(pMsg->hWin, 0); STM_EVAL_LEDOff(LED4); alarm_set=0; break; } break; } break; default: WM_DefaultProc(pMsg); break; } }
/********************************************************************* * * _CreateButton */ static WM_HWIN _CreateButton(int x, int y, int w, int h, int bx, int by, const char * pText, GUI_CONST_STORAGE GUI_BITMAP * pBm, int Id) { WM_HWIN hWin; hWin = BUTTON_CreateEx(x, y, w, h, WM_HBKWIN, WM_CF_SHOW, 0, Id); BUTTON_SetBitmapEx(hWin, 0, pBm, bx + 0, by + 0); BUTTON_SetBitmapEx(hWin, 1, pBm, bx + 1, by + 0); BUTTON_SetFont(hWin, &GUI_FontAA2_21); BUTTON_SetTextAlign(hWin, GUI_TA_TOP | GUI_TA_HCENTER); BUTTON_SetText(hWin, pText); BUTTON_SetBkColor(hWin, 0, GUI_LIGHTBLUE); return hWin; }
void configuration_panel_init() { int frmWinWidth = GUI_X_MAX; int frmWinHeight = GUI_Y_MAX - 40; int x0 = 0; int y0 = 20; int checkBoxX = 5; int checkBoxY = 22; int checkBoxWidth = 60; int checkBoxHeight = 15; int buttonWidth = 90; int buttonHeight = 20; int buttonX = 5; int buttonY = frmWinHeight - (buttonHeight + 5); sel_conf_language = sel_language; configPageWin = FRAMEWIN_Create(confFrmText[sel_language], _cbConfigWin, WM_CF_SHOW, x0, y0, frmWinWidth, frmWinHeight); FRAMEWIN_SetFont(configPageWin, &GUI_FontArialBold14_8_Unicode); for (int i = 0; i < NUM_CONF_ITEMS; i++) { int id = i + ID_CONF_DSTP_CFG_PRT_ONB; CHECKBOX_Handle checkBox = CHECKBOX_Create(checkBoxX, checkBoxY, checkBoxWidth, checkBoxHeight, configPageWin, id, WM_CF_SHOW); CHECKBOX_SetFont(checkBox, &GUI_FontArialStandard14_8_Unicode); CHECKBOX_SetText(checkBox, conf_checkbox_item[sel_language][i]); CHECKBOX_SetBoxBkColor(checkBox, GUI_USER_LIGHTGRAY, CHECKBOX_CI_DISABLED); CHECKBOX_SetBoxBkColor(checkBox, GUI_YELLOW, CHECKBOX_CI_ENABLED); CHECKBOX_SetFocusColor(checkBox, GUI_BLUE); checkBoxY += 15; } BUTTON_Handle ESC_Button = BUTTON_CreateEx(buttonX, buttonY, buttonWidth, buttonHeight, configPageWin, WM_CF_SHOW, 0, ID_CONF_BUTTON_ESC); BUTTON_SetFont(ESC_Button, &GUI_FontArialBold14_8_Unicode); BUTTON_SetText(ESC_Button, escButtonExpl[sel_language]); buttonX = frmWinWidth - (buttonWidth + 5); BUTTON_Handle ENTER_Button = BUTTON_CreateEx(buttonX, buttonY, buttonWidth, buttonHeight, configPageWin, WM_CF_SHOW, 0, ID_CONF_BUTTON_ENTER); BUTTON_SetFont(ENTER_Button, &GUI_FontArialBold14_8_Unicode); BUTTON_SetText(ENTER_Button, enterButtonExpl[sel_language]); }
/******************************************************************************************************* * * 函数名称: * * 函数功能: * * 入口参数: * * 出口参数: 无 * * 说明: * *******************************************************************************************************/ void InitKBDlg(WM_MESSAGE * pMsg) { int i; char str_buff[10]; WM_HWIN hWin = pMsg->hWin; FRAMEWIN_SetClientColor(hWin,RGB(185,205,232)); BUTTON_SetBkColor(WM_GetDialogItem(hWin,GUI_ID_BUTTON_NUM0),BUTTON_CI_UNPRESSED, RGB(70,77,106)); BUTTON_SetBkColor(WM_GetDialogItem(hWin,GUI_ID_BUTTON_NUM0),BUTTON_CI_PRESSED, RGB(123,128,106)); BUTTON_SetTextColor(WM_GetDialogItem(hWin,GUI_ID_BUTTON_NUM0),BUTTON_CI_UNPRESSED, GUI_WHITE); BUTTON_SetTextColor(WM_GetDialogItem(hWin,GUI_ID_BUTTON_NUM0),BUTTON_CI_PRESSED, GUI_WHITE); BUTTON_SetFont(WM_GetDialogItem(hWin,GUI_ID_BUTTON_NUM0),&GUI_Font16_ASCII); for (i = 2; i < 2 + 14; i++) //共14个按钮,在数组中的索引从2开始 { BUTTON_SetBkColor(WM_GetDialogItem(hWin,_aTextDialogCreate[i].Id),BUTTON_CI_UNPRESSED, RGB(70,77,106)); BUTTON_SetBkColor(WM_GetDialogItem(hWin,_aTextDialogCreate[i].Id),BUTTON_CI_PRESSED, RGB(123,128,106)); BUTTON_SetTextColor(WM_GetDialogItem(hWin,_aTextDialogCreate[i].Id),BUTTON_CI_UNPRESSED, GUI_WHITE); BUTTON_SetTextColor(WM_GetDialogItem(hWin,_aTextDialogCreate[i].Id),BUTTON_CI_PRESSED, GUI_WHITE); BUTTON_SetFont(WM_GetDialogItem(hWin,_aTextDialogCreate[i].Id),&GUI_Font16_ASCII); } //GUI_ID_EDIT_KEYBOART // EDIT_SetTextAlign(WM_GetDialogItem(hWin,GUI_ID_EDIT_KB_INPUT), EDIT_CF_RIGHT|EDIT_CF_BOTTOM); EDIT_SetBkColor(WM_GetDialogItem(hWin,GUI_ID_EDIT_KB_INPUT), EDIT_CI_ENABLED,0xe7eaeb ); EDIT_SetFont(WM_GetDialogItem(hWin,GUI_ID_EDIT_KB_INPUT),&GUI_FontD32); EDIT_SetTextColor(WM_GetDialogItem(hWin,GUI_ID_EDIT_KB_INPUT),0,GUI_RED); sprintf(str_buff,"%ld",ParentParam); EDIT_SetText(WM_GetDialogItem(hWin,GUI_ID_EDIT_KB_INPUT),str_buff); }
void GUIDEMO_Touch(void) { #define ID_KEYBOARD 1 #define ID_TESTCAL 2 #define ID_CALIBRATE 3 int i, r; int XSize = LCD_GetXSize(); int YSize = LCD_GetYSize(); int XMid = XSize / 2; int YMid = YSize / 2; //GUIDEMO_NotifyStartNext(); GUIDEMO_HideInfoWin(); do { GUI_RECT rText;/*= {0, 80, XSize, 120};*/ BUTTON_Handle ahButton[3]; rText.x0=0; rText.y0=50; rText.x1=XSize; rText.y1=90; GUI_SetBkColor(GUI_BLUE); GUI_Clear(); GUI_DrawBitmap(&bmMicriumLogo, (XSize - 1 - bmMicriumLogo.XSize) / 2, 15); GUI_SetFont(&GUI_Font16B_1); GUI_DispStringInRect("µC/GUI Touch screen demo", &rText, GUI_TA_HCENTER | GUI_TA_VCENTER); ahButton[0] = BUTTON_Create( XMid - 50, YMid - 30, 100, 50, ID_CALIBRATE,BUTTON_CF_SHOW ); ahButton[1] = BUTTON_Create( XMid - 90, YMid + 30, 80, 30, ID_KEYBOARD, BUTTON_CF_SHOW ); ahButton[2] = BUTTON_Create( XMid + 10, YMid + 30, 80, 30, ID_TESTCAL,BUTTON_CF_SHOW ); BUTTON_SetText (ahButton[0], "Calibrate"); BUTTON_SetBkColor(ahButton[0], 0, GUI_RED); BUTTON_SetText (ahButton[1], "Keyboard"); BUTTON_SetText (ahButton[2], "Test calibration"); BUTTON_SetFont(ahButton[0], &GUI_FontComic18B_ASCII); r = GUIDEMO_WaitKey(); if (r==0) { r = ID_KEYBOARD; BUTTON_SetState(ahButton[1],BUTTON_STATE_PRESSED); GUIDEMO_Delay(500); } for (i=0; i< countof(ahButton); i++) { BUTTON_Delete(ahButton[i]); } switch (r) { case ID_KEYBOARD: init_uart0(); send_press_key(); break; case ID_CALIBRATE: _ExecCalibration(); break; case ID_TESTCAL: _TestCalibration(); break; } } while (r && (r!='n') && (r!='N')); }
void InitDialog_Cus(WM_MESSAGE * pMsg) { WM_HWIN hWin = pMsg->hWin; // //GUI_ID_TEXT_USER // TEXT_SetFont(WM_GetDialogItem(hWin,GUI_ID_TEXT_USER),&GUI_FontHZ_SongTi_16); EDIT_SetFont(WM_GetDialogItem(hWin,GUI_ID_EDIT_USER),&GUI_FontHZ_SongTi_16); TEXT_SetFont(WM_GetDialogItem(hWin,GUI_ID_TEXT_MODLE),&GUI_FontHZ_SongTi_16); EDIT_SetMaxLen(WM_GetDialogItem(hWin,GUI_ID_EDIT_USER),500); // //GUI_ID_TEXT_E_PROD // TEXT_SetFont(WM_GetDialogItem(hWin,GUI_ID_TEXT_E_PROD),&GUI_FontHZ_SongTi_16); EDIT_SetFont(WM_GetDialogItem(hWin,GUI_ID_EDIT_E_PROD),&GUI_FontHZ_SongTi_16); EDIT_SetMaxLen(WM_GetDialogItem(hWin,GUI_ID_EDIT_E_PROD),500); // //GUI_ID_TEXT_MODLE // TEXT_SetFont(WM_GetDialogItem(hWin,GUI_ID_TEXT_L_PROD),&GUI_FontHZ_SongTi_16); EDIT_SetFont(WM_GetDialogItem(hWin,GUI_ID_EDIT_L_PROD),&GUI_FontHZ_SongTi_16); EDIT_SetMaxLen(WM_GetDialogItem(hWin,GUI_ID_EDIT_L_PROD),500); // //GUI_ID_TEXT0 // TEXT_SetFont(WM_GetDialogItem(hWin,GUI_ID_TEXT_L_MODE),&GUI_FontHZ_SongTi_16); // // BUTTON_SetFont(WM_GetDialogItem(hWin,GUI_ID_BUTTON_HOME),&GUI_FontHZ_SongTi_16); EDIT_SetMaxLen(WM_GetDialogItem(hWin,GUI_ID_EDIT_L_MODE),500); EDIT_SetMaxLen(WM_GetDialogItem(hWin,GUI_ID_EDIT_MODLE),500); // EDIT_SetText(WM_GetDialogItem(hWin,GUI_ID_EDIT_USER),custormer.custorm); EDIT_SetText(WM_GetDialogItem(hWin,GUI_ID_EDIT_E_PROD),custormer.elevator_productor); EDIT_SetText(WM_GetDialogItem(hWin,GUI_ID_EDIT_MODLE),custormer.series_no); EDIT_SetText(WM_GetDialogItem(hWin,GUI_ID_EDIT_L_PROD),custormer.limitor_productor); EDIT_SetText(WM_GetDialogItem(hWin,GUI_ID_EDIT_L_MODE),custormer.limitor_series); }
static void CreateCalculator(WM_HWIN hWin) { int y0 = 55; int XSize = LCD_GetXSize(); int YSize = LCD_GetYSize(); int XStep = XSize / 5; int YStep = (YSize - y0 - 25) / 4; char ac[2]; char *s=NULL; int XPos,YPos; int i = 0; for (i = 0; i < 19; i++) { if (i == 14) i = 15; XPos = (i % 5) * XStep + 3; YPos = (i / 5) * YStep + 3 + y0; memset(&ac, 0, sizeof(char)* 2); s = ac; ac[0] = _acText[i]; if (i == 18) { hButton[i] = BUTTON_CreateAsChild(XPos, YPos, XStep * 2 - 5, YStep - 5, hWin, _acText[i], WM_CF_SHOW); } else if (i == 9) hButton[i] = BUTTON_CreateAsChild(XPos, YPos, XStep - 5, YStep * 2 - 5, hWin, _acText[i], WM_CF_SHOW); else hButton[i] = BUTTON_CreateAsChild(XPos, YPos, XStep - 5, YStep - 5, hWin, _acText[i], WM_CF_SHOW); BUTTON_SetBkColor(hButton[i], BUTTON_CI_UNPRESSED, 0x50A0FF); BUTTON_SetBkColor(hButton[i], BUTTON_CI_PRESSED, 0x004080); BUTTON_SetTextColor(hButton[i], BUTTON_CI_UNPRESSED, GUI_WHITE); BUTTON_SetTextColor(hButton[i], BUTTON_CI_PRESSED, GUI_WHITE); BUTTON_SetFont(hButton[i], &GUI_Font24B_ASCII); if (i == 18) { BUTTON_SetText(hButton[i], "EXIT"); } else BUTTON_SetText(hButton[i], s); } hEdit = EDIT_CreateAsChild(0, 0, 320, 50, hWin, 0, WM_CF_SHOW, 80); EDIT_SetTextColor(hEdit, 0, 0x0080FF); EDIT_SetFont(hEdit, &GUI_Font24B_ASCII); EDIT_SetBkColor(hEdit, 0, GUI_RED); }
/********************************************************************* * * _CreateMessageBox */ static WM_HWIN _CreateMessageBox(const char * sMessage, const char * sCaption, int Flags, const GUI_FONT * pFont) { WM_HWIN hWin, hItem; GUI_RECT Rect; hWin = MESSAGEBOX_Create(sMessage, sCaption, Flags); /* * Change font of message box window */ FRAMEWIN_SetFont(hWin, pFont); /* * Adjust size */ WM_GetWindowRectEx(hWin, &Rect); WM_SetWindowPos(hWin, Rect.x0 - 15, Rect.y0 - 15, Rect.x1 - Rect.x0 + 1 + 30, Rect.y1 - Rect.y0 + 1 + 30); /* * Change font of button widget */ hItem = WM_GetDialogItem(hWin, GUI_ID_OK); BUTTON_SetFont(hItem, pFont); /* * Adjust size of button widget */ WM_GetWindowRectEx(hItem, &Rect); WM_SetWindowPos(hItem, Rect.x0, Rect.y0 + 10, Rect.x1 - Rect.x0 + 1 + 30, Rect.y1 - Rect.y0 + 1 + 5); /* * Change font of text widget */ hItem = WM_GetDialogItem(hWin, GUI_ID_TEXT0); TEXT_SetFont(hItem, pFont); /* * Adjust size text widget */ WM_GetWindowRectEx(hItem, &Rect); WM_SetWindowPos(hItem, Rect.x0, Rect.y0, Rect.x1 - Rect.x0 + 1 + 30, Rect.y1 - Rect.y0 + 1 + 12); return hWin; }
void InitDialog_Home(WM_MESSAGE * pMsg) { int i; WM_HWIN hWin = pMsg->hWin; // //FRAMEWIN // for(i=GUI_ID_BUTTON0; i< GUI_ID_BUTTON6;i++) { BUTTON_SetFont(WM_GetDialogItem(hWin,i),&GUI_FontHZ_SongTi_16); } // //GUI_ID_TEXT0 // TEXT_SetFont(WM_GetDialogItem(hWin,GUI_ID_TEXT0),&GUI_FontHZ_SongTi_16); TEXT_SetFont(WM_GetDialogItem(hWin,GUI_ID_TEXT1),&GUI_FontHZ_SongTi_16); TEXT_SetFont(WM_GetDialogItem(hWin,GUI_ID_TEXT2),&GUI_FontHZ_SongTi_16); // //GUI_ID_TEXT1 // // }
/********************************************************************* * * _cbDialog * * Purpose: Dialog callback routine */ static void _cbDialog(WM_MESSAGE *pMsg) { int NCode, Id; WM_HWIN hDlg; BUTTON_Handle hButton; hDlg = pMsg->hWin; switch (pMsg->MsgId) { case WM_PAINT: WM_DefaultProc(pMsg); /* Handle dialog items */ /* After drawing the dialog items add some user drawn items to the window */ GUI_SetPenSize(10); GUI_SetColor(GUI_GREEN); GUI_DrawLine( 95, 5, 185, 95); GUI_SetColor(GUI_RED); GUI_DrawLine( 95, 95, 185, 5); break; case WM_INIT_DIALOG: hButton = WM_GetDialogItem(hDlg, GUI_ID_BUTTON0); WM_SetHasTrans(hButton); /* Set transparency flag for button */ break; case WM_KEY: switch (((WM_KEY_INFO*)(pMsg->Data.p))->Key) { case GUI_KEY_ESCAPE: GUI_EndDialog(hDlg, 1); break; case GUI_KEY_ENTER: GUI_EndDialog(hDlg, 0); break; } 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 */ hButton = WM_GetDialogItem(hDlg, GUI_ID_BUTTON0); if (Id == GUI_ID_BUTTON1) { /* Toggle callback */ if (_pcbCallback) { WM_SetCallback(hButton, _pcbCallback); _pcbCallback = 0; } else { _pcbCallback = WM_SetCallback(hButton, _cbButton); } WM_InvalidateWindow(hButton); } if (Id == GUI_ID_BUTTON2) { /* Toggle font */ if (_Font) { BUTTON_SetFont(hButton, &GUI_Font13_1); } else { BUTTON_SetFont(hButton, &GUI_Font8x16); } _Font ^= 1; } if (Id == GUI_ID_BUTTON3) { /* Toggle color */ if (_Color) { BUTTON_SetBkColor(hButton, 0, 0xaaaaaa); BUTTON_SetBkColor(hButton, 1, GUI_WHITE); BUTTON_SetTextColor(hButton, 0, GUI_BLACK); BUTTON_SetTextColor(hButton, 1, GUI_BLACK); } else { BUTTON_SetBkColor(hButton, 0, GUI_BLUE); BUTTON_SetBkColor(hButton, 1, GUI_RED); BUTTON_SetTextColor(hButton, 0, GUI_WHITE); BUTTON_SetTextColor(hButton, 1, GUI_YELLOW); } _Color ^= 1; } if (Id == GUI_ID_OK) { /* OK Button */ GUI_EndDialog(hDlg, 0); } if (Id == GUI_ID_CANCEL) { /* Cancel Button */ GUI_EndDialog(hDlg, 1); } break; } break; default: WM_DefaultProc(pMsg); } }
/** * @brief Callback function of the settings frame * @param pMsg: pointer to data structure of type WM_MESSAGE * @retval None */ static void _cbSettingsDialog(WM_MESSAGE * pMsg) { int Id, NCode; WM_HWIN hItem; uint32_t tmp_param = 0; switch (pMsg->MsgId) { case WM_INIT_DIALOG: WM_MakeModal(pMsg->hWin); /* Settings frame initialization */ hItem = pMsg->hWin; FRAMEWIN_AddCloseButton(hItem, FRAMEWIN_BUTTON_RIGHT, 0); /* Create and attache the MULTIPAGE dialog windows */ hItem = WM_GetDialogItem(pMsg->hWin, ID_MULTIPAGE); /* 'OK' button initialization */ hItem = WM_GetDialogItem(pMsg->hWin, ID_BUTTON_OK); BUTTON_SetFont(hItem, GUI_FONT_13B_1); /* 'Cancel' button initialization */ hItem = WM_GetDialogItem(pMsg->hWin, ID_BUTTON_CANCEL); BUTTON_SetFont(hItem, GUI_FONT_13B_1); hItem = WM_GetDialogItem(pMsg->hWin, ID_TEXT_1); TEXT_SetFont(hItem, GUI_FONT_13B_1); hItem = WM_GetDialogItem(pMsg->hWin, ID_SPINBOX_0); SPINBOX_SetRange(hItem, 1, 10); if(ImSettings.b.ss_timer > 0) { SPINBOX_SetValue(hItem, ImSettings.b.ss_timer); } else { ImSettings.b.ss_timer = 1; SPINBOX_SetValue(hItem, 1); } break; case WM_NOTIFY_PARENT: Id = WM_GetId(pMsg->hWinSrc); NCode = pMsg->Data.v; switch (Id) { /* Notification sent by "OK" button */ case ID_BUTTON_OK: switch (NCode) { case WM_NOTIFICATION_RELEASED: /* Save image settings before delete settings frame */ hItem = WM_GetDialogItem(pMsg->hWin, ID_SPINBOX_0); ImSettings.b.ss_timer = SPINBOX_GetValue(hItem); WM_RestartTimer(hTimerTime, (ImSettings.b.ss_timer * 1000)); tmp_param = k_BkupRestoreParameter(CALIBRATION_IMAGE_SETTINGS_BKP); /* check if new settings have to be saved */ if(ImSettings.d32 != tmp_param) { k_BkupSaveParameter(CALIBRATION_IMAGE_SETTINGS_BKP, ImSettings.d32); } GUI_EndDialog(pMsg->hWin, 0); break; } break; /* Notification sent by "Cancel" button */ case ID_BUTTON_CANCEL: switch (NCode) { case WM_NOTIFICATION_RELEASED: GUI_EndDialog(pMsg->hWin, 0); break; } break; } break; } }
static void _cbDialog(WM_MESSAGE * pMsg) { WM_HWIN hItem; int Id, NCode; switch (pMsg->MsgId) { case WM_INIT_DIALOG: hItem = BUTTON_CreateEx(420, 0, 60, 60, pMsg->hWin, WM_CF_SHOW, 0, ID_BUTTON_EXIT); WM_SetCallback(hItem, _cbButton_exit); hItem = WM_GetDialogItem(pMsg->hWin, ID_VNC_CONNECTION); IMAGE_SetBitmap(hItem, &bmconnection_ko); hItem = BUTTON_CreateEx(315, 195, 40, 40, pMsg->hWin, WM_CF_SHOW, 0, START_VNC); WM_SetCallback(hItem, _cbButton_start); hItem = BUTTON_CreateEx(380, 195, 40, 40, pMsg->hWin, WM_CF_SHOW, 0, GO_BACKGROUND); WM_SetCallback(hItem, _cbButton_bg); hItem = BUTTON_CreateEx(245, 195, 40, 40, pMsg->hWin, WM_CF_SHOW, 0, ID_LOCK); WM_SetCallback(hItem, _cbButton_lock); hItem = WM_GetDialogItem(pMsg->hWin, GO_BACKGROUND); BUTTON_SetFont(hItem, &GUI_FontLubalGraph16B); break; case WM_PAINT: GUI_SetColor(GUI_STCOLOR_LIGHTBLUE); GUI_SetPenSize(5); GUI_DrawBitmap(&bmconnect, 7, 45); GUI_DrawCircle(332, 215, 40); GUI_AA_FillCircle(332, 215, 45); GUI_AA_FillRoundedRect(230, 182, 440, 250, 20); GUI_SetColor(GUI_WHITE); GUI_AA_FillCircle(332, 215, 42); GUI_SetBkColor(GUI_WHITE); GUI_AA_FillRoundedRect(233, 185, 437, 247, 20); GUI_SetColor(GUI_STCOLOR_LIGHTBLUE); GUI_AA_FillCircle(332, 215, 33); break; case WM_NOTIFY_PARENT: Id = WM_GetId(pMsg->hWinSrc); /* Id of widget */ NCode = pMsg->Data.v; /* Notification code */ switch(Id) { case START_VNC: /* Notifications sent by 'Start' */ switch(NCode) { case WM_NOTIFICATION_RELEASED: if((VNC_GetState() == VNC_IDLE)|| (VNC_GetState() == VNC_INIT)) { VNC_SERVER_LogMessage("Starting VNC connection..."); hItem = WM_GetDialogItem(pMsg->hWin, ID_VNC_CONNECTION); IMAGE_SetBitmap(hItem, &bmno_connection); VNC_SetState (VNC_INIT); WM_Exec(); VNC_SERVER_Start(); } else { VNC_SERVER_Stop(); } break; case WM_NOTIFICATION_CLICKED: hItem = WM_GetDialogItem(pMsg->hWin, START_VNC); WM_InvalidateWindow(hItem); WM_Update(hItem); break; } break; case GO_BACKGROUND: /* Notifications sent by 'Background' */ switch(NCode) { case WM_NOTIFICATION_RELEASED: WM_HideWindow(pMsg->hWin); module_prop[k_ModuleGetIndex(&vnc_server)].win_state = 1; ST_AnimatedIconView_SetItemText(hIcon,k_ModuleGetIndex(&vnc_server),"vnc server[B]"); ST_AnimatedIconView_SetDualTextColor(hIcon, ICONVIEW_CI_SEL, GUI_STCOLOR_LIGHTBLUE, GUI_STCOLOR_DARKBLUE ); break; } break; case ID_BUTTON_EXIT: switch(NCode) { case WM_NOTIFICATION_RELEASED: if(VNC_GetState() != VNC_IDLE) { VNC_SERVER_Stop(); } GUI_EndDialog(pMsg->hWin, 0); break; } break; case ID_LOCK: switch(NCode) { case WM_NOTIFICATION_RELEASED: if(VNC_GetState() == VNC_IDLE) { if(VNC_GetLockState()) { VNC_SetLockState(0); } else { VNC_SetLockState(1); } } break; } break; } break; default: WM_DefaultProc(pMsg); break; } }
/** * @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; int NCode; int Id, ItemNbr; int result; int duration, volume, index; static char tmp[FILEMGR_FILE_NAME_SIZE]; switch (pMsg->MsgId) { case WM_INIT_DIALOG: pWavList = (FILELIST_FileTypeDef *)k_malloc(sizeof(FILELIST_FileTypeDef)); pFileInfo = (CHOOSEFILE_INFO *)k_malloc(sizeof(CHOOSEFILE_INFO)); pWavList->ptr = 0; /* Initialization of 'Listview' */ hItem = WM_GetDialogItem(pMsg->hWin, ID_WAVFILE_LIST); LISTVIEW_AddColumn(hItem, 132, "Track", GUI_TA_VCENTER | GUI_TA_LEFT); LISTVIEW_AddColumn(hItem, 55, "Duration", GUI_TA_VCENTER | GUI_TA_RIGHT); LISTVIEW_SetGridVis(hItem, 0); LISTVIEW_SetAutoScrollV(hItem, 1); LISTVIEW_SetBkColor(hItem, LISTVIEW_CI_UNSEL, GUI_BLACK); LISTVIEW_SetTextColor(hItem, LISTVIEW_CI_UNSEL, GUI_CYAN); /* Title Initialization in play list */ hItem = WM_GetDialogItem(pMsg->hWin, ID_TITLE_CAPTION); TEXT_SetText(hItem, "TITLE:"); TEXT_SetTextColor(hItem, GUI_CYAN); /* Title Initialization in play list */ hItem = WM_GetDialogItem(pMsg->hWin, ID_TITLE); TEXT_SetTextColor(hItem, GUI_CYAN); /* Duration */ hItem = WM_GetDialogItem(pMsg->hWin, ID_ELAPSED_TIME); TEXT_SetText(hItem, "00:00"); TEXT_SetFont(hItem, GUI_FONT_20B_1); TEXT_SetTextColor(hItem, GUI_LIGHTGRAY); /* Author initialization */ hItem = WM_GetDialogItem(pMsg->hWin, ID_AUTHOR_CAPTION); TEXT_SetText(hItem, "AUTHOR:"); TEXT_SetTextColor(hItem, GUI_CYAN); /* Author */ hItem = WM_GetDialogItem(pMsg->hWin, ID_AUTHOR); TEXT_SetText(hItem, ""); TEXT_SetTextColor(hItem, GUI_CYAN); /* Sampling Rate */ hItem = WM_GetDialogItem(pMsg->hWin, ID_SAMPLING_CAPTION); TEXT_SetText(hItem, "SAMPLING:"); TEXT_SetTextColor(hItem, GUI_CYAN); /* Sampling Rate Value */ hItem = WM_GetDialogItem(pMsg->hWin, ID_SAMPLING_VALUE); TEXT_SetText(hItem, ""); TEXT_SetTextColor(hItem, GUI_CYAN); /* Duration */ hItem = WM_GetDialogItem(pMsg->hWin, ID_TOTAL_TIME); TEXT_SetText(hItem, "00:00"); TEXT_SetTextColor(hItem, GUI_CYAN); /* Initialization of 'WAV' Button */ hItem = WM_GetDialogItem(pMsg->hWin, ID_WAV_BUTTON); BUTTON_SetFont(hItem, GUI_FONT_24_1); /* Initialization of 'Play List' Button */ hItem = WM_GetDialogItem(pMsg->hWin, ID_PLAY_LIST_BUTTON); BUTTON_SetFont(hItem, GUI_FONT_24_1); /* Initialization of 'Add' Button */ hItem = WM_GetDialogItem(pMsg->hWin, ID_ADD_BUTTON); BUTTON_SetFont(hItem, GUI_FONT_24_1); volume = AUDIOPLAYER_GetVolume(); hItem = WM_GetDialogItem(pMsg->hWin, ID_VOLUME_SLIDER); SLIDER_SetValue(hItem, volume); hItem = WM_GetDialogItem(pMsg->hWin, ID_DURATION_SLIDER); SLIDER_SetNumTicks(hItem, 25); PlayerSettings.d32 = k_BkupRestoreParameter(CALIBRATION_AUDIOPLAYER_SETTING_BKP); PlayerSettings.b.mute = MUTE_OFF; PlayerSettings.b.pause = PLAY_ACTIVE; hItem = BUTTON_CreateEx(25, 100, 30, 30, pMsg->hWin, WM_CF_SHOW, 0, ID_REPEAT_BUTTON); WM_SetCallback(hItem, _cbButton_repeat); hItem = BUTTON_CreateEx(100, 95, 40, 40, pMsg->hWin, WM_CF_SHOW, 0, ID_MUTE_BUTTON); WM_SetCallback(hItem, _cbButton_speaker); hItem = BUTTON_CreateEx(22, 147, 35, 35, pMsg->hWin, WM_CF_SHOW, 0, ID_STOP_BUTTON); WM_SetCallback(hItem, _cbButton_stop); hItem = BUTTON_CreateEx(89, 147, 35, 35, pMsg->hWin, WM_CF_SHOW, 0, ID_PREVIOUS_BUTTON); WM_SetCallback(hItem, _cbButton_previous); hItem = BUTTON_CreateEx(148, 140, 50, 50, pMsg->hWin, WM_CF_SHOW, 0, ID_PLAY_BUTTON); WM_SetCallback(hItem, _cbButton_play); hItem = BUTTON_CreateEx(222, 147, 35, 35, pMsg->hWin, WM_CF_SHOW, 0, ID_NEXT_BUTTON); WM_SetCallback(hItem, _cbButton_next); hItem = WM_GetClientWindow(pMsg->hWin); hItem = BUTTON_CreateEx(20, 205, 50, 30, pMsg->hWin, WM_CF_SHOW, 0, ID_WAV_BUTTON); WM_SetCallback(hItem, _cbButton_open); hItem = BUTTON_CreateEx(80, 205, 50, 30, pMsg->hWin, WM_CF_SHOW, 0, ID_ADD_BUTTON); WM_SetCallback(hItem, _cbButton_add); hItem = BUTTON_CreateEx(235, 205, 30, 30, pMsg->hWin, WM_CF_SHOW, 0, ID_CLOSE_BUTTON); WM_SetCallback(hItem, _cbButton_close); hTimerWin = WM_CreateWindowAsChild(0, 100, 10, 10, pMsg->hWin, WM_CF_SHOW | WM_CF_HASTRANS, _cbAudioProcess, 0); hItem = WM_CreateWindowAsChild(15, 75, 255, 20, pMsg->hWin, WM_CF_SHOW | WM_CF_HASTRANS | WM_CF_BGND, _cbDrawProgressSlider, 0); hItem = WM_CreateWindowAsChild(145, 105, 125, 20, pMsg->hWin, WM_CF_SHOW | WM_CF_HASTRANS | WM_CF_BGND, _cbDrawVolumeSlider, 0); WM_CreateWindowAsChild(479, 250, 1, 1, pMsg->hWin, WM_CF_SHOW | WM_CF_HASTRANS, _cbMediaConnection , 0); break; case WM_PAINT: GUI_SetBkColor(GUI_BLACK); GUI_ClearRect(15, 6, 270, 70); DrawRect3D(15, 135, 255, 60); DrawRect3D(15, 200, 255, 40); break; case WM_DELETE: AUDIOPLAYER_DeInit(); k_free(pWavList); k_free(pFileInfo); pWavList->ptr = 0; PlayerSettings.b.mute = MUTE_OFF; PlayerSettings.b.pause = PLAY_ACTIVE; k_BkupSaveParameter(CALIBRATION_AUDIOPLAYER_SETTING_BKP, PlayerSettings.d32); break; case WM_NOTIFY_PARENT: Id = WM_GetId(pMsg->hWinSrc); NCode = pMsg->Data.v; switch(Id) { /* Notification sent by "Button_Close" */ case ID_CLOSE_BUTTON: switch (NCode) { case WM_NOTIFICATION_CLICKED: break; case WM_NOTIFICATION_RELEASED: GUI_EndDialog(pMsg->hWin, 0); break; } break; /* Notifications sent by 'Repeat' Button */ case ID_REPEAT_BUTTON: if(NCode == WM_NOTIFICATION_RELEASED) { hItem = WM_GetDialogItem(pMsg->hWin, ID_REPEAT_BUTTON); if(PlayerSettings.b.repeat == REPEAT_NONE) { PlayerSettings.b.repeat = REPEAT_ONCE; } else if(PlayerSettings.b.repeat == REPEAT_ONCE) { PlayerSettings.b.repeat = REPEAT_ALL; } else if(PlayerSettings.b.repeat == REPEAT_ALL) { PlayerSettings.b.repeat = REPEAT_NONE; } } break; /* Notifications sent by 'Mute' Button */ case ID_MUTE_BUTTON: if(NCode == WM_NOTIFICATION_RELEASED) { hItem = WM_GetDialogItem(pMsg->hWin, ID_MUTE_BUTTON); if(PlayerSettings.b.mute == MUTE_OFF) { AUDIOPLAYER_Mute(MUTE_ON); PlayerSettings.b.mute = MUTE_ON; } else { AUDIOPLAYER_Mute(MUTE_OFF); PlayerSettings.b.mute = MUTE_OFF; } } break; /* Notifications sent by 'Volume' Slider */ case ID_VOLUME_SLIDER: if(NCode == WM_NOTIFICATION_VALUE_CHANGED) { hItem = WM_GetDialogItem(pMsg->hWin, ID_VOLUME_SLIDER); AUDIOPLAYER_SetVolume(SLIDER_GetValue(hItem)); if(PlayerSettings.b.mute == MUTE_ON) { AUDIOPLAYER_Mute(MUTE_OFF); PlayerSettings.b.mute = MUTE_OFF; } } break; /* Notifications sent by 'progress' Slider */ case ID_DURATION_SLIDER: if(NCode == WM_NOTIFICATION_CLICKED) { hItem = WM_GetDialogItem(pMsg->hWin, ID_DURATION_SLIDER); AUDIOPLAYER_SetPosition(SLIDER_GetValue(hItem)); if(PlayerSettings.b.mute == MUTE_ON) { AUDIOPLAYER_Mute(MUTE_ON); } } break; /* Notifications sent by 'ListView' Slider */ case ID_WAVFILE_LIST: if(NCode == WM_NOTIFICATION_CLICKED) { hItem = WM_GetDialogItem(pMsg->hWin, ID_WAVFILE_LIST); index = LISTVIEW_GetSel(hItem); if(index < pWavList->ptr) { if(playlist_select == 0) { hPlaylistTimer = WM_CreateTimer(hTimerWin, ID_PLAYLIST_TIMER, 500, 0); playlist_select = (index + 1); } else if(playlist_select == (index + 1)) { WM_DeleteTimer(hPlaylistTimer); hPlaylistTimer = 0; playlist_select = 0; if(index < pWavList->ptr) { if(AUDIOPLAYER_GetState() == AUDIOPLAYER_PLAY) { AUDIOPLAYER_Stop(); } PlayerSettings.b.pause = PLAY_ACTIVE; hItem = WM_GetDialogItem(pMsg->hWin, ID_PLAY_BUTTON); WM_InvalidateWindow(hItem); WM_Update(hItem); file_pos = index; _PlayFile((char *)pWavList->file[index].name); } } } } break; /* Notifications sent by 'Play' Button */ case ID_PLAY_BUTTON: if(NCode == WM_NOTIFICATION_RELEASED) { if(AUDIOPLAYER_GetState() == AUDIOPLAYER_STOP) { if(pWavList->ptr > 0) { _PlayFile((char *)pWavList->file[file_pos].name); LISTVIEW_SetSel(WM_GetDialogItem(AUDIOPLAYER_hWin, ID_WAVFILE_LIST), file_pos); } else { pFileInfo->pfGetData = k_GetData; pFileInfo->pMask = acMask_audio; hItem = CHOOSEFILE_Create(pMsg->hWin, 47, 10, 385, 215, apDrives, GUI_COUNTOF(apDrives), 0, "Open an audio file", 0, pFileInfo); WM_MakeModal(hItem); result = GUI_ExecCreatedDialog(hItem); if (result == 0) { if((strstr(pFileInfo->pRoot, ".wav")) || (strstr(pFileInfo->pRoot, ".WAV"))) { if(AUDIOPLAYER_GetFileInfo(pFileInfo->pRoot, &WavInfo) == 0) { if(AUDIOPLAYER_GetState() == AUDIOPLAYER_PLAY) { /* Stop current audio sample */ AUDIOPLAYER_Stop(); } pWavList->ptr = 0; file_pos = 0; strcpy((char *)pWavList->file[pWavList->ptr].name, pFileInfo->pRoot); FILEMGR_GetFileOnly (tmp, pFileInfo->pRoot); hItem = WM_GetDialogItem(pMsg->hWin, ID_WAVFILE_LIST); /* Update Play list */ strcpy((char *)pWavList->file[pWavList->ptr].name, pFileInfo->pRoot); ItemNbr = LISTVIEW_GetNumRows(hItem); while(ItemNbr--) { LISTVIEW_DeleteRow(hItem, ItemNbr); } LISTVIEW_AddRow(hItem, NULL); LISTVIEW_SetItemText(hItem, 0, pWavList->ptr, tmp); duration = WavInfo.FileSize / WavInfo.ByteRate; sprintf((char *)tmp , "%02d:%02d", duration/60, duration%60 ); LISTVIEW_SetItemText(hItem, 1, pWavList->ptr, tmp); pWavList->ptr++; LISTVIEW_SetSel(hItem, 0); _PlayFile(pFileInfo->pRoot); } } } } } else if(AUDIOPLAYER_GetState() == AUDIOPLAYER_PLAY) { PlayerSettings.b.pause = (PlayerSettings.b.pause == PLAY_ACTIVE ? PAUSE_ACTIVE : PLAY_ACTIVE); if(PlayerSettings.b.pause == PAUSE_ACTIVE) { AUDIOPLAYER_Pause(); } else if(PlayerSettings.b.pause == PLAY_ACTIVE) { AUDIOPLAYER_Resume(); } } } break; /* Notifications sent by 'STOP' Button */ case ID_STOP_BUTTON: if(NCode == WM_NOTIFICATION_RELEASED) { if(AUDIOPLAYER_GetState() == AUDIOPLAYER_PLAY) { if(PlayerSettings.b.pause == PAUSE_ACTIVE) { PlayerSettings.b.pause = PLAY_ACTIVE; } AUDIOPLAYER_Stop(); hItem = WM_GetDialogItem(pMsg->hWin, ID_ELAPSED_TIME); TEXT_SetText(hItem, "00:00"); hItem = WM_GetDialogItem(pMsg->hWin, ID_PLAY_BUTTON); WM_InvalidateWindow(hItem); WM_Update(hItem); } } break; /* Notifications sent by 'Next' Button */ case ID_NEXT_BUTTON: if(NCode == WM_NOTIFICATION_RELEASED) { if( pWavList->ptr > 0) { if(file_pos < (pWavList->ptr - 1)) { file_pos++; } else if(PlayerSettings.b.repeat == REPEAT_ALL) { file_pos = 0; } LISTVIEW_SetSel(WM_GetDialogItem(AUDIOPLAYER_hWin, ID_WAVFILE_LIST), file_pos); if(AUDIOPLAYER_GetState() == AUDIOPLAYER_PLAY) { if(PlayerSettings.b.pause == PAUSE_ACTIVE) { PlayerSettings.b.pause = PLAY_ACTIVE; hItem = WM_GetDialogItem(pMsg->hWin, ID_PLAY_BUTTON); WM_InvalidateWindow(hItem); WM_Update(hItem); } AUDIOPLAYER_Stop(); _PlayFile((char *)pWavList->file[file_pos].name); } } } break; /* Notifications sent by 'Previous' Button */ case ID_PREVIOUS_BUTTON: if(NCode == WM_NOTIFICATION_RELEASED) { if( pWavList->ptr > 0) { if(file_pos > 0) { file_pos--; } else if(PlayerSettings.b.repeat == REPEAT_ALL) { file_pos = (pWavList->ptr - 1); } LISTVIEW_SetSel(WM_GetDialogItem(AUDIOPLAYER_hWin, ID_WAVFILE_LIST), file_pos); if(AUDIOPLAYER_GetState() == AUDIOPLAYER_PLAY) { if(PlayerSettings.b.pause == PAUSE_ACTIVE) { PlayerSettings.b.pause = PLAY_ACTIVE; hItem = WM_GetDialogItem(pMsg->hWin, ID_PLAY_BUTTON); WM_InvalidateWindow(hItem); WM_Update(hItem); } AUDIOPLAYER_Stop(); _PlayFile((char *)pWavList->file[file_pos].name); } } } break; /* Notifications sent by 'Open' Button */ case ID_WAV_BUTTON: switch(NCode) { case WM_NOTIFICATION_CLICKED: break; case WM_NOTIFICATION_RELEASED: pFileInfo->pfGetData = k_GetData; pFileInfo->pMask = acMask_dir; hItem = CHOOSEFILE_Create(pMsg->hWin, 47, 10, 385, 215, apDrives, GUI_COUNTOF(apDrives), 0, "Add a folder", 0, pFileInfo); WM_MakeModal(hItem); result = GUI_ExecCreatedDialog(hItem); if (result == 0) { _AddEntireFolder(pFileInfo->pRoot); } break; } break; /* Notifications sent by 'Add' Button */ case ID_ADD_BUTTON: switch(NCode) { case WM_NOTIFICATION_RELEASED: pFileInfo->pfGetData = k_GetData; pFileInfo->pMask = acMask_audio; hItem = CHOOSEFILE_Create(pMsg->hWin, 47, 10, 385, 215, apDrives, GUI_COUNTOF(apDrives), 0, "Add to playlist", 0, pFileInfo); WM_MakeModal(hItem); result = GUI_ExecCreatedDialog(hItem); if (result == 0) { if((strstr(pFileInfo->pRoot, ".wav")) || (strstr(pFileInfo->pRoot, ".WAV"))) { if(pWavList->ptr < FILEMGR_LIST_DEPDTH) { strcpy((char *)pWavList->file[pWavList->ptr].name, pFileInfo->pRoot); FILEMGR_GetFileOnly (tmp, pFileInfo->pRoot); hItem = WM_GetDialogItem(pMsg->hWin, ID_WAVFILE_LIST); if(AUDIOPLAYER_GetFileInfo(pFileInfo->pRoot, &WavInfo) == 0) { LISTVIEW_AddRow(hItem, NULL); LISTVIEW_SetItemText(hItem, 0, pWavList->ptr, tmp); duration = WavInfo.FileSize / WavInfo.ByteRate; sprintf((char *)tmp , "%02d:%02d", duration/60, duration%60 ); LISTVIEW_SetItemText(hItem, 1, pWavList->ptr, tmp); pWavList->ptr++; } } } } } break; } break; default: WM_DefaultProc(pMsg); break; } }
/********************************************************************* * * _cbDialog */ static void _cbDialog(WM_MESSAGE * pMsg) { WM_HWIN hItem; int NCode; int Id; // USER START (Optionally insert additional variables) // USER END GUI_DrawBitmap(&bmlogo,40,10); #if(Gradient_Rectangle) { GUI_DrawGradientRoundedH(220,120,580,380,20,REC_color1,REC_color2); } #endif #if(RoundedFrame) GUI_SetColor(GUI_GREEN); GUI_DrawRoundedFrame(218,118,582,382,20,3); #endif #if(FillRoundedRect) GUI_SetColor(RoundedRect); GUI_FillRoundedRect(220,120,580,380,20); #endif switch (pMsg->MsgId) { case WM_INIT_DIALOG: // // Initialization of 'inuse' // hItem = pMsg->hWin; FRAMEWIN_SetTitleVis(hItem, 0); FRAMEWIN_SetClientColor( hItem, framewin_backcolor); FRAMEWIN_SetFont(hItem, GUI_FONT_8_1); FRAMEWIN_SetText(hItem, "Framewin"); FRAMEWIN_SetTextAlign(hItem, GUI_TA_HCENTER | GUI_TA_VCENTER); FRAMEWIN_SetTextColor(hItem, 0x00000000); hItem = pMsg->hWin; FRAMEWIN_SetTitleVis(hItem, 0); hItem = WM_GetDialogItem(pMsg->hWin, ID_BUTTON_1); BUTTON_SetFont(hItem, &GUI_Fonthz_song30); BUTTON_SetText(hItem, "返回 "); #if(Button_3Dskin) BUTTON_SetSkin(hItem,BUTTON_SKIN_FLEX); #endif #if(!Button_3Dskin) BUTTON_SetBkColor( hItem,BUTTON_CI_UNPRESSED,Button_unpress_color); BUTTON_SetBkColor( hItem,BUTTON_CI_PRESSED,Button_press_color); #endif // // Initialization of 'Button' // hItem = WM_GetDialogItem(pMsg->hWin, ID_BUTTON_0); BUTTON_SetFont(hItem, &GUI_Fonthz_song30); BUTTON_SetText(hItem, "停止充电 "); #if(Button_3Dskin) BUTTON_SetSkin(hItem,BUTTON_SKIN_FLEX); #endif #if(!Button_3Dskin) BUTTON_SetBkColor( hItem,BUTTON_CI_UNPRESSED,Button_unpress_color); BUTTON_SetBkColor( hItem,BUTTON_CI_PRESSED,Button_press_color); #endif // // Initialization of 'Button' // // // Initialization of 'Edit' // hItem = WM_GetDialogItem(pMsg->hWin, ID_EDIT_0); EDIT_EnableBlink( hItem,1 ,0); EDIT_SetDecMode(hItem,0,0,99,0,0); EDIT_SetFont(hItem, GUI_FONT_32_ASCII); EDIT_SetTextAlign(hItem, GUI_TA_HCENTER | GUI_TA_VCENTER); // // Initialization of 'Edit' // hItem = WM_GetDialogItem(pMsg->hWin, ID_EDIT_1); EDIT_EnableBlink( hItem,1 ,0); EDIT_SetDecMode(hItem,0,0,99,0,0); EDIT_SetFont(hItem, GUI_FONT_32_ASCII); EDIT_SetTextAlign(hItem, GUI_TA_HCENTER | GUI_TA_VCENTER); EDIT_SetTextColor(hItem, EDIT_CI_ENABLED, 0x00000000); // // Initialization of 'Edit' // hItem = WM_GetDialogItem(pMsg->hWin, ID_EDIT_2); EDIT_EnableBlink( hItem,1 ,0); EDIT_SetDecMode(hItem,0,0,99,0,0); EDIT_SetFont(hItem, GUI_FONT_32_ASCII); EDIT_SetTextAlign(hItem, GUI_TA_HCENTER | GUI_TA_VCENTER); EDIT_SetTextColor(hItem, EDIT_CI_ENABLED, 0x00000000); // // Initialization of 'Edit' // hItem = WM_GetDialogItem(pMsg->hWin, ID_EDIT_3); EDIT_EnableBlink( hItem,1 ,0); EDIT_SetDecMode(hItem,0,0,9999,0,0); EDIT_SetFont(hItem, GUI_FONT_32_ASCII); EDIT_SetTextAlign(hItem, GUI_TA_HCENTER | GUI_TA_VCENTER); EDIT_SetTextColor(hItem, EDIT_CI_ENABLED, 0x00000000); // // Initialization of 'cddianliang' // hItem = WM_GetDialogItem(pMsg->hWin, ID_TEXT_0); TEXT_SetFont(hItem, &GUI_Fonthz_song24); TEXT_SetText(hItem, "使用电量 "); TEXT_SetTextAlign(hItem, GUI_TA_RIGHT); TEXT_SetTextColor(hItem, 0x00000000); // // Initialization of 'Text' // hItem = WM_GetDialogItem(pMsg->hWin, ID_TEXT_1); TEXT_SetFont(hItem, &GUI_Fonthz_song24); TEXT_SetText(hItem, "使用时间 "); TEXT_SetTextColor(hItem, 0x00000000); TEXT_SetTextAlign(hItem, GUI_TA_RIGHT); // // Initialization of 'Text' // hItem = WM_GetDialogItem(pMsg->hWin, ID_TEXT_2); TEXT_SetFont(hItem, &GUI_Fonthz_song24); TEXT_SetText(hItem, "消费金额 "); TEXT_SetTextAlign(hItem, GUI_TA_RIGHT); TEXT_SetTextColor(hItem, 0x00000000); // // Initialization of 'Text' // hItem = WM_GetDialogItem(pMsg->hWin, ID_TEXT_3); TEXT_SetFont(hItem, &GUI_Fonthz_song24); TEXT_SetText(hItem, "账户余额 "); TEXT_SetTextAlign(hItem, GUI_TA_RIGHT); TEXT_SetTextColor(hItem, 0x00000000); hItem = WM_GetDialogItem(pMsg->hWin, ID_TEXT_4); TEXT_SetTextAlign(hItem, GUI_TA_LEFT | GUI_TA_TOP); TEXT_SetText(hItem, "安徽绿建科技有限公司 "); TEXT_SetTextColor(hItem, 0x00000000); TEXT_SetFont(hItem, &GUI_FontSong_60); // // Initialization of 'Text' // hItem = WM_GetDialogItem(pMsg->hWin, ID_TEXT_5); TEXT_SetTextAlign(hItem, GUI_TA_LEFT | GUI_TA_TOP); TEXT_SetTextColor(hItem, 0x00000000); TEXT_SetText(hItem, "ANHUI GREEN BUILDING TECHNOLOGY CO.,LTD."); TEXT_SetFont(hItem, GUI_FONT_24_ASCII); // USER START (Optionally insert additional code for further widget initialization) // USER END break; case WM_NOTIFY_PARENT: Id = WM_GetId(pMsg->hWinSrc); NCode = pMsg->Data.v; switch(Id) { case ID_BUTTON_0: // Notifications sent by 'Button' switch(NCode) { case WM_NOTIFICATION_CLICKED: // USER START (Optionally insert code for reacting on notification message) // USER END break; case WM_NOTIFICATION_RELEASED: // USER START (Optionally insert code for reacting on notification message) // USER END // op=ensure; // handle_button(); GUI_EndDialog( pMsg->hWin,1); Createensure(); break; // USER START (Optionally insert additional code for further notification handling) // USER END } break; case ID_BUTTON_1: // Notifications sent by 'Button' switch(NCode) { case WM_NOTIFICATION_CLICKED: // USER START (Optionally insert code for reacting on notification message) // USER END break; case WM_NOTIFICATION_RELEASED: // USER START (Optionally insert code for reacting on notification message) // USER END GUI_EndDialog( pMsg->hWin,1); Createwindow0(); break; // USER START (Optionally insert additional code for further notification handling) // USER END } break; case ID_EDIT_0: // Notifications sent by 'Edit' switch(NCode) { case WM_NOTIFICATION_CLICKED: // USER START (Optionally insert code for reacting on notification message) // USER END break; case WM_NOTIFICATION_RELEASED: // USER START (Optionally insert code for reacting on notification message) // USER END break; case WM_NOTIFICATION_VALUE_CHANGED: // USER START (Optionally insert code for reacting on notification message) // USER END break; // USER START (Optionally insert additional code for further notification handling) // USER END } break; case ID_EDIT_1: // Notifications sent by 'Edit' switch(NCode) { case WM_NOTIFICATION_CLICKED: // USER START (Optionally insert code for reacting on notification message) // USER END break; case WM_NOTIFICATION_RELEASED: // USER START (Optionally insert code for reacting on notification message) // USER END break; case WM_NOTIFICATION_VALUE_CHANGED: // USER START (Optionally insert code for reacting on notification message) // USER END break; // USER START (Optionally insert additional code for further notification handling) // USER END } break; case ID_EDIT_2: // Notifications sent by 'Edit' switch(NCode) { case WM_NOTIFICATION_CLICKED: // USER START (Optionally insert code for reacting on notification message) // USER END break; case WM_NOTIFICATION_RELEASED: // USER START (Optionally insert code for reacting on notification message) // USER END break; case WM_NOTIFICATION_VALUE_CHANGED: // USER START (Optionally insert code for reacting on notification message) // USER END break; // USER START (Optionally insert additional code for further notification handling) // USER END } break; case ID_EDIT_3: // Notifications sent by 'Edit' switch(NCode) { case WM_NOTIFICATION_CLICKED: // USER START (Optionally insert code for reacting on notification message) // USER END break; case WM_NOTIFICATION_RELEASED: // USER START (Optionally insert code for reacting on notification message) // USER END break; case WM_NOTIFICATION_VALUE_CHANGED: // USER START (Optionally insert code for reacting on notification message) // USER END break; // USER START (Optionally insert additional code for further notification handling) // USER END } break; // USER START (Optionally insert additional code for further Ids) // USER END } break; // USER START (Optionally insert additional message handling) // USER END default: WM_DefaultProc(pMsg); break; } }
/********************************************************************* * * _cbServo */ static void _cbServo (WM_MESSAGE * pMsg) { WM_HWIN hItem; int NCode; int Id; char str[10]; switch(pMsg->MsgId) { case WM_INIT_DIALOG: // //Intialization of Text // hItem = WM_GetDialogItem(pMsg->hWin, ID_TEXT_S1); TEXT_SetFont(hItem, &GUI_FontSongTi12); strcpy(str, StringHZ[2]); strcat(str, "1"); TEXT_SetText(hItem, str); hItem = WM_GetDialogItem(pMsg->hWin, ID_TEXT_S2); TEXT_SetFont(hItem, &GUI_FontSongTi12); strcpy(str, StringHZ[2]); strcat(str, "2"); TEXT_SetText(hItem, str); hItem = WM_GetDialogItem(pMsg->hWin, ID_TEXT_S3); TEXT_SetFont(hItem, &GUI_FontSongTi12); strcpy(str, StringHZ[2]); strcat(str, "3"); TEXT_SetText(hItem, str); hItem = WM_GetDialogItem(pMsg->hWin, ID_TEXT_S4); TEXT_SetFont(hItem, &GUI_FontSongTi12); strcpy(str, StringHZ[2]); strcat(str, "4"); TEXT_SetText(hItem, str); // // Initialization of Button // hItem = WM_GetDialogItem(pMsg->hWin, ID_BUTTON_S1_0); BUTTON_SetFont(hItem, &GUI_FontSongTi12); BUTTON_SetText(hItem, StringHZ[5]); hItem = WM_GetDialogItem(pMsg->hWin, ID_BUTTON_S1_90); BUTTON_SetFont(hItem, &GUI_FontSongTi12); BUTTON_SetText(hItem, StringHZ[6]); hItem = WM_GetDialogItem(pMsg->hWin, ID_BUTTON_S1_180); BUTTON_SetFont(hItem, &GUI_FontSongTi12); BUTTON_SetText(hItem, StringHZ[7]); hItem = WM_GetDialogItem(pMsg->hWin, ID_BUTTON_S2_0); BUTTON_SetFont(hItem, &GUI_FontSongTi12); BUTTON_SetText(hItem, StringHZ[5]); hItem = WM_GetDialogItem(pMsg->hWin, ID_BUTTON_S2_90); BUTTON_SetFont(hItem, &GUI_FontSongTi12); BUTTON_SetText(hItem, StringHZ[6]); hItem = WM_GetDialogItem(pMsg->hWin, ID_BUTTON_S2_180); BUTTON_SetFont(hItem, &GUI_FontSongTi12); BUTTON_SetText(hItem, StringHZ[7]); hItem = WM_GetDialogItem(pMsg->hWin, ID_BUTTON_S3_0); BUTTON_SetFont(hItem, &GUI_FontSongTi12); BUTTON_SetText(hItem, StringHZ[5]); hItem = WM_GetDialogItem(pMsg->hWin, ID_BUTTON_S3_90); BUTTON_SetFont(hItem, &GUI_FontSongTi12); BUTTON_SetText(hItem, StringHZ[6]); hItem = WM_GetDialogItem(pMsg->hWin, ID_BUTTON_S3_180); BUTTON_SetFont(hItem, &GUI_FontSongTi12); BUTTON_SetText(hItem, StringHZ[7]); hItem = WM_GetDialogItem(pMsg->hWin, ID_BUTTON_S4_0); BUTTON_SetFont(hItem, &GUI_FontSongTi12); BUTTON_SetText(hItem, StringHZ[5]); hItem = WM_GetDialogItem(pMsg->hWin, ID_BUTTON_S4_90); BUTTON_SetFont(hItem, &GUI_FontSongTi12); BUTTON_SetText(hItem, StringHZ[6]); hItem = WM_GetDialogItem(pMsg->hWin, ID_BUTTON_S4_180); BUTTON_SetFont(hItem, &GUI_FontSongTi12); BUTTON_SetText(hItem, StringHZ[7]); break; case WM_NOTIFY_PARENT: Id = WM_GetId(pMsg->hWinSrc); NCode = pMsg->Data.v; switch(Id) { case ID_BUTTON_S1_0: switch(NCode) { case WM_NOTIFICATION_CLICKED: break; case WM_NOTIFICATION_RELEASED: SERVO_Manual( 1, 0); break; } break; case ID_BUTTON_S1_90: switch(NCode) { case WM_NOTIFICATION_CLICKED: break; case WM_NOTIFICATION_RELEASED: SERVO_Manual( 1, 90); break; } break; case ID_BUTTON_S1_180: switch(NCode) { case WM_NOTIFICATION_CLICKED: break; case WM_NOTIFICATION_RELEASED: SERVO_Manual( 1, 180); break; } break; case ID_BUTTON_S2_0: switch(NCode) { case WM_NOTIFICATION_CLICKED: break; case WM_NOTIFICATION_RELEASED: SERVO_Manual(2, 0); break; } break; case ID_BUTTON_S2_90: switch(NCode) { case WM_NOTIFICATION_CLICKED: break; case WM_NOTIFICATION_RELEASED: SERVO_Manual(2, 90); break; } break; case ID_BUTTON_S2_180: switch(NCode) { case WM_NOTIFICATION_CLICKED: break; case WM_NOTIFICATION_RELEASED: SERVO_Manual(2, 180); break; } break; case ID_BUTTON_S3_0: switch(NCode) { case WM_NOTIFICATION_CLICKED: break; case WM_NOTIFICATION_RELEASED: SERVO_Manual(3, 0); break; } break; case ID_BUTTON_S3_90: switch(NCode) { case WM_NOTIFICATION_CLICKED: break; case WM_NOTIFICATION_RELEASED: SERVO_Manual(3, 90); break; } break; case ID_BUTTON_S3_180: switch(NCode) { case WM_NOTIFICATION_CLICKED: break; case WM_NOTIFICATION_RELEASED: SERVO_Manual(3, 180); break; } break; case ID_BUTTON_S4_0: switch(NCode) { case WM_NOTIFICATION_CLICKED: break; case WM_NOTIFICATION_RELEASED: SERVO_Manual(4, 0); break; } break; case ID_BUTTON_S4_90: switch(NCode) { case WM_NOTIFICATION_CLICKED: break; case WM_NOTIFICATION_RELEASED: SERVO_Manual(4, 90); break; } break; case ID_BUTTON_S4_180: switch(NCode) { case WM_NOTIFICATION_CLICKED: break; case WM_NOTIFICATION_RELEASED: SERVO_Manual(4, 180); break; } break; } break; default: WM_DefaultProc(pMsg); break; } }
void run_db(void) { /* printf("Database name : %s\n", db->name); printf("Database nb children : %i\n", (int)db->nb_motifs); for (uint32_t i = 0; i < db->nb_motifs; i++) { motif_t * m = db->motifs; printf(" motif %i:\n", (int)i); printf(" name : %s\n", m->name); printf(" desc : %s\n", m->desc); printf(" img : %s\n", m->image); } */ char error_404[] = "No Motifs Found in Database!"; if (db->motifs == NULL) { strcpy(current_motif_title, error_404); } else { current_motif_index = 1; //sprintf(current_motif_title, "%i/%i -- %s", (int)current_motif_index, (int)db->nb_motifs, db->motifs->name); //current_motif_desc = db->motifs->desc; update_motif(); } WM_HWIN db_nav_win = WINDOW_CreateEx( 0, 0, 800, 480, WM_HBKWIN, WM_CF_SHOW, 0, GUI_ID_USER+0, _cbrundb); WINDOW_SetBkColor(db_nav_win, GUI_WHITE); motif_name_widget = TEXT_CreateEx( 0, 0, 800, 100, db_nav_win, WM_CF_SHOW, TEXT_CF_HCENTER | TEXT_CF_VCENTER, GUI_ID_TEXT0, (const char *)current_motif_title); motif_desc_widget = MULTIEDIT_CreateEx( 100, 100, 600, 380, db_nav_win, WM_CF_SHOW, MULTIEDIT_CF_AUTOSCROLLBAR_V, GUI_ID_MULTIEDIT1, 5000, (const char *) current_motif_desc ); BUTTON_Handle bt_prev_widget = BUTTON_CreateEx( 0, 100, 100, 380, db_nav_win, WM_CF_SHOW, 0, GUI_ID_BUTTON0); BUTTON_Handle bt_next_widget = BUTTON_CreateEx( 700, 100, 100, 380, db_nav_win, WM_CF_SHOW, 0, GUI_ID_BUTTON1); TEXT_SetFont(motif_name_widget, GUI_FONT_24_1); BUTTON_SetFont(bt_prev_widget, GUI_FONT_24_1); BUTTON_SetFont(bt_next_widget, GUI_FONT_24_1); MULTIEDIT_SetFont(motif_desc_widget, GUI_FONT_24_1); MULTIEDIT_SetWrapWord(motif_desc_widget); BUTTON_SetBitmap(bt_prev_widget, BUTTON_BI_UNPRESSED, &bmarrowdefault); BUTTON_SetBitmap(bt_next_widget, BUTTON_BI_UNPRESSED, &bmarrowrdefault); BUTTON_SetBitmap(bt_prev_widget, BUTTON_BI_PRESSED , &bmarrowclicked); BUTTON_SetBitmap(bt_next_widget, BUTTON_BI_PRESSED , &bmarrowrclicked); }
/********************************************************************* * * _cbDialog */ static void _cbDialog(WM_MESSAGE * pMsg) { WM_HWIN hItem; WM_MESSAGE Msg; WM_HWIN hIteminfo; int i; int sel; uint8_t items; FRESULT res; // FILINFO fno; //DIR dir; // USER START (Optionally insert additional variables) // USER END hItem = pMsg->hWin; WINDOW_SetBkColor(hItem, GUI_LIGHTGRAY); hItem = WM_GetDialogItem(pMsg->hWin, ID_LISTBOX_0); //WM_SetFocus(hItem); switch (pMsg->MsgId) { case WM_INIT_DIALOG: hItem = WM_GetDialogItem(pMsg->hWin, ID_TEXT_0); TEXT_SetFont(hItem,&GUI_FontHZ_Song_12); TEXT_SetText(hItem, "自学习文件选择"); hIteminfo = WM_GetDialogItem(pMsg->hWin, ID_TEXT_1); TEXT_SetFont(hIteminfo,&GUI_FontHZ_Song_12); TEXT_SetTextColor(hIteminfo,GUI_RED); TEXT_SetText(hIteminfo, (char *)"打开文件……"); WM_HideWindow(hIteminfo); // // Initialization of 'Dropdown' // hItem = WM_GetDialogItem(pMsg->hWin, ID_DROPDOWN_0); DROPDOWN_SetFont(hItem,&GUI_FontHZ_Song_12); DROPDOWN_AddString(hItem, "U盘"); DROPDOWN_AddString(hItem, "SD卡"); if(k_StorageGetStatus(MSD_DISK_UNIT) != 0) DROPDOWN_SetSel(hItem,1); else DROPDOWN_SetSel(hItem,0); // // Initialization of 'Treeview' // store_dev=DROPDOWN_GetSel(hItem); WT_TestFolder_Init(); hItem = WM_GetDialogItem(pMsg->hWin, ID_LISTBOX_0); for(i=0;i<TestFolder.number_TotalFile;i++) { LISTBOX_AddString(hItem, (char *)TestFolder.FilesName[i]); } LISTBOX_SetFont(hItem,GUI_FONT_20_1); LISTBOX_SetSel(hItem,TestFolder.number_CurrentFile); hItem = WM_GetDialogItem(pMsg->hWin, ID_BUTTON_OK); BUTTON_SetFont(hItem,&GUI_FontHZ_Song_12); BUTTON_SetSkinClassic(hItem); BUTTON_SetTextAlign(hItem, GUI_TA_HCENTER | GUI_TA_VCENTER); BUTTON_SetBkColor(hItem,BUTTON_CI_UNPRESSED, GUI_GREEN); BUTTON_SetFocussable(hItem,0);//不接收焦点 hItem = WM_GetDialogItem(pMsg->hWin, ID_BUTTON_CANCEL); BUTTON_SetFont(hItem,&GUI_FontHZ_Song_12); BUTTON_SetSkinClassic(hItem); BUTTON_SetTextAlign(hItem, GUI_TA_HCENTER | GUI_TA_VCENTER); BUTTON_SetBkColor(hItem,BUTTON_CI_UNPRESSED, GUI_RED); BUTTON_SetFocussable(hItem,0);//不接收焦点 // USER START (Optionally insert additional code for further widget initialization) // USER END break; case MY_MESSAGE_CLICK: GUI_SendKeyMsg(GUI_KEY_TAB, 1);//改变输入焦点 break; case MY_MESSAGE_DOWN: hItem = WM_GetDialogItem(pMsg->hWin, ID_LISTBOX_0); if(WM_HasFocus(hItem)) { LISTBOX_IncSel(hItem); } hItem = WM_GetDialogItem(pMsg->hWin, ID_DROPDOWN_0); if(WM_HasFocus(hItem)) { sel=DROPDOWN_GetSel(hItem); if(sel<1) { DROPDOWN_IncSel(hItem); } else //sel>=1 { DROPDOWN_SetSel(hItem,0); } store_dev=DROPDOWN_GetSel(hItem); WT_TestFolder_Init(); hItem = WM_GetDialogItem(pMsg->hWin, ID_LISTBOX_0); items = LISTBOX_GetNumItems(hItem); for(i=0;i<items;i++) { LISTBOX_DeleteItem(hItem,0); } for(i=0;i<TestFolder.number_TotalFile;i++) { LISTBOX_AddString(hItem, (char *)TestFolder.FilesName[i]); } } break; case MY_MESSAGE_UP: hItem = WM_GetDialogItem(pMsg->hWin, ID_LISTBOX_0); if(WM_HasFocus(hItem)) { LISTBOX_DecSel(hItem); } hItem = WM_GetDialogItem(pMsg->hWin, ID_DROPDOWN_0); if(WM_HasFocus(hItem)) { sel=DROPDOWN_GetSel(hItem); if(sel>0) { DROPDOWN_DecSel(hItem); } else //sel>=1 { DROPDOWN_SetSel(hItem,1); } store_dev=DROPDOWN_GetSel(hItem); WT_TestFolder_Init(); hItem = WM_GetDialogItem(pMsg->hWin, ID_LISTBOX_0); items = LISTBOX_GetNumItems(hItem); for(i=0;i<items;i++) { LISTBOX_DeleteItem(hItem,0); } for(i=0;i<TestFolder.number_TotalFile;i++) { LISTBOX_AddString(hItem, (char *)TestFolder.FilesName[i]); } } break; case MY_MESSAGE_CANCEL://取消 GUI_EndDialog(pMsg->hWin,0); break; case MY_MESSAGE_OK: hIteminfo = WM_GetDialogItem(pMsg->hWin, ID_TEXT_1); TEXT_SetText(hIteminfo, (char *)"打开文件中……"); WM_ShowWindow(hIteminfo); GUI_Exec(); hItem = WM_GetDialogItem(pMsg->hWin, ID_LISTBOX_0); TestFolder.number_CurrentFile=LISTBOX_GetSel(hItem); hItem = WM_GetDialogItem(pMsg->hWin, ID_DROPDOWN_0); store_dev=DROPDOWN_GetSel(hItem); WT_TestItem_Init((char *)TestFolder.FilesName[TestFolder.number_CurrentFile]); //WT_TestFile_Write2Flash((char *)TestFolder.FilesName[TestFolder.number_CurrentFile]);//将文件内容复制到Flash //WT_TestFiles_Write2card((char *)TestFolder.FilesName[TestFolder.number_CurrentFile]);//将文件内容复制到SD card if(TestFile.file_status == 1)//文件读取OK { Msg.MsgId = MY_MESSAGE_BUTTONOK; WM_SendMessage(pMsg->hWinSrc,&Msg); GUI_EndDialog(pMsg->hWin,0); } else { TEXT_SetText(hIteminfo, (char *)"读取文件错误!"); WM_ShowWindow(hIteminfo); } Msg.MsgId = MY_MESSAGE_BUTTONOK; WM_SendMessage(pMsg->hWinSrc,&Msg); GUI_EndDialog(pMsg->hWin,0); break; case MY_MESSAGE_BUTTONDELETE: hItem = WM_GetDialogItem(pMsg->hWin, ID_DROPDOWN_0); store_dev=DROPDOWN_GetSel(hItem); if(store_dev==0) //usb strcpy(filename,path_testfile); //f_opendir(&dir, path_testfile); if(store_dev==1) //sd strcpy(filename,path_testfile_sd); //f_opendir(&dir, path_testfile_sd); //res = f_opendir(&dir, "1:/LZY_WireTester/Test Files"); hItem = WM_GetDialogItem(pMsg->hWin, ID_LISTBOX_0); strcat(filename,"/"); sel = LISTBOX_GetSel(hItem); if(sel < 0) break; strcat(filename,(char *)TestFolder.FilesName[LISTBOX_GetSel(hItem)]); res=f_unlink((const TCHAR*)filename); if(res == FR_OK) { hItem = WM_GetDialogItem(pMsg->hWin, ID_DROPDOWN_0); store_dev=DROPDOWN_GetSel(hItem); WT_TestFolder_Init(); hItem = WM_GetDialogItem(pMsg->hWin, ID_LISTBOX_0); items = LISTBOX_GetNumItems(hItem); for(i=0;i<items;i++) { LISTBOX_DeleteItem(hItem,0); } for(i=0;i<TestFolder.number_TotalFile;i++) { LISTBOX_AddString(hItem, (char *)TestFolder.FilesName[i]); } WM_SetFocus(hItem); if(sel > 0) LISTBOX_SetSel(hItem,sel - 1); else LISTBOX_SetSel(hItem,0); } break; case WM_PAINT://绘制标题栏 GUI_SetColor(GUI_DARKBLUE); GUI_FillRect(0,0,380,22); GUI_SetColor(GUI_DARKGRAY); GUI_SetPenSize(8); GUI_DrawRect(0,0,378,220); break; default: WM_DefaultProc(pMsg); break; } }
/** * @brief Callback function of the Settings frame * @param pMsg: pointer to data structure of type WM_MESSAGE * @retval None */ static void _cbSettingsDialog(WM_MESSAGE * pMsg) { int Id, NCode; WM_HWIN hItem; switch (pMsg->MsgId) { case WM_INIT_DIALOG: /* Settings frame initialization */ hItem = pMsg->hWin; FRAMEWIN_AddCloseButton(hItem, FRAMEWIN_BUTTON_RIGHT, 0); /* Create and attache the MULTIPAGE dialog windows */ hItem = WM_GetDialogItem(pMsg->hWin, ID_MULTIPAGE); hDialogCameraSettings = GUI_CreateDialogBox(_aDialogCameraSettings, GUI_COUNTOF(_aDialogCameraSettings), &_cbCameraSettings, WM_UNATTACHED, 0, 0); MULTIPAGE_AddPage(hItem, hDialogCameraSettings, "Camera Settings"); hDialogFileControl = GUI_CreateDialogBox(_aDialogFileControl, GUI_COUNTOF(_aDialogFileControl), &_cbFileControl, WM_UNATTACHED, 0, 0); MULTIPAGE_AddPage(hItem, hDialogFileControl, "File Settings"); MULTIPAGE_SelectPage(hItem, 0); /* 'OK' button initialization */ hItem = WM_GetDialogItem(pMsg->hWin, ID_BUTTON_OK); BUTTON_SetFont(hItem, GUI_FONT_13B_1); /* 'Cancel' button initialization */ hItem = WM_GetDialogItem(pMsg->hWin, ID_BUTTON_CANCEL); BUTTON_SetFont(hItem, GUI_FONT_13B_1); break; case WM_DELETE: camera_disabled = 0; hSettings = 0; if(SD_Configured == 1) { BSP_CAMERA_Init(RESOLUTION_R160x120); CAMERA_Configured = 1; /* Apply new settings*/ SD_Configured = 0; } /* Delete choosfile window */ WM_DeleteWindow(chooser_select_folder); break; case WM_NOTIFY_PARENT: Id = WM_GetId(pMsg->hWinSrc); NCode = pMsg->Data.v; switch (Id) { case ID_BUTTON_OK: /* Notification sent by "OK" button */ switch (NCode) { case WM_NOTIFICATION_RELEASED: /* Save camera settings before delete settings frame */ hItem = WM_GetDialogItem(hDialogCameraSettings, ID_SLIDER_0); CameraSettings.b.brightness = SLIDER_GetValue(hItem); hItem = WM_GetDialogItem(hDialogCameraSettings, ID_SLIDER_1); CameraSettings.b.contrast = SLIDER_GetValue(hItem); /* Back to normal mode (no effects) */ hItem = WM_GetDialogItem(CAMERA_hWin, ID_RADIO); RADIO_SetValue(hItem, 0); if(CAMERA_GetState() != CAMERA_ERROR) { /* Apply new settings*/ CAMERA_Set_ContrastBrightness(CameraSettings.b.contrast, CameraSettings.b.brightness); BSP_CAMERA_BlackWhiteConfig(CAMERA_BLACK_WHITE_NORMAL); } GUI_EndDialog(pMsg->hWin, 0); break; } break; case ID_BUTTON_CANCEL: /* Notification sent by "Cancel" button */ switch (NCode) { case WM_NOTIFICATION_RELEASED: GUI_EndDialog(pMsg->hWin, 0); break; } break; } break; } }
/********************************************************************* * * _cbDialog */ static void _cbDialog(WM_MESSAGE * pMsg) { WM_HWIN hItem; int NCode; int Id; // USER START (Optionally insert additional variables) // USER END switch (pMsg->MsgId) { case WM_INIT_DIALOG: // //Initialization of windows // hItem = pMsg->hWin; WINDOW_SetBkColor(hItem, GUI_LIGHTBLUE); // // Initialization of 'HeaderTop' // hItem = WM_GetDialogItem(pMsg->hWin, ID_HEADER_0); HEADER_AddItem(hItem, 80, "LeCoder", 14); // // Initialization of 'Back' // hItem = WM_GetDialogItem(pMsg->hWin, ID_BUTTON_BACK); BUTTON_SetFont(hItem, &GUI_FontSongTi12); BUTTON_SetText(hItem, StringHZ[0]); // // Initialization of 'Multipage' // hItem = WM_GetDialogItem(pMsg->hWin, ID_MULTIPAGE_0); MULTIPAGE_SetFont(hItem, &GUI_FontSongTi12); MULTIPAGE_AddPage(hItem, hDialog_Page1, StringHZ[12]); MULTIPAGE_AddPage(hItem, hDialog_Page2, StringHZ[13]); MULTIPAGE_AddPage(hItem, hDialog_Page3, StringHZ[8]); break; case WM_NOTIFY_PARENT: Id = WM_GetId(pMsg->hWinSrc); NCode = pMsg->Data.v; switch(Id) { case ID_BUTTON_BACK: // Notifications sent by 'Back' switch(NCode) { case WM_NOTIFICATION_CLICKED: break; case WM_NOTIFICATION_RELEASED: Key_Value = WINDOW_TOP; break; } break; case ID_MULTIPAGE_0: // Notifications sent by 'Multipage' switch(NCode) { case WM_NOTIFICATION_CLICKED: break; case WM_NOTIFICATION_RELEASED: break; case WM_NOTIFICATION_MOVED_OUT: break; case WM_NOTIFICATION_VALUE_CHANGED: 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; RTC_TimeTypeDef RTC_TimeStructure; RTC_DateTypeDef RTC_DateStructure; uint8_t sec, min, hour, day, month; uint16_t year; uint8_t offset, max; static uint8_t TempStr[50]; switch (pMsg->MsgId) { case WM_PAINT: break; case WM_INIT_DIALOG: RTC_GetTime(RTC_Format_BIN, &RTC_TimeStructure); sec = RTC_TimeStructure.RTC_Seconds; min = RTC_TimeStructure.RTC_Minutes; hour = RTC_TimeStructure.RTC_Hours; RTC_GetDate(RTC_Format_BIN, &RTC_DateStructure); year = RTC_DateStructure.RTC_Year + 2000; month = RTC_DateStructure.RTC_Month; day = RTC_DateStructure.RTC_Date; /* Initialization of 'System Information' */ hItem = pMsg->hWin; FRAMEWIN_SetFont(hItem, GUI_FONT_13B_ASCII); /* Initialization of 'Close' */ hItem = WM_GetDialogItem(pMsg->hWin, ID_BUTTON_CLOSE_CLOCK); BUTTON_SetFont(hItem, GUI_FONT_13B_ASCII); /* Set date in text mode */ hItem = WM_GetDialogItem(pMsg->hWin, ID_TEXT_DATE); TEXT_SetFont(hItem, GUI_FONT_13B_1); TEXT_SetTextColor(hItem, 0x00804000); WM_CreateWindowAsChild(80, 45, 354, 23, pMsg->hWin, WM_CF_SHOW | WM_CF_HASTRANS, _cbClockWindow , 0); hItem = WM_GetDialogItem(pMsg->hWin, ID_TEXT_CLOCK); TEXT_SetFont(hItem, &GUI_FontBauhaus9332); TEXT_SetTextColor(hItem, 0x00804000); /* Set Init values */ hItem = WM_GetDialogItem(pMsg->hWin, ID_TEXT_DATE); /* Write date and clock */ sprintf((char *)TempStr, "%02d, %s, %04d",day , strMonth[month-1], year); TEXT_SetText(hItem, (char *)TempStr); hItem = WM_GetDialogItem(pMsg->hWin, ID_TEXT_CLOCK); sprintf((char *)TempStr, "%02d:%02d:%02d",hour , min, sec); TEXT_SetText(hItem, (char *)TempStr); GetDateOffset (year, month, &offset , &max); CALENDAR_SetDefaultSize(CALENDAR_SI_HEADER, 25 ); CALENDAR_SetDefaultSize(CALENDAR_SI_CELL_X, 30 ); CALENDAR_SetDefaultSize(CALENDAR_SI_CELL_Y, 20 ); CALENDAR_SetDefaultFont(CALENDAR_FI_CONTENT,GUI_FONT_16B_1 ); CALENDAR_SetDefaultFont(CALENDAR_FI_HEADER, GUI_FONT_16B_1) ; CALENDAR_Create(pMsg->hWin, 15, 70, year, month, day, 2, ID_CALENDAR, WM_CF_SHOW); WM_InvalidateWindow(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_RELEASED: /* React only if released */ switch (Id) { case ID_BUTTON_CLOSE_CLOCK: GUI_EndDialog(pMsg->hWin, 0); break; case ID_BUTTON_SETTINGS_CLOCK: GUI_CreateDialogBox(_aDialogSettingsCreate, GUI_COUNTOF(_aDialogSettingsCreate), &_cbDialogSettings, pMsg->hWin, 0, 0); hNumPad = GUI_CreateDialogBox(_aDialogNumPad, GUI_COUNTOF(_aDialogNumPad), _cbDialogNumPad, WM_GetDesktopWindowEx(1), 0, 0); /* Create the numpad dialog */ WM_SetStayOnTop(hNumPad, 1); break; } break; case WM_NOTIFICATION_CHILD_DELETED: WM_NotifyParent(WM_GetParent(pMsg->hWin), 0x500); break; } break; default: WM_DefaultProc(pMsg); break; } }
/********************************************************************* * * _cbMotor */ static void _cbMotor (WM_MESSAGE * pMsg) { WM_HWIN hItem; int NCode; int Id; char str[10]; switch(pMsg->MsgId) { case WM_INIT_DIALOG: // //Intialization of Text // hItem = WM_GetDialogItem(pMsg->hWin, ID_TEXT_M1); TEXT_SetFont(hItem, &GUI_FontSongTi12); strcpy(str, StringHZ[1]); strcat(str, "1"); TEXT_SetText(hItem, str); hItem = WM_GetDialogItem(pMsg->hWin, ID_TEXT_M2); TEXT_SetFont(hItem, &GUI_FontSongTi12); strcpy(str, StringHZ[1]); strcat(str, "2"); TEXT_SetText(hItem, str); // // Initialization of Button // hItem = WM_GetDialogItem(pMsg->hWin, ID_BUTTON_M1C); BUTTON_SetFont(hItem, &GUI_FontSongTi12); BUTTON_SetText(hItem, StringHZ[3]); hItem = WM_GetDialogItem(pMsg->hWin, ID_BUTTON_M1CC); BUTTON_SetFont(hItem, &GUI_FontSongTi12); BUTTON_SetText(hItem, StringHZ[4]); hItem = WM_GetDialogItem(pMsg->hWin, ID_BUTTON_M2C); BUTTON_SetFont(hItem, &GUI_FontSongTi12); BUTTON_SetText(hItem, StringHZ[3]); hItem = WM_GetDialogItem(pMsg->hWin, ID_BUTTON_M2CC); BUTTON_SetFont(hItem, &GUI_FontSongTi12); BUTTON_SetText(hItem, StringHZ[4]); break; case WM_NOTIFY_PARENT: Id = WM_GetId(pMsg->hWinSrc); NCode = pMsg->Data.v; switch(Id) { case ID_BUTTON_M1C: switch(NCode) { case WM_NOTIFICATION_CLICKED: MOTOR_1_Forward(); break; case WM_NOTIFICATION_RELEASED: MOTOR_1_Stop(); break; } break; case ID_BUTTON_M1CC: switch(NCode) { case WM_NOTIFICATION_CLICKED: MOTOR_1_Reverse(); break; case WM_NOTIFICATION_RELEASED: MOTOR_1_Stop(); break; } break; case ID_BUTTON_M2C: switch(NCode) { case WM_NOTIFICATION_CLICKED: MOTOR_2_Forward(); break; case WM_NOTIFICATION_RELEASED: MOTOR_2_Stop(); break; } break; case ID_BUTTON_M2CC: switch(NCode) { case WM_NOTIFICATION_CLICKED: MOTOR_2_Reverse(); break; case WM_NOTIFICATION_RELEASED: MOTOR_2_Stop(); break; } break; } break; default: WM_DefaultProc(pMsg); break; } }
/********************************************************************* * * _cbPort */ static void _cbPort (WM_MESSAGE * pMsg) { WM_HWIN hItem; int NCode; int Id; char str[10] = {0}; switch(pMsg->MsgId) { case WM_INIT_DIALOG: // //Intialization of Text // hItem = WM_GetDialogItem(pMsg->hWin, ID_TEXT_P1); TEXT_SetFont(hItem, &GUI_FontSongTi12); strcpy(str, StringHZ[11]); strcat(str, "1"); TEXT_SetText(hItem, str); hItem = WM_GetDialogItem(pMsg->hWin, ID_TEXT_P2); TEXT_SetFont(hItem, &GUI_FontSongTi12); strcpy(str, StringHZ[11]); strcat(str, "2"); TEXT_SetText(hItem, str); hItem = WM_GetDialogItem(pMsg->hWin, ID_TEXT_P3); TEXT_SetFont(hItem, &GUI_FontSongTi12); strcpy(str, StringHZ[11]); strcat(str, "3"); TEXT_SetText(hItem, str); hItem = WM_GetDialogItem(pMsg->hWin, ID_TEXT_P4); TEXT_SetFont(hItem, &GUI_FontSongTi12); strcpy(str, StringHZ[11]); strcat(str, "4"); TEXT_SetText(hItem, str); // // Initialization of Button // hItem = WM_GetDialogItem(pMsg->hWin, ID_BUTTON_P1_ON); BUTTON_SetFont(hItem, &GUI_FontSongTi12); BUTTON_SetText(hItem, StringHZ[9]); hItem = WM_GetDialogItem(pMsg->hWin, ID_BUTTON_P1_OFF); BUTTON_SetFont(hItem, &GUI_FontSongTi12); BUTTON_SetText(hItem, StringHZ[10]); hItem = WM_GetDialogItem(pMsg->hWin, ID_BUTTON_P2_ON); BUTTON_SetFont(hItem, &GUI_FontSongTi12); BUTTON_SetText(hItem, StringHZ[9]); hItem = WM_GetDialogItem(pMsg->hWin, ID_BUTTON_P2_OFF); BUTTON_SetFont(hItem, &GUI_FontSongTi12); BUTTON_SetText(hItem, StringHZ[10]); hItem = WM_GetDialogItem(pMsg->hWin, ID_BUTTON_P3_ON); BUTTON_SetFont(hItem, &GUI_FontSongTi12); BUTTON_SetText(hItem, StringHZ[9]); hItem = WM_GetDialogItem(pMsg->hWin, ID_BUTTON_P3_OFF); BUTTON_SetFont(hItem, &GUI_FontSongTi12); BUTTON_SetText(hItem, StringHZ[10]); hItem = WM_GetDialogItem(pMsg->hWin, ID_BUTTON_P4_ON); BUTTON_SetFont(hItem, &GUI_FontSongTi12); BUTTON_SetText(hItem, StringHZ[9]); hItem = WM_GetDialogItem(pMsg->hWin, ID_BUTTON_P4_OFF); BUTTON_SetFont(hItem, &GUI_FontSongTi12); BUTTON_SetText(hItem, StringHZ[10]); break; case WM_NOTIFY_PARENT: Id = WM_GetId(pMsg->hWinSrc); NCode = pMsg->Data.v; switch(Id) { case ID_BUTTON_P1_ON: switch(NCode) { case WM_NOTIFICATION_CLICKED: break; case WM_NOTIFICATION_RELEASED: LED_Mannul(1,ON); break; } break; case ID_BUTTON_P1_OFF: switch(NCode) { case WM_NOTIFICATION_CLICKED: break; case WM_NOTIFICATION_RELEASED: LED_Mannul(1,OFF); break; } break; case ID_BUTTON_P2_ON: switch(NCode) { case WM_NOTIFICATION_CLICKED: break; case WM_NOTIFICATION_RELEASED: LED_Mannul(2,ON); break; } break; case ID_BUTTON_P2_OFF: switch(NCode) { case WM_NOTIFICATION_CLICKED: break; case WM_NOTIFICATION_RELEASED: LED_Mannul(2,OFF); break; } break; case ID_BUTTON_P3_ON: switch(NCode) { case WM_NOTIFICATION_CLICKED: break; case WM_NOTIFICATION_RELEASED: LED_Mannul(3,ON); break; } break; case ID_BUTTON_P3_OFF: switch(NCode) { case WM_NOTIFICATION_CLICKED: break; case WM_NOTIFICATION_RELEASED: LED_Mannul(3,OFF); break; } break; case ID_BUTTON_P4_ON: switch(NCode) { case WM_NOTIFICATION_CLICKED: break; case WM_NOTIFICATION_RELEASED: LED_Mannul(4,ON); break; } break; case ID_BUTTON_P4_OFF: switch(NCode) { case WM_NOTIFICATION_CLICKED: break; case WM_NOTIFICATION_RELEASED: LED_Mannul(4,OFF); break; } break; } break; default: WM_DefaultProc(pMsg); break; } }
/********************************************************************* * * _cbDialog */ static void _cbDialog(WM_MESSAGE * pMsg) { WM_HWIN hItem; int NCode; int Id; // USER START (Optionally insert additional variables) // USER END switch (pMsg->MsgId) { case WM_INIT_DIALOG: // // Initialization of 'START' // hItem = WM_GetDialogItem(pMsg->hWin, ID_BUTTON_0); BUTTON_SetFont(hItem, GUI_FONT_24_ASCII); // // Initialization of 'Msg Edit' // hItem = WM_GetDialogItem(pMsg->hWin, ID_EDIT_0); EDIT_SetText(hItem, "123"); EDIT_SetFont(hItem, GUI_FONT_20_ASCII); // // Initialization of 'cbxWheel Test' // hItem = WM_GetDialogItem(pMsg->hWin, ID_CHECKBOX_0); CHECKBOX_SetText(hItem, "Wheel Test"); CHECKBOX_SetFont(hItem, GUI_FONT_16B_ASCII); // // Initialization of 'cbxSBrush Test' // hItem = WM_GetDialogItem(pMsg->hWin, ID_CHECKBOX_1); CHECKBOX_SetText(hItem, "SBrush Test"); CHECKBOX_SetFont(hItem, GUI_FONT_16B_ASCII); // // Initialization of 'cbxMBrush Test' // hItem = WM_GetDialogItem(pMsg->hWin, ID_CHECKBOX_2); CHECKBOX_SetText(hItem, "MBrush Test"); CHECKBOX_SetFont(hItem, GUI_FONT_16B_ASCII); // // Initialization of 'cbxFan Test' // hItem = WM_GetDialogItem(pMsg->hWin, ID_CHECKBOX_3); CHECKBOX_SetText(hItem, "Fan Test"); CHECKBOX_SetFont(hItem, GUI_FONT_16B_ASCII); // // Initialization of 'cbxIFRD Test' // hItem = WM_GetDialogItem(pMsg->hWin, ID_CHECKBOX_4); CHECKBOX_SetText(hItem, "IFRD Test"); CHECKBOX_SetFont(hItem, GUI_FONT_16B_ASCII); // // Initialization of 'cbxCollision Test' // hItem = WM_GetDialogItem(pMsg->hWin, ID_CHECKBOX_5); CHECKBOX_SetText(hItem, "Collision Test"); CHECKBOX_SetFont(hItem, GUI_FONT_16B_ASCII); // // Initialization of 'cbxWheelFloat Test' // hItem = WM_GetDialogItem(pMsg->hWin, ID_CHECKBOX_6); CHECKBOX_SetText(hItem, "WheelFloat Test"); CHECKBOX_SetFont(hItem, GUI_FONT_16B_ASCII); // // Initialization of 'cbxAshTray Test' // hItem = WM_GetDialogItem(pMsg->hWin, ID_CHECKBOX_7); CHECKBOX_SetText(hItem, "AshTray Test"); CHECKBOX_SetFont(hItem, GUI_FONT_16B_ASCII); // // Initialization of 'cbxUniWheel Test' // hItem = WM_GetDialogItem(pMsg->hWin, ID_CHECKBOX_8); CHECKBOX_SetText(hItem, "UniWheel Test"); CHECKBOX_SetFont(hItem, GUI_FONT_16B_ASCII); // // Initialization of 'cbxKey Test' // hItem = WM_GetDialogItem(pMsg->hWin, ID_CHECKBOX_9); CHECKBOX_SetText(hItem, "Key Test"); CHECKBOX_SetFont(hItem, GUI_FONT_16B_ASCII); // // Initialization of 'cbxIRDA Test' // hItem = WM_GetDialogItem(pMsg->hWin, ID_CHECKBOX_10); CHECKBOX_SetText(hItem, "IRDA Test"); CHECKBOX_SetFont(hItem, GUI_FONT_16B_ASCII); // // Initialization of 'cbxBuzzer Test' // hItem = WM_GetDialogItem(pMsg->hWin, ID_CHECKBOX_11); CHECKBOX_SetText(hItem, "Buzzer Test"); CHECKBOX_SetFont(hItem, GUI_FONT_16B_ASCII); // // Initialization of 'STOP' // hItem = WM_GetDialogItem(pMsg->hWin, ID_BUTTON_1); BUTTON_SetFont(hItem, GUI_FONT_24_ASCII); // USER START (Optionally insert additional code for further widget initialization) // USER END break; case WM_NOTIFY_PARENT: Id = WM_GetId(pMsg->hWinSrc); NCode = pMsg->Data.v; switch(Id) { case ID_BUTTON_0: // Notifications sent by 'START' switch(NCode) { case WM_NOTIFICATION_CLICKED: // USER START (Optionally insert code for reacting on notification message) // USER END break; case WM_NOTIFICATION_RELEASED: // USER START (Optionally insert code for reacting on notification message) // USER END break; // USER START (Optionally insert additional code for further notification handling) // USER END } break; case ID_EDIT_0: // Notifications sent by 'Msg Edit' switch(NCode) { case WM_NOTIFICATION_CLICKED: // USER START (Optionally insert code for reacting on notification message) // USER END break; case WM_NOTIFICATION_RELEASED: // USER START (Optionally insert code for reacting on notification message) // USER END break; case WM_NOTIFICATION_VALUE_CHANGED: // USER START (Optionally insert code for reacting on notification message) // USER END break; // USER START (Optionally insert additional code for further notification handling) // USER END } break; case ID_CHECKBOX_0: // Notifications sent by 'cbxWheel Test' switch(NCode) { case WM_NOTIFICATION_CLICKED: // USER START (Optionally insert code for reacting on notification message) // USER END break; case WM_NOTIFICATION_RELEASED: // USER START (Optionally insert code for reacting on notification message) // USER END break; case WM_NOTIFICATION_VALUE_CHANGED: // USER START (Optionally insert code for reacting on notification message) // USER END break; // USER START (Optionally insert additional code for further notification handling) // USER END } break; case ID_CHECKBOX_1: // Notifications sent by 'cbxSBrush Test' switch(NCode) { case WM_NOTIFICATION_CLICKED: // USER START (Optionally insert code for reacting on notification message) // USER END break; case WM_NOTIFICATION_RELEASED: // USER START (Optionally insert code for reacting on notification message) // USER END break; case WM_NOTIFICATION_VALUE_CHANGED: // USER START (Optionally insert code for reacting on notification message) // USER END break; // USER START (Optionally insert additional code for further notification handling) // USER END } break; case ID_CHECKBOX_2: // Notifications sent by 'cbxMBrush Test' switch(NCode) { case WM_NOTIFICATION_CLICKED: // USER START (Optionally insert code for reacting on notification message) // USER END break; case WM_NOTIFICATION_RELEASED: // USER START (Optionally insert code for reacting on notification message) // USER END break; case WM_NOTIFICATION_VALUE_CHANGED: // USER START (Optionally insert code for reacting on notification message) // USER END break; // USER START (Optionally insert additional code for further notification handling) // USER END } break; case ID_CHECKBOX_3: // Notifications sent by 'cbxFan Test' switch(NCode) { case WM_NOTIFICATION_CLICKED: // USER START (Optionally insert code for reacting on notification message) // USER END break; case WM_NOTIFICATION_RELEASED: // USER START (Optionally insert code for reacting on notification message) // USER END break; case WM_NOTIFICATION_VALUE_CHANGED: // USER START (Optionally insert code for reacting on notification message) // USER END break; // USER START (Optionally insert additional code for further notification handling) // USER END } break; case ID_CHECKBOX_4: // Notifications sent by 'cbxIFRD Test' switch(NCode) { case WM_NOTIFICATION_CLICKED: // USER START (Optionally insert code for reacting on notification message) // USER END break; case WM_NOTIFICATION_RELEASED: // USER START (Optionally insert code for reacting on notification message) // USER END break; case WM_NOTIFICATION_VALUE_CHANGED: // USER START (Optionally insert code for reacting on notification message) // USER END break; // USER START (Optionally insert additional code for further notification handling) // USER END } break; case ID_CHECKBOX_5: // Notifications sent by 'cbxCollision Test' switch(NCode) { case WM_NOTIFICATION_CLICKED: // USER START (Optionally insert code for reacting on notification message) // USER END break; case WM_NOTIFICATION_RELEASED: // USER START (Optionally insert code for reacting on notification message) // USER END break; case WM_NOTIFICATION_VALUE_CHANGED: // USER START (Optionally insert code for reacting on notification message) // USER END break; // USER START (Optionally insert additional code for further notification handling) // USER END } break; case ID_CHECKBOX_6: // Notifications sent by 'cbxWheelFloat Test' switch(NCode) { case WM_NOTIFICATION_CLICKED: // USER START (Optionally insert code for reacting on notification message) // USER END break; case WM_NOTIFICATION_RELEASED: // USER START (Optionally insert code for reacting on notification message) // USER END break; case WM_NOTIFICATION_VALUE_CHANGED: // USER START (Optionally insert code for reacting on notification message) // USER END break; // USER START (Optionally insert additional code for further notification handling) // USER END } break; case ID_CHECKBOX_7: // Notifications sent by 'cbxAshTray Test' switch(NCode) { case WM_NOTIFICATION_CLICKED: // USER START (Optionally insert code for reacting on notification message) // USER END break; case WM_NOTIFICATION_RELEASED: // USER START (Optionally insert code for reacting on notification message) // USER END break; case WM_NOTIFICATION_VALUE_CHANGED: // USER START (Optionally insert code for reacting on notification message) // USER END break; // USER START (Optionally insert additional code for further notification handling) // USER END } break; case ID_CHECKBOX_8: // Notifications sent by 'cbxUniWheel Test' switch(NCode) { case WM_NOTIFICATION_CLICKED: // USER START (Optionally insert code for reacting on notification message) // USER END break; case WM_NOTIFICATION_RELEASED: // USER START (Optionally insert code for reacting on notification message) // USER END break; case WM_NOTIFICATION_VALUE_CHANGED: // USER START (Optionally insert code for reacting on notification message) // USER END break; // USER START (Optionally insert additional code for further notification handling) // USER END } break; case ID_CHECKBOX_9: // Notifications sent by 'cbxKey Test' switch(NCode) { case WM_NOTIFICATION_CLICKED: // USER START (Optionally insert code for reacting on notification message) // USER END break; case WM_NOTIFICATION_RELEASED: // USER START (Optionally insert code for reacting on notification message) // USER END break; case WM_NOTIFICATION_VALUE_CHANGED: // USER START (Optionally insert code for reacting on notification message) // USER END break; // USER START (Optionally insert additional code for further notification handling) // USER END } break; case ID_CHECKBOX_10: // Notifications sent by 'cbxIRDA Test' switch(NCode) { case WM_NOTIFICATION_CLICKED: // USER START (Optionally insert code for reacting on notification message) // USER END break; case WM_NOTIFICATION_RELEASED: // USER START (Optionally insert code for reacting on notification message) // USER END break; case WM_NOTIFICATION_VALUE_CHANGED: // USER START (Optionally insert code for reacting on notification message) // USER END break; // USER START (Optionally insert additional code for further notification handling) // USER END } break; case ID_CHECKBOX_11: // Notifications sent by 'cbxBuzzer Test' switch(NCode) { case WM_NOTIFICATION_CLICKED: // USER START (Optionally insert code for reacting on notification message) // USER END break; case WM_NOTIFICATION_RELEASED: // USER START (Optionally insert code for reacting on notification message) // USER END break; case WM_NOTIFICATION_VALUE_CHANGED: // USER START (Optionally insert code for reacting on notification message) // USER END break; // USER START (Optionally insert additional code for further notification handling) // USER END } break; case ID_BUTTON_1: // Notifications sent by 'STOP' switch(NCode) { case WM_NOTIFICATION_CLICKED: // USER START (Optionally insert code for reacting on notification message) // USER END break; case WM_NOTIFICATION_RELEASED: // USER START (Optionally insert code for reacting on notification message) // USER END break; // USER START (Optionally insert additional code for further notification handling) // USER END } break; // USER START (Optionally insert additional code for further Ids) // USER END } break; // USER START (Optionally insert additional message handling) // USER END default: WM_DefaultProc(pMsg); break; } }