Ejemplo n.º 1
0
/**
  * @brief  Show Message Box
  * @param  hWin:   pointer to the parent handle
  * @param  pTitle: pointer to the title
  * @param  pText:  pointer to the text
  * @retval int 
  */ 
static int _ShowMessageBox(WM_HWIN hWin, const char* pTitle, const char* pText, int YesNo)
{
  WM_HWIN hFrame, hClient, hBut;
  int r = 0;
  /* Create frame win */
  hFrame = FRAMEWIN_CreateEx(25, 82, 190, 90, hWin, WM_CF_SHOW, FRAMEWIN_CF_MOVEABLE, 0, pTitle, &_cbMessageBox);
  FRAMEWIN_SetClientColor   (hFrame, GUI_WHITE);
  FRAMEWIN_SetFont          (hFrame, &GUI_Font16B_ASCII);
  FRAMEWIN_SetTextAlign     (hFrame, GUI_TA_HCENTER);
  /* Create dialog items */
  hClient = WM_GetClientWindow(hFrame);
  TEXT_CreateEx(10, 7, 170, 30, hClient, WM_CF_SHOW, GUI_TA_HCENTER, 0, pText);
  
  if (YesNo) {
    hBut = BUTTON_CreateEx(97, 45, 55, 18, hClient, WM_CF_SHOW, 0, GUI_ID_CANCEL);
    BUTTON_SetText        (hBut, "No");
    hBut = BUTTON_CreateEx(32, 45, 55, 18, hClient, WM_CF_SHOW, 0, GUI_ID_OK);
    BUTTON_SetText        (hBut, "Yes");
  } else {
    hBut = BUTTON_CreateEx(64, 45, 55, 18, hClient, WM_CF_SHOW, 0, GUI_ID_OK);
    BUTTON_SetText        (hBut, "Ok");
  }
  
  WM_SetFocus(hFrame);  
  WM_MakeModal(hFrame);
  r = GUI_ExecCreatedDialog(hFrame);  
  return r;
}
Ejemplo n.º 2
0
/*********************************************************************
*
*       MainTask
*/
void MainTask(void) {
  FRAMEWIN_Handle hWinVideo;
  BUTTON_Handle hBut;
  GUI_Init();
  WM_SetCallback(WM_HBKWIN, _cbBkWin);
  /* Create buttons */
  hBut = BUTTON_CreateEx(240,  5, 75, 18, WM_HBKWIN, WM_CF_SHOW, 0, GUI_ID_BUTTON0);
  BUTTON_SetText(hBut, "Create win");
  hBut = BUTTON_CreateEx(240, 25, 75, 18, WM_HBKWIN, WM_CF_SHOW, 0, GUI_ID_BUTTON1);
  BUTTON_SetText(hBut, "Delete win");
  hBut = BUTTON_CreateEx(240, 45, 75, 18, WM_HBKWIN, WM_CF_SHOW, 0, GUI_ID_BUTTON2);
  BUTTON_SetText(hBut, "Show win");
  hBut = BUTTON_CreateEx(240, 65, 75, 18, WM_HBKWIN, WM_CF_SHOW, 0, GUI_ID_BUTTON3);
  BUTTON_SetText(hBut, "Hide win");
  /* Create framewin video */
  hWinVideo = FRAMEWIN_CreateEx(5, 5, 170, 120, 0, WM_CF_SHOW, FRAMEWIN_CF_MOVEABLE, 0, "Video window", _cbFrameWinVideo);
  FRAMEWIN_SetClientColor(hWinVideo, GUI_INVALID_COLOR);
  /* Create test windows */
  _CreateWindow();
  _CreateWindow();
  _CreateWindow();
  while (1) {
    GUI_Delay(1000);
  }
}
/*********************************************************************
*
*       _ShowDemo
*/
static void _ShowDemo(void) {
  WM_HWIN hWin0;
  WM_HWIN hWin1;
  WM_HWIN hWin2;
  WM_HWIN hFrame1;
  WM_HWIN hFrame2;
  WM_HWIN hClient1;
  WM_HWIN hClient2;

  WM_SetCallback(WM_HBKWIN, _cbBkWin);
  hFrame1  = FRAMEWIN_CreateEx( 10, 30, 140, 140, 0, WM_CF_SHOW, FRAMEWIN_CF_MOVEABLE, 0, "Early Clipping", _cbFrameWin1);
  hFrame2  = FRAMEWIN_CreateEx(170, 30, 140, 140, 0, WM_CF_SHOW, FRAMEWIN_CF_MOVEABLE, 0, "Late Clipping", _cbFrameWin2);
  hClient1 = WM_GetClientWindow(hFrame1);
  hClient2 = WM_GetClientWindow(hFrame2);
  _hWin1   = WM_CreateWindowAsChild(0, 0, WM_GetWindowSizeX(hClient1), WM_GetWindowSizeY(hClient1), hClient1, WM_CF_SHOW, _cbFrameWin1, 0);
  _hWin2   = WM_CreateWindowAsChild(0, 0, WM_GetWindowSizeX(hClient2), WM_GetWindowSizeY(hClient2), hClient2, WM_CF_SHOW | WM_CF_LATE_CLIP, _cbFrameWin2, 0);
  _hBut1   = BUTTON_CreateEx( 10, 210, 140, 20, 0, WM_CF_SHOW, 0, 1);
  _hBut2   = BUTTON_CreateEx(170, 210, 140, 20, 0, WM_CF_SHOW, 0, 2);
  hWin0    = FRAMEWIN_CreateEx( 60,  80, 40, 40, 0, WM_CF_SHOW | WM_CF_STAYONTOP, FRAMEWIN_CF_MOVEABLE, 0, "Top 0", _cbTop);
  hWin1    = FRAMEWIN_CreateEx(220,  80, 40, 40, 0, WM_CF_SHOW | WM_CF_STAYONTOP, FRAMEWIN_CF_MOVEABLE, 0, "Top 1", _cbTop);
  hWin2    = FRAMEWIN_CreateEx(140, 170, 40, 40, 0, WM_CF_SHOW | WM_CF_STAYONTOP, FRAMEWIN_CF_MOVEABLE, 0, "Top 2", _cbTop);
  FRAMEWIN_SetResizeable(hWin0, 1);
  FRAMEWIN_SetResizeable(hWin1, 1);
  FRAMEWIN_SetResizeable(hWin2, 1);
  BUTTON_SetText(_hBut1, "Invalidate");
  BUTTON_SetText(_hBut2, "Reset counters");
  while(1) {
    GUI_Delay(50);
  }
}
Ejemplo n.º 4
0
/**
  * @brief  Initializes the menu.
  * @param  None.
  * @retval None.
  */
void k_InitMenu(void) 
{

  WM_HWIN  hItem;
  uint8_t i = 0;
  GUI_SetLayerVisEx (0, 0);
  GUI_DrawBitmap(&bmbackground, 0,0);     
  
  settings.d32 = k_BkupRestoreParameter(CALIBRATION_GENERAL_SETTINGS_BKP);
  
  GUI_SetLayerVisEx (0, 1);
  GUI_SelectLayer(1);
  GUI_Clear();

  WM_SetCallback(WM_HBKWIN, _cbBk);
  
  WM_CreateWindowAsChild(0,
                         0,
                         LCD_GetXSize(),
                         25,
                         WM_HBKWIN, 
                         WM_CF_SHOW | WM_CF_HASTRANS , 
                         _cbStatus, 
                         0);
     
  hIcon = ICONVIEW_CreateEx(0, 
                            26, 
                            LCD_GetXSize(), 
                            LCD_GetYSize()- 26, 
                            WM_HBKWIN, 
                            WM_CF_SHOW | WM_CF_HASTRANS | WM_CF_BGND ,
                            ICONVIEW_CF_AUTOSCROLLBAR_V,
                            ID_ICONVIEW_MENU, 
                            112, 
                            105);
  
  ICONVIEW_SetFont(hIcon, &GUI_Font13B_ASCII);
  
  ICONVIEW_SetBkColor(hIcon, ICONVIEW_CI_SEL, GUI_LIGHTBLUE |GUI_TRANSPARENT);
  
  ICONVIEW_SetSpace(hIcon, GUI_COORD_Y, 10);
  
  ICONVIEW_SetFrame(hIcon, GUI_COORD_Y, 10);
    
  for (i = 0; i < k_ModuleGetNumber(); i++)
  {
    ICONVIEW_AddBitmapItem(hIcon,module_prop[i].module->icon, (char *)module_prop[i].module->name);
  }

  if(settings.b.enable_sprite)
  {
    _ShowSprites();
  }
  
  hItem = BUTTON_CreateEx(0, 0, 40, 23, WM_HBKWIN, WM_CF_SHOW, 0, ID_BUTTON_BKGND);
  WM_SetCallback(hItem, _cbButton);
}
Ejemplo n.º 5
0
/*********************************************************************
*
*       _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;
}
Ejemplo n.º 6
0
/**
  * 函 数 名: _cbSysInfo(WM_MESSAGE* pMsg) 
  * 描    述: 显示系统信息
  * 参    数: pMsg
  * 返 回 值: 无
  */
void _cbSysInfo(WM_MESSAGE* pMsg)
{
	BUTTON_Handle ReurnButton;
	WM_HWIN hWin = pMsg->hWin;
	switch (pMsg->MsgId) 
	{
		case WM_CREATE:
            /* 设置聚焦*/
			WM_SetFocus(hWin);
			/* 创建返回按键按钮 */
			ReurnButton = BUTTON_CreateEx(118,174,94, 52,  hWin, WM_CF_SHOW, 0, SYS_INFO_BUTTON_RETURN);
			BUTTON_SetBitmapEx(ReurnButton,BUTTON_BI_UNPRESSED, &bmSys_return_xg, 0 ,0);
            BUTTON_SetBitmapEx(ReurnButton,BUTTON_BI_PRESSED, &bmSys_return, 0 ,0);
			break;
		case WM_KEY:
			/* 按下某个键后发送到当前包含焦点的窗口*/
            switch (((WM_KEY_INFO*)(pMsg->Data.p))->Key) 
            { 
				case GUI_KEY_ESCAPE:
                    GUI_EndDialog(hWin, 1);
                    break;
				case GUI_KEY_TAB:
					WM_SetFocusOnNextChild(hWin);
					break;
            }
            break;
		case WM_PAINT:
			GUI_SetBkColor(BK_COLOR_2);
			GUI_Clear();
            GUI_UC_SetEncodeNone();
			GUI_SetFont(&GUI_FontHZ16);
            GUI_DispStringAt("MODEL:7H3DFDM-FW ",30,20);
            GUI_DispStringAt("VERSION: V0.01",30,50);
            GUI_DispStringAt("SYSINFO: IN TEST  ",30,80);
		    GUI_DispStringAt(__DATE__ " " __TIME__,50,110);
            GUI_UC_SetEncodeUTF8();
			//_ShowBMPEx("1.bmp");
			break;
		case WM_NOTIFY_PARENT:
			if (pMsg->Data.v == WM_NOTIFICATION_RELEASED) 
			{
				int Id = WM_GetId(pMsg->hWinSrc);
				switch (Id) 
				{
					case SYS_INFO_BUTTON_RETURN:
						_DeleteFrame();
						_CreateFrame(&_cbSysSet);						
						break;
				}
			}
			break;
		default:
		WM_DefaultProc(pMsg);
	}
}
/**
  * @brief  Initializes the menu.
  * @param  None.
  * @retval None
  */
void k_InitMenu(void) 
{

  WM_HWIN  hItem;
  uint8_t i = 0;
  
  
  settings.d32 = k_BkupRestoreParameter(CALIBRATION_GENERAL_SETTINGS_BKP);

  WM_SetCallback(WM_HBKWIN, _cbBk);
  
  hStatusWin = WM_CreateWindowAsChild(0,
                         0,
                         LCD_GetXSize(),
                         25,
                         WM_HBKWIN, 
                         WM_CF_SHOW | WM_CF_LATE_CLIP , 
                         _cbStatus, 
                         0);
     
  hIcon = ICONVIEW_CreateEx(0, 
                            26, 
                            LCD_GetXSize(), 
                            LCD_GetYSize()- 26, 
                            WM_HBKWIN, 
                            WM_CF_SHOW | WM_CF_HASTRANS,
                            ICONVIEW_CF_AUTOSCROLLBAR_V,
                            ID_ICONVIEW_MENU, 
                            92, 
                            90);
  
    
  ICONVIEW_SetFont(hIcon, &GUI_Font13B_ASCII);
  

  
  ICONVIEW_SetTextColor(hIcon, ICONVIEW_CI_UNSEL, GUI_BLUE);
  ICONVIEW_SetTextColor(hIcon, ICONVIEW_CI_SEL, GUI_BLUE);
  
    ICONVIEW_SetBkColor(hIcon, ICONVIEW_CI_SEL, GUI_LIGHTBLUE |GUI_TRANSPARENT);
  
  ICONVIEW_SetSpace(hIcon, GUI_COORD_Y, 10);
  
  ICONVIEW_SetFrame(hIcon, GUI_COORD_Y, 10);
          
  for (i = 0; i < k_ModuleGetNumber(); i++)
  {  
    ICONVIEW_AddBitmapItem(hIcon,module_prop[i].module->icon, (char *)module_prop[i].module->name); 
  }

  hItem = BUTTON_CreateEx(0, 0, 40, 23, WM_GetDesktopWindowEx(0), WM_CF_SHOW, 0, ID_BUTTON_BKGND);
  WM_SetCallback(hItem, _cbButton);

}
/*********************************************************************
*
*       _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;
}
Ejemplo n.º 9
0
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]);
}
Ejemplo n.º 10
0
/**
  * 函 数 名: _cbChooseFrame(WM_MESSAGE* pMsg) 
  * 描    述: 选择对话框
  * 参    数: pMsg
  * 返 回 值: 无
  */
