Ejemplo n.º 1
0
/*********************************************************************
*
*       Dialog callback routine
*/
static void _cbCallback(WM_MESSAGE * pMsg) {
  int NCode, Id;
  WM_HWIN hEdit0, hEdit1, hEdit2, hEdit3, hListBox;
  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);
      /* 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, 0xffff);
      EDIT_SetBinMode(hEdit3, 0x1234, 0, 0xffff);
      LISTBOX_SetText(hListBox, _apListBox);
      SCROLLBAR_CreateAttached(hListBox, SCROLLBAR_CF_VERTICAL);
      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;
        case WM_NOTIFICATION_SEL_CHANGED: /* Selection changed */
          FRAMEWIN_SetText(hWin, "Dialog - sel changed");
          break;
        default:
          FRAMEWIN_SetText(hWin, "Dialog - notification received");
      }
      break;
    default:
      WM_DefaultProc(pMsg);
  }
}
Ejemplo n.º 2
0
/*********************************************************************
*
*       _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 'Demo'
    //
    hItem = pMsg->hWin;
    FRAMEWIN_SetText(hItem, "GUIBuilder Demo");
    FRAMEWIN_SetFont(hItem, GUI_FONT_24B_ASCII);
    FRAMEWIN_SetTextAlign(hItem, GUI_TA_HCENTER | GUI_TA_VCENTER);
    FRAMEWIN_SetTextColor(hItem, 0x00FF8000);
    SCROLLBAR_CreateAttached(hItem, 0);
    SCROLLBAR_CreateAttached(hItem, SCROLLBAR_CF_VERTICAL);
    //
    // Initialization of 'Text'
    //
    hItem = WM_GetDialogItem(pMsg->hWin, ID_TEXT_0);
    TEXT_SetText(hItem, "This is a text!");
    TEXT_SetTextAlign(hItem, GUI_TA_HCENTER | GUI_TA_VCENTER);
    TEXT_SetTextColor(hItem, 0x00000000);
    TEXT_SetFont(hItem, GUI_FONT_16B_ASCII);
    // USER START (Optionally insert additional code for further widget initialization)
    // USER END
    break;
  case WM_NOTIFY_PARENT:
    Id    = WM_GetId(pMsg->hWinSrc);
    NCode = pMsg->Data.v;
    switch(Id) {
    case ID_BUTTON_0: // Notifications sent by 'Button'
      switch(NCode) {
      case WM_NOTIFICATION_CLICKED:
        // USER START (Optionally insert code for reacting on notification message)
        // USER END
        break;
      case WM_NOTIFICATION_RELEASED:
        // USER START (Optionally insert code for reacting on notification message)
        // USER END
        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;
  }
}
Ejemplo n.º 3
0
/*********************************************************************
*
*       _SetEffect
*/
static void _SetEffect(int Index) {
  int i;
  const WIDGET_EFFECT * pEffect;
  pEffect = _apEffect[Index];
  WIDGET_SetDefaultEffect(pEffect);
  FRAMEWIN_SetText(_hFrameWin, _apEffects[Index]);
  /* Iterate over all dialog widgets */
  for (i = 0; i < NUM_WIDGETS; i++) {
    _SetWidgetEffect(_ahWin[i], _apEffect[Index]); /* Set effect */
  }
}
Ejemplo n.º 4
0
/*********************************************************************
*
*       Обновление оглавления диалогового окна
*/
void update_do_title() {
  char titleText[100] = {0};
  unsigned int i = 0;
  for (; _rankDlgDOItem[0].pText[sel_language][i] != '\0'; i++) {
    titleText[i] = _rankDlgDOItem[0].pText[sel_language][i];
  }
  char numberDOText[3] = {0};
  int numPg = do_index + 1;
  _PARSE_INT_TO_STR(numPg, numberDOText);
  _CONCAT_STR(titleText, numberDOText);
  FRAMEWIN_SetText(rankDlgDOPg, titleText);
}
Ejemplo n.º 5
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);
	}
    
}
Ejemplo n.º 6
0
static void _cbDialog(WM_MESSAGE * pMsg) {
  WM_HWIN hItem;

  switch (pMsg->MsgId) {
  case WM_INIT_DIALOG:

    hItem = pMsg->hWin;
    FRAMEWIN_SetText(hItem, "welcome");
    FRAMEWIN_SetTextAlign(hItem, GUI_TA_HCENTER | GUI_TA_VCENTER);
    FRAMEWIN_SetTitleVis(hItem, 0);
    //
    // Initialization of 'Text'
    //
    hItem = WM_GetDialogItem(pMsg->hWin, ID_TEXT_0);
    TEXT_SetTextAlign(hItem, GUI_TA_HCENTER | GUI_TA_VCENTER);
    TEXT_SetFont(hItem, GUI_FONT_20B_1);
    TEXT_SetTextColor(hItem, 0x000000FF);
    TEXT_SetText(hItem, "welcome to use our system");
    //
    // Initialization of 'Text'
    //
    hItem = WM_GetDialogItem(pMsg->hWin, ID_TEXT_1);
    TEXT_SetTextAlign(hItem, GUI_TA_HCENTER | GUI_TA_VCENTER);
    TEXT_SetFont(hItem, GUI_FONT_16B_1);
    TEXT_SetTextColor(hItem, 0x008000FF);
    TEXT_SetText(hItem, "The elderly assistant");
    //
    // Initialization of 'Text'
    //
    hItem = WM_GetDialogItem(pMsg->hWin, ID_TEXT_2);
    TEXT_SetTextAlign(hItem, GUI_TA_HCENTER | GUI_TA_VCENTER);
    TEXT_SetText(hItem, "Just a moment, please. ");
    //
    // Initialization of 'Text'
    //
    hItem = WM_GetDialogItem(pMsg->hWin, ID_TEXT_3);
    TEXT_SetText(hItem, "second");
    TEXT_SetTextAlign(hItem, GUI_TA_HCENTER | GUI_TA_VCENTER);
    // USER START (Optionally insert additional code for further widget initialization)
    // USER END
    break;
  // USER START (Optionally insert additional message handling)
  // USER END
  default:
    WM_DefaultProc(pMsg);
    break;
  }
}
Ejemplo n.º 7
0
/*********************************************************************
*
*       _cbDialog
*/
static void _cbDialog(WM_MESSAGE * pMsg)
{
    WM_HWIN hItem;
    int     NCode;
    int     Id;
    // USER START (Optionally insert additional variables)
    // USER END
    GUI_DrawBitmap(&bmlogo,40,10);
#if(Gradient_Rectangle)
    {
        GUI_DrawGradientRoundedH(220,120,580,380,20,REC_color1,REC_color2);
    }
#endif

#if(RoundedFrame)
    GUI_SetColor(GUI_GREEN);
    GUI_DrawRoundedFrame(218,118,582,382,20,3);
#endif

#if(FillRoundedRect)
    GUI_SetColor(RoundedRect);
    GUI_FillRoundedRect(220,120,580,380,20);
#endif

    switch (pMsg->MsgId)
        {
        case WM_INIT_DIALOG:
            //
            // Initialization of 'inuse'
            //


            hItem = pMsg->hWin;
            FRAMEWIN_SetTitleVis(hItem, 0);
            FRAMEWIN_SetClientColor( hItem, framewin_backcolor);
            FRAMEWIN_SetFont(hItem, GUI_FONT_8_1);
            FRAMEWIN_SetText(hItem, "Framewin");
            FRAMEWIN_SetTextAlign(hItem, GUI_TA_HCENTER | GUI_TA_VCENTER);
            FRAMEWIN_SetTextColor(hItem, 0x00000000);


            hItem = pMsg->hWin;
            FRAMEWIN_SetTitleVis(hItem, 0);

            hItem = WM_GetDialogItem(pMsg->hWin, ID_BUTTON_1);
            BUTTON_SetFont(hItem, &GUI_Fonthz_song30);
            BUTTON_SetText(hItem, "返回 ");
#if(Button_3Dskin)
            BUTTON_SetSkin(hItem,BUTTON_SKIN_FLEX);
#endif
#if(!Button_3Dskin)
            BUTTON_SetBkColor( hItem,BUTTON_CI_UNPRESSED,Button_unpress_color);
            BUTTON_SetBkColor( hItem,BUTTON_CI_PRESSED,Button_press_color);
#endif

            //
            // Initialization of 'Button'
            //
            hItem = WM_GetDialogItem(pMsg->hWin, ID_BUTTON_0);
            BUTTON_SetFont(hItem, &GUI_Fonthz_song30);
            BUTTON_SetText(hItem, "停止充电 ");
#if(Button_3Dskin)
            BUTTON_SetSkin(hItem,BUTTON_SKIN_FLEX);
#endif
#if(!Button_3Dskin)
            BUTTON_SetBkColor( hItem,BUTTON_CI_UNPRESSED,Button_unpress_color);
            BUTTON_SetBkColor( hItem,BUTTON_CI_PRESSED,Button_press_color);
#endif
            //
            // Initialization of 'Button'
            //
            //
            // Initialization of 'Edit'
            //
            hItem = WM_GetDialogItem(pMsg->hWin, ID_EDIT_0);
            EDIT_EnableBlink( hItem,1 ,0);
            EDIT_SetDecMode(hItem,0,0,99,0,0);
            EDIT_SetFont(hItem, GUI_FONT_32_ASCII);
            EDIT_SetTextAlign(hItem, GUI_TA_HCENTER | GUI_TA_VCENTER);
            //
            // Initialization of 'Edit'
            //
            hItem = WM_GetDialogItem(pMsg->hWin, ID_EDIT_1);
            EDIT_EnableBlink( hItem,1 ,0);
            EDIT_SetDecMode(hItem,0,0,99,0,0);
            EDIT_SetFont(hItem, GUI_FONT_32_ASCII);
            EDIT_SetTextAlign(hItem, GUI_TA_HCENTER | GUI_TA_VCENTER);
            EDIT_SetTextColor(hItem, EDIT_CI_ENABLED, 0x00000000);
            //
            // Initialization of 'Edit'
            //
            hItem = WM_GetDialogItem(pMsg->hWin, ID_EDIT_2);
            EDIT_EnableBlink( hItem,1 ,0);
            EDIT_SetDecMode(hItem,0,0,99,0,0);
            EDIT_SetFont(hItem, GUI_FONT_32_ASCII);
            EDIT_SetTextAlign(hItem, GUI_TA_HCENTER | GUI_TA_VCENTER);
            EDIT_SetTextColor(hItem, EDIT_CI_ENABLED, 0x00000000);
            //
            // Initialization of 'Edit'
            //
            hItem = WM_GetDialogItem(pMsg->hWin, ID_EDIT_3);
            EDIT_EnableBlink( hItem,1 ,0);
            EDIT_SetDecMode(hItem,0,0,9999,0,0);
            EDIT_SetFont(hItem, GUI_FONT_32_ASCII);
            EDIT_SetTextAlign(hItem, GUI_TA_HCENTER | GUI_TA_VCENTER);
            EDIT_SetTextColor(hItem, EDIT_CI_ENABLED, 0x00000000);
            //
            // Initialization of 'cddianliang'
            //
            hItem = WM_GetDialogItem(pMsg->hWin, ID_TEXT_0);
            TEXT_SetFont(hItem, &GUI_Fonthz_song24);

            TEXT_SetText(hItem, "使用电量 ");
            TEXT_SetTextAlign(hItem, GUI_TA_RIGHT);
            TEXT_SetTextColor(hItem, 0x00000000);
            //
            // Initialization of 'Text'
            //
            hItem = WM_GetDialogItem(pMsg->hWin, ID_TEXT_1);
            TEXT_SetFont(hItem, &GUI_Fonthz_song24);

            TEXT_SetText(hItem, "使用时间 ");
            TEXT_SetTextColor(hItem, 0x00000000);
            TEXT_SetTextAlign(hItem, GUI_TA_RIGHT);
            //
            // Initialization of 'Text'
            //
            hItem = WM_GetDialogItem(pMsg->hWin, ID_TEXT_2);
            TEXT_SetFont(hItem, &GUI_Fonthz_song24);

            TEXT_SetText(hItem, "消费金额 ");
            TEXT_SetTextAlign(hItem, GUI_TA_RIGHT);
            TEXT_SetTextColor(hItem, 0x00000000);
            //
            // Initialization of 'Text'
            //
            hItem = WM_GetDialogItem(pMsg->hWin, ID_TEXT_3);
            TEXT_SetFont(hItem, &GUI_Fonthz_song24);

            TEXT_SetText(hItem, "账户余额 ");
            TEXT_SetTextAlign(hItem, GUI_TA_RIGHT);
            TEXT_SetTextColor(hItem, 0x00000000);

            hItem = WM_GetDialogItem(pMsg->hWin, ID_TEXT_4);
            TEXT_SetTextAlign(hItem, GUI_TA_LEFT | GUI_TA_TOP);
            TEXT_SetText(hItem, "安徽绿建科技有限公司 ");
            TEXT_SetTextColor(hItem, 0x00000000);
            TEXT_SetFont(hItem, &GUI_FontSong_60);
            //
            // Initialization of 'Text'
            //
            hItem = WM_GetDialogItem(pMsg->hWin, ID_TEXT_5);
            TEXT_SetTextAlign(hItem, GUI_TA_LEFT | GUI_TA_TOP);
            TEXT_SetTextColor(hItem, 0x00000000);
            TEXT_SetText(hItem, "ANHUI GREEN BUILDING TECHNOLOGY CO.,LTD.");
            TEXT_SetFont(hItem, GUI_FONT_24_ASCII);
            // USER START (Optionally insert additional code for further widget initialization)
            // USER END
            break;
        case WM_NOTIFY_PARENT:
            Id    = WM_GetId(pMsg->hWinSrc);
            NCode = pMsg->Data.v;
            switch(Id)
                {
                case ID_BUTTON_0: // Notifications sent by 'Button'
                    switch(NCode)
                        {
                        case WM_NOTIFICATION_CLICKED:
                            // USER START (Optionally insert code for reacting on notification message)
                            // USER END
                            break;
                        case WM_NOTIFICATION_RELEASED:
                            // USER START (Optionally insert code for reacting on notification message)
                            // USER END
//                        op=ensure;
//                        handle_button();
                        
                        GUI_EndDialog( pMsg->hWin,1);
                        Createensure();
                            break;
                            // USER START (Optionally insert additional code for further notification handling)
                            // USER END
                        }
                    break;
                case ID_BUTTON_1: // Notifications sent by 'Button'
                    switch(NCode)
                        {
                        case WM_NOTIFICATION_CLICKED:
                            // USER START (Optionally insert code for reacting on notification message)
                            // USER END
                            break;
                        case WM_NOTIFICATION_RELEASED:
                            // USER START (Optionally insert code for reacting on notification message)
                            // USER END
                            GUI_EndDialog( pMsg->hWin,1);
                            Createwindow0();
                            break;
                            // USER START (Optionally insert additional code for further notification handling)
                            // USER END
                        }
                    break;
                case ID_EDIT_0: // Notifications sent by 'Edit'
                    switch(NCode)
                        {
                        case WM_NOTIFICATION_CLICKED:
                            // USER START (Optionally insert code for reacting on notification message)
                            // USER END
                            break;
                        case WM_NOTIFICATION_RELEASED:
                            // USER START (Optionally insert code for reacting on notification message)
                            // USER END
                            break;
                        case WM_NOTIFICATION_VALUE_CHANGED:
                            // USER START (Optionally insert code for reacting on notification message)
                            // USER END
                            break;
                            // USER START (Optionally insert additional code for further notification handling)
                            // USER END
                        }
                    break;
                case ID_EDIT_1: // Notifications sent by 'Edit'
                    switch(NCode)
                        {
                        case WM_NOTIFICATION_CLICKED:
                            // USER START (Optionally insert code for reacting on notification message)
                            // USER END
                            break;
                        case WM_NOTIFICATION_RELEASED:
                            // USER START (Optionally insert code for reacting on notification message)
                            // USER END
                            break;
                        case WM_NOTIFICATION_VALUE_CHANGED:
                            // USER START (Optionally insert code for reacting on notification message)
                            // USER END
                            break;
                            // USER START (Optionally insert additional code for further notification handling)
                            // USER END
                        }
                    break;
                case ID_EDIT_2: // Notifications sent by 'Edit'
                    switch(NCode)
                        {
                        case WM_NOTIFICATION_CLICKED:
                            // USER START (Optionally insert code for reacting on notification message)
                            // USER END
                            break;
                        case WM_NOTIFICATION_RELEASED:
                            // USER START (Optionally insert code for reacting on notification message)
                            // USER END
                            break;
                        case WM_NOTIFICATION_VALUE_CHANGED:
                            // USER START (Optionally insert code for reacting on notification message)
                            // USER END
                            break;
                            // USER START (Optionally insert additional code for further notification handling)
                            // USER END
                        }
                    break;
                case ID_EDIT_3: // Notifications sent by 'Edit'
                    switch(NCode)
                        {
                        case WM_NOTIFICATION_CLICKED:
                            // USER START (Optionally insert code for reacting on notification message)
                            // USER END
                            break;
                        case WM_NOTIFICATION_RELEASED:
                            // USER START (Optionally insert code for reacting on notification message)
                            // USER END
                            break;
                        case WM_NOTIFICATION_VALUE_CHANGED:
                            // USER START (Optionally insert code for reacting on notification message)
                            // USER END
                            break;
                            // USER START (Optionally insert additional code for further notification handling)
                            // USER END
                        }
                    break;
                    // USER START (Optionally insert additional code for further Ids)
                    // USER END
                }
            break;
            // USER START (Optionally insert additional message handling)
            // USER END
        default:
            WM_DefaultProc(pMsg);
            break;
        }
}
/*********************************************************************
*
*       _cbCallback
*/
static void _cbCallback(WM_MESSAGE * pMsg) {
  WM_HWIN hWin = pMsg->hWin;
  #if GUIDEMO_LARGE
    int NCode, Id;
  #endif
  switch (pMsg->MsgId) {
    case WM_INIT_DIALOG:
      /* Initialize all widgets */
      #if GUIDEMO_TINY
        EDIT_SetText(WM_GetDialogItem(hWin, GUI_ID_EDIT0), "EDIT");
      #else
        EDIT_SetText(WM_GetDialogItem(hWin, GUI_ID_EDIT0), "EDIT widget 0");
        EDIT_SetText(WM_GetDialogItem(hWin, GUI_ID_EDIT1), "EDIT widget 1");
      #endif
      {
        #if GUIDEMO_LARGE
          WM_HWIN hListBox;
          EDIT_SetHexMode(WM_GetDialogItem(hWin, GUI_ID_EDIT2), 0x1234, 0, 0xffffff);
          EDIT_SetBinMode(WM_GetDialogItem(hWin, GUI_ID_EDIT3), 0x1234, 0, 0xffff);
          hListBox = WM_GetDialogItem(hWin, GUI_ID_LISTBOX0);
          LISTBOX_SetText(hListBox, _apListBox);
          SCROLLBAR_CreateAttached(hListBox, SCROLLBAR_CF_VERTICAL);
        #else
          GUI_RECT Rect;
          int x, y, ySize;
          ySize = LCD_GetYSize();
          if (ySize < 120) {
            WM_ResizeWindow(hWin, 0, -24);
          }
          WM_GetWindowRectEx(hWin, &Rect);
          x = (LCD_GetXSize() - (Rect.x1 - Rect.x0 + 1)) >> 1;
          y = (ySize          - (Rect.y1 - Rect.y0 + 1)) >> 1;
          #if GUIDEMO_TINY
            WM_MoveTo(hWin, x, y);
          #else
            WM_MoveTo(hWin, x, y - 4);
          #endif
        #endif
      }
      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;
  #if GUIDEMO_LARGE
    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;
        case WM_NOTIFICATION_SEL_CHANGED: /* Selection changed */
          FRAMEWIN_SetText(hWin, "Dialog - sel changed");
          break;
        default:
          FRAMEWIN_SetText(hWin, "Dialog - notification received");
      }
      break;
  #endif
    default:
      WM_DefaultProc(pMsg);
  }
}
Ejemplo n.º 9
0
/**
  * @brief  Callback routine of playlist Info dialog
  * @param  pMsg: pointer to data structure of type WM_MESSAGE 
  * @retval None
  */
