Ejemplo n.º 1
0
/*********************************************************************
*
*       _cbDialogMain
*
* Function description
*   Callback routine of DialogMain
*/
static void _cbDialogMain(WM_MESSAGE * pMsg) {
  WM_HWIN hDlg;
  WM_HWIN hItem;
  int     Id;

  hDlg = pMsg->hWin;
  switch (pMsg->MsgId) {
  case WM_PAINT:
    break;
  case WM_INIT_DIALOG:
    //
    // Init progress bars
    //
    hItem = WM_GetDialogItem(hDlg, GUI_ID_PROGBAR0);
    WIDGET_SetEffect(hItem, &WIDGET_Effect_3D);
    _SetProgbarValue(GUI_ID_PROGBAR0, _aTemp1[GUI_COUNTOF(_aTemp1) - 1]);
    hItem = WM_GetDialogItem(hDlg, GUI_ID_PROGBAR1);
    WIDGET_SetEffect(hItem, &WIDGET_Effect_3D);
    _SetProgbarValue(GUI_ID_PROGBAR1, _aTemp2[GUI_COUNTOF(_aTemp2) - 1]);
    //
    // Init edit widgets
    //
    hItem = WM_GetDialogItem(hDlg, GUI_ID_EDIT0);
    EDIT_SetDecMode(hItem, _TempMin, 0, 999, 0, 0);
    WM_DisableWindow(hItem);
    hItem = WM_GetDialogItem(hDlg, GUI_ID_EDIT1);
    EDIT_SetDecMode(hItem, _TempMax, 0, 999, 0, 0);
    WM_DisableWindow(hItem);
    //
    // Init temperature window *
    //
    hItem = WM_GetClientWindow(WM_GetDialogItem(hDlg, ID_TEMPERATURE));
    _pcbCallbackTemperature = WM_SetCallback(hItem, _cbTemperature);
    _UpdateTextColors(hDlg);
    break;
  case WM_NOTIFY_PARENT:
    if (pMsg->Data.v == WM_NOTIFICATION_RELEASED) {
      Id = WM_GetId(pMsg->hWinSrc);      // Id of widget
      switch (Id) {
      case GUI_ID_BUTTON0:
        WM_SetFocus(_hDialogColor);
        GUI_SetOrg(0, 240);
        break;
      }
    }
    break;
  default:
    WM_DefaultProc(pMsg);
  }
}
Ejemplo n.º 2
0
/*********************************************************************
*
*       _InitDialogOrder
*/
static void _InitDialogOrder(WM_HWIN hWin) {
  WM_HWIN hItem;

  //
  // Init framewindow
  //
  FRAMEWIN_SetFont(hWin, &GUI_Font10_ASCII);
  FRAMEWIN_SetTitleHeight(hWin, 14);
  FRAMEWIN_SetMoveable(hWin, 1);
  //
  // Init edit widget
  //
  hItem = WM_GetDialogItem(hWin, GUI_ID_EDIT0);
  WM_DisableWindow(hItem);
  //
  // Init dropdown box color
  //
  hItem = WM_GetDialogItem(hWin, GUI_ID_DROPDOWN0);
  DROPDOWN_AddString(hItem, "Blue");
  DROPDOWN_AddString(hItem, "Green");
  DROPDOWN_AddString(hItem, "Red");
  DROPDOWN_SetBkColor(hItem, 1, GUI_WHITE);
  DROPDOWN_SetTextColor(hItem, 1, GUI_BLACK);
  //
  // Init dropdown box model
  //
  hItem = WM_GetDialogItem(hWin, GUI_ID_DROPDOWN1);
  DROPDOWN_AddString(hItem, "Navigation system");
  DROPDOWN_AddString(hItem, "CD Player");
  DROPDOWN_AddString(hItem, "Other ...");
  DROPDOWN_SetBkColor(hItem, 1, GUI_WHITE);
  DROPDOWN_SetTextColor(hItem, 1, GUI_BLACK);
}
void SWRB_WM_DisableWindow(WM_HWIN hWin, int id)
{
    WM_HWIN hItem;
    
    hItem = WM_GetDialogItem(hWin, id);
    WM_DisableWindow(hItem);
}
Ejemplo n.º 4
0
 //
 // en_able : enable or disable 
 //
 void botton_able(char able,int number)
 {
	 if(able)
	 {
	WM_EnableWindow(WM_GetDialogItem(current_handle,number));
	 }
	 else
	 {
	WM_DisableWindow(WM_GetDialogItem(current_handle,number));
	 }
 }
Ejemplo n.º 5
0
void all_button(char able,int max)
 {
	int i;
	for(i= GUI_ID_USER+1 ;i<max+1;i++)
	{
		if(able)
			WM_EnableWindow(WM_GetDialogItem(current_handle,i));
		else
			WM_DisableWindow(WM_GetDialogItem(current_handle,i));
	}
 }
Ejemplo n.º 6
0
void WidgetLock(WM_HWIN hWin,ELock_Unlock lock_unlock,int id_lenth,int id_base,int not_lock_id)
{
	int i;
	if(lock_unlock == LOCK)
		{
	WM_DisableWindow(hWin);
	for(i=0;i<id_lenth;i++){
		WM_DisableWindow(WM_GetDialogItem(hWin,id_base+i+1));
		}
	WM_EnableWindow(WM_GetDialogItem(hWin,not_lock_id));

	}else{
	WM_EnableWindow(hWin);
	for(i=0;i<id_lenth;i++)
		{
	WM_EnableWindow(WM_GetDialogItem(hWin,id_base+i+1));
	}

	}
}
Ejemplo n.º 7
0
/*******************************************************************
*
*       MainTask
*
********************************************************************
*/
void MainTask_AppMenu(void)
{
	WM_HWIN hWinMenu;

	GUI_Init();
	hWinMenu = WM_CreateWindow(0, 0, 320, 240, WM_CF_SHOW, _cbMenu, 0);
	WM_SetFocus(hWinMenu);
	WM_EnableMemdev(hWinMenu);

	while (!GUI_CheckCancel(APP_MainMenu))
	{
		GUI_Delay(10);
	}
	WM_DisableWindow(hWinMenu);
}
Ejemplo n.º 8
0
/*---------------------------------------------------------------------------*
 * Routine:     setNewButtonText
 *---------------------------------------------------------------------------*
 * Description:
 *      Applies the current mapping to the keys.
 * Inputs:
 *      WM_MESSAGE *pMsg -- message structure for current dialog.
 *      int aNCode -- Type of event received to process.
 *      int aID    -- not used.
 * Outputs:
 *      TBool -- EFalse is not problems, else ETrue.
 *---------------------------------------------------------------------------*/