void _cbChooseFrame(WM_MESSAGE* pMsg)
{
	BUTTON_Handle YesButton,NoButton,CancelButton;
	WM_HWIN hWin = pMsg->hWin;
	switch (pMsg->MsgId) 
	{
		case WM_CREATE:
            /* 设置聚焦*/
			WM_SetFocus(hWin);
			/* 创建返回按键按钮 */
			YesButton = BUTTON_CreateEx(80,80,30, 15,  hWin, WM_CF_SHOW, 0, SYS_INFO_BUTTON_RETURN);
			//BUTTON_SetBitmapEx(YesButton,BUTTON_BI_UNPRESSED, &bmSys_return_xg, 0 ,0);
			break;
		case WM_KEY:
			/* 按下某个键后发送到当前包含焦点的窗口*/
            switch (((WM_KEY_INFO*)(pMsg->Data.p))->Key) 
            { 
				case GUI_KEY_ESCAPE:
                    GUI_EndDialog(hWin, 1);
                    break;
				case GUI_KEY_TAB:
					WM_SetFocusOnNextChild(hWin);
					break;
            }
            break;
		case WM_PAINT:
			GUI_SetBkColor(BK_COLOR_2);
			GUI_Clear();
//			GUI_SetFont(&GUI_FontHZ16);
//          GUI_DispStringAt("firmware version : V0.01",30,30);
//          GUI_DispStringAt("Compile time: ",30,80);
//		    GUI_DispStringAt(STRING_VERSION_CONFIG_H,50,130);
			//_ShowBMPEx("1.bmp");
			break;
		case WM_NOTIFY_PARENT:
			if (pMsg->Data.v == WM_NOTIFICATION_RELEASED) 
			{
				int Id = WM_GetId(pMsg->hWinSrc);
				switch (Id) 
				{
					case SYS_INFO_BUTTON_RETURN:
						_DeleteFrame();
						_CreateFrame(&_cbSysSet);						
						break;
				}
			}
			break;
		default:
		WM_DefaultProc(pMsg);
	}
}
Ejemplo n.º 11
0
/*********************************************************************
*
*       MainTask
*/
void MainTask(void) {
  FRAMEWIN_Handle hWinVideo;
  BUTTON_Handle   hBut;
  WM_HWIN         hText;

  GUI_Init();
  WM_SetCallback(WM_HBKWIN, _cbBkWin);
  hText = TEXT_CreateEx(240,  85, 80, 26, WM_HBKWIN, WM_CF_SHOW, 0, GUI_ID_TEXT0, "The client\nwindow is");
  TEXT_SetTextColor(hText, GUI_WHITE);
  hText = TEXT_CreateEx(240, 111, 80, 26, WM_HBKWIN, WM_CF_SHOW, 0, GUI_ID_TEXT1, NULL);
  TEXT_SetTextColor(hText, GUI_WHITE);
  //
  // Create buttons
  //
  hBut = BUTTON_CreateEx(240,  5, 75, 18, WM_HBKWIN, WM_CF_SHOW, 0, GUI_ID_BUTTON0);
  BUTTON_SetText(hBut, "Create win");
  hBut = BUTTON_CreateEx(240, 25, 75, 18, WM_HBKWIN, WM_CF_SHOW, 0, GUI_ID_BUTTON1);
  BUTTON_SetText(hBut, "Delete win");
  hBut = BUTTON_CreateEx(240, 45, 75, 18, WM_HBKWIN, WM_CF_SHOW, 0, GUI_ID_BUTTON2);
  BUTTON_SetText(hBut, "Show win");
  hBut = BUTTON_CreateEx(240, 65, 75, 18, WM_HBKWIN, WM_CF_SHOW, 0, GUI_ID_BUTTON3);
  BUTTON_SetText(hBut, "Hide win");
  //
  // Create framewin video
  //  
  hWinVideo = FRAMEWIN_CreateEx(5, 5, 170, 120, 0, WM_CF_SHOW, FRAMEWIN_CF_MOVEABLE, 0, "Video window", _cbFrameWinVideo);
  FRAMEWIN_SetClientColor(hWinVideo, GUI_INVALID_COLOR);
  //
  // Create test windows
  //
  _CreateWindow();
  _CreateWindow();
  _CreateWindow();
  while (1) {
    GUI_Delay(1000);
  }
}
Ejemplo n.º 12
0
/**
  * @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;
  }
}
Ejemplo n.º 13
0
/**
  * @brief  Callback routine of the main dialog
  * @param  pMsg: pointer to data structure of type WM_MESSAGE
  * @retval None
  */
