Esempio n. 1
0
/**
  * @brief  Callback function of the kernel log dialog
  * @param  pMsg: pointer to data structure of type WM_MESSAGE
  * @retval None
  */
static void _cbKernelLogDialog(WM_MESSAGE * pMsg) {
  WM_HWIN hItem;
  int     NCode;
  int     Id;

  switch (pMsg->MsgId) {
  case WM_INIT_DIALOG:
    
    hItem = pMsg->hWin;
    FRAMEWIN_SetTitleVis(hItem, 0);
    
    hItem = WM_GetDialogItem(pMsg->hWin, ID_MULTIEDIT_KERNELLOG);
    MULTIEDIT_SetFont(hItem, GUI_FONT_8_1);
    MULTIEDIT_SetTextColor(hItem, MULTIEDIT_CI_READONLY, GUI_GREEN); 
    MULTIEDIT_SetBkColor(hItem, MULTIEDIT_CI_READONLY, GUI_BLACK); 
    MULTIEDIT_SetReadOnly(hItem, 1);
    MULTIEDIT_SetText(hItem, (char *)pLOG_CacheBuffer);
    MULTIEDIT_SetCursorOffset(hItem, LOG_IN_ptr);
    MULTIEDIT_SetAutoScrollV(hItem, 1);
    break;
  case WM_NOTIFY_PARENT:
    Id    = WM_GetId(pMsg->hWinSrc);
    NCode = pMsg->Data.v;
    switch(Id) {
    case ID_BUTTON_CANCEL_KERNELLOG: /* Notifications sent by 'Cancel' button */
      switch(NCode) {
      case WM_NOTIFICATION_RELEASED:
        GUI_EndDialog(pMsg->hWin, 0); 
        hLog = 0;
        break;
      }
      break;
    case ID_MULTIEDIT_KERNELLOG: /* Notifications sent by 'Multiedit' */
      switch(NCode) {
      case WM_NOTIFICATION_CLICKED:
        break;
      case WM_NOTIFICATION_RELEASED:
        break;
      case WM_NOTIFICATION_VALUE_CHANGED:
        break;
      }
      break;
    }
    break;
  default:
    WM_DefaultProc(pMsg);
    break;
  }
}
Esempio n. 2
0
/*********************************************************************
*
*       _cbFrameWinClient
*/
static void _cbFrameWinClient(WM_MESSAGE* pMsg) {
  switch(pMsg->MsgId) {
  case WM_NOTIFY_PARENT:
    if (pMsg->Data.v == WM_NOTIFICATION_RELEASED) {
      int Id = WM_GetId(pMsg->hWinSrc);
      if ((Id >= ID_NONEWRAP) && (Id <= ID_CHARWRAP)) {
        _SetButtonState(_hWrapButton, 0);
        if (Id == ID_NONEWRAP) {
          MULTIEDIT_SetWrapNone(_hMEdit);
        } else if (Id == ID_WORDWRAP) {
          MULTIEDIT_SetWrapWord(_hMEdit);
        } else if (Id == ID_CHARWRAP) {
          MULTIEDIT_SetWrapChar(_hMEdit);
        }
        _hWrapButton = pMsg->hWinSrc;
        _SetButtonState(_hWrapButton, 1);
      } else if (Id == ID_OVERWRITE) {
        _Overwrite ^= 1;
        MULTIEDIT_SetInsertMode(_hMEdit, 1 - _Overwrite);
        _SetButtonState(pMsg->hWinSrc, _Overwrite);
      } else if (Id == ID_READONLY) {
        _ReadOnly ^= 1;
        MULTIEDIT_SetReadOnly(_hMEdit, _ReadOnly);
        _SetButtonState(pMsg->hWinSrc, _ReadOnly);
      } else if (Id == ID_PASSWORD) {
        _Password ^= 1;
        MULTIEDIT_SetPasswordMode(_hMEdit, _Password);
        _SetButtonState(pMsg->hWinSrc, _Password);
      }
    }
    return;
  }
  if (_pcbFrameWinClient) {
    (*_pcbFrameWinClient)(pMsg);
  }
}
/*********************************************************************
*
*       _cbCallback
*/
static void _cbCallback(WM_MESSAGE * pMsg) {
  int     NCode;
  int     Id;
  int     Sel;
  char    ac[80];
  WM_HWIN hDlg;
  WM_HWIN hMulti;
  WM_HWIN hItem;

  hDlg   = pMsg->hWin;
  hMulti = WM_GetDialogItem(hDlg, GUI_ID_MULTIEDIT0);
  switch (pMsg->MsgId) {
  case WM_INIT_DIALOG:
    hItem = WM_GetDialogItem(hDlg, GUI_ID_SLIDER0);
    SLIDER_SetRange(hItem, 1, 100);
    SLIDER_SetValue(hItem, 100);
    hItem = WM_GetDialogItem(hDlg, GUI_ID_SLIDER1);
    SLIDER_SetRange(hItem, 1, 152);
    SLIDER_SetValue(hItem, 152);
    hItem = WM_GetDialogItem(hDlg, GUI_ID_SLIDER2);
    SLIDER_SetRange(hItem, 0, 5);
    SLIDER_SetValue(hItem, 2);
    hItem = WM_GetDialogItem(hDlg, GUI_ID_SLIDER3);
    SLIDER_SetRange(hItem, 0, 100);
    SLIDER_SetValue(hItem, 0);
    hItem = WM_GetDialogItem(hDlg, GUI_ID_EDIT1);
    EDIT_SetDecMode(hItem, 0, 0, 1000, 0, 0);
    hItem = WM_GetDialogItem(hDlg, GUI_ID_RADIO2);
    RADIO_SetText(hItem, "None", 0);
    RADIO_SetText(hItem, "Char", 1);
    RADIO_SetText(hItem, "Word", 2);
    hItem = WM_GetDialogItem(hDlg, GUI_ID_RADIO3);
    RADIO_SetText(hItem, "None",   0);
    RADIO_SetText(hItem, "Simple", 1);
    RADIO_SetText(hItem, "3D",     2);
    RADIO_SetValue(hItem, 2);
    RADIO_SetTextColor(hItem, GUI_BLUE);
    MULTIEDIT_EnableBlink(hMulti, 300, 1);
    MULTIEDIT_SetFont(hMulti, &GUI_Font8x16);
    MULTIEDIT_SetBkColor(hMulti, 0, GUI_YELLOW);
    MULTIEDIT_SetTextColor(hMulti, 0, GUI_BLUE);
    MULTIEDIT_SetAutoScrollV(hMulti, 1);
    MULTIEDIT_SetInsertMode(hMulti, 1);
    MULTIEDIT_SetPrompt(hMulti, "C:\\>");
    MULTIEDIT_SetHBorder(hMulti, 2);
    MULTIEDIT_SetText(hMulti, "Multiedit - long line 12345678901234567890\nThis demonstrates the use of a MULTIEDIT widget");
    MULTIEDIT_AddKey(hMulti, 'A');
    MULTIEDIT_AddKey(hMulti, 'B');
    MULTIEDIT_AddKey(hMulti, 'C');
    MULTIEDIT_AddKey(hMulti, GUI_KEY_ENTER);
    MULTIEDIT_SetAutoScrollH(hMulti, 1);
    hItem = WM_GetDialogItem(hDlg, GUI_ID_BUTTON5);
    BUTTON_SetFocussable(hItem, 0);
    break;
  case WM_KEY:
    switch (((WM_KEY_INFO*)(pMsg->Data.p))->Key) {
    case GUI_KEY_ESCAPE:
      GUI_EndDialog(hDlg, 1);
      break;
    case GUI_KEY_ENTER:
      GUI_EndDialog(hDlg, 0);
      break;
    }
    break;
  case WM_NOTIFY_PARENT:
    Id     = WM_GetId(pMsg->hWinSrc);
    NCode  = pMsg->Data.v;
    hItem  = WM_GetDialogItem(hDlg, Id);
    switch (NCode) {
    case WM_NOTIFICATION_VALUE_CHANGED:
      switch (Id) {
      case GUI_ID_SLIDER0:
        Sel = SLIDER_GetValue(hItem);
        WM_SetYSize(hMulti, Sel);
        break;
      case GUI_ID_SLIDER1:
        Sel = SLIDER_GetValue(hItem);
        WM_SetXSize(hMulti, Sel);
        break;
      case GUI_ID_SLIDER2:
        Sel = SLIDER_GetValue(hItem);
        MULTIEDIT_SetHBorder(hMulti, Sel);
        break;
      case GUI_ID_SLIDER3:
        Sel = SLIDER_GetValue(hItem);
        MULTIEDIT_SetMaxNumChars(hMulti, Sel);
        break;
      case GUI_ID_RADIO0:
        //
        // Horizontal scrollbar
        //
        Sel = RADIO_GetValue(hItem);
        switch (Sel) {
        case 0:
          MULTIEDIT_SetAutoScrollH(hMulti, 1);           // Auto
          break;
        case 1:
          MULTIEDIT_SetAutoScrollH(hMulti, 0);           // Off
          WM_SetScrollbarH(hMulti, 0);
          break;
        case 2:
          MULTIEDIT_SetAutoScrollH(hMulti, 0);           // On
          WM_SetScrollbarH(hMulti, 1);
          break;
        }
        break;
      case GUI_ID_RADIO1:
        //
        // Vertical scrollbar
        //
        Sel = RADIO_GetValue(hItem);
        switch (Sel) {
        case 0:
          MULTIEDIT_SetAutoScrollV(hMulti, 1);
          break;
        case 1:
          MULTIEDIT_SetAutoScrollV(hMulti, 0);
          WM_SetScrollbarV(hMulti, 0);
          break;
        case 2:
          MULTIEDIT_SetAutoScrollV(hMulti, 0);
          WM_SetScrollbarV(hMulti, 1);
          break;
        }
        break;
      case GUI_ID_RADIO2:
        //
        // Wrap
        //
        Sel = RADIO_GetValue(hItem);
        switch (Sel) {
        case 0:
          MULTIEDIT_SetWrapNone(hMulti);
          break;
        case 1:
          MULTIEDIT_SetWrapChar(hMulti);
          break;
        case 2:
          MULTIEDIT_SetWrapWord(hMulti);
          break;
        }
        break;
      case GUI_ID_RADIO3:
        //
        // Effect type
        //
        Sel = RADIO_GetValue(hItem);
        switch (Sel) {
        case 0:
          WIDGET_SetEffect(hMulti, &WIDGET_Effect_None);
          break;
        case 1:
          WIDGET_SetEffect(hMulti, &WIDGET_Effect_Simple);
          break;
        case 2:
          WIDGET_SetEffect(hMulti, &WIDGET_Effect_3D);
          break;
        }
        break;
      }
      break;
      case WM_NOTIFICATION_RELEASED:      // React only if released
        WM_GetDialogItem(hDlg, Id);
        switch (Id) {
        case GUI_ID_OK:
          GUI_EndDialog(hDlg, 0);
          break;
        case GUI_ID_CANCEL:
          GUI_EndDialog(hDlg, 1);
          break;
        case GUI_ID_CHECK0:
          _RdOnly ^= 1;
          MULTIEDIT_SetReadOnly(hMulti, _RdOnly);
          break;
        case GUI_ID_CHECK1:
          _RTF8 ^= 1;
          if (_RTF8) {
            GUI_UC_SetEncodeUTF8();
          } else {
            GUI_UC_SetEncodeNone();
          }
          WM_InvalidateWindow(hMulti);
          break;
        case GUI_ID_CHECK2:
          _Password ^= 1;
          MULTIEDIT_SetPasswordMode(hMulti, _Password);
          break;
        case GUI_ID_BUTTON1:
          hItem  = WM_GetDialogItem(hDlg, GUI_ID_EDIT0);
          EDIT_GetText(hItem, &ac[0], sizeof(ac));
          MULTIEDIT_SetPrompt(hMulti, ac);
          break;
        case GUI_ID_BUTTON2:
          hItem  = WM_GetDialogItem(hDlg, GUI_ID_EDIT1);
          MULTIEDIT_SetCursorOffset(hMulti, EDIT_GetValue(hItem));
          WM_SetFocus(hMulti);
          break;
        case GUI_ID_BUTTON3:
          MULTIEDIT_SetText(hMulti, "Short text");
          break;
        case GUI_ID_BUTTON4:
          MULTIEDIT_SetText(hMulti, "Long text\n123456789012345678901234567890\nLast line\n");
          break;
        case GUI_ID_BUTTON5:
          MULTIEDIT_AddText(hMulti, "Added");
          break;
        case GUI_ID_BUTTON6:
          MULTIEDIT_SetFont(hMulti, &GUI_Font8x16);
          break;
        case GUI_ID_BUTTON7:
          MULTIEDIT_SetFont(hMulti, &GUI_Font16_1);
          break;
        }
        break;
    }
    break;
    default:
      WM_DefaultProc(pMsg);
  }
}
Esempio n. 4
0
/*********************************************************************
*
*       _cbDialog
*/
static void _cbDialog(WM_MESSAGE * pMsg) {
  WM_HWIN hItem;
  int     NCode;
  int     Id;
  int i;
  switch (pMsg->MsgId) { 
  case WM_INIT_DIALOG:

    
    GUI_UC_SetEncodeUTF8();
    
     //
    // Initialization of 'Multiedit'
    //
    hItem = WM_GetDialogItem(pMsg->hWin, ID_MULTIEDIT_0);
    MULTIEDIT_SetFont(hItem,&GUI_Font_Song_16);
    MULTIEDIT_SetWrapWord(hItem);//启用自动换行
    MULTIEDIT_SetReadOnly(hItem,1);//只读模式
    //MULTIEDIT_SetText(hItem, FHD_PDA);
    for(i = 0;i < 14;i++)
    {
        MULTIEDIT_AddText(hItem, helpText[i]);
    }
    hItem=WM_GetDialogItem(pMsg->hWin,ID_BUTTON_0);
    BUTTON_SetBkColor(hItem,0,GUI_YELLOW);
    WIDGET_AndState(hItem,WIDGET_STATE_FOCUSSABLE);
#if 0
    hItem=WM_GetDialogItem(pMsg->hWin,ID_BUTTON_1);
    BUTTON_SetBkColor(hItem,0,GUI_GREEN);
    WIDGET_AndState(hItem,WIDGET_STATE_FOCUSSABLE);
#endif
    
    break;
  

  case WM_KEY:
    {
        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_Help);
                    g_hWin_Help=WM_HWIN_NULL;
                    WM_ShowWindow(g_hWin_TimeBar);
                    WM_ShowWindow(g_hWin_Date);
                    WM_SetFocus(g_hWin_Menu);
                    break;
                case GUI_KEY_GREEN:
                    //GUI_WARN(g_hWin_Help, GUI_MSBOX_UPDATE_CFM);
                    //GUI_WARN(g_hWin_Help,8);
                    
                    //DEV_Power_Off();

                    //while(1);
                    break;
            }
        }
    }
    break;
  default:
    WM_DefaultProc(pMsg);
    break;
  }
}
/**
  * @brief  Callback routine of the VNC dialog
  * @param  pMsg: pointer to data structure of type WM_MESSAGE
  * @retval None
  */