static void _cbPlaylistDialog(WM_MESSAGE * pMsg) {
  int     NCode;
  int     Id;
  int     r;
  WM_HWIN hItem;

  static char tmp[64];
  uint32_t i = 0;
  
  switch (pMsg->MsgId) {
  case WM_INIT_DIALOG:
    
    hItem = WM_GetDialogItem(pMsg->hWin, ID_BUTTON_OKPL);
    WM_SetCallback(hItem, _cbButton_okPL);
    
    hItem = WM_GetDialogItem(pMsg->hWin, ID_BUTTON_ADDPL);
    WM_SetCallback(hItem, _cbButton_add2PL);   
    
    
    hItem = LISTVIEW_CreateEx(85, 50, 440, 260, pMsg->hWin, WM_CF_SHOW, 0, ID_VIDEO_LIST);

    LISTVIEW_SetFont(hItem, &GUI_FontAvantGarde24);
    LISTVIEW_SetTextColor(hItem, LISTVIEW_CI_UNSEL, GUI_STCOLOR_LIGHTBLUE);
    LISTVIEW_SetTextColor(hItem, LISTVIEW_CI_SEL, GUI_WHITE);
    LISTVIEW_SetHeaderHeight(hItem, 0);
    LISTVIEW_AddColumn(hItem, 440, "", GUI_TA_VCENTER | GUI_TA_LEFT);
    LISTVIEW_SetGridVis(hItem, 0);
    LISTVIEW_SetAutoScrollV(hItem, 1);  
    WIDGET_SetEffect(hItem, &WIDGET_Effect_None);
    LISTVIEW_SetTextAlign(hItem, 0, GUI_TA_HCENTER); 
    
    if(VideoList.ptr > 0)
    {
      for(i=0; i<VideoList.ptr; i++)
      {
        strcpy(FileInfo.pRoot, (char *)VideoList.file[i].name);
        FILEMGR_GetFileOnly ((char *)tmp, (char *)FileInfo.pRoot);       
        LISTVIEW_AddRow(hItem, NULL);         
        LISTVIEW_SetItemText(hItem, 0, i, (char *)tmp);
      }
      sprintf(tmp, "PlayList [%d Item(s)]", VideoList.ptr);
      FRAMEWIN_SetText(pMsg->hWin, tmp);
    }
    else
    {
      FRAMEWIN_SetText(pMsg->hWin, "PlayList [no Item]");
    }
    break;
    
  case WM_NOTIFY_PARENT:
    Id    = WM_GetId(pMsg->hWinSrc);
    NCode = pMsg->Data.v;   
    switch(Id) {
    case ID_BUTTON_OKPL: /* Notifications sent by 'OK' */
      switch(NCode) {
      case WM_NOTIFICATION_RELEASED:
        GUI_EndDialog(pMsg->hWin, 0); 
        Video_FilePos = 0;
        hPlaylistWin = 0;
        break;
      }
      break;
      
    case ID_BUTTON_ADDPL: 
      switch(NCode) {
      case WM_NOTIFICATION_RELEASED:
        FileInfo.pfGetData = k_GetData;
        FileInfo.pMask = acMask_video;     
        hItem = ST_CHOOSEFILE_Create(pMsg->hWin, 0, 0, 600, 350,  apDrives, GUI_COUNTOF(apDrives), 0, "Video files", 0, &FileInfo);
        WM_MakeModal(hItem);
        r = GUI_WaitForDialogExec(hItem);
        if (r == 0) 
        {
          if((strstr(FileInfo.pRoot, ".emf")) || (strstr(FileInfo.pRoot, ".EMF")))
          {
            if(VideoList.ptr < FILEMGR_LIST_DEPDTH)
            {
              strcpy((char *)VideoList.file[VideoList.ptr].name, FileInfo.pRoot);
              FILEMGR_GetFileOnly ((char *)tmp, (char *)FileInfo.pRoot);
              hItem = WM_GetDialogItem(pMsg->hWin, ID_VIDEO_LIST);
              
              LISTVIEW_AddRow(hItem, NULL);         
              LISTVIEW_SetItemText(hItem, 0, VideoList.ptr, (char *)tmp);
              VideoList.ptr++;
            }
          }
          sprintf(tmp, "PlayList [%d Item(s)]", VideoList.ptr);
          FRAMEWIN_SetText(pMsg->hWin, tmp);
          WM_InvalidateWindow(pMsg->hWin);
        }
        
        break;
      }
      break;        
      
    }
    break;
  default:
    WM_DefaultProc(pMsg);
    break;
  }
}
Ejemplo n.º 10
0
/*********************************************************************
*
*       _cbDialog
*/
static void _cbDialog(WM_MESSAGE * pMsg)
{
    WM_HWIN hItem;
    int     NCode;
    int     Id;
    // USER START (Optionally insert additional variables)
    // USER END
    GUI_DrawBitmap(&bmlogo,40,10);
#if(Gradient_Rectangle)
    {
        GUI_DrawGradientRoundedH(220,120,580,380,20,REC_color1,REC_color2);
    }
#endif

#if(RoundedFrame)
    GUI_SetColor(GUI_GREEN);
    GUI_DrawRoundedFrame(218,118,582,382,20,3);
#endif

#if(FillRoundedRect)
    GUI_SetColor(RoundedRect);
    GUI_FillRoundedRect(220,120,580,380,20);
#endif

    switch (pMsg->MsgId)
        {
        case WM_INIT_DIALOG:
            //
            // Initialization of 'ICcard'
            //
            hItem = pMsg->hWin;
            FRAMEWIN_SetTitleVis(hItem, 0);
            FRAMEWIN_SetClientColor( hItem, BACKCOLOR);
            FRAMEWIN_SetFont(hItem, GUI_FONT_8_1);
            FRAMEWIN_SetText(hItem, "Framewin");
            FRAMEWIN_SetTextAlign(hItem, GUI_TA_HCENTER | GUI_TA_VCENTER);
            FRAMEWIN_SetTextColor(hItem, 0x00000000);
            //
            // Initialization of 'Button'
            //
//    hItem = WM_GetDialogItem(pMsg->hWin, ID_BUTTON_0);
//    BUTTON_SetFont(hItem, &GUI_Fonthz_song30);
//    BUTTON_SetText(hItem, "返回 ");
//  #if(Button_3Dskin)
//            BUTTON_SetSkin(hItem,BUTTON_SKIN_FLEX);
//#endif
//#if(!Button_3Dskin)
//            BUTTON_SetBkColor( hItem,BUTTON_CI_UNPRESSED,Button_unpress_color);
//            BUTTON_SetBkColor( hItem,BUTTON_CI_PRESSED,Button_press_color);
//#endif
            //
            // Initialization of 'Button'
            //
//            hItem = WM_GetDialogItem(pMsg->hWin, ID_BUTTON_1);
//            BUTTON_SetFont(hItem, GUI_FONT_13_1);
//            BUTTON_SetText(hItem, "exit");
//#if(Button_3Dskin)
//            BUTTON_SetSkin(hItem,BUTTON_SKIN_FLEX);
//#endif
//#if(!Button_3Dskin)
//            BUTTON_SetBkColor( hItem,BUTTON_CI_UNPRESSED,Button_unpress_color);
//            BUTTON_SetBkColor( hItem,BUTTON_CI_PRESSED,Button_press_color);
//#endif
            hItem = WM_GetDialogItem(pMsg->hWin, ID_TEXT_0);
            TEXT_SetTextAlign(hItem, GUI_TA_LEFT | GUI_TA_TOP);
            TEXT_SetText(hItem, "安徽绿建科技有限公司 ");
            TEXT_SetTextColor(hItem, 0x00000000);
            TEXT_SetFont(hItem, &GUI_FontSong_60);
            //
            // Initialization of 'Text'
            //
            hItem = WM_GetDialogItem(pMsg->hWin, ID_TEXT_1);
            TEXT_SetTextAlign(hItem, GUI_TA_LEFT | GUI_TA_TOP);
            TEXT_SetTextColor(hItem, 0x00000000);
            TEXT_SetText(hItem, "ANHUI GREEN BUILDING TECHNOLOGY CO.,LTD.");
            TEXT_SetFont(hItem, GUI_FONT_24_ASCII);

            //
            // Initialization of 'Text'
            //
            hItem = WM_GetDialogItem(pMsg->hWin, ID_TEXT_2);
            TEXT_SetFont(hItem, &GUI_Fonthz_song30);
            TEXT_SetWrapMode(hItem,GUI_WRAPMODE_WORD);
            TEXT_SetText(hItem, "您好像没有刷卡,系统将在2S后自动退出 ");
            TEXT_SetTextAlign(hItem, GUI_TA_HCENTER | GUI_TA_VCENTER);
            TEXT_SetTextColor(hItem, 0x00FFFFFF);
            // USER START (Optionally insert additional code for further widget initialization)
            // USER END
            break;
        case WM_NOTIFY_PARENT:
            Id    = WM_GetId(pMsg->hWinSrc);
            NCode = pMsg->Data.v;
            switch(Id)
                {
                case ID_BUTTON_0: // Notifications sent by 'Button'
                    switch(NCode)
                        {
                        case WM_NOTIFICATION_CLICKED:
                            // USER START (Optionally insert code for reacting on notification message)
                            // USER END
                            break;
                        case WM_NOTIFICATION_RELEASED:
                            // USER START (Optionally insert code for reacting on notification message)
                            // USER END
                            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;
                    // 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;
        }
}
Ejemplo n.º 11
0
/*****************************
Peremaljovuvannja paneli comunicaciji
*****************************/
void redraw_panel_Modbus(void)
{
  EDIT_SetText(hEdit, _aBitmapItem_Comm[COMM_MODBUS_ID].pExplanation[sel_language]);
  
  char title[256];
  title[0] = '\0';
  strcat_mal(title, (char *)Modbus_panel_title.ptitle[sel_language]);

  unsigned int error_data_1 = _CHECK_SET_BIT(diagnostyka, ERROR_SETTINGS_BS_EEPROM_BIT) | _CHECK_SET_BIT(diagnostyka, ERROR_SETTINGS_BS_EEPROM_EMPTY_BIT);
  
  if (error_data_1)
  {
    //Nalashtuvannja nemaje u tablyci nalashtuvan
    strcat_mal(title, (char *)ERROR_MES.ptitle[sel_language]);
    FRAMEWIN_SetText(Modbus_FrameWin, title);

    FRAMEWIN_SetBarColor(Modbus_FrameWin, 1, GUI_RED);
    FRAMEWIN_SetTextColor(Modbus_FrameWin, GUI_YELLOW);
    
    EDIT_SetText(Modbus_v[0], "");
    DROPDOWN_SetSel(Modbus_v[1], 0);
    DROPDOWN_SetSel(Modbus_v[2], 0);
    DROPDOWN_SetSel(Modbus_v[3], 0);
    EDIT_SetText(Modbus_v[4], "");
  }
  else
  {
    //Nalashtuvannja realno je u tablyci nalashtuvan
    if (current_ekran.edition != 0)
    {
      strcat_mal(title, (char *)MODE.ptitle[sel_language]);
      if (current_ekran.edition != 1)
      {
        //Помічаємо, що дані змінені
        strcat_mal(title, "*");
      }
    }
    FRAMEWIN_SetText(Modbus_FrameWin, title);
  
    if (current_ekran.edition == 0)
    {
      FRAMEWIN_SetBarColor(Modbus_FrameWin, 1, GUI_GREEN);
      FRAMEWIN_SetTextColor(Modbus_FrameWin, GUI_BLUE);
    }
    else
    {
      FRAMEWIN_SetBarColor(Modbus_FrameWin, 1, GUI_YELLOW);
      FRAMEWIN_SetTextColor(Modbus_FrameWin, GUI_RED);
    }

    AuxCfgTbl1Dsc *point_1;
    if (current_ekran.edition == 0) point_1 = &eeprom_bs_settings_tbl;
    else point_1 = &edit_settings_1;

    __info_data info_data;
    U8 Flags;

    EDIT_GetUserData(Modbus_v[0], &info_data, sizeof(__info_data));
    Flags = GUI_EDIT_SUPPRESS_LEADING_ZEROES;
    if (current_ekran.edition != 0) 
    {
      if ((info_data.extra_param & FLAG_SIGNED_FATA) != 0) Flags = GUI_EDIT_SIGNED;
      else Flags = 0;
    }
    EDIT_SetFloatMode(Modbus_v[0], point_1->RS_comm_addres, info_data.min, info_data.max, info_data.shift, Flags);
    int value_int = point_1->RS_comm_addres;
    if ((value_int >= KOEF_ADDRESS_MIN) && (value_int <= KOEF_ADDRESS_MAX))
    {
      EDIT_SetTextColor(Modbus_v[0], EDIT_CI_DISABLED, GUI_BLACK);
      EDIT_SetTextColor(Modbus_v[0], EDIT_CI_ENABLED, GUI_BLACK);
    }
    else
    {
      EDIT_SetTextColor(Modbus_v[0], EDIT_CI_DISABLED, GUI_RED);
      EDIT_SetTextColor(Modbus_v[0], EDIT_CI_ENABLED, GUI_RED);
    }
  
    DROPDOWN_SetSel(Modbus_v[1], point_1->chSpeed + 1);
    DROPDOWN_SetSel(Modbus_v[2], point_1->chParityCheck + 1);
    DROPDOWN_SetSel(Modbus_v[3], point_1->chAmtStopBit - 1 + 1);

    EDIT_GetUserData(Modbus_v[4], &info_data, sizeof(__info_data));
    Flags = GUI_EDIT_SUPPRESS_LEADING_ZEROES;
    if (current_ekran.edition != 0) 
    {
      if ((info_data.extra_param & FLAG_SIGNED_FATA) != 0) Flags = GUI_EDIT_SIGNED;
      else Flags = 0;
    }
    EDIT_SetFloatMode(Modbus_v[4], (float)point_1->chTimeOut_RS/10, info_data.min, info_data.max, info_data.shift, Flags);
    value_int = point_1->chTimeOut_RS;
    if ((value_int >= VALUE_TIME_OUT_1_INTERFACE_MIN) && (value_int <= VALUE_TIME_OUT_1_INTERFACE_MAX))
    {
      EDIT_SetTextColor(Modbus_v[4], EDIT_CI_DISABLED, GUI_BLACK);
      EDIT_SetTextColor(Modbus_v[4], EDIT_CI_ENABLED, GUI_BLACK);
    }
    else
    {
      EDIT_SetTextColor(Modbus_v[4], EDIT_CI_DISABLED, GUI_RED);
      EDIT_SetTextColor(Modbus_v[4], EDIT_CI_ENABLED, GUI_RED);
    }
  }
  
  WM_HWIN FocussedWindow = (Modbus_v[0 + current_ekran.index_position_1]);
  WM_SetFocus(FocussedWindow);
}
/*********************************************************************
*
*       _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;
  }
}
Ejemplo n.º 13
0
/*********************************************************************
*
*       _cbDialog
*/
static void _cbDialog(WM_MESSAGE * pMsg) {
  WM_HWIN hItem;
  int     NCode;
  int     Id;
  // USER START (Optionally insert additional variables)
	
	int i;
	
  // USER END

  switch (pMsg->MsgId) {
  case WM_INIT_DIALOG:
    //
    // Initialization of 'SensorsControl'
    //
    hItem = pMsg->hWin;
    FRAMEWIN_SetText(hItem, "Sensors Control");
    //
    // Initialization of 'exit_button'
    //
    hItem = WM_GetDialogItem(pMsg->hWin, ID_BUTTON_0);
    BUTTON_SetText(hItem, " X");
    //
    // Initialization of 'refresh_text'
    //
    hItem = WM_GetDialogItem(pMsg->hWin, ID_TEXT_0);
    TEXT_SetText(hItem, "delay of refresh:");
    //
    // Initialization of 'temperature_edit'
    //
    hItem = WM_GetDialogItem(pMsg->hWin, ID_EDIT_0);
    EDIT_SetText(hItem, "");
    //
    // Initialization of 'temp_text'
    //
    hItem = WM_GetDialogItem(pMsg->hWin, ID_TEXT_1);
    TEXT_SetText(hItem, "teperature:");
    //
    // Initialization of 'hum_text'
    //
    hItem = WM_GetDialogItem(pMsg->hWin, ID_TEXT_2);
    TEXT_SetText(hItem, "humidity:");
    //
    // Initialization of 'humidity_edit'
    //
    hItem = WM_GetDialogItem(pMsg->hWin, ID_EDIT_1);
    EDIT_SetText(hItem, "");
    //
    // Initialization of 'sound_text'
    //
    hItem = WM_GetDialogItem(pMsg->hWin, ID_TEXT_3);
    TEXT_SetText(hItem, "sound:");
    //
    // Initialization of 'sound_edit'
    //
    hItem = WM_GetDialogItem(pMsg->hWin, ID_EDIT_2);
    EDIT_SetText(hItem, "SILENCE");
    //
    // Initialization of 'distance_text'
    //
    hItem = WM_GetDialogItem(pMsg->hWin, ID_TEXT_4);
    TEXT_SetText(hItem, "distance:");
    //
    // Initialization of 'distance_edit'
    //
    hItem = WM_GetDialogItem(pMsg->hWin, ID_EDIT_3);
    EDIT_SetText(hItem, "FAR");
    //
    // Initialization of 'pres_text'
    //
    hItem = WM_GetDialogItem(pMsg->hWin, ID_TEXT_5);
    TEXT_SetText(hItem, "presence:");
    //
    // Initialization of 'presence_edit'
    //
    hItem = WM_GetDialogItem(pMsg->hWin, ID_EDIT_4);
    EDIT_SetText(hItem, "NO");
    //
    // Initialization of 'vibro_text'
    //
    hItem = WM_GetDialogItem(pMsg->hWin, ID_TEXT_6);
    TEXT_SetText(hItem, "vibration:");
    //
    // Initialization of 'vibration_edit'
    //
    hItem = WM_GetDialogItem(pMsg->hWin, ID_EDIT_5);
    EDIT_SetText(hItem, "NO");
    //
    // Initialization of 'light_text'
    //
    hItem = WM_GetDialogItem(pMsg->hWin, ID_TEXT_7);
    TEXT_SetText(hItem, "light:");
    //
    // Initialization of 'light_edit'
    //
    hItem = WM_GetDialogItem(pMsg->hWin, ID_EDIT_6);
    EDIT_SetText(hItem, "NO");
    //
    // Initialization of 'light_check'
    //
    hItem = WM_GetDialogItem(pMsg->hWin, ID_CHECKBOX_0);
    CHECKBOX_SetText(hItem, "turn on all leds when there is no light in the area");
    //
    // Initialization of 'alarm_check'
    //
    hItem = WM_GetDialogItem(pMsg->hWin, ID_CHECKBOX_1);
    CHECKBOX_SetText(hItem, "activate alarm on presence");
    //
    // Initialization of 'temp_check'
    //
    hItem = WM_GetDialogItem(pMsg->hWin, ID_CHECKBOX_2);
    CHECKBOX_SetText(hItem, "activate alarm on temperature");
    //
    // Initialization of 'max_temp_text'
    //
    hItem = WM_GetDialogItem(pMsg->hWin, ID_TEXT_8);
    TEXT_SetText(hItem, "max temperature:");
    // USER START (Optionally insert additional code for further widget initialization)

			actual_hWin = pMsg->hWin;
			UEZSemaphoreRelease(semaphore_actual_hWin);

		// USER END
    break;
  case WM_NOTIFY_PARENT:
    Id    = WM_GetId(pMsg->hWinSrc);
    NCode = pMsg->Data.v;
    switch(Id) {
    case ID_BUTTON_0: // Notifications sent by 'exit_button'
      switch(NCode) {
      case WM_NOTIFICATION_CLICKED:
        // USER START (Optionally insert code for reacting on notification message)
			  PlayAudio(600, 20);				
        PlayAudio(600, 20);				
        PlayAudio(200, 20);				
 
        // USER END
        break;
      case WM_NOTIFICATION_RELEASED:
        // USER START (Optionally insert code for reacting on notification message)

				PlayAudio(900, 20);				
        PlayAudio(1000, 20);				
        PlayAudio(1100, 20);				

				check_sensors.alarm = 0;
				check_sensors.light = 0;
				check_sensors.temperature = 0;

				BS_wrapper(EXIT_CONTROLLER, INTERNAL, &pMsg);

        // USER END
        break;
      // USER START (Optionally insert additional code for further notification handling)
      // USER END
      }
      break;
    case ID_SLIDER_0: // Notifications sent by 'refresh_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)
			
				hItem = WM_GetDialogItem(pMsg->hWin, ID_SLIDER_0 );
				delay_from_slider = 10 + (SLIDER_GetValue(hItem) * 2);
				BS_wrapper(CHANGE_DELAY_QUERY_FROM_WINDOW, EXTERNAL, &delay_from_slider);
			
        // USER END
        break;
      // USER START (Optionally insert additional code for further notification handling)
      // USER END
      }
      break;
    case ID_EDIT_0: // Notifications sent by 'temperature_edit'
      switch(NCode) {
      case WM_NOTIFICATION_CLICKED:
        // USER START (Optionally insert code for reacting on notification message)
        // USER END
        break;
      case WM_NOTIFICATION_RELEASED:
        // USER START (Optionally insert code for reacting on notification message)
        // USER END
        break;
      case WM_NOTIFICATION_VALUE_CHANGED:
        // USER START (Optionally insert code for reacting on notification message)
        // USER END
        break;
      // USER START (Optionally insert additional code for further notification handling)
      // USER END
      }
      break;
    case ID_EDIT_1: // Notifications sent by 'humidity_edit'
      switch(NCode) {
      case WM_NOTIFICATION_CLICKED:
        // USER START (Optionally insert code for reacting on notification message)
        // USER END
        break;
      case WM_NOTIFICATION_RELEASED:
        // USER START (Optionally insert code for reacting on notification message)
        // USER END
        break;
      case WM_NOTIFICATION_VALUE_CHANGED:
        // USER START (Optionally insert code for reacting on notification message)
        // USER END
        break;
      // USER START (Optionally insert additional code for further notification handling)
      // USER END
      }
      break;
    case ID_EDIT_2: // Notifications sent by 'sound_edit'
      switch(NCode) {
      case WM_NOTIFICATION_CLICKED:
        // USER START (Optionally insert code for reacting on notification message)
        // USER END
        break;
      case WM_NOTIFICATION_RELEASED:
        // USER START (Optionally insert code for reacting on notification message)
        // USER END
        break;
      case WM_NOTIFICATION_VALUE_CHANGED:
        // USER START (Optionally insert code for reacting on notification message)
        // USER END
        break;
      // USER START (Optionally insert additional code for further notification handling)
      // USER END
      }
      break;
    case ID_EDIT_3: // Notifications sent by 'distance_edit'
      switch(NCode) {
      case WM_NOTIFICATION_CLICKED:
        // USER START (Optionally insert code for reacting on notification message)
        // USER END
        break;
      case WM_NOTIFICATION_RELEASED:
        // USER START (Optionally insert code for reacting on notification message)
        // USER END
        break;
      case WM_NOTIFICATION_VALUE_CHANGED:
        // USER START (Optionally insert code for reacting on notification message)
        // USER END
        break;
      // USER START (Optionally insert additional code for further notification handling)
      // USER END
      }
      break;
    case ID_EDIT_4: // Notifications sent by 'presence_edit'
      switch(NCode) {
      case WM_NOTIFICATION_CLICKED:
        // USER START (Optionally insert code for reacting on notification message)
        // USER END
        break;
      case WM_NOTIFICATION_RELEASED:
        // USER START (Optionally insert code for reacting on notification message)
        // USER END
        break;
      case WM_NOTIFICATION_VALUE_CHANGED:
        // USER START (Optionally insert code for reacting on notification message)
        // USER END
        break;
      // USER START (Optionally insert additional code for further notification handling)
      // USER END
      }
      break;
    case ID_EDIT_5: // Notifications sent by 'vibration_edit'
      switch(NCode) {
      case WM_NOTIFICATION_CLICKED:
        // USER START (Optionally insert code for reacting on notification message)
        // USER END
        break;
      case WM_NOTIFICATION_RELEASED:
        // USER START (Optionally insert code for reacting on notification message)
        // USER END
        break;
      case WM_NOTIFICATION_VALUE_CHANGED:
        // USER START (Optionally insert code for reacting on notification message)
        // USER END
        break;
      // USER START (Optionally insert additional code for further notification handling)
      // USER END
      }
      break;
    case ID_EDIT_6: // Notifications sent by 'light_edit'
      switch(NCode) {
      case WM_NOTIFICATION_CLICKED:
        // USER START (Optionally insert code for reacting on notification message)
        // USER END
        break;
      case WM_NOTIFICATION_RELEASED:
        // USER START (Optionally insert code for reacting on notification message)
        // USER END
        break;
      case WM_NOTIFICATION_VALUE_CHANGED:
        // USER START (Optionally insert code for reacting on notification message)
        // USER END
        break;
      // USER START (Optionally insert additional code for further notification handling)
      // USER END
      }
      break;
    case ID_CHECKBOX_0: // Notifications sent by 'light_check'
      switch(NCode) {
      case WM_NOTIFICATION_CLICKED:
        // USER START (Optionally insert code for reacting on notification message)
						        PlayAudio(180, 30);				

        // 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)
			
					hItem = WM_GetDialogItem(pMsg->hWin, ID_CHECKBOX_0 );
					check_sensors.light = CHECKBOX_GetState(hItem);
					BS_wrapper(NOTIFY_NO_LIGHT_SENSOR_CHANGED_FROM_WINDOW, EXTERNAL, NULL);
			
        // USER END
        break;
      // USER START (Optionally insert additional code for further notification handling)
      // USER END
      }
      break;
    case ID_CHECKBOX_1: // Notifications sent by 'alarm_check'
      switch(NCode) {
      case WM_NOTIFICATION_CLICKED:
        // USER START (Optionally insert code for reacting on notification message)
						        PlayAudio(180, 30);				

        // 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)

				hItem = WM_GetDialogItem(pMsg->hWin, ID_CHECKBOX_1 );
				check_sensors.alarm = CHECKBOX_GetState(hItem);
				BS_wrapper(NOTIFY_ALARM_PRESENCE_SENSOR_CHANGED_FROM_WINDOW, EXTERNAL, NULL);

			// USER END
        break;
      // USER START (Optionally insert additional code for further notification handling)
      // USER END
      }
      break;
    case ID_CHECKBOX_2: // Notifications sent by 'temp_check'
      switch(NCode) {
      case WM_NOTIFICATION_CLICKED:
        // USER START (Optionally insert code for reacting on notification message)
						        PlayAudio(180, 30);				

        // 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)

				hItem = WM_GetDialogItem(pMsg->hWin, ID_CHECKBOX_2 );
				check_sensors.temperature = CHECKBOX_GetState(hItem);
				BS_wrapper(NOTIFY_ALARM_TEMPERATURE_SENSOR_CHANGED_FROM_WINDOW, EXTERNAL, NULL);

			// USER END
        break;
      // USER START (Optionally insert additional code for further notification handling)
      // USER END
      }
      break;
    case ID_SPINBOX_0: // Notifications sent by 'Spinbox'
      switch(NCode) {
      case WM_NOTIFICATION_CLICKED:
        // USER START (Optionally insert code for reacting on notification message)
						        PlayAudio(180, 30);				

        // USER END
        break;
      case WM_NOTIFICATION_RELEASED:
        // USER START (Optionally insert code for reacting on notification message)
        // USER END
        break;
      case WM_NOTIFICATION_MOVED_OUT:
        // 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)
			
				hItem = WM_GetDialogItem(pMsg->hWin, ID_SPINBOX_0 );
				temperature_limit = SPINBOX_GetValue(hItem);
				BS_wrapper(NOTIFY_MAX_TEMPERATURE_THRESHOLD_FROM_WINDOW, EXTERNAL, &temperature_limit);
			
        // 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)
		
	case MB_MSG_SENSOR:

		//GESTISCO L'AGGIORNAMENTO DEI LABEL DEI SENSORI
	
		/** 
	i sensori sono stati mappati così:
	
	*(usRegHoldingBuf     ) = (USHORT *) &sensors.distance1;
	*(usRegHoldingBuf + 1 ) = (USHORT *) &sensors.distance2;
	*(usRegHoldingBuf + 2 ) = (USHORT *) &sensors.lumino;
	*(usRegHoldingBuf + 3 ) = (USHORT *) &sensors.mic;
	*(usRegHoldingBuf + 4 ) = (USHORT *) &sensors.vibro;
	*(usRegHoldingBuf + 5 ) = (USHORT *) &actual_DHT11.humidity;
	*(usRegHoldingBuf + 6 ) = (USHORT *) &actual_DHT11.temperature;

	
  "temperature_edit", ID_EDIT_0
  "humidity_edit", ID_EDIT_1
  "sound_edit", ID_EDIT_2
  "distance_edit", ID_EDIT_3
  "presence_edit", ID_EDIT_4
  "vibration_edit", ID_EDIT_5
  "light_edit", ID_EDIT_6

			*/
	
		//estrazione della temperatura
		
		
	break;
	
  // USER END
  default:
    WM_DefaultProc(pMsg);
    break;
  }
}
Ejemplo n.º 14
0
/*********************************************************************
*
*       MainTask
*/
void MainTask(void) {
  WM_HWIN hScrollbar, hDlgOptions;
  GUI_RECT RectDlg, RectClient;
  int Cnt = 0, IndexEffect = 0, ButtonState = 0, DropdownState = 0;
  int ProgbarValue   = 0, ProgbarInc   = 1;
  int SliderValue    = 0, SliderInc    = 1;
  int ScrollbarValue = 0, ScrollbarInc = 1;
  int ListViewInc  = 1;
  int ListBoxInc   = 1;
  int MultiEditInc = 1;
  int Vz = 1;
  const WIDGET_EFFECT * _apEffect[] = {&WIDGET_Effect_3D,     /* Array of effects */
                                      &WIDGET_Effect_Simple, 
                                      &WIDGET_Effect_None};
  const char * _apEffects[] = {"Widget effect: 3D", "Widget effect: Simple", "Widget effect: None"};
  GUI_Init();
  GUI_CURSOR_Show();
  WM_SetCallback(WM_HBKWIN, _cbBkWindow);
  WM_SetCreateFlags(WM_CF_MEMDEV);  /* Use memory devices on all windows to avoid flicker */
  WM_EnableMemdev(WM_HBKWIN);       /* Enable use of memory devices for desktop windows */
  /* Create framewindow and set its properties */
  _hFrameWin = FRAMEWIN_CreateEx(0, 0, 640, 480, 0, WM_CF_SHOW, 0, 0, "", &_cbCallbackFramewin);
  FRAMEWIN_SetMoveable(_hFrameWin, 1);
  FRAMEWIN_SetText(_hFrameWin, _apEffects[0]);
  FRAMEWIN_SetFont(_hFrameWin, &GUI_Font13B_ASCII);
  /* Create main dialog window as child from framewindows client window */
  _hDlg = GUI_CreateDialogBox(_aDlgWidgets,
                              GUI_COUNTOF(_aDlgWidgets), 
                              &_cbCallbackWidgets, 
                              WM_GetClientWindow(_hFrameWin), 0, 0);
  /* Attach scrollbar to framewindows client window and set its properties */
  hScrollbar = SCROLLBAR_CreateAttached(WM_GetClientWindow(_hFrameWin), 0);
  WM_GetWindowRectEx(_hDlg, &RectDlg);
  WM_GetClientRectEx(WM_GetClientWindow(_hFrameWin), &RectClient);
  SCROLLBAR_SetNumItems(hScrollbar, RectDlg.x1);
  SCROLLBAR_SetPageSize(hScrollbar, RectClient.x1);
  /* Create options dialog with 'stay on top' and 'moveable' attribute */
  hDlgOptions = GUI_CreateDialogBox(_aDlgOptions, 
                                    GUI_COUNTOF(_aDlgOptions), 
                                    &_cbCallbackOptions, 
                                    WM_HBKWIN, 0, 0);
  FRAMEWIN_SetMoveable(hDlgOptions, 1);
  WM_SetStayOnTop(hDlgOptions, 1);
  /* Main loop for modifying the widgets */
  while (1) {
    if (_AutoMode) {
      Cnt++;
      /* Modify progbar */
      if ((Cnt % 2) == 0) {
        ProgbarValue += ProgbarInc;
        if ((ProgbarValue == 110) || (ProgbarValue == -10)) {
          ProgbarInc *= -1;
        }
        PROGBAR_SetValue(_ahWin[PROGBAR0], ProgbarValue);
      }
      /* Modify slider */
      if ((Cnt % 2) == 0) {
        int j;
        SliderValue += SliderInc;
        if ((SliderValue == 100) || (SliderValue == 0)) {
          SliderInc *= -1;
        }
        for (j = 0; j < 3; j++) {
          SLIDER_SetValue(_ahWin[SLIDER0 + j], SliderValue);
        }
      }
      /* Modify scrollbar */
      if ((Cnt % 3) == 0) {
        int j;
        ScrollbarValue += ScrollbarInc;
        if ((ScrollbarValue == 90) || (ScrollbarValue == 0)) {
          ScrollbarInc *= -1;
        }
        for (j = 0; j < 3; j++) {
          SCROLLBAR_SetValue(_ahWin[SCROLLBAR0 + j], ScrollbarValue);
        }
      }
      /* Modify multipage */
      if ((Cnt % 120) == 0) {
        MULTIPAGE_SelectPage(_ahWin[MULTIPAGE0], MULTIPAGE_GetSelection(_ahWin[MULTIPAGE0]) ^ 1);
      }
      /* Modify dropdown */
      if ((Cnt % 120) == 0) {
        DropdownState ^= 1;
        if (DropdownState) {
          DROPDOWN_Expand(_ahWin[DROPDOWN0]);
        } else {
          DROPDOWN_Collapse(_ahWin[DROPDOWN0]);
        }
      }
      /* Modify button */
      if ((Cnt % 40) == 0) {
        ButtonState ^= 1;
        BUTTON_SetPressed(_ahWin[BUTTON0], ButtonState);
      }
      /* Modify listbox */
      if ((Cnt % 30) == 0) {
        int Sel;
        Sel = LISTBOX_GetSel(_ahWin[LISTBOX0]);
        if (Sel < 0) {
          Sel = 0;
        }
        LISTBOX_SetSel(_ahWin[LISTBOX0], Sel + ListBoxInc);
        Sel = LISTBOX_GetSel(_ahWin[LISTBOX0]);
        if ((Sel == (int)LISTBOX_GetNumItems(_ahWin[LISTBOX0]) - 1) || (Sel == 0)) {
          ListBoxInc *= -1;
        }
      }
      /* Modify listview */
      if ((Cnt % 50) == 0) {
        int Sel;
        Sel = LISTVIEW_GetSel(_ahWin[LISTVIEW0]);
        if (Sel < 0) {
          Sel = 0;
        }
        LISTVIEW_SetSel(_ahWin[LISTVIEW0], Sel + ListViewInc);
        Sel = LISTVIEW_GetSel(_ahWin[LISTVIEW0]);
        if ((Sel == (int)LISTVIEW_GetNumRows(_ahWin[LISTVIEW0]) - 1) || (Sel == 0)) {
          ListViewInc *= -1;
        }
      }
      /* Modify multiedit */
      if ((Cnt % 5) == 0) {
        int Sel, Len;
        char acBuffer[100];
        MULTIEDIT_SetCursorOffset(_ahWin[MULTIEDIT0], MULTIEDIT_GetCursorCharPos(_ahWin[MULTIEDIT0]) + MultiEditInc);
        MULTIEDIT_GetText(_ahWin[MULTIEDIT0], acBuffer, sizeof(acBuffer));
        Sel = MULTIEDIT_GetCursorCharPos(_ahWin[MULTIEDIT0]);
        Len = strlen(acBuffer);
        if ((Sel == (Len - 1)) || (Sel == 0)) {
          MultiEditInc *= -1;
        }
        if (!DropdownState) {
          WM_SetFocus(_ahWin[MULTIEDIT0]);
        }
      }
      /* Modify graph */
      _AddValues(_ahWin[GRAPH0], 95);
      /* Move window */
      if ((Cnt % 1200) == 0) {
        int Inc;
        WM_HWIN hScroll;
        WM_SCROLL_STATE ScrollState;
        hScroll = WM_GetScrollbarH(WM_GetClientWindow(_hFrameWin));
        WM_GetScrollState(hScroll, &ScrollState);
        Inc = (ScrollState.NumItems - ScrollState.PageSize) / 2;
        ScrollState.v += Inc * Vz;
        if ((ScrollState.v >= Inc * 2) || (ScrollState.v <= 0)) {
          Vz *= -1;
        }
        SCROLLBAR_SetValue(hScroll, ScrollState.v);
      }
      /* Change effect */
      if ((Cnt % 400) == 0) {
        int Index;
        WM_HWIN hWin;
        IndexEffect++;
        Index = IndexEffect % GUI_COUNTOF(_apEffect);
        _SetEffect(Index);
        hWin = WM_GetDialogItem(hDlgOptions, GUI_ID_RADIO0);
        RADIO_SetValue(hWin, Index);
      }
    }
    /* Wait a while */
    GUI_Delay(10);
  }
}
Ejemplo n.º 15
0
/*********************************************************************
*
*       _cbDialog
*/
static void _cbDialog(WM_MESSAGE *pMsg)
{
    WM_HWIN hItem;
    WM_HWIN const hEdit = WM_GetDialogItem(pMsg->hWin, ID_EDIT_0);
    int     NCode;
    int     Id;
    float 	fre;
    int 		tab = 0;
    static int ratio[] = { 1, 1000, 1000000};
    static const char *sel[] = {"Hz", "kHz", "MHz"};
    // USER START (Optionally insert additional variables)
    // USER END

    switch (pMsg->MsgId)
    {
    case WM_PAINT:
        WM_SetFocus(hEdit);
        break;
    case WM_INIT_DIALOG:
        //
        // Initialization of 'MeasureSet'
        //
        hItem = pMsg->hWin;
        FRAMEWIN_SetText(hItem, "Set Frequency");
        FRAMEWIN_SetTextAlign(hItem, GUI_TA_HCENTER | GUI_TA_VCENTER);
        //
        // Initialization of 'Edit'
        //
        hItem = WM_GetDialogItem(pMsg->hWin, ID_EDIT_0);
        EDIT_SetText(hItem, "");
        EDIT_SetFont(hItem, GUI_FONT_20B_1);
        EDIT_SetTextAlign(hItem, GUI_TA_RIGHT | GUI_TA_VCENTER);
        fre = ptrDDS->GetFrequency();
        while(fre > 999.99)
        {
            fre /= 1000;
            tab++;
        }
        EDIT_SetFloatMode(hItem, fre, 0.00, 999.99, 2, GUI_EDIT_NORMAL);
        //
        // Initialization of 'Button'
        //
        hItem = WM_GetDialogItem(pMsg->hWin, ID_BUTTON_0);
        BUTTON_SetFont(hItem, GUI_FONT_16_1);
        BUTTON_SetText(hItem, "Set");
        //
        // Initialization of 'Radio'
        //
        hItem = WM_GetDialogItem(pMsg->hWin, ID_RADIO_0);
        RADIO_SetFont(hItem, GUI_FONT_20_1);
        RADIO_SetText(hItem, sel[0], 0);
        RADIO_SetText(hItem, sel[1], 1);
        RADIO_SetText(hItem, sel[2], 2);
        RADIO_SetValue(hItem, tab);
        //
        // Initialization of 'Button'
        //
        hItem = WM_GetDialogItem(pMsg->hWin, ID_BUTTON_1);
        BUTTON_SetFont(hItem, GUI_FONT_16_1);
        BUTTON_SetText(hItem, "Cancel");
        //
        // Initialization of 'btn1'
        //
        hItem = WM_GetDialogItem(pMsg->hWin, ID_BUTTON_2);
        BUTTON_SetText(hItem, "1");
        BUTTON_SetFocussable(hItem, 0);
        //
        // Initialization of 'btn2'
        //
        hItem = WM_GetDialogItem(pMsg->hWin, ID_BUTTON_3);
        BUTTON_SetText(hItem, "2");
        BUTTON_SetFocussable(hItem, 0);
        //
        // Initialization of 'btn3'
        //
        hItem = WM_GetDialogItem(pMsg->hWin, ID_BUTTON_4);
        BUTTON_SetText(hItem, "3");
        BUTTON_SetFocussable(hItem, 0);
        //
        // Initialization of 'btn4'
        //
        hItem = WM_GetDialogItem(pMsg->hWin, ID_BUTTON_5);
        BUTTON_SetText(hItem, "4");
        BUTTON_SetFocussable(hItem, 0);
        //
        // Initialization of 'btn5'
        //
        hItem = WM_GetDialogItem(pMsg->hWin, ID_BUTTON_6);
        BUTTON_SetText(hItem, "5");
        BUTTON_SetFocussable(hItem, 0);
        //
        // Initialization of 'btn6'
        //
        hItem = WM_GetDialogItem(pMsg->hWin, ID_BUTTON_7);
        BUTTON_SetText(hItem, "6");
        BUTTON_SetFocussable(hItem, 0);
        //
        // Initialization of 'btn7'
        //
        hItem = WM_GetDialogItem(pMsg->hWin, ID_BUTTON_8);
        BUTTON_SetText(hItem, "7");
        BUTTON_SetFocussable(hItem, 0);
        //
        // Initialization of 'btn8'
        //
        hItem = WM_GetDialogItem(pMsg->hWin, ID_BUTTON_9);
        BUTTON_SetText(hItem, "8");
        BUTTON_SetFocussable(hItem, 0);
        //
        // Initialization of 'btn9'
        //
        hItem = WM_GetDialogItem(pMsg->hWin, ID_BUTTON_10);
        BUTTON_SetText(hItem, "9");
        BUTTON_SetFocussable(hItem, 0);
        //
        // Initialization of 'btn0'
        //
        hItem = WM_GetDialogItem(pMsg->hWin, ID_BUTTON_11);
        BUTTON_SetText(hItem, "0");
        BUTTON_SetFocussable(hItem, 0);
        //
        // Initialization of 'btnBS'
        //
        hItem = WM_GetDialogItem(pMsg->hWin, ID_BUTTON_12);
        BUTTON_SetText(hItem, "<--");
        BUTTON_SetFocussable(hItem, 0);
        //
        // Initialization of 'btnC'
        //
        hItem = WM_GetDialogItem(pMsg->hWin, ID_BUTTON_13);
        BUTTON_SetText(hItem, "-->");
        BUTTON_SetFocussable(hItem, 0);
        // 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)
                fre = EDIT_GetFloatValue(hEdit);
                tab = RADIO_GetValue(WM_GetDialogItem(pMsg->hWin, ID_RADIO_0));
                ptrDDS->SetFrequency(fre * ratio[tab]);
                GUI_EndDialog(pMsg->hWin, 0);
                // USER END
                break;
                // USER START (Optionally insert additional code for further notification handling)
                // USER END
            }
            break;
        case ID_RADIO_0: // Notifications sent by 'Radio'
            switch(NCode)
            {
            case WM_NOTIFICATION_CLICKED:
                // USER START (Optionally insert code for reacting on notification message)
                // USER END
                break;
            case WM_NOTIFICATION_RELEASED:
                // USER START (Optionally insert code for reacting on notification message)
                // USER END
                break;
            case WM_NOTIFICATION_VALUE_CHANGED:
                // USER START (Optionally insert code for reacting on notification message)
                // USER END
                break;
                // USER START (Optionally insert additional code for further notification handling)
                // USER END
            }
            break;
        case ID_BUTTON_1: // Notifications sent by '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)
                GUI_EndDialog(pMsg->hWin, 0);
                // USER END
                break;
                // USER START (Optionally insert additional code for further notification handling)
                // USER END
            }
            break;
        case ID_BUTTON_2: // Notifications sent by 'btn1'
            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)
                EDIT_AddKey(hEdit, '1');
                // USER END
                break;
                // USER START (Optionally insert additional code for further notification handling)
                // USER END
            }
            break;
        case ID_BUTTON_3: // Notifications sent by 'btn2'
            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)
                EDIT_AddKey(hEdit, '2');
                // USER END
                break;
                // USER START (Optionally insert additional code for further notification handling)
                // USER END
            }
            break;
        case ID_BUTTON_4: // Notifications sent by 'btn3'
            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)
                EDIT_AddKey(hEdit, '3');
                // USER END
                break;
                // USER START (Optionally insert additional code for further notification handling)
                // USER END
            }
            break;
        case ID_BUTTON_5: // Notifications sent by 'btn4'
            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)
                EDIT_AddKey(hEdit, '4');
                // USER END
                break;
                // USER START (Optionally insert additional code for further notification handling)
                // USER END
            }
            break;
        case ID_BUTTON_6: // Notifications sent by 'btn5'
            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)
                EDIT_AddKey(hEdit, '5');
                // USER END
                break;
                // USER START (Optionally insert additional code for further notification handling)
                // USER END
            }
            break;
        case ID_BUTTON_7: // Notifications sent by 'btn6'
            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)
                EDIT_AddKey(hEdit, '6');
                // USER END
                break;
                // USER START (Optionally insert additional code for further notification handling)
                // USER END
            }
            break;
        case ID_BUTTON_8: // Notifications sent by 'btn7'
            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)
                EDIT_AddKey(hEdit, '7');
                // USER END
                break;
                // USER START (Optionally insert additional code for further notification handling)
                // USER END
            }
            break;
        case ID_BUTTON_9: // Notifications sent by 'btn8'
            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)
                EDIT_AddKey(hEdit, '8');
                // USER END
                break;
                // USER START (Optionally insert additional code for further notification handling)
                // USER END
            }
            break;
        case ID_BUTTON_10: // Notifications sent by 'btn9'
            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)
                EDIT_AddKey(hEdit, '9');
                // USER END
                break;
                // USER START (Optionally insert additional code for further notification handling)
                // USER END
            }
            break;
        case ID_BUTTON_11: // Notifications sent by 'btn0'
            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)
                EDIT_AddKey(hEdit, '0');
                // USER END
                break;
                // USER START (Optionally insert additional code for further notification handling)
                // USER END
            }
            break;
        case ID_BUTTON_12: // Notifications sent by 'btnBS'
            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)
                EDIT_AddKey(hEdit, GUI_KEY_LEFT);
                // USER END
                break;
                // USER START (Optionally insert additional code for further notification handling)
                // USER END
            }
            break;
        case ID_BUTTON_13: // Notifications sent by 'btnC'
            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)
                EDIT_AddKey(hEdit, GUI_KEY_RIGHT);
                // 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;
    }
}
Ejemplo n.º 16
0
static void _cbDialog(WM_MESSAGE * pMsg) {
    WM_HWIN hItem;
    int     NCode;
    int     Id;
    int led;
    static int i;
    int led_num;
    
    switch (pMsg->MsgId)
    {
        case WM_TIMER:

            rt_device_control(dev_led, RT_DEVICE_GET_LED_NUM, &led_num);
            rt_device_control(dev_led, RT_DEVICE_CTRL_LED_TOGGLE, &i);
            i++; i%= led_num;
            if(_gMode == LED_WATERLAMP)
            {
                WM_RestartTimer(pMsg->Data.v, _gFreq);
            }
            break;
      case WM_INIT_DIALOG:

        _gMode = 0;
        _LedInit();

        hItem = pMsg->hWin;
        FRAMEWIN_SetText(hItem, "led");
      
        hItem = WM_GetDialogItem(pMsg->hWin, ID_RADIO_0);
        RADIO_SetText(hItem, "control", 0);
        RADIO_SetText(hItem, "Water lamp", 1);
        RADIO_SetFont(hItem, GUI_FONT_13B_1);
      
        hItem = WM_GetDialogItem(pMsg->hWin, ID_SLIDER_0);
        SLIDER_SetRange(hItem, 50, 1000);
      
        hItem = WM_GetDialogItem(pMsg->hWin, ID_BUTTON_0);
        BUTTON_SetText(hItem, "led1");

        hItem = WM_GetDialogItem(pMsg->hWin, ID_BUTTON_1);
        BUTTON_SetText(hItem, "led2");

        hItem = WM_GetDialogItem(pMsg->hWin, ID_TEXT_0);
        TEXT_SetText(hItem, "freuqency");

        hItem = WM_GetDialogItem(pMsg->hWin, ID_BUTTON_2);
        BUTTON_SetText(hItem, "led3");

        hItem = WM_GetDialogItem(pMsg->hWin, ID_BUTTON_3);
        BUTTON_SetText(hItem, "led4");

        hItem = WM_GetDialogItem(pMsg->hWin, ID_BUTTON_4);
        BUTTON_SetText(hItem, "Cancel");
        break;
      case WM_NOTIFY_PARENT:
        Id    = WM_GetId(pMsg->hWinSrc);
        NCode = pMsg->Data.v;
        switch(Id) {
        case ID_SLIDER_0: // Notifications sent by 'Slider'
            switch(NCode)
            {
                case WM_NOTIFICATION_VALUE_CHANGED:
                    _gFreq = SLIDER_GetValue(WM_GetDialogItem(pMsg->hWin, ID_SLIDER_0));
                break;
            }
            break;
        case ID_RADIO_0:
          switch(NCode) {
          case WM_NOTIFICATION_CLICKED:
            break;
          case WM_NOTIFICATION_RELEASED:
            break;
          case WM_NOTIFICATION_VALUE_CHANGED:
              _gMode = RADIO_GetValue(WM_GetDialogItem(pMsg->hWin, ID_RADIO_0));
              if(_gMode == LED_WATERLAMP)
              {
                  WM_CreateTimer(WM_GetClientWindow(pMsg->hWin), 0, 200, 0);
              }
              
            break;
          }
          break;
          
        case ID_BUTTON_0:
          switch(NCode) {
          case WM_NOTIFICATION_CLICKED:
                if(_gMode == LED_CONTROL)
                {
                    led = 0;
                    rt_device_control(dev_led, RT_DEVICE_CTRL_LED_TOGGLE, &led); 
                }
                break;
          }
          break;

        case ID_BUTTON_1:
          switch(NCode) {
          case WM_NOTIFICATION_CLICKED:
                if(_gMode == LED_CONTROL)
                {
                    led = 1;
                    rt_device_control(dev_led, RT_DEVICE_CTRL_LED_TOGGLE, &led); 
                }
            break;
          }
          break;
        case ID_BUTTON_2:
          switch(NCode) {
          case WM_NOTIFICATION_CLICKED:
                if(_gMode == LED_CONTROL)
                {
                    led = 2;
                    rt_device_control(dev_led, RT_DEVICE_CTRL_LED_TOGGLE, &led); 
                }
            break;
          }
          break;
        case ID_BUTTON_3:
          switch(NCode) {
          case WM_NOTIFICATION_CLICKED:
                if(_gMode == LED_CONTROL)
                {
                    led = 3;
                    rt_device_control(dev_led, RT_DEVICE_CTRL_LED_TOGGLE, &led); 
                }
            break;
          }
          break;
        case ID_BUTTON_4: // Notifications sent by 'Button'
          switch(NCode) {
          case WM_NOTIFICATION_RELEASED:
                    GUI_EndDialog(pMsg->hWin, 0);
            break;

          }
          break;
        }
        break;

  default:
    WM_DefaultProc(pMsg);
    break;
  }
}
Ejemplo n.º 17
0
static void _cbProtection_FrameWin(WM_MESSAGE * pMsg) 
{
  switch (pMsg->MsgId)
  {
  case WM_NOTIFY_PARENT:
    {
      WM_HWIN hObjSrc = pMsg->hWinSrc;
      int Id = WM_GetId(hObjSrc);
      int NCode = pMsg->Data.v;
      
      switch (NCode)
      {
      case WM_NOTIFICATION_GOT_FOCUS:
        {
          if (focus_Modbus_settings != hObjSrc)
          {
            /*
            Визначаємо координати об'єкта, який сфокусований
            */
            WM_SCROLL_STATE ScrollState;
            WM_GetScrollState(ScrollBar_Modbus, &ScrollState);

            int y_hWinSrc = _y_cbPickup_Modbus + WM_GetWindowOrgY(pMsg->hWinSrc);
            int y_hWin    = WM_GetWindowOrgY(pMsg->hWin);
            int y_tmp = y_hWinSrc - y_hWin;
            int v_scroll;
            v_scroll = y_tmp/ScrollState.PageSize;
            v_scroll *= ScrollState.PageSize;
        
            if (_y_cbPickup_Modbus != v_scroll)
            {
              int dy = _y_cbPickup_Modbus - v_scroll;
              for (unsigned int i = 0; i < MAX_NUMBER_ITEMS_MODBUS; i++) 
              {
                WM_MoveWindow(*(Modbus_t + i), 0, dy);
                WM_MoveWindow(*(Modbus_v + i), 0, dy);
              }
              WM_MoveWindow(Modbus_d, 0, dy);
            }
            _y_cbPickup_Modbus = v_scroll;
            focus_Modbus_settings = hObjSrc;
            SCROLLBAR_SetValue(ScrollBar_Modbus, v_scroll);
          }
          break;
        }
      case WM_NOTIFICATION_VALUE_CHANGED:
        {
          if (
              (Id == ID_MODBUS_ADDRESS_VALUE) ||
              (Id == ID_MODBUS_TIMEOUT_VALUE)
             )   
          {
            float value = EDIT_GetFloatValue(hObjSrc);

            int  min = 0, max = 0, value_int;
            unsigned int changer_was_made = false;
            
            switch (Id)
            {
            case ID_MODBUS_ADDRESS_VALUE:
              {
                min = KOEF_ADDRESS_MIN;
                max = KOEF_ADDRESS_MAX;
                value_int = (int)(value);
                if (
                    (current_ekran.edition != 0) &&
                    (edit_settings_1.RS_comm_addres != value_int)
                   )
                {
                  edit_settings_1.RS_comm_addres = value_int;
                  changer_was_made = true;
                }
                break;
              }
            case ID_MODBUS_TIMEOUT_VALUE:
              {
                min = VALUE_TIME_OUT_1_INTERFACE_MIN;
                max = VALUE_TIME_OUT_1_INTERFACE_MAX;
                value_int = (int)(round(value*10.0f));
                if (
                    (current_ekran.edition != 0) &&
                    (edit_settings_1.chTimeOut_RS != value_int)
                   )
                {
                  edit_settings_1.chTimeOut_RS = value_int;
                  changer_was_made = true;
                }
                break;
              }
              default: break;
            }
            
            if (
                (changer_was_made == true) &&
                (current_ekran.edition == 1)
               )    
            {
              //Помічаємо, що дані змінені
              char title[256];
              title[0] = '\0';
              strcat_mal(title, (char *)Modbus_panel_title.ptitle[sel_language]);
              strcat_mal(title, (char *)MODE.ptitle[sel_language]);
              strcat_mal(title, "*");
              FRAMEWIN_SetText(Modbus_FrameWin, title);
              current_ekran.edition = 2;
            }
            
            __info_data info_data;
            EDIT_GetUserData(hObjSrc, &info_data, sizeof(__info_data));
            if ((info_data.extra_param & FLAG_SIGNED_FATA) != 0) value_int = abs(value_int);
            if ((value_int >= min) && (value_int <= max))
            {
              EDIT_SetTextColor(hObjSrc, EDIT_CI_DISABLED, GUI_BLACK);
              EDIT_SetTextColor(hObjSrc, EDIT_CI_ENABLED, GUI_BLACK);
            }
            else
            {
              EDIT_SetTextColor(hObjSrc, EDIT_CI_DISABLED, GUI_RED);
              EDIT_SetTextColor(hObjSrc, EDIT_CI_ENABLED, GUI_RED);
            }
          }
          
          break;
        }
      }

      break;
    }
//  case WM_PAINT:
//    {
//      
//      break;
//    }
  default:
    {
      WM_DefaultProc(pMsg);
      break;
    }
  }
}
Ejemplo n.º 18
0
void update_conf_item() {
  WM_SetFocus(
    WM_GetDialogItem(
      configPageWin,
      ID_CONF_DSTP_CFG_PRT_ONB + current_ekran.index_position
    )
  );
  
  for (int i = 0; i < NUM_CONF_ITEMS; i++) {
    CHECKBOX_Handle checkBox = WM_GetDialogItem(configPageWin, ID_CONF_DSTP_CFG_PRT_ONB + i);
    if (sel_conf_language != sel_language) {
      CHECKBOX_SetText(checkBox, conf_checkbox_item[sel_language][i]);
    }
    if (WM_HasFocus(checkBox)) {
      CHECKBOX_SetTextColor(checkBox, GUI_YELLOW);
      CHECKBOX_SetBkColor(checkBox, GUI_BLUE);
    } else {
      CHECKBOX_SetTextColor(checkBox, GUI_BLACK);
      CHECKBOX_SetBkColor(checkBox, GUI_FRM_COLOR);
    }
    if (_CHECK_BIT_UCHAR(selInfConf, i)) {
      if (CHECKBOX_GetState(checkBox) == 0) {
        CHECKBOX_SetState(checkBox, 1);
      }
    } else {
      if (CHECKBOX_GetState(checkBox) != 0) {
        CHECKBOX_SetState(checkBox, 0);
      }
    }
  }
  
  if (sel_conf_language != sel_language) {
    sel_conf_language = sel_language;
    
    BUTTON_SetText(
      WM_GetDialogItem(
        configPageWin,
        ID_CONF_BUTTON_ESC
      ),
      escButtonExpl[sel_language]
    );
    BUTTON_SetText(
      WM_GetDialogItem(
        configPageWin,
        ID_CONF_BUTTON_ENTER
      ),
      enterButtonExpl[sel_language]
    );
  }
  
  char titleText[100] = {0};
  unsigned int i = 0;
  for (; confFrmText[sel_language][i] != '\0'; i++) {
    titleText[i] = confFrmText[sel_language][i];
  }
  
  if (current_ekran.edition != 0) {
    _CONCAT_STR(titleText, editModeAdditionalText[sel_language]);
  }
  
  FRAMEWIN_SetText(configPageWin, titleText);
  
  EDIT_SetText(hEdit, confExplText[sel_language]);
}