static void _cbDialog(WM_MESSAGE * pMsg) {
  WM_HWIN hItem;
  int Id, NCode;
    
  switch (pMsg->MsgId) {
  case WM_INIT_DIALOG:
         
    hItem = WM_GetDialogItem(pMsg->hWin, ID_EQUAL);
    IMAGE_SetBitmap(hItem, &bmframe0);
    
    hItem = BUTTON_CreateEx(700, 0, 100, 100, pMsg->hWin, WM_CF_SHOW, 0, ID_BUTTON_EXIT);
    WM_SetCallback(hItem, _cbButton_exit);

    hItem = BUTTON_CreateEx(540, 350, 80, 80, pMsg->hWin, WM_CF_SHOW, 0, ID_RECORD_PAUSE);
    WM_SetCallback(hItem, _cbButton_pause);     
    
    hItem = BUTTON_CreateEx(320, 350, 80, 80, pMsg->hWin, WM_CF_SHOW, 0, ID_RECORD_STOP);
    WM_SetCallback(hItem, _cbButton_stop);    
    
    hItem = BUTTON_CreateEx(430, 350, 80, 80, pMsg->hWin, WM_CF_SHOW, 0, ID_RECORD_REC_CANCEL_PLAY);
    WM_SetCallback(hItem, _cbButton_record); 
    
    hItem = WM_GetDialogItem(pMsg->hWin, ID_FILENAMECAPTION);
    TEXT_SetFont(hItem, &GUI_FontLubalGraph24B);

    hItem = WM_GetDialogItem(pMsg->hWin, ID_FILENAME);
    TEXT_SetFont(hItem, &GUI_FontLubalGraph24B);
    
    hItem = WM_GetDialogItem(pMsg->hWin, ID_ELAPSED_TIME);
    TEXT_SetFont(hItem, &GUI_FontLubalGraph20);
    
    if((module_prop[k_ModuleGetIndex(&audio_player_board)].in_use) ||
      (k_StorageGetStatus(USB_DISK_UNIT) == 0))
    { 
      
      if(module_prop[k_ModuleGetIndex(&audio_player_board)].in_use)
      {
        
        hItem = WM_GetDialogItem(pMsg->hWin, ID_FILENAMECAPTION);
        TEXT_SetText(hItem, ">>>");   
        hItem = WM_GetDialogItem(pMsg->hWin, ID_FILENAME);
        TEXT_SetText(hItem, "Audio IF busy");
      }
      
      if (k_StorageGetStatus(USB_DISK_UNIT) == 0)
      {
        hItem = WM_GetDialogItem(pMsg->hWin, ID_FILENAMECAPTION);
        TEXT_SetText(hItem, ">>>");   
        hItem = WM_GetDialogItem(pMsg->hWin, ID_FILENAME);
        TEXT_SetText(hItem, "USB NOT ready");
      }

      RecorderMode = RECORDER_MODE_REC_DISABLED;
        
      hItem = WM_GetDialogItem(pMsg->hWin, ID_RECORD_STOP);
      WM_DisableWindow(hItem);
      
      hItem = WM_GetDialogItem(pMsg->hWin, ID_RECORD_REC_CANCEL_PLAY);
      WM_DisableWindow(hItem);    
      
      hItem = WM_GetDialogItem(pMsg->hWin, ID_RECORD_PAUSE);
      WM_DisableWindow(hItem);         
        
    }
    else
    {
      RecorderMode = RECORDER_MODE_REC_IDLE;
      WM_CreateWindowAsChild(0,
                             100,
                             10,
                             10,
                             pMsg->hWin, 
                             WM_CF_SHOW | WM_CF_HASTRANS,
                             _cbAudioProcess, 
                             0);
    }    
    
    
    WM_CreateWindowAsChild(799, 460, 1, 1, pMsg->hWin, WM_CF_SHOW | WM_CF_HASTRANS, _cbMediaConnection , 0); 

    break;     
    
  case WM_PAINT:
    GUI_DrawBitmap(&bmrecorder, 60, 120);
    
    GUI_SetColor(GUI_STCOLOR_LIGHTBLUE);
    GUI_FillEllipse(470, 430, 214, 140);
    GUI_SetColor(GUI_WHITE);
    GUI_FillEllipse(470, 435, 214, 140);   
    
    break;     

  case WM_NOTIFY_PARENT:
    Id    = WM_GetId(pMsg->hWinSrc);    /* Id of widget */
    NCode = pMsg->Data.v;               /* Notification code */
    
    
    switch(Id) {
    case ID_BUTTON_EXIT: 
      switch(NCode) {
      case WM_NOTIFICATION_RELEASED:
        
        if(module_prop[k_ModuleGetIndex(&audio_player_board)].in_use == 0)
        {          
          AUDIO_RECORDER_DeInit();
        }        
        GUI_EndDialog(pMsg->hWin, 0);
        
        break;
      }
      break;
      
    case ID_RECORD_PAUSE: 
      switch(NCode) {
      case WM_NOTIFICATION_RELEASED:

        
          if((AUDIO_RECORDER_GetState() == AUDIO_RECORDER_PLAY_PAUSE)||
             (AUDIO_RECORDER_GetState() == AUDIO_RECORDER_RECORD_PAUSE))
          {
            AUDIO_RECORDER_PauseResume();
            
            hItem = WM_GetDialogItem(pMsg->hWin, ID_EQUAL);
            IMAGE_SetGIF(hItem, equal, sizeof(equal));
            WM_InvalidateWindow(hItem);
            WM_Update(hItem);    
          }
          else if((AUDIO_RECORDER_GetState() == AUDIO_RECORDER_PLAYING)||
             (AUDIO_RECORDER_GetState() == AUDIO_RECORDER_RECORDING))
          {
            AUDIO_RECORDER_PauseResume();
            
            hItem = WM_GetDialogItem(pMsg->hWin, ID_EQUAL);
            IMAGE_SetBitmap(hItem, &bmframe0);
            WM_InvalidateWindow(hItem);
            WM_Update(hItem);    
          }

        break;
      }
      break;

    case ID_RECORD_STOP: 
      switch(NCode) {
      case WM_NOTIFICATION_RELEASED:

        if( RecorderMode == RECORDER_MODE_RECORDING)
        {
          AUDIO_RECORDER_StopRec();
          RecorderMode = RECORDER_MODE_PLAY_IDLE;
        }
        
        else if( RecorderMode == RECORDER_MODE_PLAYING)
        {
          AUDIO_RECORDER_StopPlayer();
          RecorderMode = RECORDER_MODE_PLAY_IDLE;
        }
        
        else if( RecorderMode == RECORDER_MODE_PLAY_IDLE)
        {
          RecorderMode = RECORDER_MODE_REC_IDLE;
        }
        
        hItem = WM_GetDialogItem(pMsg->hWin, ID_RECORD_REC_CANCEL_PLAY);
        WM_InvalidateWindow(hItem);
        WM_Update(hItem);     

        hItem = WM_GetDialogItem(pMsg->hWin, ID_RECORD_STOP);
        WM_InvalidateWindow(hItem);
        WM_Update(hItem);     
        
        hItem = WM_GetDialogItem(pMsg->hWin, ID_RECORD_PAUSE);
        WM_InvalidateWindow(hItem);
        WM_Update(hItem);    
        break;
      }
      break;

    case ID_RECORD_REC_CANCEL_PLAY: 
      switch(NCode) {
      case WM_NOTIFICATION_RELEASED:

        /* Start Recored */
        if( RecorderMode == RECORDER_MODE_REC_IDLE) 
        {
          _BuildFileName();
          
          hItem = WM_GetDialogItem(hMainWin, ID_FILENAMECAPTION);
          TEXT_SetText(hItem, "File : ");   
          WM_InvalidateWindow(hItem);
          WM_Update(hItem);             
          hItem = WM_GetDialogItem(hMainWin, ID_FILENAME);
          TEXT_SetText(hItem, FileName);
          WM_InvalidateWindow(hItem);
          WM_Update(hItem);   
          
          AUDIO_RECORDER_SelectFile(FileName, FA_CREATE_ALWAYS | FA_WRITE);
          AUDIO_RECORDER_StartRec(DEFAULT_AUDIO_IN_FREQ);
          RecorderMode = RECORDER_MODE_RECORDING;
          
          hItem = WM_GetDialogItem(pMsg->hWin, ID_EQUAL);
          IMAGE_SetGIF(hItem, equal, sizeof(equal));
          WM_InvalidateWindow(hItem);
          WM_Update(hItem);              
        }
        
        /* Cancel */
        else if( RecorderMode == RECORDER_MODE_RECORDING) 
        {
          AUDIO_RECORDER_StopRec();
          RecorderMode = RECORDER_MODE_REC_IDLE; 
          AUDIO_RECORDER_RemoveAudioFile(FileName);
         }
        /* Start Play */
        else if( RecorderMode == RECORDER_MODE_PLAY_IDLE) 
        {
          RecorderMode = RECORDER_MODE_PLAYING;
          AUDIO_RECORDER_SelectFile(FileName, FA_OPEN_EXISTING | FA_READ);          
          AUDIO_RECORDER_Play(DEFAULT_AUDIO_IN_FREQ);
          
                   
          hItem = WM_GetDialogItem(pMsg->hWin, ID_EQUAL);
          IMAGE_SetGIF(hItem, equal, sizeof(equal));
          WM_InvalidateWindow(hItem);
          WM_Update(hItem);            
        }
        
        hItem = WM_GetDialogItem(pMsg->hWin, ID_RECORD_REC_CANCEL_PLAY);
        WM_InvalidateWindow(hItem);
        WM_Update(hItem);     

        hItem = WM_GetDialogItem(pMsg->hWin, ID_RECORD_STOP);
        WM_InvalidateWindow(hItem);
        WM_Update(hItem);     
        
        hItem = WM_GetDialogItem(pMsg->hWin, ID_RECORD_PAUSE);
        WM_InvalidateWindow(hItem);
        WM_Update(hItem);          
        
        break;
      }
      break;
      
    }
    break;
  default:
    WM_DefaultProc(pMsg);
    break;
  }   
}
Ejemplo n.º 14
0
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);

}
Ejemplo n.º 15
0
void vHeartbeatTask (void * pvParameters){

	int Key, Entries, ySize;
	uint16_t click_cnt=0;
	int8_t Item_nb;
	BUTTON_Handle hOK_Button, hTest_Key;
	LISTBOX_Handle hStationListBox;
	static enum GuiState eGuiState = SELECT;
	static const GUI_ConstString StationList[] = {"ZET", "RMFFM", "RMFMAXXX", "SKY.FM", "ESKA ROCK", "TERMINAL", NULL};

	vSemaphoreCreateBinary(xButton_pushed_Semaphore);
	if(xDMAch1_Semaphore != NULL){
		xSemaphoreTake(xButton_pushed_Semaphore, 0);
	}else{
		// The semaphore was not created
	}
	BUTTON_Config();	//INT0 Button as source of interrupt
	xSemaphoreTake(xButton_pushed_Semaphore, 0);

	xListBoxQueue = xQueueCreate(2, sizeof(int8_t));


	GUI_Init();
	if(0){
		_ExecCalibration();
	}else{
		_DefaultCalibration();
	}

	GUI_SetBkColor(GUI_BLUE);
	GUI_Clear();



	if (xSemaphoreTake(xDhcpCmplSemaphore_1, portMAX_DELAY) == pdTRUE) {
		/* OK button */
		hOK_Button = BUTTON_CreateEx(120, 210, 80, 20, 0, WM_CF_SHOW, 0, 12);
		GUI_SetFont(&GUI_Font32_ASCII);
		BUTTON_SetText(hOK_Button, "OK");

		/* Cancel button */
		hTest_Key = BUTTON_CreateEx(120, 180, 80, 20, 0, WM_CF_SHOW, 0, 13);
		GUI_SetFont(&GUI_Font16B_ASCII);
		BUTTON_SetText(hTest_Key, "CLICK");
		WM_SetStayOnTop(hTest_Key, 1);

		/* Station list */
		Entries = 6;//countof(StationList) - 1;
		ySize = GUI_GetYDistOfFont(&GUI_Font16B_ASCII)*Entries;
		hStationListBox = LISTBOX_CreateEx(100, 10, 120, ySize, 0, WM_CF_SHOW, 0, 5, StationList);
		SCROLLBAR_CreateAttached(hStationListBox, SCROLLBAR_CF_VERTICAL);

	}

	while(1){
		Key = GUI_GetKey();
		//top = WM_GetStayOnTop(hTest_Key);

		switch(eGuiState){
		case SELECT:
			switch (Key){
			case 12:
				Item_nb = LISTBOX_GetSel(hStationListBox);
				if(Item_nb >= 0){
					if(xQueueSendToBack(xListBoxQueue, &Item_nb, 50/portTICK_RATE_MS) == pdPASS){
						/* OK button delete */
						BUTTON_Delete(hOK_Button);
						GUI_SetBkColor(GUI_BLUE);
						GUI_ClearRect(120, 210, 200, 230);
						GUI_ClearKeyBuffer();

						/* Listbox delete */
						LISTBOX_Delete(hStationListBox);
						GUI_ClearRect(100, 10, 220, ySize+10);

						eGuiState = PLAYING;
					}
				}
				vTaskResume(xShoutcastTaskHandle);
				break;
			case 13:
				click_cnt++;
				GUI_SetFont(&GUI_Font16B_ASCII);
				Item_nb = LISTBOX_GetSel(hStationListBox);
				GUI_DispStringAt("CNT = ", 0, 210);
				GUI_DispDecSpace(Item_nb, 3);
				break;
			default:
				break;
			}

			break;
		case PLAYING:
			switch (Key){
			case 13:
				click_cnt++;
				GUI_SetFont(&GUI_Font16B_ASCII);
//				Item_nb = LISTBOX_GetSel(hStationListBox);
				GUI_DispStringAt("CNT = ", 0, 210);
				GUI_DispDecSpace(123, 3);
				break;
			default:
				break;
			}
		}
		vTaskDelay(20/portTICK_RATE_MS);
	}
}
Ejemplo n.º 16
0
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);
    
    /* Initialization of 'Board : STM324x9I' */
    hItem = WM_GetDialogItem(pMsg->hWin, ID_TEXT_BOARD);
    TEXT_SetFont(hItem, &GUI_FontLubalGraph16);
    TEXT_SetTextColor(hItem, GUI_STCOLOR_DARKBLUE    );

    /* Initialization of 'Core: STM32F-4 Series' */
    hItem = WM_GetDialogItem(pMsg->hWin, ID_TEXT_CORE);
    TEXT_SetFont(hItem, &GUI_FontLubalGraph16);
    TEXT_SetTextColor(hItem, GUI_STCOLOR_DARKBLUE    );

    /* Initialization of 'CPU Speed : 180MHz' */
    hItem = WM_GetDialogItem(pMsg->hWin, ID_TEXT_CPU);
    TEXT_SetFont(hItem, &GUI_FontLubalGraph16);
    TEXT_SetTextColor(hItem, GUI_STCOLOR_DARKBLUE    );

    /* Initialization of 'Firmware Version : 1.0.1' */
    hItem = WM_GetDialogItem(pMsg->hWin, ID_TEXT_VERSION);
    TEXT_SetFont(hItem, &GUI_FontLubalGraph16);
    TEXT_SetTextColor(hItem, GUI_STCOLOR_DARKBLUE    ); 

    /* Initialization of 'Board : STM324x9I' */
    hItem = WM_GetDialogItem(pMsg->hWin, ID_TEXT_BOARD_1);
    TEXT_SetFont(hItem, &GUI_FontLubalGraph16);
    TEXT_SetTextColor(hItem, GUI_STCOLOR_LIGHTBLUE);

    /* Initialization of 'Board : STM32F746G' */
    hItem = WM_GetDialogItem(pMsg->hWin, ID_TEXT_BOARD_2);
    TEXT_SetFont(hItem, &GUI_FontLubalGraph16);
    TEXT_SetTextColor(hItem, GUI_STCOLOR_LIGHTBLUE);    
    
    /* Initialization of 'Core: STM32F-4 Series' */
    hItem = WM_GetDialogItem(pMsg->hWin, ID_TEXT_CORE_1);
    TEXT_SetFont(hItem, &GUI_FontLubalGraph16);
    TEXT_SetTextColor(hItem, GUI_STCOLOR_LIGHTBLUE);

    /* Initialization of 'CPU Speed : 180MHz' */
    hItem = WM_GetDialogItem(pMsg->hWin, ID_TEXT_CPU_1);
    TEXT_SetFont(hItem, &GUI_FontLubalGraph16);
    TEXT_SetTextColor(hItem, GUI_STCOLOR_LIGHTBLUE);

    /* Initialization of 'Firmware Version : 1.0' */
    hItem = WM_GetDialogItem(pMsg->hWin, ID_TEXT_VERSION_1);
    TEXT_SetFont(hItem, &GUI_FontLubalGraph16);
    TEXT_SetTextColor(hItem, GUI_STCOLOR_LIGHTBLUE);  
    /* ST Copyright */
    hItem = WM_GetDialogItem(pMsg->hWin, ID_TEXT_COPYRIGHT);
    TEXT_SetFont(hItem, GUI_FONT_13_ASCII);
    TEXT_SetTextColor(hItem, GUI_STCOLOR_DARKBLUE    );

    /* ST Copyright */
    hItem = WM_GetDialogItem(pMsg->hWin, ID_TEXT_TITLE);
    TEXT_SetFont(hItem, &GUI_FontLubalGraph20);
    TEXT_SetTextColor(hItem, GUI_STCOLOR_LIGHTBLUE);

    IMAGE_CreateEx(40,  120, 70, 70, pMsg->hWin, WM_CF_SHOW, 0, ID_IMAGE_BOARD);  
    IMAGE_CreateEx(150, 120, 70, 70, pMsg->hWin, WM_CF_SHOW, 0, ID_IMAGE_MCU);
    IMAGE_CreateEx(260, 120, 70, 70, pMsg->hWin, WM_CF_SHOW, 0, ID_IMAGE_CPU);
    IMAGE_CreateEx(370, 120, 70, 70, pMsg->hWin, WM_CF_SHOW, 0, ID_IMAGE_FVERSION);
    
    break;     
    
  case WM_PAINT:    
    GUI_SetColor(GUI_STCOLOR_LIGHTBLUE);
    GUI_AA_DrawRoundedRect(30,  80, 120, 230, 30);
    GUI_AA_DrawRoundedRect(140, 80, 230, 230, 30);
    GUI_AA_DrawRoundedRect(250, 80, 340, 230, 30);
    GUI_AA_DrawRoundedRect(360, 80, 450, 230, 30);
    
    break;     

  case WM_TIMER:
    /* draw */
    
    if(frame < 5)
    {
      WM_RestartTimer(pMsg->Data.v, 25);
      
      hItem = WM_GetDialogItem(pMsg->hWin, ID_IMAGE_BOARD);
      IMAGE_SetBitmap(hItem, open_board[frame]);
      
      hItem = WM_GetDialogItem(pMsg->hWin, ID_IMAGE_MCU);
      IMAGE_SetBitmap(hItem, open_mcu[frame]);
      
      hItem = WM_GetDialogItem(pMsg->hWin, ID_IMAGE_CPU);
      IMAGE_SetBitmap(hItem, open_cpu[frame]);
      
      hItem = WM_GetDialogItem(pMsg->hWin, ID_IMAGE_FVERSION);
      IMAGE_SetBitmap(hItem, open_fversion[frame]);
      
      frame++;
    }
    else
    {
      if(hTimer != 0)
      {
        WM_DeleteTimer(hTimer);
        hTimer = 0;
      }  
    }    
    break;
    
  case WM_DELETE:
    if(hTimer != 0)
    {
      WM_DeleteTimer(hTimer);
      hTimer = 0;
    }    
   
     break;
    
  case WM_NOTIFY_PARENT:
    Id    = WM_GetId(pMsg->hWinSrc);    /* Id of widget */
    NCode = pMsg->Data.v;               /* Notification code */
       
    switch(Id) {
    case ID_BUTTON_EXIT: 
      switch(NCode) {
      case WM_NOTIFICATION_RELEASED:
        if(hTimer != 0)
        {
          WM_DeleteTimer(hTimer);
          hTimer = 0;
        }         
        GUI_EndDialog(pMsg->hWin, 0);

        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;
  GUI_RECT r;
  int      result;
  int      Id, NCode, Index;
  char tmp[FILEMGR_FILE_NAME_SIZE];

  switch (pMsg->MsgId)
  {
  case WM_INIT_DIALOG:


    pImageList = (FILELIST_FileTypeDef *)k_malloc(sizeof(FILELIST_FileTypeDef));
    pFileInfo = (CHOOSEFILE_INFO *)k_malloc(sizeof(CHOOSEFILE_INFO));

    pImageList->ptr = 0;
    file_pos = 0;
    effects = 0;

    ImSettings.d32 = k_BkupRestoreParameter(CALIBRATION_IMAGE_SETTINGS_BKP);
    if(ImSettings.b.ss_timer == 0)
    {
      ImSettings.b.ss_timer = 1;
    }


    /* Image frame initialization */
    IMAGE_Enlarge = 0;
    hItem = WM_GetClientWindow(pMsg->hWin);
    WM_GetClientRectEx(hItem, &r);
    imFrame = WM_CreateWindowAsChild(r.x0 + 6, r.y0 + 6, r.x1 - 98, r.y1 - 78, hItem, WM_CF_SHOW, _cbImageWindow, 0);

    /* Buttons initialization */

    hItem = BUTTON_CreateEx(47, 155, 35, 35, pMsg->hWin, WM_CF_SHOW, 0, ID_PREVIOUS_BUTTON);
    WM_SetCallback(hItem, _cbButton_previous);

    hItem = BUTTON_CreateEx(94, 148, 50, 50, pMsg->hWin, WM_CF_SHOW, 0, ID_SLIDE_BUTTON);
    WM_SetCallback(hItem, _cbButton_play);
    slideshow_state = OFF;

    hItem = BUTTON_CreateEx(154, 155, 35, 35, pMsg->hWin, WM_CF_SHOW, 0, ID_NEXT_BUTTON);
    WM_SetCallback(hItem, _cbButton_next);


    hItem = BUTTON_CreateEx(242, 145, 70, 30, pMsg->hWin, WM_CF_SHOW, 0, ID_ADD_BUTTON);
    WM_SetCallback(hItem, _cbButton_add);

    hItem = BUTTON_CreateEx(242, 175, 70, 30, pMsg->hWin, WM_CF_SHOW, 0, ID_OPEN_BUTTON);
    WM_SetCallback(hItem, _cbButton_open);

    hItem = BUTTON_CreateEx(196, 174, 30, 30, pMsg->hWin, WM_CF_SHOW, 0, ID_SETTINGS_BUTTON);
    WM_SetCallback(hItem, _cbButton_settings);

    hItem = BUTTON_CreateEx(10, 174, 30, 30, pMsg->hWin, WM_CF_SHOW, 0, ID_CLOSE_BUTTON);
    WM_SetCallback(hItem, _cbButton_close);

    hItem = WM_GetDialogItem(pMsg->hWin, ID_IMAGE_LIST);
    LISTBOX_SetBkColor(hItem, LISTBOX_CI_SEL, GUI_BLUE);
    LISTBOX_SetTextColor(hItem, LISTBOX_CI_SEL, GUI_WHITE);
    LISTBOX_SetBkColor(hItem, LISTBOX_CI_UNSEL, GUI_BLACK);
    LISTBOX_SetTextColor(hItem, LISTBOX_CI_UNSEL, GUI_CYAN);
    LISTBOX_SetAutoScrollV(hItem, 1);

    break;

  case WM_TIMER:
    playlist_select = 0;
    break;

 case WM_PAINT:
    DrawRect3D(5, 140, 222, 67);
    DrawRect3D(230, 140, 83, 67);

    break;
  case WM_NOTIFY_PARENT:
    Id = WM_GetId(pMsg->hWinSrc);
    NCode = pMsg->Data.v;

    switch (Id) {
    /* Notification sent by "Button_Settings" */
    case ID_SETTINGS_BUTTON:
      switch (NCode) {
      case WM_NOTIFICATION_CLICKED:
        break;
      case WM_NOTIFICATION_RELEASED:
        GUI_CreateDialogBox(_aSettingsDialogCreate, GUI_COUNTOF(_aSettingsDialogCreate), _cbSettingsDialog, IMAGE_hWin, 0, 0);
        break;
      }
      break;

     /* Notifications sent by 'ListView' Slider */
    case ID_IMAGE_LIST:
      if(NCode == WM_NOTIFICATION_CLICKED)
      {
        hItem = WM_GetDialogItem(pMsg->hWin, ID_IMAGE_LIST);
        Index = LISTBOX_GetSel(hItem);

        if(Index < pImageList->ptr)
        {
          if(playlist_select == 0)
          {
            hPlaylistTimer = WM_CreateTimer(pMsg->hWin, 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 < pImageList->ptr)
            {
              file_pos = Index;
              if((strstr((char *)pImageList->file[file_pos].name, ".bmp")) || (strstr((char *)pImageList->file[file_pos].name, ".BMP")))
              {
                IMAGE_Type = IMAGE_TYPE_BMP;
              }
              else if((strstr((char *)pImageList->file[file_pos].name, ".jpg")) || (strstr((char *)pImageList->file[file_pos].name, ".JPG")))
              {
                IMAGE_Type = IMAGE_TYPE_JPG;
              }
              f_close(&Image_File);
              f_open(&Image_File, (char const *)pImageList->file[file_pos].name, FA_OPEN_EXISTING | FA_READ);
              WM_InvalidateWindow(imFrame);
            }
          }
        }
      }
      break;

    /* Notification sent by "Button_Close" */
    case ID_CLOSE_BUTTON:
      switch (NCode) {
      case WM_NOTIFICATION_CLICKED:
        break;
      case WM_NOTIFICATION_RELEASED:
        f_close(&Image_File);
        k_free(pImageList);
        k_free(pFileInfo);
        GUI_EndDialog(pMsg->hWin, 0);
        break;
      }
      break;

    /* Notification sent by "Button_Open" */
    case ID_OPEN_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, 20, 20, 200, 150, apDrives, GUI_COUNTOF(apDrives), 0, "add a folder", 0, pFileInfo);
        WM_MakeModal(hItem);
        result = GUI_ExecCreatedDialog(hItem);
        if (result == 0)
        {

          if(pImageList->ptr == 0)
          {
            _AddEntireFolder(pFileInfo->pRoot);
            file_pos = 0;
            if((strstr((char *)pImageList->file[file_pos].name, ".bmp")) || (strstr((char *)pImageList->file[file_pos].name, ".BMP")))
            {
              IMAGE_Type = IMAGE_TYPE_BMP;
            }
            else if((strstr((char *)pImageList->file[file_pos].name, ".jpg")) || (strstr((char *)pImageList->file[file_pos].name, ".JPG")))
            {
              IMAGE_Type = IMAGE_TYPE_JPG;
            }

            f_open(&Image_File, (char *)pImageList->file[file_pos].name, FA_OPEN_EXISTING | FA_READ);
            WM_InvalidateWindow(imFrame);
          }
          else
          {
            _AddEntireFolder(pFileInfo->pRoot);
          }
        }

        break;
      }
      break;

      /* Notification sent by "Button_Open" */
    case ID_ADD_BUTTON:
      switch (NCode) {
      case WM_NOTIFICATION_CLICKED:
        break;
      case WM_NOTIFICATION_RELEASED:

        pFileInfo->pfGetData = k_GetData;
        pFileInfo->pMask = acMask_img;
        hItem = CHOOSEFILE_Create(pMsg->hWin, 20, 20, 200, 150, apDrives, GUI_COUNTOF(apDrives), 0, "Add an image to playlist", 0, pFileInfo);
        WM_MakeModal(hItem);
        result = GUI_ExecCreatedDialog(hItem);
        if (result == 0)
        {

          if((strstr(pFileInfo->pRoot, ".jpg")) || (strstr(pFileInfo->pRoot, ".bmp")) || (strstr(pFileInfo->pRoot, ".JPG")) || (strstr(pFileInfo->pRoot, ".BMP")))
          {
            strcpy((char *)pImageList->file[pImageList->ptr].name, pFileInfo->pRoot);
            FILEMGR_GetFileOnly(tmp, (char *)pFileInfo->pRoot);
            hItem = WM_GetDialogItem(IMAGE_hWin, ID_IMAGE_LIST);
            LISTBOX_AddString(hItem, tmp);
            LISTBOX_SetSel(hItem, pImageList->ptr);
            pImageList->ptr++;
            file_pos = pImageList->ptr - 1;
            f_close(&Image_File);

            if((strstr((char *)pImageList->file[file_pos].name, ".bmp")) || (strstr((char *)pImageList->file[file_pos].name, ".BMP")))
            {
              IMAGE_Type = IMAGE_TYPE_BMP;
            }
            else if((strstr((char *)pImageList->file[file_pos].name, ".jpg")) || (strstr((char *)pImageList->file[file_pos].name, ".JPG")))
            {
              IMAGE_Type = IMAGE_TYPE_JPG;
            }

            f_open(&Image_File, (char *)pImageList->file[file_pos].name, FA_OPEN_EXISTING | FA_READ);
            WM_InvalidateWindow(imFrame);
          }
        }
        break;
      }
      break;

    /* Notification sent by "Button_SlideShow" */
    case ID_SLIDE_BUTTON:
      switch (NCode) {
      case WM_NOTIFICATION_CLICKED:
        break;
      case WM_NOTIFICATION_RELEASED:
        if(pImageList->ptr > 1)
        {
          f_close(&Image_File);
          f_open(&Image_File, (char const *)pImageList->file[file_pos].name, FA_OPEN_EXISTING | FA_READ);

          if((strstr((char *)pImageList->file[file_pos].name, ".bmp")) || (strstr((char *)pImageList->file[file_pos].name, ".BMP")))
          {
            IMAGE_Type = IMAGE_TYPE_BMP;
          }
          else if((strstr((char *)pImageList->file[file_pos].name, ".jpg")) || (strstr((char *)pImageList->file[file_pos].name, ".JPG")))
          {
            IMAGE_Type = IMAGE_TYPE_JPG;
          }

          WM_InvalidateWindow(imFrame);
          if (slideshow_state == OFF)
          {
            hTimerTime = WM_CreateTimer(imFrame, ID_SLIDER_TIMER, (ImSettings.b.ss_timer * 1000) , 0);
          }
          else if(hTimerTime != 0)
          {
            WM_DeleteTimer(hTimerTime);
            hTimerTime = 0;
          }

          slideshow_state = (slideshow_state == OFF ? ON : OFF);
        }
        break;
      }
      break;

    /* Notification sent by "Button_Next" */
    case ID_NEXT_BUTTON:
      switch (NCode) {
      case WM_NOTIFICATION_CLICKED:
        break;
      case WM_NOTIFICATION_RELEASED:

        if(pImageList->ptr > 0)
        {
          if (file_pos < (pImageList->ptr - 1))
          {
            file_pos++;
            f_close(&Image_File);
          }
          else
          {
            file_pos = 0;
            f_close(&Image_File);
          }

          if((strstr((char *)pImageList->file[file_pos].name, ".bmp")) || (strstr((char *)pImageList->file[file_pos].name, ".BMP")))
          {
            IMAGE_Type = IMAGE_TYPE_BMP;
          }
          else if((strstr((char *)pImageList->file[file_pos].name, ".jpg")) || (strstr((char *)pImageList->file[file_pos].name, ".JPG")))
          {
            IMAGE_Type = IMAGE_TYPE_JPG;
          }

          f_open(&Image_File, (char const *)pImageList->file[file_pos].name, FA_OPEN_EXISTING | FA_READ);
          WM_InvalidateWindow(imFrame);
          hItem = WM_GetDialogItem(IMAGE_hWin, ID_IMAGE_LIST);
          LISTBOX_SetSel(hItem, file_pos);

        }

        break;
      }
      break;

    /* Notification sent by "Button_Previous" */
    case ID_PREVIOUS_BUTTON:
      switch (NCode) {
      case WM_NOTIFICATION_CLICKED:
        break;
      case WM_NOTIFICATION_RELEASED:

        if(pImageList->ptr > 0)
        {
          if (file_pos > 0 )
          {
            file_pos--;
            f_close(&Image_File);
          }
          else
          {
            file_pos = (pImageList->ptr - 1);
            f_close(&Image_File);
          }

            if((strstr((char *)pImageList->file[file_pos].name, ".bmp")) || (strstr((char *)pImageList->file[file_pos].name, ".BMP")))
            {
              IMAGE_Type = IMAGE_TYPE_BMP;
            }
            else if((strstr((char *)pImageList->file[file_pos].name, ".jpg")) || (strstr((char *)pImageList->file[file_pos].name, ".JPG")))
            {
              IMAGE_Type = IMAGE_TYPE_JPG;
            }

            f_open(&Image_File, (char const *)pImageList->file[file_pos].name, FA_OPEN_EXISTING | FA_READ);
            WM_InvalidateWindow(imFrame);
            hItem = WM_GetDialogItem(IMAGE_hWin, ID_IMAGE_LIST);
            LISTBOX_SetSel(hItem, file_pos);
        }

        break;
      }
      break;
    }
    break;
  default:
    WM_DefaultProc(pMsg);
    break;
  }
}
Ejemplo n.º 18
0
/**
  * @brief  Callback routine of the main dialog
  * @param  pMsg: pointer to data structure of type WM_MESSAGE
  * @retval None
  */