static void _cbDialog_VNC(WM_MESSAGE * pMsg) {
  WM_HWIN hItem;
  int Id, NCode;
  
  switch (pMsg->MsgId) {
  case WM_INIT_DIALOG:
    /* Initialization of 'Multi Edit' */
    hItem = WM_GetDialogItem(pMsg->hWin, ID_MULTIEDIT_VNC);
    MULTIEDIT_SetReadOnly(hItem, 1);
    MULTIEDIT_SetBkColor(hItem, 1, 0);
    MULTIEDIT_SetTextColor(hItem, 1, 0xFFFFFF);

    /* Initialization of 'Image 1' */
    hItem = WM_GetDialogItem(pMsg->hWin, ID_IMAGE_PCNETWORK);
    IMAGE_SetBitmap(hItem, &bmpc_network64);

    /* Initialization of 'Image 2' */
    hItem = WM_GetDialogItem(pMsg->hWin, ID_IMAGE_STATE);
    IMAGE_SetBitmap(hItem, &bmDelete32);
    
    hItem = WM_GetDialogItem(pMsg->hWin, ID_TEXT_DHCP);
    TEXT_SetFont(hItem, GUI_FONT_13B_1);
    TEXT_SetTextColor(hItem, GUI_BLACK);
    
    hItem = WM_GetDialogItem(pMsg->hWin, ID_TEXT_DHCP_STATE);
    TEXT_SetFont(hItem, GUI_FONT_8_ASCII);
    TEXT_SetTextColor(hItem, GUI_BLACK);

    hItem = WM_GetDialogItem(pMsg->hWin, ID_TEXT_IPADDR);
    TEXT_SetFont(hItem, GUI_FONT_13B_1);
    TEXT_SetTextColor(hItem, GUI_BLACK);
    
    hItem = WM_GetDialogItem(pMsg->hWin, ID_TEXT_IPADDR_VALUE);
    TEXT_SetFont(hItem, GUI_FONT_8_ASCII);
    TEXT_SetTextColor(hItem, GUI_BLACK);
    
    hItem = WM_GetDialogItem(pMsg->hWin, ID_TEXT_SUBNETMASK);
    TEXT_SetFont(hItem, GUI_FONT_13B_1);
    TEXT_SetTextColor(hItem, GUI_BLACK);
    
    hItem = WM_GetDialogItem(pMsg->hWin, ID_TEXT_SUBNETMASK_VALUE);
    TEXT_SetFont(hItem, GUI_FONT_8_ASCII);
    TEXT_SetTextColor(hItem, GUI_BLACK);
    
    hItem = WM_GetDialogItem(pMsg->hWin, ID_TEXT_GWADDR);
    TEXT_SetFont(hItem, GUI_FONT_13B_1);
    TEXT_SetTextColor(hItem, GUI_BLACK);
    
    hItem = WM_GetDialogItem(pMsg->hWin, ID_TEXT_GWADDR_VALUE);
    TEXT_SetFont(hItem, GUI_FONT_8_ASCII);
    TEXT_SetTextColor(hItem, GUI_BLACK); 
    
    /* Restore VNC settings */
    _VNCServer_RestoreSettings();
    
    if (VNCSettings.maskaddr.b.addr3 != 255)
    {
      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;
      
      /* Save VNC settings */
      _VNCServer_SaveSettings();
    }
    else
    {
      _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);
    }     
    
    if (VNCSettings.dhcp_use.b.dhcp == 0)
    {
       _VNCServer_DisplayIPAddress();
    }
    
    
    break;

  case WM_PAINT:
    
    DrawRect3D(230, 5, 87, 120);  
    DrawRect3D(2, 130, 225, 80);
    DrawRect3D(230, 130, 87, 80);
    
    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: /* Settings */
        if(hWinVNC_Settings == 0)
        {
          hWinVNC_Settings = GUI_CreateDialogBox(_aDialog_VNC_SETTINGS, GUI_COUNTOF(_aDialog_VNC_SETTINGS), _cbDialog_VNC_SETTINGS, hWinVNC, 0, 10);
          
          hNumPad = GUI_CreateDialogBox(_aDialogNumPad, 
                                        GUI_COUNTOF(_aDialogNumPad), 
                                        _cbDialogNumPad, pMsg->hWin, 0, 0); 
        }
        break;	  
      case ID_BUTTON_START: /* Start */
        
        if(hWinVNC_Settings == 0)
        {
          if (start_button == VNC_START) 
          {          
            /* change start button to hide */
            start_button = VNC_HIDE;
            hItem = WM_GetDialogItem(pMsg->hWin, ID_BUTTON_START);
            BUTTON_SetText(hItem, (const char*) "Hide");
            
            /* Cange connection png pic from disconnected to connecting */
            hItem = WM_GetDialogItem(pMsg->hWin, ID_IMAGE_STATE);
            IMAGE_SetBitmap(hItem, &bmhourglass32);
            
            
            hItem = WM_GetDialogItem(pMsg->hWin, ID_MULTIEDIT_VNC);
            MULTIEDIT_AddText(hItem, (const char *) "TCP/IP stack initialization ... \n\r");
            
            TCPIP_Initialized = 1;
            
            /* Initilaize the LwIP stack */
            NetworkInit(VNCSettings.dhcp_use.b.dhcp);
          }
          else /* start_button == VNC_HIDE  */
          {
            if(hWinVNC_Settings == 0)
            {        
              WM_HideWindow(pMsg->hWin);
            }
          }
        }
        break;
      }
      break;  
    }
    break;
    
  default:
    WM_DefaultProc(pMsg);
    break;
  }
}