예제 #1
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);
}
예제 #2
0
/*********************************************************************
*
*       _InitDialogSelect
*/
static void _InitDialogSelect(WM_HWIN hWin) {
  WM_HWIN hItem;
  int     i;
  
  i = 0;
  //
  // Init framewindow
  //
  FRAMEWIN_SetFont(hWin, &GUI_Font10_ASCII);
  FRAMEWIN_SetTitleHeight(hWin, 14);
  FRAMEWIN_SetMoveable(hWin, 1);
  //
  // Init listbox items
  //
  hItem = WM_GetDialogItem(hWin, GUI_ID_LISTVIEW0);
  WM_SetScrollbarV(hItem, 1);
  LISTVIEW_SetGridVis(hItem, 1);
  LISTVIEW_SetLBorder(hItem, 3);
  LISTVIEW_SetRBorder(hItem, 3);
  LISTVIEW_AddColumn(hItem,  80, "Make",    GUI_TA_LEFT);
  LISTVIEW_AddColumn(hItem, 100, "Options", GUI_TA_LEFT);
  while (_acItems[i][0][0]) {
    _AddListviewItem(hItem, _acItems[i][0], _acItems[i][1]);
    i++;
  }
}
예제 #3
0
static void OpenFileProcess(int sel_num,char* record_file)
{
	result = f_open (&listfile, FILE_LIST_PATH, FA_READ|FA_OPEN_EXISTING); //打开索引文件
	if(result != FR_OK)
	  return ;
	result = f_lseek (&listfile, sel_num*BROWSER_FILE_NAME_LEN);
	if(result != FR_OK)
	  return ;
	result = f_read (&listfile, curentopenfile, BROWSER_FILE_NAME_LEN, &bw);	
	if(result != FR_OK)
	  return ;
	//printf("\nfileItem=:%s",openfile);
	f_close (&listfile);
    
    if(strstr(curentopenfile,".gcode")||strstr(curentopenfile,".GCODE")
        ||strstr(curentopenfile,".g")||strstr(curentopenfile,".G")) //判断是否是gcode文件,可以执行打印指令
    {
        //对话框显示是否打印该文件
        _ChooseFrame = CreatePrintFileWaring();
        WM_MakeModal(_ChooseFrame);
    }
#if 0    
	else if(strstr(openfile,".txt")||strstr(openfile,".TXT")
			||strstr(openfile,".c")||strstr(openfile,".c")
				||strstr(openfile,".cpp")||strstr(openfile,".CPP")
						||strstr(openfile,".h")||strstr(openfile,".h"))//判断是否可以使用txt格式打开
	{
		//printf("\ntxt file");
		WM_HideWindow(hDialog);
		hOpenfile=FRAMEWIN_CreateEx(0,0,320,240,WM_HBKWIN,WM_CF_SHOW,0,0,0,_cbOpenfile);
		FRAMEWIN_SetTextColor(hOpenfile,GUI_DARKGRAY);
		FRAMEWIN_SetTitleHeight(hOpenfile, 20);
		FRAMEWIN_SetText(hOpenfile,framename);
		FRAMEWIN_SetTextAlign(hOpenfile, GUI_TA_LEFT | GUI_TA_VCENTER);
		FRAMEWIN_AddCloseButton(hOpenfile,FRAMEWIN_BUTTON_RIGHT,0);
		hWin=MULTIEDIT_CreateEx(5,22,295,230,hOpenfile,
							WM_CF_SHOW,MULTIEDIT_CF_AUTOSCROLLBAR_V|MULTIEDIT_CF_READONLY,0,0,0);
		MULTIEDIT_SetBkColor(hWin,MULTIEDIT_CI_READONLY,GUI_WHITE);
		MULTIEDIT_SetWrapWord(hWin);
		MULTIEDIT_AddText(hWin,txtBuffer);
	}
#endif
	else
	{				
		GUI_MessageBox("Sorry,do not support open the file!","Sorry",GUI_MESSAGEBOX_CF_MODAL);
	}
    
}
예제 #4
0
void InitDialog(WM_MESSAGE * pMsg)
{
    WM_HWIN hWin = pMsg->hWin;

    FRAMEWIN_SetTextAlign(hWin,GUI_TA_VCENTER|GUI_TA_CENTER);
	
    FRAMEWIN_AddCloseButton(hWin, FRAMEWIN_BUTTON_RIGHT, 0);
    FRAMEWIN_AddMaxButton(hWin, FRAMEWIN_BUTTON_RIGHT, 1);
    FRAMEWIN_AddMinButton(hWin, FRAMEWIN_BUTTON_RIGHT, 2);
		FRAMEWIN_SetTitleHeight(hWin,18);
	
		SLIDER_SetRange(WM_GetDialogItem(hWin,GUI_ID_SLIDER0),5,250);
		SLIDER_SetValue(WM_GetDialogItem(hWin,GUI_ID_SLIDER0),200);
	
		EDIT_SetTextAlign(WM_GetDialogItem(hWin,GUI_ID_EDIT0),GUI_TA_VCENTER|GUI_TA_CENTER);
		EDIT_SetTextAlign(WM_GetDialogItem(hWin,GUI_ID_EDIT1),GUI_TA_VCENTER|GUI_TA_CENTER);
		EDIT_SetTextAlign(WM_GetDialogItem(hWin,GUI_ID_EDIT2),GUI_TA_VCENTER|GUI_TA_CENTER);
		EDIT_SetTextAlign(WM_GetDialogItem(hWin,GUI_ID_EDIT3),GUI_TA_VCENTER|GUI_TA_CENTER);
		EDIT_SetTextAlign(WM_GetDialogItem(hWin,GUI_ID_EDIT4),GUI_TA_VCENTER|GUI_TA_CENTER);	

}
예제 #5
0
/*********************************************************************
*
*       _DemoMultiedit
*/
static void _DemoMultiedit(void) {
  GUI_RECT Rect;
  int WinFlags;
  _hFrame = 1;
  _Overwrite = 0;
  _ReadOnly  = 0;
  _Password  = 0;
  /* Create framewin */
  _ChangeInfoText("Create framewin", SPEED);
  _hFrame = FRAMEWIN_CreateEx(60, 80, 200, 120, WM_HBKWIN, WM_CF_SHOW, 0, 0, "Notepad", 0);
  _hClient = WM_GetClientWindow(_hFrame);
  _pcbFrameWin       = WM_SetCallback(_hFrame,  _cbFrameWin);
  _pcbFrameWinClient = WM_SetCallback(_hClient, _cbFrameWinClient);
  /* Set framewin properties */
  FRAMEWIN_SetMoveable(_hFrame, 1);
  FRAMEWIN_SetActive(_hFrame, 1);
  FRAMEWIN_SetTextAlign(_hFrame, GUI_TA_HCENTER | GUI_TA_VCENTER);
  FRAMEWIN_SetFont(_hFrame, &GUI_Font8x12_ASCII);
  FRAMEWIN_SetTitleHeight(_hFrame, 16);
  /* Add framewin buttons */
  if (_ChangeInfoText("Add framewin buttons", SPEED)) return;
  FRAMEWIN_AddCloseButton(_hFrame, FRAMEWIN_BUTTON_LEFT,  0);
  FRAMEWIN_AddMaxButton(_hFrame, FRAMEWIN_BUTTON_RIGHT, 0);
  FRAMEWIN_AddMinButton(_hFrame, FRAMEWIN_BUTTON_RIGHT, 1);
  WM_InvalidateWindow(_hFrame);
  /* Create buttons */
  if (_ChangeInfoText("Add option buttons", SPEED)) return;
  _hWrapButton = _CreateLButton("None",   0, 36, 16, _hClient, ID_NONEWRAP);
                 _CreateLButton("Word",  37, 36, 16, _hClient, ID_WORDWRAP);
                 _CreateLButton("Char",  74, 36, 16, _hClient, ID_CHARWRAP);
                 _CreateRButton("PSW",   52, 25, 16, _hClient, ID_PASSWORD);
                 _CreateRButton("OVR",   26, 25, 16, _hClient, ID_OVERWRITE);
                 _CreateRButton("R/O",    0, 25, 16, _hClient, ID_READONLY);
  _SetButtonState(_hWrapButton, 1);
  /* Create multiedit */
  if (_ChangeInfoText("using\nMULTIEDIT_CreateEx", SPEED)) return;
  WinFlags = WM_CF_SHOW | WM_CF_ANCHOR_RIGHT | WM_CF_ANCHOR_LEFT | WM_CF_ANCHOR_TOP | WM_CF_ANCHOR_BOTTOM;
  WM_GetClientRectEx(_hClient, &Rect);
  _hMEdit = MULTIEDIT_CreateEx(0, 0, 0, Rect.y1 - 16 + 1, _hClient, WinFlags, MULTIEDIT_CF_INSERT, 0, 0, "");
  _pcbMultiEdit = WM_SetCallback(_hMEdit,  _cbMultiEdit);
  MULTIEDIT_SetAutoScrollH(_hMEdit, 1);
  MULTIEDIT_SetAutoScrollV(_hMEdit, 1);
  WM_SetFocus(_hMEdit);
  if (_ChangeInfoText("using\nMULTIEDIT_SetText", SPEED)) return;
  MULTIEDIT_SetText(_hMEdit, "This sample demonstrates the use of a multiedit widget!");
  if (_ChangeInfoText("using\nMULTIEDIT_SetFont", SPEED)) return;
  MULTIEDIT_SetFont(_hMEdit, &GUI_Font16_1);
  if (_ChangeInfoText("using\nMULTIEDIT_SetTextColor", SPEED)) return;
  MULTIEDIT_SetTextColor(_hMEdit, 0, 0xE00000);
  if (_ChangeInfoText("using\nMULTIEDIT_SetBkColor", SPEED)) return;
  MULTIEDIT_SetBkColor(_hMEdit, 0, 0xD0FFFF);
  if (_ChangeInfoText("using\nMULTIEDIT_SetWrapWord", SPEED)) return;
  MULTIEDIT_SetWrapWord(_hMEdit);
  _SetButtonState(_hWrapButton, 0);
  _hWrapButton = WM_GetDialogItem(_hClient, ID_WORDWRAP);
  _SetButtonState(_hWrapButton, 1);
  if (_ChangeInfoText("using\nMULTIEDIT_SetHBorder", SPEED)) return;
  MULTIEDIT_SetHBorder(_hMEdit, 3);
  if (_ChangeInfoText("using\nMULTIEDIT_SetPrompt", SPEED)) return;
  MULTIEDIT_SetPrompt(_hMEdit, "Type: ");
  if (_ChangeInfoText("Play with multiedit...", SPEED)) return;
  while (_hFrame) {
    GUI_Delay(100);
  }
}
예제 #6
0
void MeasureData_InitDialog (WM_MESSAGE* pMsg) {
	WM_HWIN hWin = pMsg->hWin;
	//
	//FRAMEWIN
	//
	FRAMEWIN_SetBarColor(hWin, 1, 0xff901e);
	FRAMEWIN_SetClientColor(hWin, 0xc0c0c0);
	FRAMEWIN_SetTextColor(hWin, 0xcc3299);
	FRAMEWIN_SetFont(hWin, &GUI_Font16B_ASCII);
	FRAMEWIN_SetTextAlign(hWin, GUI_TA_VCENTER | GUI_TA_CENTER);
	FRAMEWIN_AddCloseButton(hWin, FRAMEWIN_BUTTON_RIGHT, 0);
	FRAMEWIN_AddMaxButton(hWin, FRAMEWIN_BUTTON_RIGHT, 1);
	FRAMEWIN_AddMinButton(hWin, FRAMEWIN_BUTTON_RIGHT, 2);
	FRAMEWIN_SetTitleHeight(hWin, 16);
	//
	//GUI_ID_TEXT0
	//
	TEXT_SetBkColor(WM_GetDialogItem(hWin, GUI_ID_TEXT0), 0xc0c0c0);
	TEXT_SetTextColor(WM_GetDialogItem(hWin, GUI_ID_TEXT0), 0x228b22);
	TEXT_SetFont(WM_GetDialogItem(hWin, GUI_ID_TEXT0), &GUI_Font24B_ASCII);
	//
	//GUI_ID_TEXT2
	//
	TEXT_SetBkColor(WM_GetDialogItem(hWin, GUI_ID_TEXT2), 0xc0c0c0);
	TEXT_SetTextColor(WM_GetDialogItem(hWin, GUI_ID_TEXT2), 0x4763ff);
	TEXT_SetFont(WM_GetDialogItem(hWin, GUI_ID_TEXT2), &GUI_Font24B_ASCII);
	//
	//GUI_ID_TEXT1
	//
	TEXT_SetBkColor(WM_GetDialogItem(hWin, GUI_ID_TEXT1), 0xc0c0c0);
	TEXT_SetTextColor(WM_GetDialogItem(hWin, GUI_ID_TEXT1), 0xe16941);
	TEXT_SetFont(WM_GetDialogItem(hWin, GUI_ID_TEXT1), &GUI_Font24B_ASCII);
	//
	//GUI_ID_EDIT1
	//
	EDIT_SetFont(WM_GetDialogItem(hWin, GUI_ID_EDIT1), &GUI_Font24B_ASCII);
	EDIT_SetTextAlign(WM_GetDialogItem(hWin, GUI_ID_EDIT1), GUI_TA_VCENTER | GUI_TA_LEFT);
	//
	//GUI_ID_EDIT2
	//
	EDIT_SetFont(WM_GetDialogItem(hWin, GUI_ID_EDIT2), &GUI_Font24B_ASCII);
	EDIT_SetTextAlign(WM_GetDialogItem(hWin, GUI_ID_EDIT2), GUI_TA_VCENTER | GUI_TA_LEFT);
	//
	//GUI_ID_EDIT3
	//
	EDIT_SetFont(WM_GetDialogItem(hWin, GUI_ID_EDIT3), &GUI_Font24B_ASCII);
	EDIT_SetTextAlign(WM_GetDialogItem(hWin, GUI_ID_EDIT3), GUI_TA_VCENTER | GUI_TA_LEFT);
	//
	//GUI_ID_EDIT4
	//
	EDIT_SetTextColor(WM_GetDialogItem(hWin, GUI_ID_EDIT4), 0, 0x228b22);
	EDIT_SetFont(WM_GetDialogItem(hWin, GUI_ID_EDIT4), &GUI_Font24B_ASCII);
	EDIT_SetTextAlign(WM_GetDialogItem(hWin, GUI_ID_EDIT4), GUI_TA_VCENTER | GUI_TA_CENTER);
	//
	//GUI_ID_EDIT5
	//
	EDIT_SetTextColor(WM_GetDialogItem(hWin, GUI_ID_EDIT5), 0, 0xff901e);
	EDIT_SetFont(WM_GetDialogItem(hWin, GUI_ID_EDIT5), &GUI_Font24B_ASCII);
	EDIT_SetTextAlign(WM_GetDialogItem(hWin, GUI_ID_EDIT5), GUI_TA_VCENTER | GUI_TA_CENTER);
	//
	//GUI_ID_EDIT6
	//
	EDIT_SetTextColor(WM_GetDialogItem(hWin, GUI_ID_EDIT6), 0, 0x4763ff);
	EDIT_SetFont(WM_GetDialogItem(hWin, GUI_ID_EDIT6), &GUI_Font24B_ASCII);
	EDIT_SetTextAlign(WM_GetDialogItem(hWin, GUI_ID_EDIT6), GUI_TA_VCENTER | GUI_TA_CENTER);
}
예제 #7
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;
  }
}
/*********************************************************************
*
*       _cbDialog
*/
static void _cbDialog(WM_MESSAGE * pMsg) {
  WM_HWIN hItem;
  int Id, NCode;
  // USER START (Optionally insert additional variables)
  // USER END

  switch (pMsg->MsgId) {
  case WM_INIT_DIALOG:
    //
    // Initialization of 'Framewin'
    //
    hItem = pMsg->hWin;
    FRAMEWIN_SetTitleHeight(hItem, 20);
    FRAMEWIN_SetText(hItem, "Framewin");
    FRAMEWIN_SetFont(hItem, GUI_FONT_13B_ASCII);
    FRAMEWIN_SetTextAlign(hItem, GUI_TA_HCENTER | GUI_TA_VCENTER);
    FRAMEWIN_SetTextColor(hItem, 0x00FF0000);
    //
    // Initialization of 'Edit'
    //
    hItem = WM_GetDialogItem(pMsg->hWin, ID_EDIT_0);
    EDIT_SetText(hItem, "123");
    //
    // Initialization of 'Button'
    //
    hItem = WM_GetDialogItem(pMsg->hWin, ID_BUTTON_0);
    BUTTON_SetText(hItem, "Browse");
    //
    // Initialization of 'Button'
    //
    hItem = WM_GetDialogItem(pMsg->hWin, ID_BUTTON_1);
    BUTTON_SetText(hItem, "Start");
    //
    // Initialization of 'Checkbox'
    //
    hItem = WM_GetDialogItem(pMsg->hWin, ID_CHECKBOX_0);
    CHECKBOX_SetText(hItem, "Check-1");
    //
    // Initialization of 'Checkbox'
    //
    hItem = WM_GetDialogItem(pMsg->hWin, ID_CHECKBOX_1);
    CHECKBOX_SetText(hItem, "Check-2");
    // USER START (Optionally insert additional code for further widget initialization)
    // USER END
    break;
  case WM_NOTIFY_PARENT:
    Id    = WM_GetId(pMsg->hWinSrc);
    NCode = pMsg->Data.v;
    switch(Id) {
    case ID_EDIT_0: // Notifications sent by 'Edit'
      switch(NCode) {
      case WM_NOTIFICATION_CLICKED:
        // USER START (Optionally insert code for reacting on notification message)
        // USER END
        break;
      case WM_NOTIFICATION_RELEASED:
        // USER START (Optionally insert code for reacting on notification message)
        // USER END
        break;
      case WM_NOTIFICATION_VALUE_CHANGED:
        // USER START (Optionally insert code for reacting on notification message)
        // USER END
        break;
      // USER START (Optionally insert additional code for further notification handling)
      // USER END
      }
      break;
    case ID_BUTTON_0: // Notifications sent by 'Button'
      switch(NCode) {
      case WM_NOTIFICATION_CLICKED:
        // USER START (Optionally insert code for reacting on notification message)
        // USER END
        break;
      case WM_NOTIFICATION_RELEASED:
        // USER START (Optionally insert code for reacting on notification message)
        // USER END
        break;
      // USER START (Optionally insert additional code for further notification handling)
      // USER END
      }
      break;
    case ID_BUTTON_1: // Notifications sent by 'Button'
      switch(NCode) {
      case WM_NOTIFICATION_CLICKED:
        // USER START (Optionally insert code for reacting on notification message)
        // USER END
        break;
      case WM_NOTIFICATION_RELEASED:
        // USER START (Optionally insert code for reacting on notification message)
        // USER END
        break;
      // USER START (Optionally insert additional code for further notification handling)
      // USER END
      }
      break;
    case ID_CHECKBOX_0: // Notifications sent by 'Checkbox'
      switch(NCode) {
      case WM_NOTIFICATION_CLICKED:
        // USER START (Optionally insert code for reacting on notification message)
        // USER END
        break;
      case WM_NOTIFICATION_RELEASED:
        // USER START (Optionally insert code for reacting on notification message)
        // USER END
        break;
      case WM_NOTIFICATION_VALUE_CHANGED:
        // USER START (Optionally insert code for reacting on notification message)
        // USER END
        break;
      // USER START (Optionally insert additional code for further notification handling)
      // USER END
      }
      break;
    case ID_CHECKBOX_1: // Notifications sent by 'Checkbox'
      switch(NCode) {
      case WM_NOTIFICATION_CLICKED:
        // USER START (Optionally insert code for reacting on notification message)
        // USER END
        break;
      case WM_NOTIFICATION_RELEASED:
        // USER START (Optionally insert code for reacting on notification message)
        // USER END
        break;
      case WM_NOTIFICATION_VALUE_CHANGED:
        // USER START (Optionally insert code for reacting on notification message)
        // USER END
        break;
      // USER START (Optionally insert additional code for further notification handling)
      // USER END
      }
      break;
    case ID_SLIDER_0: // Notifications sent by 'Slider'
      switch(NCode) {
      case WM_NOTIFICATION_CLICKED:
        // USER START (Optionally insert code for reacting on notification message)
        // USER END
        break;
      case WM_NOTIFICATION_RELEASED:
        // USER START (Optionally insert code for reacting on notification message)
        // USER END
        break;
      case WM_NOTIFICATION_VALUE_CHANGED:
        // USER START (Optionally insert code for reacting on notification message)
        // USER END
        break;
      // USER START (Optionally insert additional code for further notification handling)
      // USER END
      }
      break;
    // USER START (Optionally insert additional code for further Ids)
    // USER END
    }
    break;
  // USER START (Optionally insert additional message handling)
  // USER END
  default:
    WM_DefaultProc(pMsg);
    break;
  }
}
예제 #9
0
/*********************************************************************
*
*       _cbDialog
*/
static void _cbDialogBrowser(WM_MESSAGE * pMsg) {
	TREEVIEW_ITEM_Handle hNode;			//结点句柄
	TREEVIEW_ITEM_INFO ItemInfo;
	WM_HWIN                hItem;
	int                    NCode;
	int                    Id;
	// USER START (Optionally insert additional variables)
    SCROLLBAR_Handle       hScrollbar;
	// USER END

	switch (pMsg->MsgId) {
	case WM_DELETE:
		ltk_printf("Browserapp delete\n");
        record_file=0;
        _CreateFrame(&_cbIndex);
	break;
	case WM_INIT_DIALOG:
		//
		// Initialization of 'Browser'
		//
		hItem = pMsg->hWin;
		FRAMEWIN_SetTextColor(hItem,GUI_WHITE);
		FRAMEWIN_SetFont(hItem, GUI_FONT_20B_ASCII);
		FRAMEWIN_SetTextAlign(hItem, GUI_TA_LEFT | GUI_TA_VCENTER);
		FRAMEWIN_AddCloseButton(hItem,FRAMEWIN_BUTTON_RIGHT,0);
//      FRAMEWIN_AddMaxButton(hItem, FRAMEWIN_BUTTON_RIGHT, 1);
//      FRAMEWIN_AddMinButton(hItem, FRAMEWIN_BUTTON_RIGHT, 2);
		FRAMEWIN_SetTitleHeight(hItem, 25);
		//
		// Initialization of 'FileTree'
		//
        GUI_UC_SetEncodeNone();
		hItem = WM_GetDialogItem(pMsg->hWin, GUI_ID_TREEVIEW0);
        TREEVIEW_SetFont(hItem,&GUI_FontHZ16);
//		TREEVIEW_SetAutoScrollH(hItem,1);
//		TREEVIEW_SetAutoScrollV(hItem,1);
        hScrollbar = SCROLLBAR_CreateAttached(hItem,SCROLLBAR_CF_VERTICAL);  //创建窗口的子控件
        SCROLLBAR_SetWidth(hScrollbar,20); //设置滚动条宽度为20
		TREEVIEW_SetSelMode(hItem, TREEVIEW_SELMODE_ROW);  //使用自动滚动条
		hNode = TREEVIEW_InsertItem(hItem, TREEVIEW_ITEM_TYPE_NODE, 0, 0, "SDCard[0:]");
		// USER START (Optionally insert additional code for further widget initialization)
        if( SD_OK !=  c_sdReader_init()) ltk_printf("sd card init failed\r\n");
		Fill_FileList("0:",record_file,hItem,hNode,NULL);
		TREEVIEW_ITEM_Expand(hNode);
		// USER END
	break;
	case WM_NOTIFY_PARENT:
		Id    = WM_GetId(pMsg->hWinSrc);
		NCode = pMsg->Data.v;
		switch(Id) {
		case GUI_ID_TREEVIEW0: // Notifications sent by 'FileTree'
            switch(NCode) {
            case WM_NOTIFICATION_CLICKED:
            break;
            case WM_NOTIFICATION_RELEASED:
                // USER START (Optionally insert code for reacting on notification message)
                //printf("\n release\n");				
                /* 查看选中了哪个项目 */
                hNode = TREEVIEW_GetSel(pMsg->hWinSrc);						
                /* 获取该项目的信息 */
                TREEVIEW_ITEM_GetInfo(hNode,&ItemInfo);

                if(ItemInfo.IsNode == 0)        //点击的是目录树的叶子(即文件)
                {
                    //printf("\r\nleaf num =%ld",hNode);
                    OpenFileProcess(hNode,record_file);
                }
                //		else										        //结点
                //		{					
                //			printf("\r\nnode num =%ld",hNode);
                //		}
                // USER END
            break;
            case WM_NOTIFICATION_MOVED_OUT:
                // USER START (Optionally insert code for reacting on notification message)
                // USER END
            break;
            case WM_NOTIFICATION_SEL_CHANGED:
                // USER START (Optionally insert code for reacting on notification message)
                // USER END
            break;
                // USER START (Optionally insert additional code for further notification handling)
                // USER END
            }
        break;
		// USER START (Optionally insert additional code for further Ids)
		// USER END
        }
    break;
	// USER START (Optionally insert additional message handling)
	// USER END
	default:
	WM_DefaultProc(pMsg);
		break;
	}
}