static void _cbDialog(WM_MESSAGE * pMsg) {
  WM_HWIN hItem;
  int Id, NCode;

  switch (pMsg->MsgId) {
  case WM_INIT_DIALOG:
    
    frame = 0;
    hTimer = WM_CreateTimer(pMsg->hWin, 0, 50, 0);
  
    hItem = BUTTON_CreateEx(700, 0, 100, 100, pMsg->hWin, WM_CF_SHOW, 0, ID_BUTTON_EXIT);
    WM_SetCallback(hItem, _cbButton_exit);
    
    /* Initialization of 'Board*/
    hItem = WM_GetDialogItem(pMsg->hWin, ID_TEXT_BOARD);
    TEXT_SetFont(hItem, &GUI_FontLubalGraph24B);
    TEXT_SetTextColor(hItem, GUI_STCOLOR_DARKBLUE);

    /* Initialization of 'Core: STM32F-4 Series' */
    hItem = WM_GetDialogItem(pMsg->hWin, ID_TEXT_CORE);
    TEXT_SetFont(hItem, &GUI_FontLubalGraph24B);
    TEXT_SetTextColor(hItem, GUI_STCOLOR_DARKBLUE);

    /* Initialization of 'CPU Speed : 180MHz' */
    hItem = WM_GetDialogItem(pMsg->hWin, ID_TEXT_CPU);
    TEXT_SetFont(hItem, &GUI_FontLubalGraph24B);
    TEXT_SetTextColor(hItem, GUI_STCOLOR_DARKBLUE);

    /* Initialization of 'Firmware Version*/
    hItem = WM_GetDialogItem(pMsg->hWin, ID_TEXT_VERSION);
    TEXT_SetFont(hItem, &GUI_FontLubalGraph24B);
    TEXT_SetTextColor(hItem, GUI_STCOLOR_DARKBLUE); 

    /* Initialization of 'Board*/
    hItem = WM_GetDialogItem(pMsg->hWin, ID_TEXT_BOARD_1);
    TEXT_SetFont(hItem, &GUI_FontLubalGraph24);
    TEXT_SetTextColor(hItem, GUI_STCOLOR_LIGHTBLUE);

    /* Initialization of 'Board */
    hItem = WM_GetDialogItem(pMsg->hWin, ID_TEXT_BOARD_2);
    TEXT_SetFont(hItem, &GUI_FontLubalGraph24);
    TEXT_SetTextColor(hItem, GUI_STCOLOR_LIGHTBLUE);    
    
    /* Initialization of 'Core: STM32F-4 Series' */
    hItem = WM_GetDialogItem(pMsg->hWin, ID_TEXT_CORE_1);
    TEXT_SetFont(hItem, &GUI_FontLubalGraph24);
    TEXT_SetTextColor(hItem, GUI_STCOLOR_LIGHTBLUE);

    /* Initialization of 'CPU Speed : 180MHz' */
    hItem = WM_GetDialogItem(pMsg->hWin, ID_TEXT_CPU_1);
    TEXT_SetFont(hItem, &GUI_FontLubalGraph24);
    TEXT_SetTextColor(hItem, GUI_STCOLOR_LIGHTBLUE);

    /* Initialization of 'Firmware Version*/
    hItem = WM_GetDialogItem(pMsg->hWin, ID_TEXT_VERSION_1);
    TEXT_SetFont(hItem, &GUI_FontLubalGraph24);
    TEXT_SetTextColor(hItem, GUI_STCOLOR_LIGHTBLUE); 
    
    /* ST Copyright */
    hItem = WM_GetDialogItem(pMsg->hWin, ID_TEXT_COPYRIGHT);
    TEXT_SetFont(hItem, &GUI_FontLubalGraph16);
    TEXT_SetTextColor(hItem, GUI_STCOLOR_DARKBLUE);

    /* ST Copyright */
    hItem = WM_GetDialogItem(pMsg->hWin, ID_TEXT_TITLE);
    TEXT_SetFont(hItem, &GUI_FontLubalGraph32B);
    TEXT_SetTextColor(hItem, GUI_STCOLOR_LIGHTBLUE);
    
    break;     
    
  case WM_PAINT:    
    GUI_SetColor(GUI_STCOLOR_LIGHTBLUE);
    GUI_AA_DrawRoundedRect(30,  140, 200, 340, 30);
    GUI_AA_DrawRoundedRect(220, 140, 390, 340, 30);
    GUI_AA_DrawRoundedRect(410, 140, 580, 340, 30);
    GUI_AA_DrawRoundedRect(600, 140, 770, 340, 30);
    
    GUI_DrawBitmap(open_board[frame]   , 65,  190);
    GUI_DrawBitmap(open_mcu[frame]     , 255, 190);
    GUI_DrawBitmap(open_cpu[frame]     , 445, 190);
    GUI_DrawBitmap(open_fversion[frame], 635, 190);
      
    break;     

  case WM_TIMER:
    if(frame < 4)
    {
      WM_InvalidateWindow(pMsg->hWin);
      WM_RestartTimer(pMsg->Data.v, 50);
      frame++;
    }
    else
    {
      if(hTimer != 0)
      {
        WM_DeleteTimer(hTimer);
        hTimer = 0;
      }  
    }    
    break;
       
  case WM_NOTIFY_PARENT:
    Id    = WM_GetId(pMsg->hWinSrc);    /* Id of widget */
    NCode = pMsg->Data.v;               /* Notification code */
       
    switch(Id) {
    case ID_BUTTON_EXIT: 
      switch(NCode) {
      case WM_NOTIFICATION_RELEASED:
        if(hTimer != 0)
        {
          WM_DeleteTimer(hTimer);
          hTimer = 0;
        }         
        GUI_EndDialog(pMsg->hWin, 0);

        break;
      }
      break;      
    }
    break;
  default:
    WM_DefaultProc(pMsg);
    break;
  }    
}
Ejemplo n.º 19
0
static void _cbWindow(WM_MESSAGE * pMsg) {
	
	const WM_KEY_INFO* pInfo;
  WM_HWIN thisFrame  = pMsg->hWin;

  int     NCode;
  int     Id;
	
	int xSize;
	int ySize;  
	
	
  switch (pMsg->MsgId) {
			  
	case WM_SET_FOCUS:
			 if(pMsg->Data.v)
			 {
//					WM_GetUserData(pMsg->hWin,&UserData,4);
					if(UserData==MONITMMSI_FULL || UserData == MONITMMSI_FIRST)
					{
						WM_SetFocus(buttons[2]);
					}
					else
					{
      UserData = 0;
						WM_SetFocus(buttons[0]);
					}
			 }
			 break;		
	
  case WM_PAINT:
       
       xSize = WM_GetWindowSizeX(pMsg->hWin);
       ySize = WM_GetWindowSizeY(pMsg->hWin);
//       hMem0 = GUI_MEMDEV_Create(0, 0, xSize, ySize);
//       GUI_MEMDEV_Select(hMem0);
       GUI_DrawGradientRoundedV(0, 0, xSize - 1, ySize - 1, 20, pColors->bkTopColor,pColors->bkBottomColor);
//       GUI_MEMDEV_Select(0);
//       GUI_MEMDEV_CopyToLCD(hMem0);
//       GUI_MEMDEV_Delete(hMem0);
       break;
	
	case USER_MSG_SKIN:
       pColors = &(confirmWinColors[pMsg->Data.v]);
    
       BUTTON_SetBkColor(buttons[0], BUTTON_BI_UNPRESSED, pColors->btBkColor);
       BUTTON_SetBkColor(buttons[1], BUTTON_BI_UNPRESSED, pColors->btBkColor);
       BUTTON_SetBkColor(buttons[2], BUTTON_BI_UNPRESSED, pColors->btBkColor);
   
       BUTTON_SetFocusColor(buttons[0], pColors->btFocusBkColor);
       BUTTON_SetFocusColor(buttons[1], pColors->btFocusBkColor);
       BUTTON_SetFocusColor(buttons[2], pColors->btFocusBkColor);
       
       TEXT_SetTextColor(dlgTextContent, pColors->textColor);
       break;
 
  case WM_CREATE:
       pColors = &confirmWinColors[t90_set.sys.nightmode];
  
       BUTTON_CreateEx (60,110,80,40,thisFrame, WM_CF_HASTRANS  ,0,GUI_ID_BUTTON0);
       buttons[0] = WM_GetDialogItem(pMsg->hWin, GUI_ID_BUTTON0);
       BUTTON_SetFocusColor(buttons[0],pColors->btFocusBkColor);
       WM_ShowWindow (buttons[0]);
       BUTTON_SetText(buttons[0], "确定");
       BUTTON_SetFont(buttons[0], &GUI_Font_T90_30);
	      WM_SetCallback(buttons[0], &myButton);
	
       BUTTON_SetBkColor(buttons[0],BUTTON_BI_UNPRESSED,pColors->btBkColor);
       BUTTON_SetTextColor(buttons[0],BUTTON_BI_UNPRESSED,pColors->btTextColor);
       
       BUTTON_CreateEx(260,  110,   80,  40,thisFrame,WM_CF_HASTRANS,0,GUI_ID_BUTTON1);
       buttons[1] = WM_GetDialogItem(pMsg->hWin, GUI_ID_BUTTON1);
       BUTTON_SetFocusColor(buttons[1],pColors->btFocusBkColor);
       WM_ShowWindow (buttons[1]);
       BUTTON_SetText(buttons[1], "取消");
       BUTTON_SetFont(buttons[1], &GUI_Font_T90_30);
			    WM_SetCallback(buttons[1], &myButton);
			 
       BUTTON_SetBkColor(buttons[1],BUTTON_BI_UNPRESSED,pColors->btBkColor);
       BUTTON_SetTextColor(buttons[1],BUTTON_BI_UNPRESSED,pColors->btTextColor);
						
		     buttons[2] = BUTTON_CreateEx (160,110,80,40,thisFrame, WM_CF_HASTRANS  ,0,GUI_ID_BUTTON2);
       WM_HideWin(buttons[2]);
       BUTTON_SetText(buttons[2], "确定");
       BUTTON_SetFont(buttons[2], &GUI_Font_T90_30);
	      WM_SetCallback(buttons[2], &myButton);
	      BUTTON_SetFocusColor(buttons[2],pColors->btFocusBkColor);
				
				BUTTON_SetBkColor(buttons[2],BUTTON_BI_UNPRESSED,pColors->btBkColor);
       BUTTON_SetTextColor(buttons[2],BUTTON_BI_UNPRESSED,pColors->btTextColor);
       						
		     TEXT_CreateEx (0,   35,  400, 80, thisFrame,WM_CF_SHOW,0,ID_TEXT_CONTENT,NULL);
       dlgTextContent = WM_GetDialogItem(pMsg->hWin, ID_TEXT_CONTENT);
		     TEXT_SetTextAlign(dlgTextContent,TEXT_CF_HCENTER);
       TEXT_SetFont(dlgTextContent, &GUI_Font_T90_30);
			 
		     TEXT_SetTextColor (dlgTextContent,pColors->textColor);

       break;
	
	case WM_KEY:

		pInfo  = (WM_KEY_INFO*)pMsg->Data.p;
	
	  switch(pInfo->Key)
		 {
		   	case GUI_KEY_LEFT:
		   	case GUI_KEY_RIGHT: 
//							   WM_GetUserData(pMsg->hWin,&UserData,4);
							   if(UserData==MONITMMSI_FULL || UserData == MONITMMSI_FIRST)
										{
											WM_SetFocus(buttons[2]);
										}
										else
										{
											if(WM_HasFocus(buttons[0]))
											{
													WM_SetFocus(buttons[1]);
											}
											else
											{
													WM_SetFocus(buttons[0]);
											}
										}
										break;	
                 
			   default:
			       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
               switch (Id) 
               {
                  case GUI_ID_BUTTON0:
//                       if(myMsg.Data.v == UPDATA)
//                       {
//                          updata[2] = 0x01;
//                          if(UART_Send(UART_1, updata, 18, BLOCKING) == 18)
//                          {
//                             GUI_Delay(100);
//                             NVIC_SystemReset();
//                          }
//                          break;
//                       }                        
                       myMsg.hWin     = myMsg.hWinSrc;
                       myMsg.hWinSrc  = pMsg->hWin;
                       myMsg.MsgId    = USER_MSG_REPLY;
                       myMsg.Data.v   = REPLY_OK;
                       WM_SendMessage(myMsg.hWin, &myMsg);
                       break;
                       
                  case GUI_ID_BUTTON1:
//                       if(myMsg.Data.v == UPDATA) 
//                       {
//                          UART_Send(UART_1, updata, 18, BLOCKING);
//                          WM_SetFocus(myMsg.hWinSrc);
//                          break;
//                       }
                       WM_SetFocusOnPrevChild(confirmWin);
                       
                       myMsg.hWin     = myMsg.hWinSrc;
                       myMsg.hWinSrc  = pMsg->hWin;
                       myMsg.MsgId    = USER_MSG_REPLY;
                       myMsg.Data.v   = REPLY_CANCEL;
                       WM_SendMessage(myMsg.hWin, &myMsg);
                       break;
																		
																		case GUI_ID_BUTTON2:
                       myMsg.hWin     = myMsg.hWinSrc;
                       myMsg.hWinSrc  = pMsg->hWin;
                       myMsg.MsgId    = USER_MSG_REPLY;
                       myMsg.Data.v   = REPLY_OK;
                       WM_SendMessage(myMsg.hWin, &myMsg);
                       {
                          WM_ShowWin(buttons[0]);
                          WM_ShowWin(buttons[1]);
                          WM_HideWin(buttons[2]);
                       }
																			    break;
               }
               WM_BringToBottom(confirmWin);
               break;
    }
    break;

  case USER_MSG_CHOOSE:
      Option  = pMsg->Data.v;

      myMsg.hWinSrc  = pMsg->hWinSrc;
      myMsg.Data.v   = Option;
 
      switch(Option)   
      {
         case CANCEL_MONITED:         
              TEXT_SetText(dlgTextContent, "??????????");
              break;        
         case STORE_SETTING:       
              TEXT_SetText(dlgTextContent, "??????????");    
              break;
         case ADD_MONITED:             
              TEXT_SetText(dlgTextContent, "????????????");
              break;
         case SYS_SETTING:

              TEXT_SetText(dlgTextContent, "是否更改设置内容?");
									     UserData = SYS_SETTING;
//									     WM_SetUserData(pMsg->hWin,&UserData,4);
						       	break;
         case SYS_RESET:
              TEXT_SetText(dlgTextContent, "是否恢复出厂设置?");
									     UserData = SYS_RESET;
//									     WM_SetUserData(pMsg->hWin,&UserData,4);
              break;
									
									case MONITMMSI_SET:
              MMSI = getMMSItmp();
              sprintf(pstring,"您输入的辅船九位码为: \n%09ld,是否确定?",MMSI);
										    TEXT_SetText(dlgTextContent, pstring);
									     UserData = MONITMMSI_SET;
//									     WM_SetUserData(pMsg->hWin,&UserData,4);
              break;
									
									case MONITMMSI_ADD:
              MMSI = getMMSItmp(); 
              sprintf(pstring, "确定将船只 %09ld \n加入船队?",MMSI);
										    TEXT_SetText(dlgTextContent, pstring);
									     
									     UserData = MONITMMSI_ADD;
//									     WM_SetUserData(pMsg->hWin,&UserData,4);
									     break;
									
									case MONITMMSI_DEL:
										    TEXT_SetText(dlgTextContent, "删除后,对该船只报警功能\n恢复正常,是否确认删除?");								     
									     UserData = MONITMMSI_DEL;
									     WM_SetUserData(pMsg->hWin,&UserData,4);
									     break;
									
									case MONITMMSI_FULL:
										    TEXT_SetText(dlgTextContent, "已经达到设置上限,请删\n除后再进行添加!");
									     WM_HideWin(buttons[0]);
									     WM_HideWin(buttons[1]);
									     WM_ShowWin(buttons[2]);
									     UserData = MONITMMSI_FULL;
//									     WM_SetUserData(pMsg->hWin,&UserData,4);
									     break;
									case MONITMMSI_NINE:
              TEXT_SetText(dlgTextContent, "你输入的九位码不足九位, \n确定继续修改?");
              break;
         case MONITMMSI_FIRST:
              TEXT_SetText(dlgTextContent, "你输入的九位码不足九位, \n请继续输入!");
              WM_HideWin(buttons[0]);
									     WM_HideWin(buttons[1]);
									     WM_ShowWin(buttons[2]);
              UserData = MONITMMSI_FIRST;
//									     WM_SetUserData(pMsg->hWin,&UserData,4);
              break;
//         case UPDATA:
//              TEXT_SetText(dlgTextContent,"是否进行更新?");
         default:       
              break;
      }
      break;

  default:
    WM_DefaultProc(pMsg);
    break;
  }
}
Ejemplo n.º 20
0
/**
  * @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 + 79, 
                                          r.y0 + 49, r.x1 - 159, 
                                          r.y1 - 93, 
                                          hItem, 
                                          WM_CF_SHOW | WM_CF_LATE_CLIP, 
                                          _cbCameraWindow, 
                                          0);
    
    /* Buttons initialization */
    hItem = BUTTON_CreateEx(266, 175, 30, 30, pMsg->hWin, WM_CF_SHOW, 0, ID_BUTTON_CLOSE);
    WM_SetCallback(hItem, _cbButton_close);
    
    hItem = BUTTON_CreateEx(256, 79, 50, 50, pMsg->hWin, WM_CF_SHOW, 0, ID_BUTTON_CAPTURE);
    WM_SetCallback(hItem, _cbButton_capture);
    
    hItem = BUTTON_CreateEx(266, 14, 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(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(100,
                                          90,
                                          120, 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;
  }
}
Ejemplo n.º 21
0
void _cbSysSet(WM_MESSAGE* pMsg)
{
	int i=0;
	BUTTON_Handle SysInfoButton,MonitCalibraButton,SetDefaultButton,ReturnButton;
	WM_HWIN hWin = pMsg->hWin;
	WM_HWIN hItem;
	switch (pMsg->MsgId) 
	{
		case WM_CREATE:
			/* 设置聚焦*/
			WM_SetFocus(hWin);
			/* 创建四个图片按钮 */
			SysInfoButton = BUTTON_CreateEx(11, 44, 94, 94,  hWin, WM_CF_SHOW, 0, SYS_BUTTON_INFO);
			BUTTON_SetBitmapEx(SysInfoButton,BUTTON_BI_UNPRESSED, &bmSys_info_xg, 0 ,0);
            BUTTON_SetBitmapEx(SysInfoButton,BUTTON_BI_PRESSED, &bmSys_info, 0 ,0);  

			MonitCalibraButton = BUTTON_CreateEx(111, 44, 94, 94, hWin, WM_CF_SHOW, 0, SYS_BUTTON_MONIT);
			BUTTON_SetBitmapEx(MonitCalibraButton,BUTTON_BI_UNPRESSED, &bmSys_moniter_xg, 0 ,0);
            BUTTON_SetBitmapEx(MonitCalibraButton,BUTTON_BI_PRESSED, &bmSys_moniter, 0 ,0); 
        
			SetDefaultButton = BUTTON_CreateEx(211, 44, 94, 94 ,hWin, WM_CF_SHOW, 0, SYS_BUTTON_DEFAULT);
			BUTTON_SetBitmapEx(SetDefaultButton,BUTTON_BI_UNPRESSED, &bmSys_default_xg, 0 ,0);
            BUTTON_SetBitmapEx(SetDefaultButton,BUTTON_BI_PRESSED, &bmSys_default, 0 ,0);   

			ReturnButton = BUTTON_CreateEx(116, 170, 94, 52, hWin, WM_CF_SHOW, 0, SYS_BUTTON_RETURN);
			BUTTON_SetBitmapEx(ReturnButton,BUTTON_BI_UNPRESSED, &bmSys_return_xg, 0 ,0);
            BUTTON_SetBitmapEx(ReturnButton,BUTTON_BI_PRESSED, &bmSys_return, 0 ,0);   

			break;
		case WM_KEY:
			/* 按下某个键后发送到当前包含焦点的窗口*/
            switch (((WM_KEY_INFO*)(pMsg->Data.p))->Key) 
            { 
				case GUI_KEY_ESCAPE:
                    GUI_EndDialog(hWin, 1);
                    break;
				case GUI_KEY_TAB:
					WM_SetFocusOnNextChild(hWin);
					break;
            }
            break;
		case WM_PAINT:
			GUI_SetBkColor(BK_COLOR_2);
			GUI_Clear();
			break;
		case WM_NOTIFY_PARENT:
			if (pMsg->Data.v == WM_NOTIFICATION_RELEASED) 
			{
				int Id = WM_GetId(pMsg->hWinSrc);
				switch (Id) 
				{
					case SYS_BUTTON_INFO:
						_DeleteFrame();
						_CreateFrame(&_cbSysInfo);
						break;
					case SYS_BUTTON_MONIT:				
                        /* ts_calibrate是属于是循环函数,关闭 TIM_TOUCH 避免不要
                           的扫描坐标,以免影响GUI的运行 */
                        TIM_Cmd(TIM_TOUCH,DISABLE); 
                        ts_calibrate();
                        _DeleteFrame();
                        _CreateFrame(&_cbSysSet);
                        TIM_Cmd(TIM_TOUCH,ENABLE);
						break;
					case SYS_BUTTON_WIFI:
					
						break;
					case SYS_BUTTON_DEFAULT:
						/* 增加对话框机制*/
                        _hWarningDlg = CreateSetDefaultWaring();
						break;
					case SYS_BUTTON_LANGUAGE:
					
						break;
					case SYS_BUTTON_RETURN:
						_DeleteFrame();
						_CreateFrame(&_cbIndex);						
						break;
				}
			}
			break;
		default:
		WM_DefaultProc(pMsg);
	}
}
Ejemplo n.º 22
0
/**
  * @brief  Callback function of the Camera frame
  * @param  pMsg: pointer to data structure of type WM_MESSAGE
  * @retval None
  */
static void _cbCameraWindow(WM_MESSAGE * pMsg)
{
  int     NCode;
  int     Id;
  WM_HWIN hItem;
    
  switch (pMsg->MsgId)
  {
    
  case WM_CREATE:
    if(HomeSettings.b.camera == CAM_1)
    {
      /* Title Initialization in play list */   
      hItem = TEXT_CreateEx(20, 30, 65, 24, pMsg->hWin, WM_CF_SHOW, 0, ID_CAM, "CAM 1");
      TEXT_SetFont(hItem, &GUI_FontLubalGraph24B);
      TEXT_SetTextColor(hItem, GUI_WHITE); 
    }
    else if(HomeSettings.b.camera == CAM_2)
    {
      /* Title Initialization in play list */   
      hItem = TEXT_CreateEx(20, 30, 65, 24, pMsg->hWin, WM_CF_SHOW, 0, ID_CAM, "CAM 2");
      TEXT_SetFont(hItem, &GUI_FontLubalGraph24B);
      TEXT_SetTextColor(hItem, GUI_WHITE); 
    }
    else if(HomeSettings.b.camera == CAM_3)
    {
      /* Title Initialization in play list */   
      hItem = TEXT_CreateEx(20, 30, 65, 24, pMsg->hWin, WM_CF_SHOW, 0, ID_CAM, "CAM 3");
      TEXT_SetFont(hItem, &GUI_FontLubalGraph24B);
      TEXT_SetTextColor(hItem, GUI_WHITE);
    }
    else if(HomeSettings.b.camera == CAM_4)
    {
      /* Title Initialization in play list */   
      hItem = TEXT_CreateEx(20, 30, 65, 24, pMsg->hWin, WM_CF_SHOW, 0, ID_CAM, "CAM 4");
      TEXT_SetFont(hItem, &GUI_FontLubalGraph24B);
      TEXT_SetTextColor(hItem, GUI_WHITE);
    }
    else
    {
      /* Title Initialization in play list */   
      hItem = TEXT_CreateEx(20, 30, 65, 24, pMsg->hWin, WM_CF_SHOW, 0, ID_CAM, "CAM 5");
      TEXT_SetFont(hItem, &GUI_FontLubalGraph24B);
      TEXT_SetTextColor(hItem, GUI_WHITE);      
    }  
    
    hItem = BUTTON_CreateEx(700, 0, 100, 100, pMsg->hWin, WM_CF_SHOW, 0, ID_BUTTON_MENU);
    WM_SetCallback(hItem, _cbButton_menu);     
    
    hItem = BUTTON_CreateEx(0, 379, 100, 100, pMsg->hWin, WM_CF_SHOW, 0, ID_BUTTON_EXIT_FROM_CAM);
    WM_SetCallback(hItem, _cbButton_exit1); 
    break;
    
  case WM_PAINT:
    if(HomeSettings.b.camera == CAM_1)
    {
      GUI_DrawBitmap(&bmcam1, 0, 0);      
    }
    else if(HomeSettings.b.camera == CAM_2)
    {
      GUI_DrawBitmap(&bmcam2, 0, 0);
    }
    else if(HomeSettings.b.camera == CAM_3)
    {
      GUI_DrawBitmap(&bmcam3, 0, 0);      
    }
    else if(HomeSettings.b.camera == CAM_4)
    {
      GUI_DrawBitmap(&bmcam4, 0, 0);      
    }
    else
    {
      GUI_DrawBitmap(&bmcam5, 0, 0);      
    }  
    GUI_SetColor(GUI_STCOLOR_LIGHTBLUE);
    GUI_AA_FillRoundedRect((-30), 10, 100, 75, 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_CAM: 
      switch(NCode) {
      case WM_NOTIFICATION_RELEASED:
        /* re-initialize the NOR pin*/
        GUI_EndDialog(pMsg->hWin, 0);
        WM_HideWindow(hCameraFrame);        
        WM_Exec();        
        WM_DeleteWindow(hCameraFrame);
        WM_InvalidateWindow(HOME_hWin);
        break;     
      }
      break;

    case ID_BUTTON_MENU: 
      switch(NCode) {
      case WM_NOTIFICATION_RELEASED:
        GUI_EndDialog(pMsg->hWin, 0);
        WM_DeleteWindow(hCameraFrame);
        WM_DeleteWindow(HOME_hWin);
        break;
      }
      break;
    }
    break;
    
  case WM_DELETE:
    break;
    
  default:
    WM_DefaultProc(pMsg);
  }
}
Ejemplo n.º 23
0
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;
  }      
}
Ejemplo n.º 24
0
/**
  * @brief  Callback routine of the video main dialog
  * @param  pMsg: pointer to a data structure of type WM_MESSAGE
  * @retval None
  */