static void setNewButtonText(WM_MESSAGE * pMsg, int aNCode, int aID)
{
     T_keyboardMapping *p = G_keypadCurrentMapping;
     WM_HWIN hitem;
         
     while(p->iID){
        hitem = WM_GetDialogItem(pMsg->hWin, p->iID);
        BUTTON_SetText(hitem, p->iTextOnButton);
        if ((p->iType == 0) || (p->iType & G_showKeys)) {
            WM_EnableWindow(hitem);
        } else {
            WM_DisableWindow(hitem);
        }
        p++;
     }
}
/*********************************************************************
*
*       _cbMain
*
* Purpose:
*   Callback routine of main window
*/
static void _cbMain(WM_MESSAGE * pMsg) {
  WM_HWIN hItem, hDlg;
  hDlg = pMsg->hWin;

  switch (pMsg->MsgId) {
  case WM_INIT_DIALOG:
    hItem = WM_GetDialogItem(hDlg, GUI_ID_TEXT0);
    TEXT_SetFont(hItem, &GUI_Font20B_ASCII);
    TEXT_SetTextAlign(hItem, GUI_TA_HCENTER);
    hItem = WM_GetDialogItem(hDlg, GUI_ID_MULTIPAGE0);
    _InitMultipage(hItem);
    hItem = WM_GetDialogItem(hDlg, GUI_ID_TREEVIEW0);
    _InitTreeview(hItem);
    hItem = WM_GetDialogItem(hDlg, GUI_ID_TREEVIEW1);
    WM_DisableWindow(hItem);
    break;
  case WM_PAINT:
    break;
  default:
    WM_DefaultProc(pMsg);
  }
}
/*********************************************************************
*
*       _cbCallback
*/
static void _cbCallback(WM_MESSAGE * pMsg) {
  WM_HWIN hDlg, hWinSrc, hItem;
  int Id, NCode, i;
  hWinSrc = pMsg->hWinSrc;
  hDlg = pMsg->hWin;
  switch (pMsg->MsgId) {
  case WM_INIT_DIALOG:
    WM_MakeModal(hDlg);
    FRAMEWIN_SetFont(hDlg, &GUI_Font24B_ASCII);
    FRAMEWIN_SetTextAlign(hDlg, GUI_TA_HCENTER);
    FRAMEWIN_SetClientColor(hDlg, GUI_YELLOW);
    for (i = 0; i < 4; i++) {
      hItem = WM_GetDialogItem(hDlg, GUI_ID_SLIDER0 + i);
      SLIDER_SetRange(hItem, 0, 999); 
      SLIDER_SetValue(hItem, _aSlider[i]);
      hItem = WM_GetDialogItem(hDlg, GUI_ID_EDIT0 + i);
      EDIT_SetDecMode(hItem, _aSlider[i], 0, 999, 0, 0);
      WM_DisableWindow(hItem);
    }
    break;
  case WM_NOTIFY_PARENT:
    Id    = WM_GetId(hWinSrc);                    /* Id of widget */
    NCode = pMsg->Data.v;                         /* Notification code */
    if (NCode == WM_NOTIFICATION_RELEASED) {      /* React only if released */
      if (Id == GUI_ID_OK) {                      /* OK Button */
        GUI_EndDialog(hDlg, 0);
        WM_SetFocus(_hPrevWin);
      }
    }
    if (NCode == WM_NOTIFICATION_VALUE_CHANGED) {
      _OnValueChanged(hDlg, Id);
    }
    break;

  default:
    WM_DefaultProc(pMsg);
  }
}
Ejemplo n.º 11
0
/*********************************************************************
*
*       _cbCallback
*/
static void _cbCallback(WM_MESSAGE * pMsg) {
  WM_HWIN hDlg;
  WM_HWIN hItem;
  int     Sel;
  int     NCode;
  int     Id;

  GUI_PID_STATE * pState;
  hDlg = pMsg->hWin;
  switch (pMsg->MsgId) {
    case WM_INIT_DIALOG:
      hItem = WM_GetDialogItem(hDlg, GUI_ID_EDIT0);
      EDIT_SetDecMode(hItem, 30,   0, 999, 0, 0);    // Select decimal mode
      WM_DisableWindow(hItem);
      break;
    case WM_KEY:
      switch (((WM_KEY_INFO*)(pMsg->Data.p))->Key) {
        case GUI_KEY_ESCAPE:
          GUI_EndDialog(hDlg, 1);
          break;
        case GUI_KEY_ENTER:
          GUI_EndDialog(hDlg, 0);
          break;
      }
      break;
    case WM_TOUCH_CHILD:
      Id = WM_GetId(pMsg->hWinSrc);      // Id of widget
      switch (Id) {
        case GUI_ID_TEXT0:
        case GUI_ID_TEXT1:
        case GUI_ID_TEXT2:
          pState = (GUI_PID_STATE *)((WM_MESSAGE *)pMsg->Data.p)->Data.p;
          if (pState) {
            if (pState->Pressed) {
              WM_HWIN hRadio = WM_GetDialogItem(hDlg, GUI_ID_RADIO0);
              RADIO_SetValue(hRadio, Id - GUI_ID_TEXT0);    // Use the text beside the radio button to 
                                                            // set the value of the radio button
            }
          }
          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_OK:
              GUI_EndDialog(hDlg, 0);
              break;
            case GUI_ID_CANCEL:
              GUI_EndDialog(hDlg, 1);
              break;
          }
          break;
        case WM_NOTIFICATION_VALUE_CHANGED:
          hItem = WM_GetDialogItem(hDlg, GUI_ID_RADIO0);
          Sel   = RADIO_GetValue(hItem);
          hItem = WM_GetDialogItem(hDlg, GUI_ID_EDIT0);
          WM_SetEnableState(hItem, Sel == 2);      
          break;
      }
      break;
    default:
      WM_DefaultProc(pMsg);
  }
}
Ejemplo n.º 12
0
static void _cbDialog(WM_MESSAGE * pMsg) {
  WM_HWIN hItem;
  int     NCode;
  int     Id;
  int     key_num;
  u8      tmp[16];
  key_num=((WM_KEY_INFO *)(pMsg->Data.p))->Key;

   
  // USER START (Optionally insert additional variables)
  // USER END

  switch (pMsg->MsgId) 
  {
      case WM_INIT_DIALOG:
        //
        // Initialization of 'freq'
        //
        hItem = WM_GetDialogItem(pMsg->hWin, ID_EDIT_0);
        sprintf(tmp, "%d", g_rom_para.auto_sleep_time);
        EDIT_SetText(hItem, tmp);
        WM_DisableWindow(hItem);

        hItem = WM_GetDialogItem(pMsg->hWin, ID_EDIT_1);
        sprintf(tmp, "%d", g_rom_para.auto_shutdown_time);
        EDIT_SetText(hItem, tmp);
        WM_DisableWindow(hItem);

        hItem = WM_GetDialogItem(pMsg->hWin,ID_BUTTON_0);
        BUTTON_SetBkColor(hItem,0,GUI_GREEN);
        WIDGET_AndState(hItem,WIDGET_STATE_FOCUSSABLE);

        hItem = WM_GetDialogItem(pMsg->hWin,ID_BUTTON_1);
        BUTTON_SetBkColor(hItem,0,GUI_YELLOW);
        WIDGET_AndState(hItem,WIDGET_STATE_FOCUSSABLE);

        hItem = WM_GetDialogItem(pMsg->hWin,ID_BUTTON_2);
        BUTTON_SetBkColor(hItem,0,GUI_CYAN);
        WIDGET_AndState(hItem,WIDGET_STATE_FOCUSSABLE);

        hItem = WM_GetDialogItem(pMsg->hWin,ID_BUTTON_3);
        BUTTON_SetBkColor(hItem,0,GUI_CYAN);
        WIDGET_AndState(hItem,WIDGET_STATE_FOCUSSABLE);

       //PUB_InitFreq(pMsg,ID_EDIT_1);
        
        break;
      // USER START (Optionally insert additional message handling)
      // USER END
      case WM_KEY:
        Id = WM_GetId(pMsg->hWinSrc);
        if(((WM_KEY_INFO*)(pMsg->Data.p))->PressedCnt == 1)
        {
            switch(((WM_KEY_INFO *)(pMsg->Data.p))->Key)
            {
                case GUI_KEY_GREEN:
                   //WM_DeleteWindow(g_hWin_AdvanSet);
                   //WM_SetFocus(g_hWin_para);
                   WM_DeleteWindow(g_hWin_AdvanSet);
                   g_hWin_AdvanSet = HBWIN_NULL;
                   WM_SetFocus(g_hWin_para);
                   ads_press_cnt = 0;
                    break;
                    
                case GUI_KEY_YELLOW:
                   WM_DeleteWindow(g_hWin_AdvanSet);
                   g_hWin_AdvanSet = HBWIN_NULL;
                   WM_SetFocus(g_hWin_para);
                   ads_press_cnt = 0;
                   g_gui_para.state = GUI_STATE_IDLE;
                   break;

                case GUI_KEY_F2:
                    if(SYS_BEEP_ON == g_rom_para.beep_switch)
                    {
                         g_rom_para.beep_switch = SYS_BEEP_OFF;
                    }
                    else 
                    {
                         g_rom_para.beep_switch = SYS_BEEP_ON;
                    }
                    
                    DEV_Parameters_Write();
                    break;

                case GUI_KEY_F1:
                    ERR_NOTE(g_hWin_AdvanSet,GUI_MSBOX_RESET_ERROR);
                    break;
                    
#if 0
                case GUI_KEY_TAB:
                        ADS_Color_Change();
                    break;
#endif
                case GUI_KEY_UP:
                    ADS_SelEdt_Up(pMsg);
                    //ADS_Color_Change();
                    GUI_Color_Change(g_hWin_AdvanSet, ID_EDIT_0, 2);
                    break;

                case GUI_KEY_DOWN:
                    ADS_SelEdt_Down(pMsg);
                    //ADS_Color_Change();
                    GUI_Color_Change(g_hWin_AdvanSet, ID_EDIT_0, 2);
                    break;
                case GUI_KEY_ENTER:
                    switch(Id)
                    {
#if 0
                        case ID_EDIT_0:
                           g_hWin_freq = CreateSpeed(g_hWin_AdvanSet);
                           break;
#endif
                        case ID_EDIT_1:
                            g_sys_ctrl.selectWidget=EDIT_SHUTDOWN_TIME;
                            g_hWin_Input=Create_Edit_Set(g_hWin_para);
                            WM_SetFocus(g_hWin_Input);
 
                            break;
                        case ID_EDIT_0:
                            g_sys_ctrl.selectWidget=EDIT_SLEEP_TIME;
                            g_hWin_Input=Create_Edit_Set(g_hWin_para);
                            WM_SetFocus(g_hWin_Input);
                            break;
                    }
                    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
/**
  * @brief  Callback function of the media connection status
  * @param  pMsg: pointer to data structure of type WM_MESSAGE
  * @retval None
  */
static void _cbMediaConnection(WM_MESSAGE * pMsg) 
{
  WM_HWIN hItem;
  static WM_HTIMER      hStatusTimer;  
  static uint8_t        prev_usb_status = 0;
  
  switch (pMsg->MsgId) 
  {
  case WM_CREATE:
    prev_usb_status = k_StorageGetStatus(USB_DISK_UNIT);    
    hStatusTimer = WM_CreateTimer(pMsg->hWin, 0, 500, 0); 
    
    break;
    
  case WM_TIMER:
    if(prev_usb_status != k_StorageGetStatus(USB_DISK_UNIT))
    {
      prev_usb_status = k_StorageGetStatus(USB_DISK_UNIT);
      if(prev_usb_status == 0)
      {
        if( RecorderMode == RECORDER_MODE_RECORDING)
        {
          AUDIO_RECORDER_StopRec();
        }
        
        else if( RecorderMode == RECORDER_MODE_PLAYING)
        {
          AUDIO_RECORDER_StopPlayer();
        }
        
        hItem = WM_GetDialogItem(hMainWin, ID_FILENAMECAPTION);
        TEXT_SetText(hItem, ">>>");   
        hItem = WM_GetDialogItem(hMainWin, ID_FILENAME);
        TEXT_SetText(hItem, "USB NOT ready");
        
        RecorderMode = RECORDER_MODE_REC_DISABLED;
        
        hItem = WM_GetDialogItem(hMainWin, ID_RECORD_STOP);
        WM_DisableWindow(hItem);
        WM_Update(hItem);
        
        hItem = WM_GetDialogItem(hMainWin, ID_RECORD_REC_CANCEL_PLAY);
        WM_DisableWindow(hItem);
        WM_Update(hItem);
        
        hItem = WM_GetDialogItem(hMainWin, ID_RECORD_PAUSE);
        WM_DisableWindow(hItem); 
        WM_Update(hItem);
      }
      else
      {
        
        hItem = WM_GetDialogItem(hMainWin, ID_FILENAMECAPTION);
        TEXT_SetText(hItem, "Press");   
        hItem = WM_GetDialogItem(hMainWin, ID_FILENAME);
        TEXT_SetText(hItem, "[Record] to start");
        
        RecorderMode = RECORDER_MODE_REC_IDLE;
        
        hItem = WM_GetDialogItem(hMainWin, ID_RECORD_STOP);
        WM_EnableWindow(hItem);
        WM_Update(hItem);        
        
        hItem = WM_GetDialogItem(hMainWin, ID_RECORD_REC_CANCEL_PLAY);
        WM_EnableWindow(hItem);
        WM_Update(hItem);
        
        hItem = WM_GetDialogItem(hMainWin, ID_RECORD_PAUSE);
        WM_EnableWindow(hItem); 
        WM_Update(hItem);        
      }
    }
    WM_RestartTimer(pMsg->Data.v, 500);
    break;
    
  case WM_DELETE:
    if(hStatusTimer != 0)
    {
      WM_DeleteTimer(hStatusTimer);
      hStatusTimer = 0;
    }
    break;   
    
  default:
    WM_DefaultProc(pMsg);
  }
}
void Button_SetDisable(WM_HWIN hWin, int buttonId)
{
    WM_HWIN hItem;
    hItem = WM_GetDialogItem(hWin, buttonId);
    WM_DisableWindow(hItem);
}
Ejemplo n.º 16
0
/*********************************************************************
*
*       _cbDialog
*/
static void _cbDialog(WM_MESSAGE * pMsg) {
  WM_HWIN hItem;
  int     NCode;
  int     Id;
  int     key_num;
  // USER START (Optionally insert additional variables)
  // USER END
  int i;
  switch (pMsg->MsgId) {
  case WM_INIT_DIALOG:
    //
    // Initialization of 'Edit'
    //
    GUI_UC_SetEncodeUTF8();

#if 1   
    hItem=WM_GetDialogItem(pMsg->hWin,ID_BUTTON_2);
    BUTTON_SetBkColor(hItem,0,GUI_GREEN);
    WIDGET_AndState(hItem,WIDGET_STATE_FOCUSSABLE);
#endif

    hItem=WM_GetDialogItem(pMsg->hWin,ID_BUTTON_3);
    BUTTON_SetBkColor(hItem,0,GUI_YELLOW);
    WIDGET_AndState(hItem,WIDGET_STATE_FOCUSSABLE);

    hItem=WM_GetDialogItem(pMsg->hWin,ID_BUTTON_4);
    BUTTON_SetBkColor(hItem,0,GUI_CYAN);
    WIDGET_AndState(hItem,WIDGET_STATE_FOCUSSABLE);


    hItem=WM_GetDialogItem(pMsg->hWin,ID_BUTTON_1);
    WIDGET_AndState(hItem,WIDGET_STATE_FOCUSSABLE);
    BUTTON_SetBkColor(hItem,0,GUI_CYAN);
    
    hItem=WM_GetDialogItem(pMsg->hWin,ID_BUTTON_0);
    BUTTON_SetBkColor(hItem,0,GUI_CYAN);
    WIDGET_AndState(hItem,WIDGET_STATE_FOCUSSABLE);
    
    hItem = WM_GetDialogItem(pMsg->hWin, ID_EDIT_0);
    WM_DisableWindow(hItem);
    EDIT_SetText(hItem, (const char *)GUI_hex2MeterAddrStr(g_sys_ctrl.recentMeterAddr, 6));

    for(i = 0;i < 5; i++)
    {
        hItem=WM_GetDialogItem(pMsg->hWin,(ID_EDIT_3+i));
        EDIT_SetText(hItem, "0");
        WIDGET_AndState(hItem,WIDGET_STATE_FOCUSSABLE);
        WM_DisableWindow(hItem);
    }
    
    PUB_InitFreq(pMsg,ID_EDIT_2);
    hItem = WM_GetDialogItem(pMsg->hWin,ID_EDIT_2);
    WM_DisableWindow(hItem);
    
    hItem = WM_GetDialogItem(pMsg->hWin, ID_EDIT_1);

    if(DL645_2007 == g_rom_para.protocol)
    {   
        //EDIT_SetText(hItem, pReadSel_07[g_sys_ctrl.data_item_index]);
        EDIT_SetText(hItem, pReadSel_07[0]);
        
        memcpy(g_gui_para.dataItem,
            &c_645dataItemDef[g_rom_para.protocol][0],
            4);
        
        g_gui_para.ctrlCode=0x11;
    }
    else if(DL645_1997 == g_rom_para.protocol)
    {
        //EDIT_SetText(hItem, pReadSel_97[g_sys_ctrl.data_item_index]);
        EDIT_SetText(hItem, pReadSel_97[0]);
        
        memcpy(g_gui_para.dataItem,
            &c_645dataItemDef[g_rom_para.protocol][0],
            2);
        g_gui_para.ctrlCode=0x01; 

    }
    
    WM_DisableWindow(hItem);

    hItem = WM_GetDialogItem(pMsg->hWin, ID_PROGBAR_0);
    PROGBAR_SetBarColor(hItem,0,GUI_GREEN);
   
    break;

  case WM_KEY:
    Id  = WM_GetId(pMsg->hWinSrc);
    if((((WM_KEY_INFO*)(pMsg->Data.p))->PressedCnt) == 1)
    {
        switch(((WM_KEY_INFO*)(pMsg->Data.p))->Key)
        {
            case GUI_KEY_YELLOW:
                WM_DeleteWindow(g_hWin_ReadMeter);
                g_hWin_ReadMeter=HBWIN_NULL;
                WM_BringToBottom(g_hWin_msg);
                WM_HideWindow(g_hWin_msg);
                WM_ShowWindow(g_hWin_TimeBar);
                WM_ShowWindow(g_hWin_Date);
                WM_SetFocus(g_hWin_menu);
                RMD_key_cnt = 0;
                g_gui_para.state = GUI_STATE_IDLE;
                break;

            case GUI_KEY_GREEN:
                g_hWin_MeterTime = CreateExtFnct();
                hItem = MTD_GetMeterAddr();
                WM_SetFocus(hItem);
                MTD_SetAddrBkColor(hItem);
                
                
                break;
                
            case GUI_KEY_F1: /*获取表号*/
                if(CHANNEL_RF != g_rom_para.channel)
                {
                    g_gui_para.ctrlCode = 0x13;
                    g_gui_para.cmd = GUI_CMD_BROAD_READ_ADDR;
                    g_gui_para.state = GUI_STATE_AMR;                        
                    OSMboxPost(g_sys_ctrl.up_mbox, (void*)&g_gui_para);
                }
                else 
                {
                    ERR_NOTE(g_hWin_ReadMeter,GUI_MSBOX_FUN_DISALE_ERROR);
                }
                break;
                
            case '#':
                WM_BringToTop(g_hWin_msg);
                WM_ShowWindow(g_hWin_msg);                    
                WM_SetFocus(g_hWin_msg);
                break;
                
            case GUI_KEY_F2:  /*抄表*/              
                if(DEV_OK == RMD_Get_Para(pMsg))//获取参数数据
                {
                    g_gui_para.state = GUI_STATE_AMR;
                    OSMboxPost(g_sys_ctrl.up_mbox, (void*)&g_gui_para);
                }
                break;

            case GUI_KEY_UP:
                RMD_SelEdt_Up(pMsg);
                //RMD_Color_Change();
                GUI_Color_Change(g_hWin_ReadMeter, ID_EDIT_0, 3);
                break;

            case GUI_KEY_DOWN:
                RMD_SelEdt_Down(pMsg);
                //RMD_Color_Change();
                GUI_Color_Change(g_hWin_ReadMeter, ID_EDIT_0, 3);
                break;
            case GUI_KEY_ENTER:
                switch(Id)
                {
                    case ID_EDIT_0:
                        g_sys_ctrl.selectWidget=EDIT_METER_NUM;
                        g_hWin_Input=Create_Edit_Set(g_hWin_ReadMeter);
                        WM_SetFocus(g_hWin_Input);
                        break;
                    case ID_EDIT_1:
                        g_sys_ctrl.selectWidget=LISTBOX_READ_SEL;
                        g_hWin_Input=Create_ListBox_Set(g_hWin_ReadMeter);
                        WM_SetFocus(g_hWin_Input);
                        break;
                        
                    case ID_EDIT_2:
                        //g_sys_ctrl.selectWidget=LISTBOX_SPEED;
                        //g_hWin_Input=Create_ListBox_Set(g_hWin_ReadMeter);
                        //WM_SetFocus(g_hWin_Input);
                        g_hWin_freq = CreateSpeed(g_hWin_ReadMeter);
                        //WM_SetFocus(g_hWin_freq);
                         break;
                 }
       }
    }
    break;
#if 0
    if((((WM_KEY_INFO*)(pMsg->Data.p))->PressedCnt)==1)//按键点击。
    {
        switch(Id)
        {
          case ID_EDIT_0:
            if(key_num==GUI_KEY_ENTER)
            {
              g_sys_ctrl.selectWidget=EDIT_METER_NUM;
              g_hWin_Input=Create_Edit_Set(g_hWin_ReadMeter);
              WM_SetFocus(g_hWin_Input);
            }
            break;
          case ID_EDIT_1:
            if(key_num==GUI_KEY_ENTER)
            {
              g_sys_ctrl.selectWidget=LISTBOX_READ_SEL;
              g_hWin_Input=Create_ListBox_Set(g_hWin_ReadMeter);
              WM_SetFocus(g_hWin_Input);
            }
            break;
            
          case ID_EDIT_2:
            if(key_num==GUI_KEY_ENTER)
            {
              //g_sys_ctrl.selectWidget=LISTBOX_SPEED;
              //g_hWin_Input=Create_ListBox_Set(g_hWin_ReadMeter);
              //WM_SetFocus(g_hWin_Input);
              g_hWin_freq = CreateSpeed(g_hWin_ReadMeter);
              //WM_SetFocus(g_hWin_freq);
            }
            break;
        }
    }

                
    switch(((WM_KEY_INFO *)(pMsg->Data.p))->Key)
    {
        case GUI_KEY_YELLOW:
            if((((WM_KEY_INFO*)(pMsg->Data.p))->PressedCnt)==1)
            {
                WM_DeleteWindow(g_hWin_ReadMeter);
                g_hWin_ReadMeter=HBWIN_NULL;
                WM_BringToBottom(g_hWin_msg);
                WM_HideWindow(g_hWin_msg);
                WM_ShowWindow(g_hWin_TimeBar);
                WM_ShowWindow(g_hWin_Date);
                WM_SetFocus(g_hWin_menu);
                RMD_key_cnt = 0;
                g_gui_para.state = GUI_STATE_IDLE;
            }
            break;
            
        case GUI_KEY_F1: /*获取表号*/
            if((((WM_KEY_INFO*)(pMsg->Data.p))->PressedCnt)==0)
            {
                if(CHANNEL_RF != g_rom_para.channel)
                {
                    g_gui_para.cmd = GUI_CMD_BROAD_READ_ADDR;
                    g_gui_para.state = GUI_STATE_AMR;                        
                    OSMboxPost(g_sys_ctrl.up_mbox, (void*)&g_gui_para);
                }
            }
            break;
            
        case '#':
            if((((WM_KEY_INFO*)(pMsg->Data.p))->PressedCnt)==0)
            {
                 WM_BringToTop(g_hWin_msg);
                 WM_ShowWindow(g_hWin_msg);                    
                 WM_SetFocus(g_hWin_msg);
            }
            break;
            
        case GUI_KEY_F2:  /*抄表*/              
            if((((WM_KEY_INFO*)(pMsg->Data.p))->PressedCnt)==0)
            {
                if(DEV_OK == RMD_Get_Para(pMsg))//获取参数数据
                {
                    g_gui_para.state = GUI_STATE_AMR;
                    OSMboxPost(g_sys_ctrl.up_mbox, (void*)&g_gui_para);
                }
            }
       
            break;

        case GUI_KEY_UP:
            if((((WM_KEY_INFO*)(pMsg->Data.p))->PressedCnt)==0)
            {
                RMD_SelEdt_Up(pMsg);
                //RMD_Color_Change();
            }
            break;

        case GUI_KEY_DOWN:
            if((((WM_KEY_INFO*)(pMsg->Data.p))->PressedCnt)==0)
            {
                RMD_SelEdt_Down(pMsg);
                //RMD_Color_Change();
                GUI_Color_Change(g_hWin_ReadMeter, ID_EDIT_0, 3);
            }
            break;
        case GUI_KEY_TAB:
            if((((WM_KEY_INFO*)(pMsg->Data.p))->PressedCnt)==0)
            {
                //RMD_Sel_Down(pMsg);
                RMD_Color_Change();
            }
            break;
#endif

  case WM_MSG_CLOSE:
    WM_DeleteWindow(g_hWin_ReadMeter);
	break;
    
  default:
    WM_DefaultProc(pMsg);
    break;
  }
}

/*********************************************************************
*
*       CreateReadMeter
*/
WM_HWIN CreateReadMeter(void);
WM_HWIN CreateReadMeter(void) {
  WM_HWIN hWin;

  hWin = GUI_CreateDialogBox(_aDialogCreate, GUI_COUNTOF(_aDialogCreate), _cbDialog, g_hWin_menu, 0, 0);
  return hWin;
}
Ejemplo n.º 17
0
/*********************************************************************
*
*       _cbCallback
*/
static void _cbCallback(WM_MESSAGE * pMsg) {
  int NCode, Id;
  WM_HWIN hEdit0, hEdit1, hEdit2, hEdit3, hListBox, hDropd0, hDropd1;
  WM_HWIN hWin = pMsg->hWin;
  switch (pMsg->MsgId) {
    case WM_INIT_DIALOG:
      /* Get window handles for all widgets */
      hEdit0   = WM_GetDialogItem(hWin, GUI_ID_EDIT0);
      hEdit1   = WM_GetDialogItem(hWin, GUI_ID_EDIT1);
      hEdit2   = WM_GetDialogItem(hWin, GUI_ID_EDIT2);
      hEdit3   = WM_GetDialogItem(hWin, GUI_ID_EDIT3);
      hListBox = WM_GetDialogItem(hWin, GUI_ID_LISTBOX0);
      hDropd0  = WM_GetDialogItem(hWin, GUI_ID_DROPDOWN0);
      hDropd1  = WM_GetDialogItem(hWin, GUI_ID_DROPDOWN1);
      /* Initialize all widgets */
      EDIT_SetText(hEdit0, "EDIT widget 0");
      EDIT_SetText(hEdit1, "EDIT widget 1");
      EDIT_SetTextAlign(hEdit1, GUI_TA_LEFT);
      EDIT_SetHexMode(hEdit2, 0x1234, 0, 0xffffff);
      EDIT_SetBinMode(hEdit3, 0x1234, 0, 0xffff);
      LISTBOX_SetText(hListBox, _apListBox);
      WM_DisableWindow (WM_GetDialogItem(hWin, GUI_ID_CHECK1));
      CHECKBOX_Check(  WM_GetDialogItem(hWin, GUI_ID_CHECK0));
      CHECKBOX_Check(  WM_GetDialogItem(hWin, GUI_ID_CHECK1));
      SLIDER_SetWidth( WM_GetDialogItem(hWin, GUI_ID_SLIDER0), 5);
      SLIDER_SetValue( WM_GetDialogItem(hWin, GUI_ID_SLIDER1), 50);
      SCROLLBAR_CreateAttached(hListBox, SCROLLBAR_CF_VERTICAL);
      DROPDOWN_AddString(hDropd0, "Item 0");
      DROPDOWN_AddString(hDropd0, "Item 1");
      DROPDOWN_AddString(hDropd0, "Item 2");
      DROPDOWN_AddString(hDropd1, "Item 0");
      DROPDOWN_AddString(hDropd1, "Item 1");
      DROPDOWN_AddString(hDropd1, "Item 2");
      DROPDOWN_AddString(hDropd1, "Item 3");
      DROPDOWN_AddString(hDropd1, "Item 4");
      break;
    case WM_KEY:
      switch (((WM_KEY_INFO*)(pMsg->Data.p))->Key) {
      case GUI_KEY_ESCAPE:
        GUI_EndDialog(hWin, 1);
        break;
      case GUI_KEY_ENTER:
        GUI_EndDialog(hWin, 0);
        break;
      }
      break;
    case WM_NOTIFY_PARENT:
      Id    = WM_GetId(pMsg->hWinSrc);    /* Id of widget */
      NCode = pMsg->Data.v;               /* Notification code */
      switch (NCode) {
        case WM_NOTIFICATION_RELEASED:    /* React only if released */
          if (Id == GUI_ID_OK) {          /* OK Button */
            GUI_EndDialog(hWin, 0);
          }
          if (Id == GUI_ID_CANCEL) {      /* Cancel Button */
            GUI_EndDialog(hWin, 1);
          }
          break;
      }
      break;
    default:
      WM_DefaultProc(pMsg);
  }
}
Ejemplo n.º 18
0
static void _cbDialog_VNC_SETTINGS(WM_MESSAGE * pMsg) {
  WM_HWIN hItem;
  int Id, NCode;
  
  switch (pMsg->MsgId) {
  case WM_INIT_DIALOG: 
    
    /* Restore VNC settings */
    _VNCServer_RestoreSettings(); 

    /* Initialization of 'VNC Server Settings' */
    hItem = pMsg->hWin;
    FRAMEWIN_SetTitleHeight(hItem, 18);

    /* Initialization of 'DHCP' */
    hItem = WM_GetDialogItem(pMsg->hWin, ID_CHECKBOX_DHCP);
    CHECKBOX_SetText(hItem, "Enable DHCP");
    CHECKBOX_SetState(hItem, VNCSettings.dhcp_use.b.dhcp);

    /* Initialization of 'Edit' */
    hItem = WM_GetDialogItem(pMsg->hWin, ID_EDIT_IPADDRESS_3);
    EDIT_SetDecMode(hItem, VNCSettings.ipaddr.b.addr3, 0, 255, 0, GUI_EDIT_SUPPRESS_LEADING_ZEROES);

    /* Initialization of 'Edit' */
    hItem = WM_GetDialogItem(pMsg->hWin, ID_EDIT_IPADDRESS_2);
    EDIT_SetDecMode(hItem, VNCSettings.ipaddr.b.addr2, 0, 255, 0, GUI_EDIT_SUPPRESS_LEADING_ZEROES);

    /* Initialization of 'Edit' */
    hItem = WM_GetDialogItem(pMsg->hWin, ID_EDIT_IPADDRESS_1);
    EDIT_SetDecMode(hItem, VNCSettings.ipaddr.b.addr1, 0, 255, 0, GUI_EDIT_SUPPRESS_LEADING_ZEROES);

    /* Initialization of 'Edit' */
    hItem = WM_GetDialogItem(pMsg->hWin, ID_EDIT_IPADDRESS_0);
    EDIT_SetDecMode(hItem, VNCSettings.ipaddr.b.addr0, 0, 255, 0, GUI_EDIT_SUPPRESS_LEADING_ZEROES);

    /* Initialization of 'Edit' */
    hItem = WM_GetDialogItem(pMsg->hWin, ID_EDIT_SNMASK_3);
    EDIT_SetDecMode(hItem, VNCSettings.maskaddr.b.addr3, 0, 255, 0, GUI_EDIT_SUPPRESS_LEADING_ZEROES);

    /* Initialization of 'Edit' */
    hItem = WM_GetDialogItem(pMsg->hWin, ID_EDIT_SNMASK_2);
    EDIT_SetDecMode(hItem, VNCSettings.maskaddr.b.addr2, 0, 255, 0, GUI_EDIT_SUPPRESS_LEADING_ZEROES);

    /* Initialization of 'Edit' */
    hItem = WM_GetDialogItem(pMsg->hWin, ID_EDIT_SNMASK_1);
    EDIT_SetDecMode(hItem, VNCSettings.maskaddr.b.addr1, 0, 255, 0, GUI_EDIT_SUPPRESS_LEADING_ZEROES);

    /* Initialization of 'Edit' */
    hItem = WM_GetDialogItem(pMsg->hWin, ID_EDIT_SNMASK_0);
    EDIT_SetDecMode(hItem, VNCSettings.maskaddr.b.addr0, 0, 255, 0, GUI_EDIT_SUPPRESS_LEADING_ZEROES);

    /* Initialization of 'Edit' */
    hItem = WM_GetDialogItem(pMsg->hWin, ID_EDIT_GWADDRESS_3);
    EDIT_SetDecMode(hItem, VNCSettings.gwaddr.b.addr3, 0, 255, 0, GUI_EDIT_SUPPRESS_LEADING_ZEROES);

    /* Initialization of 'Edit' */
    hItem = WM_GetDialogItem(pMsg->hWin, ID_EDIT_GWADDRESS_2);
    EDIT_SetDecMode(hItem, VNCSettings.gwaddr.b.addr2, 0, 255, 0, GUI_EDIT_SUPPRESS_LEADING_ZEROES);

    /* Initialization of 'Edit' */
    hItem = WM_GetDialogItem(pMsg->hWin, ID_EDIT_GWADDRESS_1);
    EDIT_SetDecMode(hItem, VNCSettings.gwaddr.b.addr1, 0, 255, 0, GUI_EDIT_SUPPRESS_LEADING_ZEROES);

    /* Initialization of 'Edit' */
    hItem = WM_GetDialogItem(pMsg->hWin, ID_EDIT_GWADDRESS_0);
    EDIT_SetDecMode(hItem, VNCSettings.gwaddr.b.addr0, 0, 255, 0, GUI_EDIT_SUPPRESS_LEADING_ZEROES); 
    
    /* If DHCP enabled: disable all Edits*/
    if (VNCSettings.dhcp_use.b.dhcp)
    {
      hItem = WM_GetDialogItem(pMsg->hWin, ID_EDIT_IPADDRESS_3);
      WM_DisableWindow(hItem);
      EDIT_SetFocussable(hItem, 0);

      hItem = WM_GetDialogItem(pMsg->hWin, ID_EDIT_IPADDRESS_2);
      WM_DisableWindow(hItem);
      EDIT_SetFocussable(hItem, 0);
      
      hItem = WM_GetDialogItem(pMsg->hWin, ID_EDIT_IPADDRESS_1);
      WM_DisableWindow(hItem);
      EDIT_SetFocussable(hItem, 0);

      hItem = WM_GetDialogItem(pMsg->hWin, ID_EDIT_IPADDRESS_0);
      WM_DisableWindow(hItem);
      EDIT_SetFocussable(hItem, 0);

      hItem = WM_GetDialogItem(pMsg->hWin, ID_EDIT_SNMASK_3);
      WM_DisableWindow(hItem);
      EDIT_SetFocussable(hItem, 0);

      hItem = WM_GetDialogItem(pMsg->hWin, ID_EDIT_SNMASK_2);
      WM_DisableWindow(hItem);
      EDIT_SetFocussable(hItem, 0);

      hItem = WM_GetDialogItem(pMsg->hWin, ID_EDIT_SNMASK_1);
      WM_DisableWindow(hItem);
      EDIT_SetFocussable(hItem, 0);

      hItem = WM_GetDialogItem(pMsg->hWin, ID_EDIT_SNMASK_0);
      WM_DisableWindow(hItem);
      EDIT_SetFocussable(hItem, 0);

      hItem = WM_GetDialogItem(pMsg->hWin, ID_EDIT_GWADDRESS_3);
      WM_DisableWindow(hItem);
      EDIT_SetFocussable(hItem, 0);

      hItem = WM_GetDialogItem(pMsg->hWin, ID_EDIT_GWADDRESS_2);
      WM_DisableWindow(hItem);
      EDIT_SetFocussable(hItem, 0);

      hItem = WM_GetDialogItem(pMsg->hWin, ID_EDIT_GWADDRESS_1);
      WM_DisableWindow(hItem);
      EDIT_SetFocussable(hItem, 0);

      hItem = WM_GetDialogItem(pMsg->hWin, ID_EDIT_GWADDRESS_0);
      WM_DisableWindow(hItem);
      EDIT_SetFocussable(hItem, 0); 
    }
    break;
    

  case WM_DELETE:
    hWinVNC_Settings = 0;
    break;
    
  case WM_NOTIFY_PARENT:
    Id = WM_GetId(pMsg->hWinSrc);    /* Id of widget */
    NCode = pMsg->Data.v;               /* Notification code */
    switch (NCode) {
    case WM_NOTIFICATION_RELEASED:      /* React only if released */
      switch (Id) {
      case ID_BUTTON_SETTINGS_CANCEL: /* Settings: Cancel */
        /* Delete NumPad VNC Window */
        WM_DeleteWindow(hNumPad);
        GUI_EndDialog(pMsg->hWin, 0);
        break;
      case ID_BUTTON_SETTINGS_OK: /* Settings: OK */       
        
        /* Save Settings */
        hItem = WM_GetDialogItem(pMsg->hWin, ID_CHECKBOX_DHCP);
        if (CHECKBOX_GetState(hItem)) /* Use DHCP to allocate dynamic IP address */
        {
          if(VNCSettings.dhcp_use.b.dhcp == 0)
          {
            VNCSettings.dhcp_use.b.dhcp = 1;
            VNCSettings.ipaddr.b.addr0 = 0;
            VNCSettings.ipaddr.b.addr1 = 0;
            VNCSettings.ipaddr.b.addr2 = 0;
            VNCSettings.ipaddr.b.addr3 = 0;
            VNCSettings.maskaddr.b.addr0 = 0;
            VNCSettings.maskaddr.b.addr1 = 0;
            VNCSettings.maskaddr.b.addr2 = 0;
            VNCSettings.maskaddr.b.addr3 = 0;
            VNCSettings.gwaddr.b.addr0 = 0;
            VNCSettings.gwaddr.b.addr1 = 0;
            VNCSettings.gwaddr.b.addr2 = 0;
            VNCSettings.gwaddr.b.addr3 = 0;
            
            hItem = WM_GetDialogItem(hWinVNC, ID_TEXT_DHCP_STATE);
            TEXT_SetText(hItem, (char const *)"Enabled");  
            
            hItem = WM_GetDialogItem(hWinVNC, ID_TEXT_IPADDR_VALUE);
            TEXT_SetText(hItem, (char const *)"Not assigned");
            
            hItem = WM_GetDialogItem(hWinVNC, ID_TEXT_SUBNETMASK_VALUE);
            TEXT_SetText(hItem, (char const *)"Not assigned");
            
            hItem = WM_GetDialogItem(hWinVNC, ID_TEXT_GWADDR_VALUE);
            TEXT_SetText(hItem, (char const *)"Not assigned");
            
            if (start_button == VNC_HIDE)
            {
              hItem = WM_GetDialogItem(hWinVNC, ID_MULTIEDIT_VNC);
              MULTIEDIT_AddText(hItem, (const char *) "Network settings has been modified\r\n");
              MULTIEDIT_AddText(hItem, (const char *) "Restart to apply new settings\r\n"); 
            }
          }
        } /* Use static IP address */
        else
        {
          if (VNCSettings.dhcp_use.b.dhcp == 1)
          {
            VNCSettings.dhcp_use.b.dhcp = 0;
          }

          if (start_button == VNC_HIDE)
          {
            hItem = WM_GetDialogItem(hWinVNC, ID_MULTIEDIT_VNC);
            MULTIEDIT_AddText(hItem, (const char *) "Network settings has been modified\r\n");
            MULTIEDIT_AddText(hItem, (const char *) "Restart to apply new settings\r\n"); 
          }
          
          /* Get the new network addresses configuration */
          hItem = WM_GetDialogItem(pMsg->hWin, ID_EDIT_IPADDRESS_3);
          VNCSettings.ipaddr.b.addr3 = EDIT_GetValue(hItem);
          hItem = WM_GetDialogItem(pMsg->hWin, ID_EDIT_IPADDRESS_2);
          VNCSettings.ipaddr.b.addr2 = EDIT_GetValue(hItem);
          hItem = WM_GetDialogItem(pMsg->hWin, ID_EDIT_IPADDRESS_1);
          VNCSettings.ipaddr.b.addr1 = EDIT_GetValue(hItem);
          hItem = WM_GetDialogItem(pMsg->hWin, ID_EDIT_IPADDRESS_0);
          VNCSettings.ipaddr.b.addr0 = EDIT_GetValue(hItem);
          
          hItem = WM_GetDialogItem(pMsg->hWin, ID_EDIT_SNMASK_3);
          VNCSettings.maskaddr.b.addr3 = EDIT_GetValue(hItem);
          hItem = WM_GetDialogItem(pMsg->hWin, ID_EDIT_SNMASK_2);
          VNCSettings.maskaddr.b.addr2 = EDIT_GetValue(hItem);
          hItem = WM_GetDialogItem(pMsg->hWin, ID_EDIT_SNMASK_1);
          VNCSettings.maskaddr.b.addr1 = EDIT_GetValue(hItem);
          hItem = WM_GetDialogItem(pMsg->hWin, ID_EDIT_SNMASK_0);
          VNCSettings.maskaddr.b.addr0 = EDIT_GetValue(hItem);
          
          hItem = WM_GetDialogItem(pMsg->hWin, ID_EDIT_GWADDRESS_3);
          VNCSettings.gwaddr.b.addr3 = EDIT_GetValue(hItem);
          hItem = WM_GetDialogItem(pMsg->hWin, ID_EDIT_GWADDRESS_2);
          VNCSettings.gwaddr.b.addr2 = EDIT_GetValue(hItem);
          hItem = WM_GetDialogItem(pMsg->hWin, ID_EDIT_GWADDRESS_1);
          VNCSettings.gwaddr.b.addr1 = EDIT_GetValue(hItem);
          hItem = WM_GetDialogItem(pMsg->hWin, ID_EDIT_GWADDRESS_0);
          VNCSettings.gwaddr.b.addr0 = EDIT_GetValue(hItem);
          
          _VNCApp_GetIPAddress(IP_ADDRESS, VNCSettings.ipaddr.b.addr3, VNCSettings.ipaddr.b.addr2, VNCSettings.ipaddr.b.addr1, VNCSettings.ipaddr.b.addr0);
          _VNCApp_GetIPAddress(SUBNET_MASK, VNCSettings.maskaddr.b.addr3, VNCSettings.maskaddr.b.addr2, VNCSettings.maskaddr.b.addr1, VNCSettings.maskaddr.b.addr0);
          _VNCApp_GetIPAddress(GW_ADDRESS, VNCSettings.gwaddr.b.addr3, VNCSettings.gwaddr.b.addr2, VNCSettings.gwaddr.b.addr1, VNCSettings.gwaddr.b.addr0);
        }
        
        /********** Save Settings ***********/
        _VNCServer_SaveSettings(); 
        
        /* Delete NumPad VNC Window */
        WM_DeleteWindow(hNumPad);
        GUI_EndDialog(pMsg->hWin, 0);
        break;
      }
      break;
    case WM_NOTIFICATION_VALUE_CHANGED:
      switch (Id) {
      case ID_CHECKBOX_DHCP:
        {
          hItem = WM_GetDialogItem(pMsg->hWin, ID_CHECKBOX_DHCP);
          if (CHECKBOX_IsChecked(hItem))
          {
            hItem = WM_GetDialogItem(pMsg->hWin, ID_EDIT_IPADDRESS_3);
            WM_DisableWindow(hItem);
            EDIT_SetFocussable(hItem, 0);
            hItem = WM_GetDialogItem(pMsg->hWin, ID_EDIT_IPADDRESS_2);
            WM_DisableWindow(hItem);
            EDIT_SetFocussable(hItem, 0);
            hItem = WM_GetDialogItem(pMsg->hWin, ID_EDIT_IPADDRESS_1);
            WM_DisableWindow(hItem);
            EDIT_SetFocussable(hItem, 0);
            hItem = WM_GetDialogItem(pMsg->hWin, ID_EDIT_IPADDRESS_0);
            WM_DisableWindow(hItem);
            EDIT_SetFocussable(hItem, 0);
            hItem = WM_GetDialogItem(pMsg->hWin, ID_EDIT_SNMASK_3);
            WM_DisableWindow(hItem);
            EDIT_SetFocussable(hItem, 0);
            hItem = WM_GetDialogItem(pMsg->hWin, ID_EDIT_SNMASK_2);
            WM_DisableWindow(hItem);
            EDIT_SetFocussable(hItem, 0);
            hItem = WM_GetDialogItem(pMsg->hWin, ID_EDIT_SNMASK_1);
            WM_DisableWindow(hItem);
            EDIT_SetFocussable(hItem, 0);
            hItem = WM_GetDialogItem(pMsg->hWin, ID_EDIT_SNMASK_0);
            WM_DisableWindow(hItem);
            EDIT_SetFocussable(hItem, 0);
            hItem = WM_GetDialogItem(pMsg->hWin, ID_EDIT_GWADDRESS_3);
            WM_DisableWindow(hItem);
            EDIT_SetFocussable(hItem, 0);
            hItem = WM_GetDialogItem(pMsg->hWin, ID_EDIT_GWADDRESS_2);
            WM_DisableWindow(hItem);
            EDIT_SetFocussable(hItem, 0);
            hItem = WM_GetDialogItem(pMsg->hWin, ID_EDIT_GWADDRESS_1);
            WM_DisableWindow(hItem);
            EDIT_SetFocussable(hItem, 0);
            hItem = WM_GetDialogItem(pMsg->hWin, ID_EDIT_GWADDRESS_0);
            WM_DisableWindow(hItem);
            EDIT_SetFocussable(hItem, 0);
          }
          else
          {
            hItem = WM_GetDialogItem(pMsg->hWin, ID_EDIT_IPADDRESS_3);
            WM_EnableWindow(hItem);
            EDIT_SetFocussable(hItem, 1);
            hItem = WM_GetDialogItem(pMsg->hWin, ID_EDIT_IPADDRESS_2);
            WM_EnableWindow(hItem);
            EDIT_SetFocussable(hItem, 1);
            hItem = WM_GetDialogItem(pMsg->hWin, ID_EDIT_IPADDRESS_1);
            WM_EnableWindow(hItem);
            EDIT_SetFocussable(hItem, 1);
            hItem = WM_GetDialogItem(pMsg->hWin, ID_EDIT_IPADDRESS_0);
            WM_EnableWindow(hItem);
            EDIT_SetFocussable(hItem, 1);
            hItem = WM_GetDialogItem(pMsg->hWin, ID_EDIT_SNMASK_3);
            WM_EnableWindow(hItem);
            EDIT_SetFocussable(hItem, 1);
            hItem = WM_GetDialogItem(pMsg->hWin, ID_EDIT_SNMASK_2);
            WM_EnableWindow(hItem);
            EDIT_SetFocussable(hItem, 1);
            hItem = WM_GetDialogItem(pMsg->hWin, ID_EDIT_SNMASK_1);
            WM_EnableWindow(hItem);
            EDIT_SetFocussable(hItem, 1);
            hItem = WM_GetDialogItem(pMsg->hWin, ID_EDIT_SNMASK_0);
            WM_EnableWindow(hItem);
            EDIT_SetFocussable(hItem, 1);
            hItem = WM_GetDialogItem(pMsg->hWin, ID_EDIT_GWADDRESS_3);
            WM_EnableWindow(hItem);
            EDIT_SetFocussable(hItem, 1);
            hItem = WM_GetDialogItem(pMsg->hWin, ID_EDIT_GWADDRESS_2);
            WM_EnableWindow(hItem);
            EDIT_SetFocussable(hItem, 1);
            hItem = WM_GetDialogItem(pMsg->hWin, ID_EDIT_GWADDRESS_1);
            WM_EnableWindow(hItem);
            EDIT_SetFocussable(hItem, 1);
            hItem = WM_GetDialogItem(pMsg->hWin, ID_EDIT_GWADDRESS_0);
            WM_EnableWindow(hItem);
            EDIT_SetFocussable(hItem, 1);
          }
        }
        break;
      }
      break;
      
    }
    break;
    
  default:
    WM_DefaultProc(pMsg);
    break;
  }
}