static void _cbDialog(WM_MESSAGE * pMsg) {
  WM_HWIN  hItem;
  int Id, NCode;

  static uint8_t sel = 0;
  
  switch (pMsg->MsgId) {
  case WM_INIT_DIALOG:

    memset(Video_Path, 0, 256);   
    
    hItem = BUTTON_CreateEx(700, 0, 100, 100, pMsg->hWin, WM_CF_SHOW, 0, ID_BUTTON_EXIT);
    WM_SetCallback(hItem, _cbButton_exit); 
    
    hItem = ST_AnimatedIconView_CreateEx(120, 
                                         50, 
                                         LCD_GetXSize() - 220, 
                                         LCD_GetYSize() - 150, 
                                         pMsg->hWin, 
                                         WM_CF_SHOW | WM_CF_HASTRANS ,
                                         0,
                                         ID_ICONVIEW_SUBMENU, 
                                         240, 
                                         300, 100, 5);    
    
    
    ST_AnimatedIconView_SetDualFont(hItem, &GUI_FontLubalGraph24, &GUI_FontLubalGraph24);
    
    ST_AnimatedIconView_SetSpace(hItem, GUI_COORD_Y, 5);
    ST_AnimatedIconView_SetSpace(hItem, GUI_COORD_X, 25);
    ST_AnimatedIconView_SetFrame(hItem, GUI_COORD_Y, 10);
    ST_AnimatedIconView_SetFrame(hItem, GUI_COORD_X, 5);
    
    ST_AnimatedIconView_SetSel(hItem, -1);
    
    ST_AnimatedIconView_SetTextColor(hItem, ICONVIEW_CI_UNSEL, GUI_STCOLOR_LIGHTBLUE);
    ST_AnimatedIconView_SetBkColor(hItem, ICONVIEW_CI_UNSEL, GUI_WHITE);
    ST_AnimatedIconView_SetBkColor(hItem, ICONVIEW_CI_SEL, GUI_WHITE);
    
    ST_AnimatedIconView_SetDualTextColor(hItem, ICONVIEW_CI_SEL, GUI_STCOLOR_LIGHTBLUE, GUI_STCOLOR_DARKBLUE);  
    
    ST_AnimatedIconView_AddIcon(hItem, open_file, 0, "Play video");   
    ST_AnimatedIconView_AddIcon(hItem, add_video, 0, "Open playlist");    
    
    break;     

  case WM_PAINT: 
    GUI_SetColor(GUI_BLACK);
    GUI_DrawLine(799, 0, 799, 480);   

    break;
    
  case WM_NOTIFY_PARENT:
    Id    = WM_GetId(pMsg->hWinSrc);    /* Id of widget */
    NCode = pMsg->Data.v;               /* Notification code */   
    
    switch(Id) {
    case ID_BUTTON_EXIT: 
      switch(NCode) {
      case WM_NOTIFICATION_CLICKED:
        /* avoid icon view animation */
        hItem = WM_GetDialogItem(pMsg->hWin, ID_ICONVIEW_SUBMENU);
        WM_HideWindow(hItem);
        break;
        
      case WM_NOTIFICATION_MOVED_OUT:
        hItem = WM_GetDialogItem(pMsg->hWin, ID_ICONVIEW_SUBMENU);
        WM_ShowWindow(hItem);        
        break;
        
      case WM_NOTIFICATION_RELEASED:
        GUI_EndDialog(pMsg->hWin, 0);
        break;
      }
      break; 
      
      
    case ID_ICONVIEW_SUBMENU: 
      switch(NCode) {
      case WM_NOTIFICATION_RELEASED:      
        sel = ST_AnimatedIconView_GetSel(pMsg->hWinSrc);
        
        if(sel == 0)
        {
          if(VNC_IsRunning() == 0)
          {
            /* Playlist not empty, so start play first item */
            if(VideoList.ptr > 0)
            {  
              GUI_SetLayerVisEx (1, 1);
              GUI_SelectLayer(1); 
              playbackwin = WM_CreateWindowAsChild(0, 0, 800, 480, WM_GetDesktopWindowEx(1), WM_CF_SHOW, _cbplaybackwin , 0);
              WM_CreateWindowAsChild(100, 100, 600, 280, WM_GetDesktopWindowEx(1), WM_CF_SHOW | WM_CF_HASTRANS, _cbTouch , 0);             
              GUI_SelectLayer(0);
              _StartPlay(&hvideo, (char *)VideoList.file[0].name, &Video_File, 0, 0);
              VideoPlayer_State = VIDEO_PLAY;
              hFrame = WM_CreateWindowAsChild(0, 0, 800, 480,pMsg->hWin, WM_CF_SHOW, _cbVideoWindow , 0);    
              GUI_SelectLayer(1);
              
            }
            else 
            {/* There is no item yet in the playlist: Show hint message */
              hItem = GUI_CreateDialogBox(_aFileInfoDialogCreate, 
                                          GUI_COUNTOF(_aFileInfoDialogCreate), 
                                          _cbFileInfoDialog, 
                                          pMsg->hWin, 
                                          100, 50);
              WM_MakeModal(hItem);            
            }
          }
          else
          {
              hItem = GUI_CreateDialogBox(_aFileErrorDialogCreate, 
                                          GUI_COUNTOF(_aFileErrorDialogCreate), 
                                          _cbFileInfoDialog, 
                                          pMsg->hWin, 
                                          100, 50);
              WM_MakeModal(hItem);
          }
        }
        else if(sel == 1)
        {
            hPlaylistWin = GUI_CreateDialogBox(_aPlaylistDialogCreate, 
                                GUI_COUNTOF(_aPlaylistDialogCreate), 
                                _cbPlaylistDialog, 
                                pMsg->hWin, 
                                100, 50);
            WM_MakeModal(hPlaylistWin);
        }
        break;
      }
      break;
    }
    break;
  default:
    WM_DefaultProc(pMsg);
    break;
  }    
}
Ejemplo n.º 25
0
/**
  * @brief  Callback routine of the main dialog
  * @param  pMsg: pointer to data structure of type WM_MESSAGE
  * @retval None
  */
static void _cbDialog(WM_MESSAGE * pMsg) {
  WM_HWIN hItem;
  int Id, NCode;
  
  switch (pMsg->MsgId) {
  case WM_INIT_DIALOG:
    
    hItem = BUTTON_CreateEx(700, 0, 100,100, pMsg->hWin, WM_CF_SHOW, 0, ID_BUTTON_EXIT);
    WM_SetCallback(hItem, _cbButton_exit);

    hItem = BUTTON_CreateEx(50,  150, 180, 180, pMsg->hWin, WM_CF_SHOW, 0, ID_BUTTON_CONTROL);
    WM_SetCallback(hItem, _cbButton_control);     
      
    hItem = BUTTON_CreateEx(310, 140, 180, 180, pMsg->hWin, WM_CF_SHOW, 0, ID_BUTTON_SPRINKLERS);
    WM_SetCallback(hItem, _cbButton_sprinklers); 

    hItem = BUTTON_CreateEx(570, 140, 180,  180, pMsg->hWin, WM_CF_SHOW, 0, ID_BUTTON_DROWISE);
    WM_SetCallback(hItem, _cbButton_drowise);     

    /* Title Initialization in play list */
    hItem = WM_GetDialogItem(pMsg->hWin, ID_TEXT_CONTROL);
    TEXT_SetText(hItem, "main");
    TEXT_SetFont(hItem, &GUI_FontLubalGraph24B);
    TEXT_SetTextColor(hItem, GUI_STCOLOR_LIGHTBLUE);
	
    hItem = WM_GetDialogItem(pMsg->hWin, ID_TEXT_CONTROL2);
    TEXT_SetText(hItem, "control");
    TEXT_SetFont(hItem, &GUI_FontLubalGraph24B);
    TEXT_SetTextColor(hItem, GUI_STCOLOR_DARKBLUE);	
    
    hItem = WM_GetDialogItem(pMsg->hWin, ID_TEXT_CONTROL3);
    TEXT_SetText(hItem, "(on/off)");
    TEXT_SetFont(hItem, &GUI_FontLubalGraph24B);
    TEXT_SetTextColor(hItem, GUI_STCOLOR_DARKBLUE);			
		
    /* Title Initialization in play list */
    hItem = WM_GetDialogItem(pMsg->hWin, ID_TEXT_SPRINKLERS);
    TEXT_SetText(hItem, "sprinklers");
    TEXT_SetFont(hItem, &GUI_FontLubalGraph24B);
    TEXT_SetTextColor(hItem, GUI_STCOLOR_LIGHTBLUE);    
    
    /* Duration */
    hItem = WM_GetDialogItem(pMsg->hWin, ID_TEXT_DROWISE);
    TEXT_SetText(hItem, "dropwise");
    TEXT_SetFont(hItem, &GUI_FontLubalGraph24B);
    TEXT_SetTextColor(hItem, GUI_STCOLOR_DARKBLUE);

    break;     
    
  case WM_PAINT:
    
    break;     
  case WM_NOTIFY_PARENT:
    Id    = WM_GetId(pMsg->hWinSrc);    /* Id of widget */
    NCode = pMsg->Data.v;               /* Notification code */
    
    
    switch(Id) {
    case ID_BUTTON_EXIT: 
      switch(NCode) {
      case WM_NOTIFICATION_RELEASED:
        
        GUI_EndDialog(pMsg->hWin, 0);
        
        break;
      }
      break; 
    }
    break;
  default:
    WM_DefaultProc(pMsg);
    break;
  }    
}
Ejemplo n.º 26
0
/**
  * @brief  Callback routine of the dialog
  * @param  pMsg: pointer to a data structure of type WM_MESSAGE
  * @retval None
  */
static void _cbDialog(WM_MESSAGE * pMsg) {
  WM_HWIN  hItem;
  int Id, NCode;

  static uint8_t sel = 0;
  
  switch (pMsg->MsgId) {
  case WM_INIT_DIALOG:

    memset(Video_Path, 0, 256);   
    
    hItem = BUTTON_CreateEx(574, 0, 65, 65, pMsg->hWin, WM_CF_SHOW, 0, ID_BUTTON_EXIT);
    WM_SetCallback(hItem, _cbButton_exit); 
    
    hItem = ST_AnimatedIconView_CreateEx(100, 
                                         70, 
                                         LCD_GetXSize() - 0, 
                                         LCD_GetYSize() - 30, 
                                         pMsg->hWin, 
                                         WM_CF_SHOW | WM_CF_HASTRANS ,
                                         0,
                                         ID_ICONVIEW_SUBMENU, 
                                         200, 
                                         250, 5, 5);    
    
    
    ST_AnimatedIconView_SetDualFont(hItem, GUI_FONT_20_1, GUI_FONT_20_1);
    
    ST_AnimatedIconView_SetSpace(hItem, GUI_COORD_Y, 5);
    ST_AnimatedIconView_SetSpace(hItem, GUI_COORD_X, 25);
    ST_AnimatedIconView_SetFrame(hItem, GUI_COORD_Y, 10);
    ST_AnimatedIconView_SetFrame(hItem, GUI_COORD_X, 5);
    
    ST_AnimatedIconView_SetSel(hItem, -1);
    
    ST_AnimatedIconView_SetTextColor(hItem, ICONVIEW_CI_UNSEL, 0x00DCA939);
    ST_AnimatedIconView_SetBkColor(hItem, ICONVIEW_CI_UNSEL, GUI_WHITE);
    ST_AnimatedIconView_SetBkColor(hItem, ICONVIEW_CI_SEL, GUI_WHITE);
    
    ST_AnimatedIconView_SetDualTextColor(hItem, ICONVIEW_CI_SEL, 0x00DCA939, 0x00522000);  
    
    ST_AnimatedIconView_AddIcon(hItem, open_file, 0, "Play video");   
    ST_AnimatedIconView_AddIcon(hItem, add_video, 0, "Add to playlist");    
    
    break;     

  case WM_PAINT: 
    GUI_SetColor(GUI_BLACK);
    GUI_DrawLine(639, 0, 639, 480);   

    break;
    
  case WM_NOTIFY_PARENT:
    Id    = WM_GetId(pMsg->hWinSrc);    /* Id of widget */
    NCode = pMsg->Data.v;               /* Notification code */   
    
    switch(Id) {
    case ID_BUTTON_EXIT: 
      switch(NCode) {
      case WM_NOTIFICATION_RELEASED:
        GUI_EndDialog(pMsg->hWin, 0);
        break;
      }
      break; 
      
      
    case ID_ICONVIEW_SUBMENU: 
      switch(NCode) {
      case WM_NOTIFICATION_RELEASED:      
        sel = ST_AnimatedIconView_GetSel(pMsg->hWinSrc);
        
        if(sel == 0)
        {

          osDelay(100);  
          /* Playlist not empty, so start play first item */
          if(VideoList.ptr > 0)
          {  
            GUI_SetLayerVisEx (1, 1);
            GUI_SelectLayer(1); 
            playbackwin = WM_CreateWindowAsChild(-1, 0, 640, 480, WM_GetDesktopWindowEx(1), WM_CF_SHOW, _cbplaybackwin , 0);
            WM_CreateWindowAsChild(0, 70, 640, 300, WM_GetDesktopWindowEx(1), WM_CF_SHOW | WM_CF_HASTRANS, _cbTouch , 0);             
            GUI_SelectLayer(0);
            _StartPlay(&hvideo, (char *)VideoList.file[0].name, &Video_File, 0, 0);
            VideoPlayer_State = VIDEO_PLAY;
            hFrame = WM_CreateWindowAsChild(-1, 0, 640, 480,pMsg->hWin, WM_CF_SHOW, _cbVideoWindow , 0);    
            GUI_SelectLayer(1);
            
          }
          else
          {/* There is no item yet in the playlist: Show hint message */
            hItem = GUI_CreateDialogBox(_aFileInfoDialogCreate, 
                                GUI_COUNTOF(_aFileInfoDialogCreate), 
                                _cbFileInfoDialog, 
                                pMsg->hWin, 
                                100, 
                                80);
            WM_MakeModal(hItem);
          }
        }
        else /* Add file to playlist icon item action */
        {
            hItem = GUI_CreateDialogBox(_aPlaylistDialogCreate, 
                                GUI_COUNTOF(_aPlaylistDialogCreate), 
                                _cbPlaylistDialog, 
                                pMsg->hWin, 
                                100, 
                                80);
            WM_MakeModal(hItem);
        }
        break;
      }
      break;
    }
    break;
  default:
    WM_DefaultProc(pMsg);
    break;
  }    
}
Ejemplo n.º 27
0
void rank_dlg_do_init() {
  #define WIDTH_DLG     185
  #define HEIGHT_DLG    85

  #define WIDTH_B       65
  #define HEIGHT_B      20
  #define WIDTH_T       60
  #define HEIGHT_T      20
  #define WIDTH_COMP    65
  #define HEIGHT_COMP   20
  
  int x0 = (GUI_X_MAX - WIDTH_DLG) >> 1;
  int y0 = (GUI_Y_MAX - HEIGHT_DLG) >> 1;
  
  int x_b = 5;
  int y_b = HEIGHT_DLG - (HEIGHT_B + 5);
  int x_textLabel = x_b;
  int y_textLabel = 30;
  
  int x_components = WIDTH_T + 10;
  
  TEXT_Handle label;
  
  DROPDOWN_Handle typeDOListBox; //список для выбора вида дискр. выхода
  
  BUTTON_Handle ESC_Button_do_rank_dlg;
  BUTTON_Handle ENTER_Button_do_rank_dlg;
  
  rankDlgDOPg = FRAMEWIN_CreateEx(x0, y0, WIDTH_DLG, HEIGHT_DLG, 0, WM_CF_SHOW, 0, win_id_list[ID_RANK_DO_DLG], _rankDlgDOItem[0].pText[sel_language], _cbRankDlgWin);
  FRAMEWIN_SetFont(rankDlgDOPg, &GUI_FontArialBold14_8_Unicode);
  
  label = TEXT_CreateEx(x_textLabel, y_textLabel, WIDTH_T, HEIGHT_T, rankDlgDOPg, WM_CF_SHOW, 0, ID_RANK_DO_TEXT_LABEL, typeDOTextLabels[sel_language]);
  TEXT_SetFont(label, &GUI_FontArialBold14_8_Unicode);
  
  typeDOListBox = DROPDOWN_CreateEx(x_components, y_textLabel, WIDTH_COMP + 25, HEIGHT_COMP, rankDlgDOPg, WM_CF_SHOW, DROPDOWN_CF_AUTOSCROLLBAR, ID_RANK_DO_TYPE);
  DROPDOWN_SetFont(typeDOListBox, &GUI_FontArialStandard14_8_Unicode);
  DROPDOWN_SetBkColor(typeDOListBox, DROPDOWN_CI_UNSEL, GUI_GRAY);
  DROPDOWN_SetBkColor(typeDOListBox, DROPDOWN_CI_SEL, GUI_GRAY);
  DROPDOWN_SetBkColor(typeDOListBox, DROPDOWN_CI_SELFOCUS, GUI_BLUE);
  DROPDOWN_AddString(typeDOListBox, typesDO0[sel_language]);
  DROPDOWN_AddString(typeDOListBox, typesDO1[sel_language]);
  
  ESC_Button_do_rank_dlg = BUTTON_CreateEx(x_b, y_b, WIDTH_B, HEIGHT_B, rankDlgDOPg, WM_CF_SHOW, 0, ID_RANK_DO_DLGBUT_ESC);
  BUTTON_SetFont(ESC_Button_do_rank_dlg, &GUI_FontArialBold14_8_Unicode);
  BUTTON_SetText(ESC_Button_do_rank_dlg, "ESC");
  
  x_b = WIDTH_DLG - (WIDTH_B + 5);
  ENTER_Button_do_rank_dlg = BUTTON_CreateEx(x_b, y_b, WIDTH_B, HEIGHT_B, rankDlgDOPg, WM_CF_SHOW, 0, ID_RANK_DO_DLGBUT_ENTER);
  BUTTON_SetFont(ENTER_Button_do_rank_dlg, &GUI_FontArialBold14_8_Unicode);
  BUTTON_SetText(ENTER_Button_do_rank_dlg, "ENTER");
  
  WM_BringToTop(rankDlgDOPg);

  #undef WIDTH_DLG
  #undef HEIGHT_DLG

  #undef WIDTH_B
  #undef HEIGHT_B
  #undef WIDTH_T
  #undef HEIGHT_T
  #undef WIDTH_COMP
  #undef HEIGHT_COMP
}
Ejemplo n.º 28
0
/**
  * @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;
  }
}
Ejemplo n.º 29
0
/**
  * @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, hClient;
  int      NCode;
  int      Id, Index, newpos;
  GUI_RECT r;
  int  ItemNbr;
  int      result;  
  static char tmp[FILEMGR_FILE_NAME_SIZE];  
  
  switch (pMsg->MsgId) {
  case WM_INIT_DIALOG:

    
    pVideoList = (FILELIST_FileTypeDef *)k_malloc(sizeof(FILELIST_FileTypeDef));
    pFileInfo = (CHOOSEFILE_INFO *)k_malloc(sizeof(CHOOSEFILE_INFO));
    pVideoList->ptr = 0;
    
    
    PlayerSettings.d32 = k_BkupRestoreParameter(CALIBRATION_VIDEOPLAYER_SETTING_BKP);
    
    /* Initialization of 'Listview' */
    hItem = WM_GetDialogItem(pMsg->hWin, ID_VIDEO_LIST);
    LISTVIEW_AddColumn(hItem, 165, "Video", GUI_TA_VCENTER | GUI_TA_LEFT);
    LISTVIEW_SetGridVis(hItem, 0);
    LISTVIEW_SetAutoScrollV(hItem, 1);
    LISTVIEW_SetBkColor(hItem, LISTVIEW_CI_UNSEL, GUI_BLACK);
    LISTVIEW_SetTextColor(hItem, LISTVIEW_CI_UNSEL, GUI_CYAN);

    hItem = BUTTON_CreateEx( 240,  202, 35,  35, pMsg->hWin, WM_CF_SHOW, 0, ID_STOP_BUTTON);
    WM_SetCallback(hItem, _cbButton_stop);    
    
    hItem = BUTTON_CreateEx(92, 202, 35,  35, pMsg->hWin, WM_CF_SHOW, 0, ID_PREVIOUS_BUTTON);
    WM_SetCallback(hItem, _cbButton_previous);     
    
    hItem = BUTTON_CreateEx(137, 195, 50,  45, pMsg->hWin, WM_CF_SHOW, 0, ID_PLAY_BUTTON);
    WM_SetCallback(hItem, _cbButton_play);
    
    hItem = BUTTON_CreateEx(195, 202, 35,  35, pMsg->hWin, WM_CF_SHOW, 0, ID_NEXT_BUTTON);
    WM_SetCallback(hItem, _cbButton_next);
    
    hItem = BUTTON_CreateEx(47,  205, 30,  30, pMsg->hWin, WM_CF_SHOW, 0, ID_REPEAT_BUTTON);
    WM_SetCallback(hItem, _cbButton_repeat);
    
    hItem = BUTTON_CreateEx(315, 205, 70,  30, pMsg->hWin, WM_CF_SHOW, 0, ID_OPEN_BUTTON);
    WM_SetCallback(hItem, _cbButton_open); 

    hItem = BUTTON_CreateEx(375, 205, 70,  30, pMsg->hWin, WM_CF_SHOW, 0, ID_ADD_BUTTON);
    WM_SetCallback(hItem, _cbButton_add);    
    
    hItem = BUTTON_CreateEx(440,  202, 30,  30, pMsg->hWin, WM_CF_SHOW, 0, ID_CLOSE_BUTTON);
    WM_SetCallback(hItem, _cbButton_close);    
    
    hItem = BUTTON_CreateEx(281,  172, 25,  25, pMsg->hWin, WM_CF_SHOW, 0, ID_FULL_SCREEN_BUTTON);
    WM_SetCallback(hItem, _cbButton_fullscreen);      
    
    hClient = WM_GetClientWindow(pMsg->hWin);
    WM_GetClientRectEx(hClient, &r);
    hFrame = WM_CreateWindowAsChild(r.x0 + 5, r.y0 + 5, r.x1 - 179, r.y1 - 75, hClient, WM_CF_SHOW, _cbVideoWindow , 0);
    hItem = WM_GetDialogItem(pMsg->hWin, ID_PLAY_BUTTON);    
    
    hItem = WM_GetDialogItem(pMsg->hWin, ID_PROGRESS_SLIDER);
    SLIDER_SetNumTicks(hItem, 25);
    
    hItem = WM_CreateWindowAsChild(05,
                                   163,
                                   275,
                                   20,
                                   pMsg->hWin, 
                                   WM_CF_SHOW | WM_CF_HASTRANS | WM_CF_BGND,
                                   _cbDrawProgressSlider, 
                                   0);
    
     WM_CreateWindowAsChild(479, 250, 1, 1, pMsg->hWin, WM_CF_SHOW | WM_CF_HASTRANS, _cbMediaConnection , 0); 
    break;
    

    
  case WM_PAINT:
    
    DrawRect3D(05, 193, 300, 50);
    DrawRect3D(310, 193, 165, 50); 
    
    break;    
    
    
    
  case WM_TIMER:
    Id = WM_GetTimerId(pMsg->Data.v);
    if (Id == ID_PLAYLIST_TIMER)
    {
      playlist_select = 0;
    }    
    break; 
    
  case WM_DELETE:       
    k_BkupSaveParameter(CALIBRATION_VIDEOPLAYER_SETTING_BKP, PlayerSettings.d32);    
    WM_DeleteTimer(hPlaylistTimer);
    break;

    
case WM_NOTIFY_PARENT:
    Id    = WM_GetId(pMsg->hWinSrc);
    NCode = pMsg->Data.v;
    
    switch(Id) {
      
      /* Notification sent by "Close Button" */  
    case ID_FULL_SCREEN_BUTTON: 
      switch (NCode) {
      case WM_NOTIFICATION_RELEASED:
        if( VideoPlayer_State != VIDEO_IDLE)
        {
          _ShowFullScreen();
        }
        break;
      }
      break;
      
    /* Notifications sent by 'Add' Button */
    case ID_ADD_BUTTON: 
      switch(NCode) {
      case WM_NOTIFICATION_RELEASED:
        
        pFileInfo->pfGetData = k_GetData;
        pFileInfo->pMask = acMask_video;     
        hItem = CHOOSEFILE_Create(pMsg->hWin,  47, 10, 385, 215, apDrives, GUI_COUNTOF(apDrives), 0, "Add video file to playlist", 0, pFileInfo);        
        
        if(VideoPlayer_State == VIDEO_PLAY)
        {
          GUI_MOVIE_Pause(hMovie);
        } 
        WM_MakeModal(hItem);          
        result = GUI_ExecCreatedDialog(hItem);
        if (result == 0) 
        {     
          if((strstr(pFileInfo->pRoot, ".emf")) || (strstr(pFileInfo->pRoot, ".EMF")))
          {
            if(pVideoList->ptr < FILEMGR_LIST_DEPDTH)
            {
              strcpy((char *)pVideoList->file[pVideoList->ptr].name, pFileInfo->pRoot);
              FILEMGR_GetFileOnly ((char *)tmp, (char *)pFileInfo->pRoot);
              hItem = WM_GetDialogItem(pMsg->hWin, ID_VIDEO_LIST);
              
              LISTVIEW_AddRow(hItem, NULL);         
              LISTVIEW_SetItemText(hItem, 0, pVideoList->ptr, tmp);
              pVideoList->ptr++;
            }
          }
          
          WM_InvalidateWindow(hFrame);          
        }   
        if(VideoPlayer_State == VIDEO_PLAY)
        {
          GUI_MOVIE_Play(hMovie);  
        } 
        break;   
      }
      break;       
      
    /* Notifications sent by 'Open' Button */
    case ID_OPEN_BUTTON: 
      switch(NCode) {
      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);        
        if(VideoPlayer_State == VIDEO_PLAY)
        {
          GUI_MOVIE_Pause(hMovie);
        }
        WM_MakeModal(hItem);
        result = GUI_ExecCreatedDialog(hItem);
        if (result == 0) 
        {  
          _AddEntireFolder(pFileInfo->pRoot);
          
          WM_InvalidateWindow(hFrame);        
        }
        if(VideoPlayer_State == VIDEO_PLAY)
        {
          GUI_MOVIE_Play(hMovie);
        }
        break;
      }
      break;      
      
      /* Notification sent by "Full Screen button" */  
    case ID_CLOSE_BUTTON: 
      switch (NCode) {
      case WM_NOTIFICATION_RELEASED:
        k_free(pVideoList); 
        k_free(pFileInfo);   
        _StopPlay();
        GUI_EndDialog(pMsg->hWin, 0);
        break;
      }
      break;      
      
      /* Notification sent by "Play Button" */  
    case ID_PLAY_BUTTON: 
      switch(NCode) {
      case WM_NOTIFICATION_RELEASED:
        
        if(VideoPlayer_State == VIDEO_IDLE)
        {
          if (pVideoList->ptr > 0)
          {
            _StartPlay((char *)pVideoList->file[file_pos].name);
            LISTVIEW_SetSel(WM_GetDialogItem(VIDEOPLAYER_hWin, ID_VIDEO_LIST), file_pos);
          }
          else
          {
            pFileInfo->pfGetData = k_GetData;
            pFileInfo->pMask = acMask_video;     
            hItem = CHOOSEFILE_Create(pMsg->hWin,  47, 10, 385, 215, apDrives, GUI_COUNTOF(apDrives), 0, "Open a video file", 0, pFileInfo);
            WM_MakeModal(hItem);
            result = GUI_ExecCreatedDialog(hItem);
            if (result == 0) 
            {
              if((strstr(pFileInfo->pRoot, ".emf")) || (strstr(pFileInfo->pRoot, ".EMF")))
              {                   
                pVideoList->ptr = 0;
                
                strcpy((char *)pVideoList->file[pVideoList->ptr].name, pFileInfo->pRoot);
                FILEMGR_GetFileOnly (tmp, pFileInfo->pRoot);
                hItem = WM_GetDialogItem(pMsg->hWin, ID_VIDEO_LIST);
                
                /* Update Play list */
                strcpy((char *)pVideoList->file[pVideoList->ptr].name, pFileInfo->pRoot);
                
                ItemNbr = LISTVIEW_GetNumRows(hItem);
                while(ItemNbr--)
                {
                  LISTVIEW_DeleteRow(hItem, ItemNbr);
                }
                
                LISTVIEW_AddRow(hItem, NULL);         
                LISTVIEW_SetItemText(hItem, 0, pVideoList->ptr, tmp);
                pVideoList->ptr++;  
                file_pos = 0;
                LISTVIEW_SetSel(hItem, 0);
                _StartPlay((char *)pVideoList->file[file_pos].name);
                WM_InvalidateWindow(hFrame);
                
              }
            }
          }        
          
        }
        else if(VideoPlayer_State == VIDEO_PLAY)
        {
          _PausePlay();         
        }
        else if(VideoPlayer_State == VIDEO_PAUSE)
        {
          _ResumePlay();  
        }        
        break;
      }
      break;

    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;
      
    case ID_STOP_BUTTON:
      _StopPlay();  
      hItem = WM_GetDialogItem(VIDEOPLAYER_hWin, ID_PROGRESS_SLIDER);
      SLIDER_SetValue(hItem, 0);
      WM_InvalidateWindow(hFrame);
      break;
      
    case ID_NEXT_BUTTON: 
      switch(NCode) {
      case WM_NOTIFICATION_RELEASED:
        if(file_pos < (pVideoList->ptr - 1))
        {
          /* Play Next */
          file_pos++;
          LISTVIEW_IncSel(WM_GetDialogItem(VIDEOPLAYER_hWin, ID_VIDEO_LIST)); 
        }
        else if(PlayerSettings.b.repeat == REPEAT_ALL)
        {
          file_pos = 0; 
          LISTVIEW_SetSel(WM_GetDialogItem(VIDEOPLAYER_hWin, ID_VIDEO_LIST), file_pos);
        }           

        if(VideoPlayer_State == VIDEO_PLAY)
        {
          _StopPlay();
          _StartPlay((char *)pVideoList->file[file_pos].name);
          WM_InvalidateWindow(hFrame);
        }
        break;
      }
      break;
      
      
    case ID_PREVIOUS_BUTTON: 
      switch(NCode) {
      case WM_NOTIFICATION_RELEASED:
        
        if( pVideoList->ptr > 0)
        {
          if(file_pos > 0)
          {   
            file_pos--;
            LISTVIEW_DecSel(WM_GetDialogItem(VIDEOPLAYER_hWin, ID_VIDEO_LIST));             
          }
          else if(PlayerSettings.b.repeat == REPEAT_ALL)
          {
            file_pos = (pVideoList->ptr - 1); 
            LISTVIEW_SetSel(WM_GetDialogItem(VIDEOPLAYER_hWin, ID_VIDEO_LIST), file_pos);
          } 
          if(VideoPlayer_State == VIDEO_PLAY)
          {
            _StopPlay();
            _StartPlay((char *)pVideoList->file[file_pos].name);
            WM_InvalidateWindow(hFrame);
          }
        }    
        break;
        
      }
      break;
      
    /* Notifications sent by 'progress' Slider */
    case ID_PROGRESS_SLIDER: 
      if(NCode == WM_NOTIFICATION_CLICKED)
      {
        if(VideoPlayer_State != VIDEO_IDLE)
        {
          GUI_MOVIE_Pause(hMovie);
          hItem = WM_GetDialogItem(pMsg->hWin, ID_PROGRESS_SLIDER);
          newpos = (SLIDER_GetValue(hItem) * Video_Info.NumFrames)/100;
          GUI_MOVIE_GotoFrame(hMovie, newpos);
          if(VideoPlayer_State == VIDEO_PLAY)
          {
            GUI_MOVIE_Play(hMovie);
          }
        }
      }
      break;
      
    /* Notifications sent by 'ListView' Slider */
    case ID_VIDEO_LIST: 
      if(NCode == WM_NOTIFICATION_CLICKED)
      {
        hItem = WM_GetDialogItem(pMsg->hWin, ID_VIDEO_LIST);
        Index = LISTVIEW_GetSel(hItem);
        
        if(Index < pVideoList->ptr)
        {
          file_pos = Index;
          
          if(playlist_select == 0)
          {
            hPlaylistTimer = WM_CreateTimer(pMsg->hWin, 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 < pVideoList->ptr)
            {
              if(VideoPlayer_State != VIDEO_IDLE)
              {
                _StopPlay();
              } 
              
              _StartPlay((char *)pVideoList->file[Index].name); 
              hItem = WM_GetDialogItem(VIDEOPLAYER_hWin, ID_PLAY_BUTTON);
              WM_InvalidateWindow(hItem);
              WM_Update(hItem); 
              WM_InvalidateWindow(hFrame);
            }
          }
        }
      }
      break;   
    }
    break;
  default:
    WM_DefaultProc(pMsg);
    break;
  }
}
Ejemplo n.º 30
0
static void _cbDialog(WM_MESSAGE * pMsg) {
  WM_HWIN hItem;
  int Id, NCode;

  
  switch (pMsg->MsgId) {
  case WM_INIT_DIALOG:
    
    hItem = BUTTON_CreateEx(700, 0, 100, 100, pMsg->hWin, WM_CF_SHOW, 0, ID_BUTTON_EXIT);
    WM_SetCallback(hItem, _cbButton_exit);

    hItem = BUTTON_CreateEx(50, 40, 150, 135, pMsg->hWin, WM_CF_SHOW, 0, ID_BUTTON_CAMERA);
    WM_SetCallback(hItem, _cbButton_camera); 

    hItem = BUTTON_CreateEx(50, 235, 150,  135, pMsg->hWin, WM_CF_SHOW, 0, ID_BUTTON_ALARM);
    WM_SetCallback(hItem, _cbButton_alarm);
    
    hItem = BUTTON_CreateEx(410, 302, 100, 133, pMsg->hWin, WM_CF_SHOW, 0, ID_BUTTON_CAM1);
    WM_SetCallback(hItem, _cbButton_cam1); 

    hItem = BUTTON_CreateEx(510, 302, 180, 132, pMsg->hWin, WM_CF_SHOW, 0, ID_BUTTON_CAM2);
    WM_SetCallback(hItem, _cbButton_cam2); 

    hItem = BUTTON_CreateEx(510, 192, 180, 111, pMsg->hWin, WM_CF_SHOW, 0, ID_BUTTON_CAM3);
    WM_SetCallback(hItem, _cbButton_cam3); 

    hItem = BUTTON_CreateEx(510, 60, 180, 132, pMsg->hWin, WM_CF_SHOW, 0, ID_BUTTON_CAM4);
    WM_SetCallback(hItem, _cbButton_cam4); 

    hItem = BUTTON_CreateEx(240, 60, 270, 242, pMsg->hWin, WM_CF_SHOW, 0, ID_BUTTON_CAM5);
    WM_SetCallback(hItem, _cbButton_cam5); 

    hItem = BUTTON_CreateEx(240, 302, 170, 133, pMsg->hWin, WM_CF_SHOW, 0, ID_BUTTON_CAM5_1);
    WM_SetCallback(hItem, _cbButton_cam5_1); 
    
    /* Title Initialization in play list */
    hItem = WM_GetDialogItem(pMsg->hWin, ID_TEXT_CAMERA1);
    TEXT_SetText(hItem, "watch");
    TEXT_SetFont(hItem, &GUI_FontLubalGraph24B);
    TEXT_SetTextColor(hItem, GUI_STCOLOR_LIGHTBLUE);
	
    hItem = WM_GetDialogItem(pMsg->hWin, ID_TEXT_CAMERA2);
    TEXT_SetText(hItem, "room");
    TEXT_SetFont(hItem, &GUI_FontLubalGraph24B);
    TEXT_SetTextColor(hItem, GUI_STCOLOR_DARKBLUE);	
    
    hItem = WM_GetDialogItem(pMsg->hWin, ID_TEXT_ALARM1);
    TEXT_SetText(hItem, "room");
    TEXT_SetFont(hItem, &GUI_FontLubalGraph24B);
    TEXT_SetTextColor(hItem, GUI_STCOLOR_LIGHTBLUE);			
		
    /* Title Initialization in play list */
    hItem = WM_GetDialogItem(pMsg->hWin, ID_TEXT_ALARM2);
    TEXT_SetText(hItem, "alarm");
    TEXT_SetFont(hItem, &GUI_FontLubalGraph24B);
    TEXT_SetTextColor(hItem, GUI_STCOLOR_DARKBLUE);    
    
    /* Duration */
    hItem = WM_GetDialogItem(pMsg->hWin, ID_TEXT_ALARM3);
    TEXT_SetText(hItem, "(on/off)");
    TEXT_SetFont(hItem, &GUI_FontLubalGraph24B);
    TEXT_SetTextColor(hItem, GUI_STCOLOR_DARKBLUE); 
    break;     

  case WM_NOTIFY_PARENT:
    Id    = WM_GetId(pMsg->hWinSrc);    /* Id of widget */
    NCode = pMsg->Data.v;               /* Notification code */
    
    
    switch(Id) {
    case ID_BUTTON_EXIT: 
      switch(NCode) {
      case WM_NOTIFICATION_RELEASED:
        GUI_EndDialog(pMsg->hWin, 0);
        break;
      }
      break;
    case ID_BUTTON_ALARM: 
      switch(NCode) {
      case WM_NOTIFICATION_RELEASED:

        if(HomeSettings.b.alarm == ALARM_ON)
        {
          HomeSettings.b.alarm = ALARM_OFF;
        }
        else
        {
          HomeSettings.b.alarm = ALARM_ON;
        }
        
        hItem = WM_GetDialogItem(pMsg->hWin, ID_BUTTON_CAM1);
        WM_InvalidateWindow(hItem);
        WM_Update(hItem);    
        
        hItem = WM_GetDialogItem(pMsg->hWin, ID_BUTTON_CAM2);
        WM_InvalidateWindow(hItem);
        WM_Update(hItem);

        hItem = WM_GetDialogItem(pMsg->hWin, ID_BUTTON_CAM3);
        WM_InvalidateWindow(hItem);
        WM_Update(hItem);

        hItem = WM_GetDialogItem(pMsg->hWin, ID_BUTTON_CAM4);
        WM_InvalidateWindow(hItem);
        WM_Update(hItem);

        hItem = WM_GetDialogItem(pMsg->hWin, ID_BUTTON_CAM5);
        WM_InvalidateWindow(hItem);
        WM_Update(hItem);  
        
        hItem = WM_GetDialogItem(pMsg->hWin, ID_BUTTON_CAM5_1);
        WM_InvalidateWindow(hItem);
        WM_Update(hItem);        
        
        hItem = WM_GetDialogItem(pMsg->hWin, ID_BUTTON_CAMERA);
        WM_InvalidateWindow(hItem);
        WM_Update(hItem); 
        
        break;         
        
      }
      break;     


    case ID_BUTTON_CAMERA: 
      switch(NCode) {
      case WM_NOTIFICATION_RELEASED:

        if(HomeSettings.b.alarm == ALARM_ON)
        {
          if(HomeSettings.b.camera != CAM_DESACTIVATED)
          {      
            /* Camera frame initialization */            
            hCameraFrame = WM_CreateWindowAsChild(0, 0, 800, 480, pMsg->hWin,  WM_CF_SHOW | WM_CF_LATE_CLIP, _cbCameraWindow, 0);    
          }
        }     
        break;         
        
      }
      break;      
      
    case ID_BUTTON_CAM1: 
      switch(NCode) {
      case WM_NOTIFICATION_RELEASED:

        HomeSettings.b.camera = CAM_1;     
        
        hItem = WM_GetDialogItem(pMsg->hWin, ID_BUTTON_CAM2);
        WM_InvalidateWindow(hItem);
        WM_Update(hItem);    
        
        hItem = WM_GetDialogItem(pMsg->hWin, ID_BUTTON_CAM3);
        WM_InvalidateWindow(hItem);
        WM_Update(hItem);

        hItem = WM_GetDialogItem(pMsg->hWin, ID_BUTTON_CAM4);
        WM_InvalidateWindow(hItem);
        WM_Update(hItem);

        hItem = WM_GetDialogItem(pMsg->hWin, ID_BUTTON_CAM5);
        WM_InvalidateWindow(hItem);
        WM_Update(hItem);

        hItem = WM_GetDialogItem(pMsg->hWin, ID_BUTTON_CAM5_1);
        WM_InvalidateWindow(hItem);
        WM_Update(hItem);        
        
        hItem = WM_GetDialogItem(pMsg->hWin, ID_BUTTON_CAMERA);
        WM_InvalidateWindow(hItem);
        WM_Update(hItem); 
        
        break;
      }
      break; 
        
    case ID_BUTTON_CAM2: 
      switch(NCode) {
      case WM_NOTIFICATION_RELEASED:

        HomeSettings.b.camera = CAM_2;    
        
        hItem = WM_GetDialogItem(pMsg->hWin, ID_BUTTON_CAM1);
        WM_InvalidateWindow(hItem);
        WM_Update(hItem);    
        
        hItem = WM_GetDialogItem(pMsg->hWin, ID_BUTTON_CAM3);
        WM_InvalidateWindow(hItem);
        WM_Update(hItem);

        hItem = WM_GetDialogItem(pMsg->hWin, ID_BUTTON_CAM4);
        WM_InvalidateWindow(hItem);
        WM_Update(hItem);

        hItem = WM_GetDialogItem(pMsg->hWin, ID_BUTTON_CAM5);
        WM_InvalidateWindow(hItem);
        WM_Update(hItem);

        hItem = WM_GetDialogItem(pMsg->hWin, ID_BUTTON_CAM5_1);
        WM_InvalidateWindow(hItem);
        WM_Update(hItem);  
        
        hItem = WM_GetDialogItem(pMsg->hWin, ID_BUTTON_CAMERA);
        WM_InvalidateWindow(hItem);
        WM_Update(hItem); 
        
        break;
      }
      break;

    case ID_BUTTON_CAM3: 
      switch(NCode) {
      case WM_NOTIFICATION_RELEASED:

        HomeSettings.b.camera = CAM_3; 
        
        hItem = WM_GetDialogItem(pMsg->hWin, ID_BUTTON_CAM1);
        WM_InvalidateWindow(hItem);
        WM_Update(hItem);    
        
        hItem = WM_GetDialogItem(pMsg->hWin, ID_BUTTON_CAM2);
        WM_InvalidateWindow(hItem);
        WM_Update(hItem);

        hItem = WM_GetDialogItem(pMsg->hWin, ID_BUTTON_CAM4);
        WM_InvalidateWindow(hItem);
        WM_Update(hItem);

        hItem = WM_GetDialogItem(pMsg->hWin, ID_BUTTON_CAM5);
        WM_InvalidateWindow(hItem);
        WM_Update(hItem);

        hItem = WM_GetDialogItem(pMsg->hWin, ID_BUTTON_CAM5_1);
        WM_InvalidateWindow(hItem);
        WM_Update(hItem);         
        
        hItem = WM_GetDialogItem(pMsg->hWin, ID_BUTTON_CAMERA);
        WM_InvalidateWindow(hItem);
        WM_Update(hItem); 
        
        break;
      }
      break;

    case ID_BUTTON_CAM4: 
      switch(NCode) {
      case WM_NOTIFICATION_RELEASED:

        HomeSettings.b.camera = CAM_4;

        hItem = WM_GetDialogItem(pMsg->hWin, ID_BUTTON_CAM1);
        WM_InvalidateWindow(hItem);
        WM_Update(hItem);    
        
        hItem = WM_GetDialogItem(pMsg->hWin, ID_BUTTON_CAM2);
        WM_InvalidateWindow(hItem);
        WM_Update(hItem);

        hItem = WM_GetDialogItem(pMsg->hWin, ID_BUTTON_CAM3);
        WM_InvalidateWindow(hItem);
        WM_Update(hItem);

        hItem = WM_GetDialogItem(pMsg->hWin, ID_BUTTON_CAM5);
        WM_InvalidateWindow(hItem);
        WM_Update(hItem);

        hItem = WM_GetDialogItem(pMsg->hWin, ID_BUTTON_CAM5_1);
        WM_InvalidateWindow(hItem);
        WM_Update(hItem); 
        
        hItem = WM_GetDialogItem(pMsg->hWin, ID_BUTTON_CAMERA);
        WM_InvalidateWindow(hItem);
        WM_Update(hItem);         
        
        break;
      }
      break;

    case ID_BUTTON_CAM5: 
      switch(NCode) {
      case WM_NOTIFICATION_RELEASED:

        HomeSettings.b.camera = CAM_5;

        hItem = WM_GetDialogItem(pMsg->hWin, ID_BUTTON_CAM1);
        WM_InvalidateWindow(hItem);
        WM_Update(hItem);    
        
        hItem = WM_GetDialogItem(pMsg->hWin, ID_BUTTON_CAM2);
        WM_InvalidateWindow(hItem);
        WM_Update(hItem);

        hItem = WM_GetDialogItem(pMsg->hWin, ID_BUTTON_CAM3);
        WM_InvalidateWindow(hItem);
        WM_Update(hItem);

        hItem = WM_GetDialogItem(pMsg->hWin, ID_BUTTON_CAM4);
        WM_InvalidateWindow(hItem);
        WM_Update(hItem);

        hItem = WM_GetDialogItem(pMsg->hWin, ID_BUTTON_CAM5_1);
        WM_InvalidateWindow(hItem);
        WM_Update(hItem);         
        
        hItem = WM_GetDialogItem(pMsg->hWin, ID_BUTTON_CAMERA);
        WM_InvalidateWindow(hItem);
        WM_Update(hItem);         
        
        break;
      }
      break;

    case ID_BUTTON_CAM5_1: 
      switch(NCode) {
      case WM_NOTIFICATION_RELEASED:

        HomeSettings.b.camera = CAM_5;

        hItem = WM_GetDialogItem(pMsg->hWin, ID_BUTTON_CAM1);
        WM_InvalidateWindow(hItem);
        WM_Update(hItem);    
        
        hItem = WM_GetDialogItem(pMsg->hWin, ID_BUTTON_CAM2);
        WM_InvalidateWindow(hItem);
        WM_Update(hItem);

        hItem = WM_GetDialogItem(pMsg->hWin, ID_BUTTON_CAM3);
        WM_InvalidateWindow(hItem);
        WM_Update(hItem);

        hItem = WM_GetDialogItem(pMsg->hWin, ID_BUTTON_CAM4);
        WM_InvalidateWindow(hItem);
        WM_Update(hItem);

        hItem = WM_GetDialogItem(pMsg->hWin, ID_BUTTON_CAM5);
        WM_InvalidateWindow(hItem);
        WM_Update(hItem);           
        
        hItem = WM_GetDialogItem(pMsg->hWin, ID_BUTTON_CAMERA);
        WM_InvalidateWindow(hItem);
        WM_Update(hItem);         
        
        break;
      }
      break;        
      
    }
    break;
  default:
    WM_DefaultProc(pMsg);
    break;
  }    
}