/**
  * @brief  Callback function of the Settings dialog
  * @param  pMsg: pointer to a data structure of type WM_MESSAGE
  * @retval None
  */
static void _cbDialogSettings(WM_MESSAGE * pMsg) {
  WM_HWIN hItem;
  int Id, NCode, idx;
  static int8_t sec, min, hour;
  static int8_t asec, amin, ahour;
  static int8_t day, month, max_days;
  static int16_t  year;
  SPINBOX_Handle   hSpin;
  DROPDOWN_Handle  hDropMonth; 
  TEXT_Handle     hText  ;
  static  CALENDAR_DATE   current_date;
  RTC_TimeTypeDef   RTC_TimeStructure;
  RTC_DateTypeDef   RTC_DateStructure;
  static uint8_t TempStr[50];  
  
  switch (pMsg->MsgId) {
  case WM_INIT_DIALOG:
    
    /* Get Clock setting from RTC */
    RTC_GetTime(RTC_Format_BIN, &RTC_TimeStructure);
    
    sec    =  RTC_TimeStructure.RTC_Seconds;
    min    =  RTC_TimeStructure.RTC_Minutes;
    hour   =  RTC_TimeStructure.RTC_Hours;
    
    RTC_GetAlarm(RTC_Format_BIN, RTC_Alarm_A, &RTC_AlarmStructure);
    
    asec  = RTC_AlarmStructure.RTC_AlarmTime.RTC_Seconds;
    amin  = RTC_AlarmStructure.RTC_AlarmTime.RTC_Minutes;
    ahour = RTC_AlarmStructure.RTC_AlarmTime.RTC_Hours;
    
    RTC_GetDate(RTC_Format_BIN, &RTC_DateStructure);
    
    year =  RTC_DateStructure.RTC_Year + 2000;
    month =  RTC_DateStructure.RTC_Month;
    day =  RTC_DateStructure.RTC_Date;
    
    max_days = GetMaxDays(month, year);
    
    /* Update the dialog items */
    hItem = pMsg->hWin;
    FRAMEWIN_SetFont(hItem, GUI_FONT_13B_ASCII);
    
    /* Date */
    
    hText = TEXT_CreateEx(20, 20, 100, 25, pMsg->hWin, WM_CF_SHOW,0, 0x11F," Date : ");
    TEXT_SetFont(hText, GUI_FONT_13B_ASCII);
    TEXT_SetTextColor(hText, 0x00804000);
    
    hSpin = SPINBOX_CreateEx(20, 35, 40, 18, pMsg->hWin, WM_CF_SHOW, ID_CLOCK_DAY, 1, max_days);
    SPINBOX_SetFont(hSpin, GUI_FONT_13B_ASCII);
    SPINBOX_SetTextColor(hSpin, SPINBOX_CI_ENABLED, 0x00804000);
    SPINBOX_EnableBlink(hSpin, 250, 1);
      
      
    SPINBOX_SetValue(hSpin, day);
    
    hDropMonth = DROPDOWN_CreateEx(65, 35, 80, 160, pMsg->hWin, WM_CF_SHOW, 0,  ID_CLOCK_MONTH);
    DROPDOWN_SetFont(hDropMonth, GUI_FONT_13B_ASCII);
    DROPDOWN_SetTextColor(hDropMonth, DROPDOWN_CI_UNSEL, 0x00804000);
    DROPDOWN_SetTextColor(hDropMonth, DROPDOWN_CI_SEL, 0x00804000);    
    
    for (idx = 0; idx < 12; idx++ )
    {
      DROPDOWN_AddString (hDropMonth, (char *)strMonth[idx]);
    }
    
    DROPDOWN_SetSel(hDropMonth, month - 1);
    
    hSpin = SPINBOX_CreateEx(150, 35, 50, 18, pMsg->hWin, WM_CF_SHOW, ID_CLOCK_YEAR, 2000, 2099);
    SPINBOX_SetFont(hSpin, GUI_FONT_13B_ASCII);
    SPINBOX_SetTextColor(hSpin, SPINBOX_CI_ENABLED, 0x00804000);  
    SPINBOX_EnableBlink(hSpin, 250, 1);
    SPINBOX_SetValue(hSpin, year);
    
    hItem = CHECKBOX_Create(205, 37, 20, 26, pMsg->hWin, ID_CLOCK_CHECK_DATE ,WM_CF_SHOW);
    CHECKBOX_SetState(hItem, 1);
    
    /* Time */
    
    hText = TEXT_CreateEx(20, 50 + 20, 100, 25, pMsg->hWin, WM_CF_SHOW,0, 0x123," Time : ");
    TEXT_SetFont(hText, GUI_FONT_13B_ASCII);
    TEXT_SetTextColor(hText, 0x00804000);    
    
    hSpin = SPINBOX_CreateEx(20, 65 + 20, 40, 18, pMsg->hWin, WM_CF_SHOW, ID_CLOCK_HOUR, 0,23);
    SPINBOX_SetFont(hSpin, GUI_FONT_13B_ASCII);
    SPINBOX_SetTextColor(hSpin, SPINBOX_CI_ENABLED, 0x00804000);      
    SPINBOX_SetValue(hSpin, hour);
    SPINBOX_EnableBlink(hSpin, 250, 1);
    
    hSpin = SPINBOX_CreateEx(75, 65 + 20, 40, 18, pMsg->hWin, WM_CF_SHOW, ID_CLOCK_MIN, 0, 59);
    SPINBOX_SetFont(hSpin, GUI_FONT_13B_ASCII);  
    SPINBOX_SetTextColor(hSpin, SPINBOX_CI_ENABLED, 0x00804000);  
    SPINBOX_SetValue(hSpin, min);
    SPINBOX_EnableBlink(hSpin, 250, 1);
    
    hSpin = SPINBOX_CreateEx(130, 65 + 20, 40, 18, pMsg->hWin, WM_CF_SHOW, ID_CLOCK_SEC, 0, 59);
    SPINBOX_SetFont(hSpin, GUI_FONT_13B_ASCII);  
    SPINBOX_SetTextColor(hSpin, SPINBOX_CI_ENABLED, 0x00804000);  
    SPINBOX_SetValue(hSpin, sec);
    SPINBOX_EnableBlink(hSpin, 250, 1);
    
    
    hItem = CHECKBOX_Create(205, 65 + 20, 20, 26, pMsg->hWin, ID_CLOCK_CHECK_TIME ,WM_CF_SHOW);
    CHECKBOX_SetState(hItem, 1);
    
    /* Alarm */
    
    hText = TEXT_CreateEx(20, 78 + 40, 100, 25, pMsg->hWin, WM_CF_SHOW,0, 0x126," Alarm : ");
    TEXT_SetFont(hText, GUI_FONT_13B_ASCII);
    TEXT_SetTextColor(hText, 0x00804000);    
    
    hSpin = SPINBOX_CreateEx(20, 93 + 40, 40, 18, pMsg->hWin, WM_CF_SHOW, ID_CLOCK_AHOUR, 0,23);
    SPINBOX_SetFont(hSpin, GUI_FONT_13B_ASCII);
    SPINBOX_SetTextColor(hSpin, SPINBOX_CI_ENABLED, 0x00804000);      
    SPINBOX_SetValue(hSpin, ahour);
    SPINBOX_EnableBlink(hSpin, 250, 1);
    
    
    hSpin = SPINBOX_CreateEx(75, 93 + 40, 40, 18, pMsg->hWin, WM_CF_SHOW, ID_CLOCK_AMIN, 0, 59);
    SPINBOX_SetFont(hSpin, GUI_FONT_13B_ASCII); 
    SPINBOX_SetTextColor(hSpin, SPINBOX_CI_ENABLED, 0x00804000);  
    SPINBOX_SetValue(hSpin, amin);
    SPINBOX_EnableBlink(hSpin, 250, 1);
        
    hSpin = SPINBOX_CreateEx(130, 93 + 40, 40, 18, pMsg->hWin, WM_CF_SHOW, ID_CLOCK_ASEC, 0, 59);
    SPINBOX_SetFont(hSpin, GUI_FONT_13B_ASCII);  
    SPINBOX_SetTextColor(hSpin, SPINBOX_CI_ENABLED, 0x00804000);  
    SPINBOX_SetValue(hSpin, asec);
    hItem = CHECKBOX_Create(205, 93 + 40, 20, 26, pMsg->hWin, ID_CLOCK_CHECK_ALARM ,WM_CF_SHOW);
    CHECKBOX_SetState(hItem, 1);
    SPINBOX_EnableBlink(hSpin, 250, 1);
    
    break;
    
  case WM_NOTIFY_PARENT:
    Id    = WM_GetId(pMsg->hWinSrc);
    NCode = pMsg->Data.v;
    switch(Id) {
      
    case ID_CLOSE_SETTINGS: /* Notifications sent by 'Close' */
      switch(NCode) {
      case WM_NOTIFICATION_RELEASED:
        /* Exit */
        GUI_EndDialog(pMsg->hWin, 0);
        GUI_EndDialog (hNumPad, 0);
        break;
      }
      break;
    case ID_SET_SETTINGS: /* Notifications sent by 'Apply' */
      switch(NCode) {
      case WM_NOTIFICATION_RELEASED:
        
        if(CHECKBOX_GetState( WM_GetDialogItem(WM_GetParent(pMsg->hWin), ID_CLOCK_CHECK_DATE)))
        { 
          current_date.Year = year =  SPINBOX_GetValue (WM_GetDialogItem(pMsg->hWin, ID_CLOCK_YEAR));
          current_date.Month = month = DROPDOWN_GetSel (WM_GetDialogItem(pMsg->hWin, ID_CLOCK_MONTH)) + 1;
          current_date.Day = day =  SPINBOX_GetValue (WM_GetDialogItem(pMsg->hWin, ID_CLOCK_DAY)); 
          
          
          RTC_DateStructure.RTC_Year  = year - 2000;
          RTC_DateStructure.RTC_Month = month;
          RTC_DateStructure.RTC_Date  = day;
          RTC_DateStructure.RTC_WeekDay = 0;
          RTC_SetDate(RTC_Format_BIN, &RTC_DateStructure);
          
          hItem = WM_GetDialogItem(WM_GetParent(pMsg->hWin), ID_CALENDAR);
          CALENDAR_SetDate(hItem, &current_date);
          CALENDAR_SetSel(hItem, &current_date);
          
          /* Date */
          hItem = WM_GetDialogItem(WM_GetParent(pMsg->hWin), ID_TEXT_DATE);    
          sprintf((char *)TempStr, "%02d, %s, %04d",day , strMonth[month-1], year);
          TEXT_SetText(hItem, (char *)TempStr);
        }
        
        if(CHECKBOX_GetState( WM_GetDialogItem(WM_GetParent(pMsg->hWin), ID_CLOCK_CHECK_TIME)))
        {
          /* Save new param in RTC */
          sec    =  SPINBOX_GetValue (WM_GetDialogItem(pMsg->hWin, ID_CLOCK_SEC));
          min    =  SPINBOX_GetValue (WM_GetDialogItem(pMsg->hWin, ID_CLOCK_MIN));
          hour   =  SPINBOX_GetValue (WM_GetDialogItem(pMsg->hWin, ID_CLOCK_HOUR));
          
          RTC_TimeStructure.RTC_Seconds = sec;
          RTC_TimeStructure.RTC_Minutes = min;
          RTC_TimeStructure.RTC_Hours   = hour;
          RTC_SetTime(RTC_Format_BIN, &RTC_TimeStructure);
        }
        
        if(CHECKBOX_GetState( WM_GetDialogItem(WM_GetParent(pMsg->hWin), ID_CLOCK_CHECK_ALARM)))
        {
          asec  = SPINBOX_GetValue (WM_GetDialogItem(pMsg->hWin, ID_CLOCK_ASEC));
          amin  = SPINBOX_GetValue (WM_GetDialogItem(pMsg->hWin, ID_CLOCK_AMIN));
          ahour = SPINBOX_GetValue (WM_GetDialogItem(pMsg->hWin, ID_CLOCK_AHOUR));
          
          /* Disable the Alarm A */
          RTC_AlarmCmd(RTC_Alarm_A, DISABLE);
          
          /* Disable the RTC Alarm A Interrupt */
          RTC_ITConfig(RTC_IT_ALRA, DISABLE);
          
          STM_EVAL_LEDOff(LED4);
          
          RTC_AlarmStructure.RTC_AlarmTime.RTC_Seconds = asec;
          RTC_AlarmStructure.RTC_AlarmTime.RTC_Minutes = amin;
          RTC_AlarmStructure.RTC_AlarmTime.RTC_Hours = ahour;
          RTC_AlarmStructure.RTC_AlarmDateWeekDaySel = RTC_AlarmDateWeekDaySel_Date;
          RTC_AlarmStructure.RTC_AlarmDateWeekDay = day;
          RTC_SetAlarm(RTC_Format_BIN, RTC_Alarm_A, &RTC_AlarmStructure);
          
          /* Enable the RTC Alarm A Interrupt */
          RTC_ITConfig(RTC_IT_ALRA, ENABLE);
          
          /* Enable the alarm  A */
          RTC_AlarmCmd(RTC_Alarm_A, ENABLE);
          
          alarm_set = 1;
        }
        
        /* Exit */
        WM_InvalidateWindow(WM_GetParent(pMsg->hWin));
        GUI_EndDialog(pMsg->hWin, 0);
        GUI_EndDialog (hNumPad, 0);
        break;
      }
      break;
    }
    break;
  default:
    WM_DefaultProc(pMsg);
    break;
  }
}
Esempio n. 2
0
/*********************************************************************
*
*       MainTask
*/
void MainTask(void) {
  FRAMEWIN_Handle hWinVideo;
  BUTTON_Handle hBut;
  WM_HWIN hText;

  GUI_Init();
  WM_SetCallback(WM_HBKWIN, _cbBkWin);
  hText = TEXT_CreateEx(240,  85, 80, 26, WM_HBKWIN, WM_CF_SHOW, 0, GUI_ID_TEXT0, "The client\nwindow is");
  TEXT_SetTextColor(hText, GUI_WHITE);
  hText = TEXT_CreateEx(240, 111, 80, 26, WM_HBKWIN, WM_CF_SHOW, 0, GUI_ID_TEXT1, NULL);
  TEXT_SetTextColor(hText, GUI_WHITE);
  /* Create buttons */
  hBut = BUTTON_CreateEx(240,  5, 75, 18, WM_HBKWIN, WM_CF_SHOW, 0, GUI_ID_BUTTON0);
  BUTTON_SetText(hBut, "Create win");
  hBut = BUTTON_CreateEx(240, 25, 75, 18, WM_HBKWIN, WM_CF_SHOW, 0, GUI_ID_BUTTON1);
  BUTTON_SetText(hBut, "Delete win");
  hBut = BUTTON_CreateEx(240, 45, 75, 18, WM_HBKWIN, WM_CF_SHOW, 0, GUI_ID_BUTTON2);
  BUTTON_SetText(hBut, "Show win");
  hBut = BUTTON_CreateEx(240, 65, 75, 18, WM_HBKWIN, WM_CF_SHOW, 0, GUI_ID_BUTTON3);
  BUTTON_SetText(hBut, "Hide win");
  /* Create framewin video */
  hWinVideo = FRAMEWIN_CreateEx(5, 5, 170, 120, 0, WM_CF_SHOW, FRAMEWIN_CF_MOVEABLE, 0, "Video window", _cbFrameWinVideo);
  FRAMEWIN_SetClientColor(hWinVideo, GUI_INVALID_COLOR);
  /* Create test windows */
  _CreateWindow();
  _CreateWindow();
  _CreateWindow();
  while (1) {
    GUI_Delay(1000);
  }
}
Esempio n. 3
0
/**
  * @brief  Initializes the menu.
  * @param  None.
  * @retval None.
  */
void k_InitMenu(void) 
{
  uint8_t i = 0;
  WM_HWIN   hItem;
  ICONVIEW_Handle hIcon ;
  
  WM_SetCallback(WM_GetDesktopWindowEx(0), _cbBk);
  
  hIcon = ST_AnimatedIconView_CreateEx(0, 
                                       0, 
                                       LCD_GetXSize() - 0, 
                                       LCD_GetYSize() - 0, 
                                       WM_GetDesktopWindowEx(0), 
                                       WM_CF_SHOW | WM_CF_HASTRANS ,
                                       0,
                                       ID_ICONVIEW_MENU, 
                                       150, 
                                       180, 5, 5);  
  
  ST_AnimatedIconView_SetDualFont(hIcon, &GUI_FontLubalGraphXLtBT20, &GUI_FontITCAvantGardeStdBk20);
  
  ST_AnimatedIconView_SetSpace(hIcon, GUI_COORD_Y, 5);
  ST_AnimatedIconView_SetSpace(hIcon, GUI_COORD_X, 5);
  ST_AnimatedIconView_SetFrame(hIcon, GUI_COORD_Y, 10);
  ST_AnimatedIconView_SetFrame(hIcon, GUI_COORD_X, 5);
  
  ST_AnimatedIconView_SetTextColor(hIcon, ICONVIEW_CI_UNSEL, 0x00DCA939);
  ST_AnimatedIconView_SetBkColor(hIcon, ICONVIEW_CI_UNSEL, GUI_WHITE);
  ST_AnimatedIconView_SetBkColor(hIcon, ICONVIEW_CI_SEL, GUI_WHITE);
  ST_AnimatedIconView_SetSel(hIcon, -1);
  ST_AnimatedIconView_SetDualTextColor(hIcon, ICONVIEW_CI_SEL, 0x00DCA939, 0x00522000);  
  
  for (i = 0; i < k_ModuleGetNumber(); i++)
  {   
    ST_AnimatedIconView_AddIcon(hIcon, module_prop[i].module->open_icon, module_prop[i].module->close_icon, (char *)module_prop[i].module->name);
  } 
  
  hItem = TEXT_CreateEx(548, 360, 260, 20, WM_GetDesktopWindowEx(0), WM_CF_SHOW, TEXT_CF_LEFT, ID_FEATURES_FPU, "FPU : ON");
  TEXT_SetFont(hItem, GUI_FONT_13B_1);
  TEXT_SetTextColor(hItem, GUI_WHITE); 
  
  hItem = TEXT_CreateEx(548, 380, 260, 20, WM_GetDesktopWindowEx(0), WM_CF_SHOW, TEXT_CF_LEFT, ID_FEATURES_IC, "I-Cache : ON");
  TEXT_SetFont(hItem, GUI_FONT_13B_1);
  TEXT_SetTextColor(hItem, GUI_WHITE);     
  
  hItem = TEXT_CreateEx(548, 400, 260, 20, WM_GetDesktopWindowEx(0), WM_CF_SHOW, TEXT_CF_LEFT, ID_FEATURES_DC, "D-Cache : ON");
  TEXT_SetFont(hItem, GUI_FONT_13B_1);
  TEXT_SetTextColor(hItem, GUI_WHITE);  
  
  hItem = TEXT_CreateEx(548, 420, 260, 20, WM_GetDesktopWindowEx(0), WM_CF_SHOW, TEXT_CF_LEFT, ID_FEATURES_CPU, "MCU Load < 1%");
  TEXT_SetFont(hItem, GUI_FONT_13B_1);
  TEXT_SetTextColor(hItem, GUI_WHITE);  
  
  hItem = TEXT_CreateEx(548, 440, 260, 20, WM_GetDesktopWindowEx(0), WM_CF_SHOW, TEXT_CF_LEFT, ID_FEATURES_FREQ, "Clk : 200 MHz");
  TEXT_SetFont(hItem, GUI_FONT_13B_1);
  TEXT_SetTextColor(hItem, GUI_WHITE);    
  
}
/**
  * @brief  Show Message Box
  * @param  hWin:   pointer to the parent handle
  * @param  pTitle: pointer to the title
  * @param  pText:  pointer to the text
  * @retval int 
  */ 
static int _ShowMessageBox(WM_HWIN hWin, const char* pTitle, const char* pText, int YesNo)
{
  WM_HWIN hFrame, hClient, hBut;
  int r = 0;
  /* Create frame win */
  hFrame = FRAMEWIN_CreateEx(25, 82, 190, 90, hWin, WM_CF_SHOW, FRAMEWIN_CF_MOVEABLE, 0, pTitle, &_cbMessageBox);
  FRAMEWIN_SetClientColor   (hFrame, GUI_WHITE);
  FRAMEWIN_SetFont          (hFrame, &GUI_Font16B_ASCII);
  FRAMEWIN_SetTextAlign     (hFrame, GUI_TA_HCENTER);
  /* Create dialog items */
  hClient = WM_GetClientWindow(hFrame);
  TEXT_CreateEx(10, 7, 170, 30, hClient, WM_CF_SHOW, GUI_TA_HCENTER, 0, pText);
  
  if (YesNo) {
    hBut = BUTTON_CreateEx(97, 45, 55, 18, hClient, WM_CF_SHOW, 0, GUI_ID_CANCEL);
    BUTTON_SetText        (hBut, "No");
    hBut = BUTTON_CreateEx(32, 45, 55, 18, hClient, WM_CF_SHOW, 0, GUI_ID_OK);
    BUTTON_SetText        (hBut, "Yes");
  } else {
    hBut = BUTTON_CreateEx(64, 45, 55, 18, hClient, WM_CF_SHOW, 0, GUI_ID_OK);
    BUTTON_SetText        (hBut, "Ok");
  }
  
  WM_SetFocus(hFrame);  
  WM_MakeModal(hFrame);
  r = GUI_ExecCreatedDialog(hFrame);  
  return r;
}
Esempio n. 5
0
/*****************************
Initializacija paneli nalashtuvan resursu
*****************************/
void resurs_panel_show(void)
{
  if (Resurs_FrameWin == WM_UNATTACHED)
  {
    //Stvorjujemo FrameWin
    Resurs_FrameWin = FRAMEWIN_CreateEx(X0, Y0, X_SIZE, Y_SIZE, 0, WM_CF_HIDE, 0, ID_RESURS_FRAMEWIN, Resurs_panel_title.ptitle[sel_language], _cbEmpty);
    FRAMEWIN_SetFont(Resurs_FrameWin, &GUI_FontArialBold14_8_Unicode);
    FRAMEWIN_SetTextAlign(Resurs_FrameWin, GUI_TA_HCENTER);
    FRAMEWIN_SetBarColor(Resurs_FrameWin, 1, GUI_GREEN);
    FRAMEWIN_SetBarColor(Resurs_FrameWin, 0, GUI_LIGHTGRAY);
    FRAMEWIN_SetTextColor(Resurs_FrameWin, GUI_BLUE);  

#define COL_1_X         5
#define ROW_1_Y         10
#define HIGHT_Y         10
#define SHIFT_Y         (ROW_1_Y + HIGHT_Y)
#define WIDTH_X_T       165
#define WIDTH_X_V       80
#define SHIFT_X1        (WIDTH_X_T + 10)
#define SHIFT_X2        (SHIFT_X1 + WIDTH_X_V + 10)

    for (unsigned int i = 0; i < MAX_NUMBER_ITEMS_RESURS; i++)
    {
      Resurs_t[i] = TEXT_CreateEx(COL_1_X, ROW_1_Y + i*SHIFT_Y, WIDTH_X_T, HIGHT_Y, WM_GetClientWindow(Resurs_FrameWin), WM_CF_SHOW, TEXT_CF_LEFT | TEXT_CF_VCENTER, ID_RESURS_1_TITLE + i,  Resurs_title[i].ptitle[sel_language]);
      TEXT_SetFont(Resurs_t[i], &GUI_FontArialStandard14_8_Unicode);

      Resurs_v[i] = TEXT_CreateEx(COL_1_X + SHIFT_X1, ROW_1_Y + i*SHIFT_Y, WIDTH_X_V, HIGHT_Y, WM_GetClientWindow(Resurs_FrameWin), WM_CF_SHOW, TEXT_CF_LEFT | TEXT_CF_VCENTER, ID_RESURS_1_VALUE + i,  "");
      TEXT_SetFont(Resurs_v[i], &GUI_FontArialStandard14_8_Unicode);
    }
  
#undef COL_1_X
#undef ROW_1_Y
#undef HIGHT_Y
#undef SHIFT_Y
#undef WIDTH_X_T
#undef WIDTH_X_V
#undef SHIFT_X1
#undef SHIFT_X2

  }
  
  WM_BringToTop(Resurs_FrameWin);
  WM_ShowWindow(Resurs_FrameWin);
  
}
Esempio n. 6
0
/*********************************************************************
*
*       _MakeNumberText
*
* Purpose:
*   Create text widgets for showing the result
*/
static void _MakeNumberText(WM_HWIN hParent, int xPos, int * pyPos, int xSize, int ySize, char * pText, U32 Value) {
  WM_HWIN hText;
  int     Len;

  Len = _GetLen(pText);
  _MakeNumberString(pText + Len, Value);
  hText = TEXT_CreateEx(xPos, *pyPos, xSize, ySize, hParent, WM_CF_SHOW, 0, GUI_ID_TEXT0, pText);
  *pyPos += WM_GetWindowSizeY(hText);
}
Esempio n. 7
0
/* Update the host IP address in Emwin Window */
static void lcd_create_infobox(void)
{
	WM_HWIN hItem;
	static char name[] = {"HTTP Server Address"};
	static char remote_name[] = {"Remote IP address"};

	/* Create HTTP server address Text box */
	hItem  = TEXT_CreateEx(24, 40, 150, 100, WM_GetClientWindow(hWin), WM_CF_SHOW, 0, ID_TEXT_2, name);
	TEXT_SetFont(hItem, &GUI_Font16B_ASCII);
	TEXT_SetTextAlign(hItem, GUI_TA_HCENTER);
	TEXT_SetTextColor(hItem, GUI_DARKCYAN);

	/* Create Remote IP address Text box */
	hItem  = TEXT_CreateEx(24, 60, 150, 100, WM_GetClientWindow(hWin), WM_CF_SHOW, 0, ID_TEXT_3, remote_name);
	TEXT_SetFont(hItem, &GUI_Font16B_ASCII);
	TEXT_SetTextAlign(hItem, GUI_TA_HCENTER);
	TEXT_SetTextColor(hItem, GUI_DARKGREEN);

	/* Create Host IP edit box */
	hItem  = EDIT_CreateEx(170, 40, 100, 20, WM_GetClientWindow(hWin), WM_CF_SHOW, 0, ID_EDIT_0, 16);

	/* Create Remote IP edit box */
	hItem  = EDIT_CreateEx(170, 60, 100, 20, WM_GetClientWindow(hWin), WM_CF_SHOW, 0, ID_EDIT_1, 16);
}
Esempio n. 8
0
static void GUIMakeWinIn() {
    hWinIn = WINDOW_CreateEx(
        20, 140, 200, 150,
        0,
        WM_CF_SHOW,
        0,
        ++curId,
        0
    );
    TEXT_CreateEx(
        40, 50, 120, 50,
        hWinIn,
        WM_CF_SHOW,
        TEXT_CF_HCENTER, 
        ++curId,
        "Please put in\r\nyour clothes!"
    );
}
Esempio n. 9
0
static void _cbDialog(WM_MESSAGE *pMsg)
{
	 WM_KEY_INFO *pKEY;
	 CHAR TimeID;
  switch(pMsg->MsgId)
	 {
			 case WM_PAINT:
									GUI_SetBkColor(GUI_WHITE);
									GUI_Clear();
					    GUI_SetFont(&GUI_Font30);
				     GUI_SetColor(GUI_BLACK);
				     if (Language == 0)
				         GUI_DispStringAt("自检中...",100,50);
									else GUI_DispStringAt("CHECKING...",100,50);
									break;
			 case WM_KEY:
					    pKEY = (WM_KEY_INFO*)pMsg->Data.p;
				     switch (pKEY->Key)
									{
										      case GUI_KEY_ESCAPE:
																	    WM_BringToTop(mainwin);
																     TimerIndex = 0;
																     WM_DeleteTimer(CheckTimer);
																     WM_SetFocus(mainwin);
																	break;
									}
					    break;
			 case WM_CREATE:
					    CheckText[0] = TEXT_CreateEx (150,   80,   600, 40, pMsg->hWin,WM_CF_SHOW,0,0,NULL);
				     CheckText[1] = TEXT_CreateEx (150,   120,  600, 40, pMsg->hWin,WM_CF_SHOW,0,0,NULL);
				     CheckText[2] = TEXT_CreateEx (150,   160,  600, 40, pMsg->hWin,WM_CF_SHOW,0,0,NULL);
				     CheckText[3] = TEXT_CreateEx (150,   200,  600, 40, pMsg->hWin,WM_CF_SHOW,0,0,NULL);
				     CheckText[4] = TEXT_CreateEx (150,   240,  600, 40, pMsg->hWin,WM_CF_SHOW,0,0,NULL);
				     CheckText[5] = TEXT_CreateEx (150,   280,  600, 40, pMsg->hWin,WM_CF_SHOW,0,0,NULL);
				     CheckText[6] = TEXT_CreateEx (150,   320,  600, 40, pMsg->hWin,WM_CF_SHOW,0,0,NULL);
				     CheckText[7] = TEXT_CreateEx (150,   360,  600, 40, pMsg->hWin,WM_CF_SHOW,0,0,NULL);
					    break;
				
				case WM_TIMER:
				{
					    pLanguage = &Lgucheckwin[Language];
									if (TimerIndex == 0)
									{
										  //pchecktext = "国际频道 . . . . . . . . . . . . . . . . . . . . . 通过";
										  TEXT_SetText(CheckText[0],pLanguage->CheckItem[0]);
										  WM_RestartTimer(CheckTimer,2000);
										  TimerIndex++;
									}
									else if (TimerIndex == 1)
									{
										  //pchecktext = "本地频道I. . . . . . . . . . . . . . . . . . . . . 通过";
										  TEXT_SetText(CheckText[1],pLanguage->CheckItem[1]);
										  WM_RestartTimer(CheckTimer,2000);
												TimerIndex++;
									}
									else if (TimerIndex == 2)
									{
										  //pchecktext = "本地频道II . . . . . . . . . . . . . . . . . . . . 通过";
										  TEXT_SetText(CheckText[2],pLanguage->CheckItem[2]);
										  WM_RestartTimer(CheckTimer,2000);
												TimerIndex++;
									}
									else if (TimerIndex == 3)
									{
										  //pchecktext = "中文频道 . . . . . . . . . . . . . . . . . . . . . 通过";
										  TEXT_SetText(CheckText[3],pLanguage->CheckItem[3]);
										  WM_RestartTimer(CheckTimer,2000);
												TimerIndex++;
									}
									else if (TimerIndex == 4)
									{
										  //pchecktext = "数据内存 . . . . . . . . . . . . . . . . . . . . . 通过";
										  TEXT_SetText(CheckText[4],pLanguage->CheckItem[4]);
										  WM_RestartTimer(CheckTimer,2000);
												TimerIndex++;
									}
									else if (TimerIndex == 5)
									{
										  //pchecktext = "天线单元 . . . . . . . . . . . . . . . . . . . . . 通过";
										  TEXT_SetText(CheckText[5],pLanguage->CheckItem[5]);
										  WM_RestartTimer(CheckTimer,2000);
												TimerIndex++;
									}
									else if (TimerIndex == 6)
									{
										  //pchecktext = "打印端口 . . . . . . . . . . . . . . . . . . . . . 通过";
										  TEXT_SetText(CheckText[6],pLanguage->CheckItem[6]);
										  WM_RestartTimer(CheckTimer,2000);
												TimerIndex++;
									}
									else if (TimerIndex == 7)
									{
										  //pchecktext = "报警铃声 . . . . . . . . . . . . . . . . . . . .  已执行";
										  TEXT_SetText(CheckText[7],pLanguage->CheckItem[7]);
										  WM_RestartTimer(CheckTimer,2000);
												TimerIndex = 0;
										  WM_DeleteTimer(CheckTimer);
									}
									
									break;
					}
			default:
				  WM_DefaultProc(pMsg);
			   break;
		}
		
}
Esempio n. 10
0
/*********************************************************************
*
*       TEXT_CreateAsChild
*/
TEXT_Handle TEXT_CreateAsChild(int x0, int y0, int xsize, int ysize, WM_HWIN hParent, int Id, int Flags, const char * s, int Align) {
  return TEXT_CreateEx(x0, y0, xsize, ysize, hParent, Flags, Align, Id, s);
}
Esempio n. 11
0
/*********************************************************************
*
*       MainTask
*/
void MainTask(void) 
{
		
	GUI_Init();
	
	
	WM_SetDesktopColor(GUI_BLUE);	//!< SetDesktopColor
	
	 /* The First window to display the Temperature Curve */
	{
		hWM_HBKWIN_CURVE =
		WM_CreateWindow(0,0,400,240,WM_CF_SHOW | WM_CF_MEMDEV ,0,0);
		
		btn = 		 BUTTON_CreateAsChild(315, 10, 75, 35,hWM_HBKWIN_CURVE, ID_CURVE_BTN_SWTITCH_2_PARA, WM_CF_SHOW);
		btnClear = BUTTON_CreateAsChild(315, 60, 75, 35,hWM_HBKWIN_CURVE, 202, WM_CF_SHOW);
		
		/** PWM Edit **/
		{
			/* Edit to display the PWM1 */
				Edit_PWM1 = EDIT_CreateEx			 (370, 170, 25, 20,hWM_HBKWIN_CURVE, 
																				 WM_CF_SHOW,EDIT_CF_HCENTER | EDIT_CF_VCENTER,ID_CFG_PID_EDT_PWM1,
																				 3);
				EDIT_SetDecMode(Edit_PWM1,0,0,255,0,0);
				EDIT_SetValue(Edit_PWM1,0);
				
				/* Edit to display the PWM2 */
				Edit_PWM2 = EDIT_CreateEx			 (370, 190, 25, 20,hWM_HBKWIN_CURVE, 
																				 WM_CF_SHOW,EDIT_CF_HCENTER | EDIT_CF_VCENTER,ID_CFG_PID_EDT_PWM2,
																				 3);
				EDIT_SetDecMode(Edit_PWM2,0,0,255,0,0);
				EDIT_SetValue(Edit_PWM2,0);
				
					/* Edit to display the PWM3 */
				Edit_PWM3 = EDIT_CreateEx			 (370, 210, 25, 20,hWM_HBKWIN_CURVE, 
																				 WM_CF_SHOW,EDIT_CF_HCENTER | EDIT_CF_VCENTER,ID_CFG_PID_EDT_PWM3,
																				 3);
				EDIT_SetDecMode(Edit_PWM3,0,0,255,0,0);
				EDIT_SetValue(Edit_PWM3,0);
		}


		
		
		// Set Callback function for background window
		WM_SetCallback(hWM_HBKWIN_CURVE, _cbBk);
	}
		
	{
		hWM_HBKWIN_CFG_PID =
		WM_CreateWindow(0,0,400,240,WM_CF_HIDE | WM_CF_MEMDEV ,0,0); //Add the | WM_CF_MEMDEV flah
		
	

		btn1 			= BUTTON_CreateAsChild(320, 30 , 60, 35,hWM_HBKWIN_CFG_PID, ID_CFG_PID_BTN_SWTITCH_2_CURVE, WM_CF_SHOW);
		btnClear1 = BUTTON_CreateAsChild(320, 75, 60, 35,hWM_HBKWIN_CFG_PID, 203, WM_CF_SHOW);
		BUTTON_SetText(btn1,"PID_Set");
		BUTTON_SetText(btnClear1,"Back");
		
		BUTTON_SetText(btn     ,"Running");
		BUTTON_SetText(btnClear,"PID_Set");
	

		WM_SetCallback(hWM_HBKWIN_CFG_PID, _cbBk_CFG_PID);
	}
	

	
	//!< Create a graph widget
	{
		hGraph = GRAPH_CreateEx(8, 10, 300, 220, hWM_HBKWIN_CURVE, WM_CF_SHOW | WM_CF_CONST_OUTLINE | WM_CF_MEMDEV_ON_REDRAW , 0, 100);
		//GRAPH_DATA_YT_MirrorX(hGraph , 1);
		
		//!< Create a YT_data 
		hData  = GRAPH_DATA_YT_Create(GUI_BLUE, 292,0, 0); // Set the	MaxItemNum to 0	
		hData2 = GRAPH_DATA_YT_Create(GUI_RED,292,0,0);
		
		GRAPH_AttachData(hGraph, hData); //!< Attach the data to graph
		GRAPH_AttachData(hGraph, hData2); //!< Attach the data to graph
		
	}
	
	WM_ShowWindow(hWM_HBKWIN_CURVE);
	WM_HideWindow(hWM_HBKWIN_CFG_PID);
/*
	WM_BringToTop(hWM_HBKWIN);
	WM_BringToBottom(hWM_HBKWIN_CFG_PID);
	WM_MoveTo(hWM_HBKWIN_CFG_PID,400,240);
	WM_ResizeWindow(hWM_HBKWIN_CFG_PID,1,1);
*/	
	#ifdef PWM_TEXT		
			/** PWM Text **/
		{
			/* Edit to display the PWM1 */
				Text_PWM1 = TEXT_CreateEx			 (310, 170, 30, 20,hWM_HBKWIN_CURVE, 
																				 WM_CF_SHOW,EDIT_CF_HCENTER | EDIT_CF_VCENTER,ID_CFG_PID_TXT_PWM1,
																				 "PMW1");				
				/* Edit to display the PWM2 */
				Text_PWM2 = TEXT_CreateEx			 (310, 190, 30, 20,hWM_HBKWIN_CURVE, 
																				 WM_CF_SHOW,EDIT_CF_HCENTER | EDIT_CF_VCENTER,ID_CFG_PID_TXT_PWM2,
																				 "PWM2");
					/* Edit to display the PWM3 */
				Text_PWM3 = TEXT_CreateEx			 (310, 210, 30, 20,hWM_HBKWIN_CURVE, 
																				 WM_CF_SHOW,EDIT_CF_HCENTER | EDIT_CF_VCENTER,ID_CFG_PID_TXT_PWM3,
																				 "PWM3");
		}
#endif
		
#ifdef EDIT_AD		
	 {
				/* Edit to display the AD1 */
				Edit_AD1 = EDIT_CreateEx			 (350, 120, 35, 20,hWM_HBKWIN_CURVE, 
																				 WM_CF_SHOW,EDIT_CF_HCENTER | EDIT_CF_VCENTER,ID_CFG_PID_EDT_AD1,
																				 5);
				EDIT_SetDecMode(Edit_AD1,0,0,4095,0,0);
				EDIT_SetValue(Edit_AD1,0);
				
				/* Edit to display the AD2 */
				Edit_AD2 = EDIT_CreateEx			 (350, 140, 35, 20,hWM_HBKWIN_CURVE, 
																				 WM_CF_SHOW,EDIT_CF_HCENTER | EDIT_CF_VCENTER,ID_CFG_PID_EDT_AD2,
																				 5);
				EDIT_SetDecMode(Edit_AD2,0,0,4095,0,0);
				EDIT_SetValue(Edit_AD2,0);
		 

				EDIT_SetFloatMode(
													Edit_AD1,1.0,
													0.0,99.9,1,/*1 bit after dot*/
													0
													);
				EDIT_SetFloatMode(
													Edit_AD2,0.0,
													0.0,99.9,1,/*1 bit after dot*/
													0
													);
	 }
#endif		

	//!< Graph configuration
	{
		hScale = GRAPH_SCALE_Create(28, GUI_TA_RIGHT, GRAPH_SCALE_CF_VERTICAL, 20);
		GRAPH_SCALE_SetTextColor(hScale,GUI_GREEN);
		GRAPH_SCALE_SetFactor(hScale,0.5);
		GRAPH_SCALE_SetNumDecs(hScale,1);
		GRAPH_AttachScale(hGraph, hScale);
		
		GRAPH_SetGridDistX(hGraph,0); // Hide the X Grid
		GRAPH_SetGridDistY(hGraph,20);	
		GRAPH_SetGridVis(hGraph,1);  //!< Display the Grid
		
		GRAPH_SetBorder(hGraph,30,5,5,5);  //!< Set the frame border 
		
		//GRAPH_SetGridFixedX(hGraph,1);
		//GRAPH_SetVSizeX(hGraph,500);  //加入此会导致死掉 程序卡死在获取此指针上面.
		//GRAPH_SetGridFixedY(hGraph,1);
		GRAPH_SetColor(hGraph,GUI_BLUE,GRAPH_CI_BORDER);
		GRAPH_SetColor(hGraph,GUI_WHITE,GRAPH_CI_BK);
		GRAPH_SetColor(hGraph,GUI_WHITE,GRAPH_CI_FRAME);

	}	
	/* Button Configuration */
	{
	
		BUTTON_SetBkColor(btn,BUTTON_CI_UNPRESSED,GUI_LIGHTBLUE);
		BUTTON_SetBkColor(btn,BUTTON_CI_PRESSED,GUI_RED);
			
		BUTTON_SetFocusColor(btn,GUI_YELLOW);	
	}
			
  while(1) 
	{
		GUI_Exec();	

	 	OSTimeDlyHMSM(0,0,0,50);
//#define DRAWPOINT
#ifdef DRAWPOINT
		
		itoa(usValue, buf, 10);
		BUTTON_SetText(btn,buf);

	//	GRAPH_DATA_YT_AddValue(hData,usValue/20);
#endif		
	}
}
Esempio n. 12
0
/*********************************************************************
*
*       _cbDialog
*/
static void _cbDialog(WM_MESSAGE * pMsg) {
  WM_HWIN hItem;
  int     NCode;
  int     Id;
  // USER START (Optionally insert additional variables)
  // USER END

  switch (pMsg->MsgId) {
  case WM_INIT_DIALOG:
    //
    // Initialization of 'menu_window'
    //
    hItem = pMsg->hWin;
//    WINDOW_SetBkColor(hItem, 0x00FF3939);
    //
    // Initialization of 'Header'
    //
    hItem = WM_GetDialogItem(pMsg->hWin, ID_HEADER_0);
    HEADER_AddItem(hItem, 120, "LEDS CONTROL", 14);
    //
    // Initialization of 'Header'
    //
    hItem = WM_GetDialogItem(pMsg->hWin, ID_HEADER_1);
    HEADER_AddItem(hItem, 120, "SENSORS CONTROL", 14);
    //
    // Initialization of 'Header'
    //
    hItem = WM_GetDialogItem(pMsg->hWin, ID_HEADER_2);
    HEADER_AddItem(hItem, 120, "MODBUS DEBUG", 14);
    // USER START (Optionally insert additional code for further widget initialization)

    hItem = WM_GetDialogItem(pMsg->hWin, ID_BUTTON_2);
    BUTTON_SetText( hItem, "");
    BUTTON_SetBkColor (hItem, 0, GUI_RED);
    BUTTON_SetBkColor (hItem, 1, GUI_YELLOW);

    BUTTON_SetBitmapEx(hItem, 0, &bmdebug_icon, 5, 5);



    hItem = WM_GetDialogItem(pMsg->hWin, ID_BUTTON_0);
    BUTTON_SetText( hItem, "");
    BUTTON_SetBkColor (hItem, 0, GUI_GREEN);
    BUTTON_SetBkColor (hItem, 1, GUI_YELLOW);

    BUTTON_SetBitmapEx(hItem, 0, &bmled_icon, 5, 5);



    hItem = WM_GetDialogItem(pMsg->hWin, ID_BUTTON_1);
    BUTTON_SetText( hItem, "");
    BUTTON_SetBkColor (hItem, 0, GUI_BLUE);
    BUTTON_SetBkColor (hItem, 1, GUI_YELLOW);

    BUTTON_SetBitmapEx(hItem, 0, &bmsensor_icon, 5, 5);


    hItem = TEXT_CreateEx(0, 40, 640, 30, 0, WM_CF_SHOW, 0, GUI_ID_TEXT0, "House Control with MODBUS");
    TEXT_SetFont(hItem, &GUI_Font24B_ASCII);
    TEXT_SetTextAlign(hItem, GUI_TA_HCENTER | GUI_TA_VCENTER);
    TEXT_SetTextColor(hItem, GUI_BLACK);


    // 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 'led_button'
      switch(NCode) {
      case WM_NOTIFICATION_CLICKED:
        // USER START (Optionally insert code for reacting on notification message)
        PlayAudio(150, 20);				
        // USER END
        break;
      case WM_NOTIFICATION_RELEASED:
        // USER START (Optionally insert code for reacting on notification message)
				
				BS_wrapper(SWITCH_CONTEXT_TO_LEDS_CONTROLLER, INTERNAL, NULL);
        
				// USER END
        break;
      // USER START (Optionally insert additional code for further notification handling)
      // USER END
      }
      break;
    case ID_BUTTON_1: // Notifications sent by 'sensor_button'
      switch(NCode) {
      case WM_NOTIFICATION_CLICKED:
        // USER START (Optionally insert code for reacting on notification message)
        PlayAudio(150, 20);				
        
        // USER END
        break;
      case WM_NOTIFICATION_RELEASED:
        // USER START (Optionally insert code for reacting on notification message)
			
				BS_wrapper(SWITCH_CONTEXT_TO_SENSORS_CONTROLLER, INTERNAL, NULL);			
			
        // USER END
        break;
      // USER START (Optionally insert additional code for further notification handling)
      // USER END
      }
      break;
    case ID_BUTTON_2: // Notifications sent by 'debug_button'
      switch(NCode) {
      case WM_NOTIFICATION_CLICKED:
        // USER START (Optionally insert code for reacting on notification message)

        PlayAudio(150, 20);				

        // USER END
        break;
      case WM_NOTIFICATION_RELEASED:
        // USER START (Optionally insert code for reacting on notification message)

				BS_wrapper(SWITCH_CONTEXT_TO_DEBUG_MODBUS_CONTROLLER, INTERNAL, NULL);			

        // USER END
        break;
      // USER START (Optionally insert additional code for further notification handling)
      // USER END
      }
      break;
    case ID_HEADER_0: // Notifications sent by 'Header'
      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_MOVED_OUT:
        // 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_HEADER_1: // Notifications sent by 'Header'
      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_MOVED_OUT:
        // 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_HEADER_2: // Notifications sent by 'Header'
      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_MOVED_OUT:
        // 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;
  }
}
Esempio n. 13
0
/**
  * @brief  Callback function of the Camera frame
  * @param  pMsg: pointer to data structure of type WM_MESSAGE
  * @retval None
  */
static void _cbCameraWindow(WM_MESSAGE * pMsg)
{
  int     NCode;
  int     Id;
  WM_HWIN hItem;
    
  switch (pMsg->MsgId)
  {
    
  case WM_CREATE:
    if(HomeSettings.b.camera == CAM_1)
    {
      /* Title Initialization in play list */   
      hItem = TEXT_CreateEx(20, 30, 65, 24, pMsg->hWin, WM_CF_SHOW, 0, ID_CAM, "CAM 1");
      TEXT_SetFont(hItem, &GUI_FontLubalGraph24B);
      TEXT_SetTextColor(hItem, GUI_WHITE); 
    }
    else if(HomeSettings.b.camera == CAM_2)
    {
      /* Title Initialization in play list */   
      hItem = TEXT_CreateEx(20, 30, 65, 24, pMsg->hWin, WM_CF_SHOW, 0, ID_CAM, "CAM 2");
      TEXT_SetFont(hItem, &GUI_FontLubalGraph24B);
      TEXT_SetTextColor(hItem, GUI_WHITE); 
    }
    else if(HomeSettings.b.camera == CAM_3)
    {
      /* Title Initialization in play list */   
      hItem = TEXT_CreateEx(20, 30, 65, 24, pMsg->hWin, WM_CF_SHOW, 0, ID_CAM, "CAM 3");
      TEXT_SetFont(hItem, &GUI_FontLubalGraph24B);
      TEXT_SetTextColor(hItem, GUI_WHITE);
    }
    else if(HomeSettings.b.camera == CAM_4)
    {
      /* Title Initialization in play list */   
      hItem = TEXT_CreateEx(20, 30, 65, 24, pMsg->hWin, WM_CF_SHOW, 0, ID_CAM, "CAM 4");
      TEXT_SetFont(hItem, &GUI_FontLubalGraph24B);
      TEXT_SetTextColor(hItem, GUI_WHITE);
    }
    else
    {
      /* Title Initialization in play list */   
      hItem = TEXT_CreateEx(20, 30, 65, 24, pMsg->hWin, WM_CF_SHOW, 0, ID_CAM, "CAM 5");
      TEXT_SetFont(hItem, &GUI_FontLubalGraph24B);
      TEXT_SetTextColor(hItem, GUI_WHITE);      
    }  
    
    hItem = BUTTON_CreateEx(700, 0, 100, 100, pMsg->hWin, WM_CF_SHOW, 0, ID_BUTTON_MENU);
    WM_SetCallback(hItem, _cbButton_menu);     
    
    hItem = BUTTON_CreateEx(0, 379, 100, 100, pMsg->hWin, WM_CF_SHOW, 0, ID_BUTTON_EXIT_FROM_CAM);
    WM_SetCallback(hItem, _cbButton_exit1); 
    break;
    
  case WM_PAINT:
    if(HomeSettings.b.camera == CAM_1)
    {
      GUI_DrawBitmap(&bmcam1, 0, 0);      
    }
    else if(HomeSettings.b.camera == CAM_2)
    {
      GUI_DrawBitmap(&bmcam2, 0, 0);
    }
    else if(HomeSettings.b.camera == CAM_3)
    {
      GUI_DrawBitmap(&bmcam3, 0, 0);      
    }
    else if(HomeSettings.b.camera == CAM_4)
    {
      GUI_DrawBitmap(&bmcam4, 0, 0);      
    }
    else
    {
      GUI_DrawBitmap(&bmcam5, 0, 0);      
    }  
    GUI_SetColor(GUI_STCOLOR_LIGHTBLUE);
    GUI_AA_FillRoundedRect((-30), 10, 100, 75, 30);
    break;
    
    
  case WM_NOTIFY_PARENT:
    Id    = WM_GetId(pMsg->hWinSrc);    /* Id of widget */
    NCode = pMsg->Data.v;               /* Notification code */
 
    switch(Id) {
      
    case ID_BUTTON_EXIT_FROM_CAM: 
      switch(NCode) {
      case WM_NOTIFICATION_RELEASED:
        /* re-initialize the NOR pin*/
        GUI_EndDialog(pMsg->hWin, 0);
        WM_HideWindow(hCameraFrame);        
        WM_Exec();        
        WM_DeleteWindow(hCameraFrame);
        WM_InvalidateWindow(HOME_hWin);
        break;     
      }
      break;

    case ID_BUTTON_MENU: 
      switch(NCode) {
      case WM_NOTIFICATION_RELEASED:
        GUI_EndDialog(pMsg->hWin, 0);
        WM_DeleteWindow(hCameraFrame);
        WM_DeleteWindow(HOME_hWin);
        break;
      }
      break;
    }
    break;
    
  case WM_DELETE:
    break;
    
  default:
    WM_DefaultProc(pMsg);
  }
}
Esempio n. 14
0
void rank_dlg_do_init() {
  #define WIDTH_DLG     185
  #define HEIGHT_DLG    85

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

  #undef WIDTH_DLG
  #undef HEIGHT_DLG

  #undef WIDTH_B
  #undef HEIGHT_B
  #undef WIDTH_T
  #undef HEIGHT_T
  #undef WIDTH_COMP
  #undef HEIGHT_COMP
}
Esempio n. 15
0
/**
  * @brief  callback for video window
  * @param  pMsg: pointer to a data structure of type WM_MESSAGE
  * @retval None
  */
static void _cbplaybackwin(WM_MESSAGE * pMsg) 
{
  WM_HWIN hItem;
  int Id, NCode;
  char tmp[64];
  
  switch (pMsg->MsgId) 
  {
  case WM_CREATE:
    SelLayer = 1;    
   
    hItem = BUTTON_CreateEx(398 - 160, 442, 40, 40, pMsg->hWin, WM_CF_SHOW, 0, ID_BUTTON_BACK);
    WM_SetCallback(hItem, _cbButton_back);
    
    hItem = BUTTON_CreateEx(449 - 160, 442, 40, 40, pMsg->hWin, WM_CF_SHOW, 0, ID_BUTTON_STOP);
    WM_SetCallback(hItem, _cbButton_stop); 

    hItem = BUTTON_CreateEx(495 - 160, 441, 40, 40, pMsg->hWin, WM_CF_SHOW, 0, PLAY_VIDEO_ID);
    WM_SetCallback(hItem, _cbButton_play);
        
    hItem = BUTTON_CreateEx(540 - 160, 442, 40, 40, pMsg->hWin, WM_CF_SHOW, 0, ID_BUTTON_FORE);
    WM_SetCallback(hItem, _cbButton_fore);
    
    hItem = SLIDER_CreateEx(72, 420, 510, 13, pMsg->hWin, WM_CF_SHOW, 0, ID_SLIDER_DURATION);
    SLIDER_SetBkColor(hItem, GUI_TRANSPARENT);
    SLIDER_SetFocusColor (hItem, 0x00DCA939);
    SLIDER_SetValue(hItem, 0);
    SLIDER_SetWidth(hItem, 0);
    SLIDER_SetSTSkin(hItem);    
       
    hItem = BUTTON_CreateEx(568, 0, 70, 70, pMsg->hWin, WM_CF_SHOW, 0, ID_BUTTON_MENU);
    WM_SetCallback(hItem, _cbButton_menu);     
    
    hItem = BUTTON_CreateEx(0, 410, 70, 70, pMsg->hWin, WM_CF_SHOW, 0, ID_BUTTON_EXIT_FROM_VIDEO);
    WM_SetCallback(hItem, _cbButton_exit1);   
    
    /* Title Initialization in play list */   
    hItem = TEXT_CreateEx(10, 20, 100, 40, pMsg->hWin, WM_CF_SHOW, 0, ID_ELAPSED_TIME, "00:00");
    TEXT_SetFont(hItem, GUI_FONT_20B_1);
    TEXT_SetTextColor(hItem, GUI_WHITE);     
    
    /* Title Initialization in play list */   
    hItem = TEXT_CreateEx(50, 40, 50, 30, pMsg->hWin, WM_CF_SHOW, 0, ID_TIME, "00:00");
    TEXT_SetFont(hItem, GUI_FONT_16B_1);
    TEXT_SetTextColor(hItem, GUI_WHITE);  
    
    hItem = TEXT_CreateEx(150, 20, 350, 30, pMsg->hWin, WM_CF_SHOW, TEXT_CF_HCENTER, ID_VIDEO_NAME, "File Name");
    TEXT_SetFont(hItem, GUI_FONT_20B_1);
    TEXT_SetTextColor(hItem, GUI_WHITE); 
    
    hItem = TEXT_CreateEx(150, 48, 350, 30, pMsg->hWin, WM_CF_SHOW, TEXT_CF_HCENTER, ID_VIDEO_FORMAT, "Format : MJPEG");
    TEXT_SetFont(hItem, GUI_FONT_13B_1);
    TEXT_SetTextColor(hItem, GUI_WHITE);
    
    hItem = TEXT_CreateEx(548, 200, 260, 20, pMsg->hWin, WM_CF_SHOW, TEXT_CF_LEFT, ID_FPS, "Rate : 20 fps");
    TEXT_SetFont(hItem, GUI_FONT_13B_1);
    TEXT_SetTextColor(hItem, GUI_WHITE);   
    
    hItem = TEXT_CreateEx(548, 220, 260, 20, pMsg->hWin, WM_CF_SHOW, TEXT_CF_LEFT, ID_FEATURES_FPU, "FPU : ON");
    TEXT_SetFont(hItem, GUI_FONT_13B_1);
    TEXT_SetTextColor(hItem, GUI_WHITE); 
    
    hItem = TEXT_CreateEx(548, 240, 260, 20, pMsg->hWin, WM_CF_SHOW, TEXT_CF_LEFT, ID_FEATURES_IC, "I-Cache : ON");
    TEXT_SetFont(hItem, GUI_FONT_13B_1);
    TEXT_SetTextColor(hItem, GUI_WHITE);     
    
    hItem = TEXT_CreateEx(548, 260, 260, 20, pMsg->hWin, WM_CF_SHOW, TEXT_CF_LEFT, ID_FEATURES_DC, "D-Cache : ON");
    TEXT_SetFont(hItem, GUI_FONT_13B_1);
    TEXT_SetTextColor(hItem, GUI_WHITE);  

    hItem = TEXT_CreateEx(548, 280, 260, 20, pMsg->hWin, WM_CF_SHOW, TEXT_CF_LEFT, ID_FEATURES_CPU, "MCU Load : 0%");
    TEXT_SetFont(hItem, GUI_FONT_13B_1);
    TEXT_SetTextColor(hItem, GUI_WHITE);       
    
    break;
    
  case WM_TIMER:
    { 
      WM_RestartTimer(pMsg->Data.v, 1000);
      /* show elapsed time */
      hItem = WM_GetDialogItem(pMsg->hWin, ID_ELAPSED_TIME);
      elapsed_time++;
      sprintf((char *)tmp , "%02lu:%02lu", elapsed_time/60, elapsed_time%60 );
      TEXT_SetText(hItem, tmp);
      sprintf((char *)tmp , "MCU Load : %d%%", ((osGetCPUUsage() > 90) ? (osGetCPUUsage() - 10) : osGetCPUUsage()));
      hItem = WM_GetDialogItem(pMsg->hWin, ID_FEATURES_CPU);
      TEXT_SetText(hItem, tmp);
      
      hItem = WM_GetDialogItem(pMsg->hWin, ID_SLIDER_DURATION);
      SLIDER_SetValue(hItem, (GUI_MOVIE_GetFrameIndex(hvideo)* 100)/ Video_Info.NumFrames);
      
      if(step == 0)
      {
        step = ((GUI_MOVIE_GetFrameIndex(hvideo)* 100)/ Video_Info.NumFrames);
      }

      if(((GUI_MOVIE_GetFrameIndex(hvideo)* 100)/ Video_Info.NumFrames) > (100 - 2*step - 1))
      {
        SLIDER_SetValue(hItem, 100);
        GUI_Exec();
      }
      
    }
    break;
    
  case WM_DELETE:
    if(hTimer != 0)
    {
      WM_DeleteTimer(hTimer);
      hTimer = 0;
    }
    
  case WM_PAINT: 
    GUI_SetColor(0xFF000000 | GUI_BLACK);
    GUI_SetBkColor(GUI_TRANSPARENT);
    GUI_Clear();

    GUI_SetColor(GUI_BLACK);
    GUI_DrawHLine(0, 0, 640);
    GUI_DrawHLine(479, 0, 640);
    GUI_DrawLine(639, 0, 639, 480);   
    GUI_DrawLine(0, 0, 0, 480);

    /* Background for total time */
    GUI_SetColor(0x00DCA939);
    GUI_AA_FillRoundedRect((-30), 5, 90, 65, 30);
    
    /*Video Information */
    GUI_AA_FillRoundedRect(150, 5, 500, 65, 30);
    
    /*H/W Information */
    GUI_AA_FillRoundedRect(538, 180, 780, 320, 30);    
    
    break;
    
    
  case WM_NOTIFY_PARENT:
    Id    = WM_GetId(pMsg->hWinSrc);    /* Id of widget */
    NCode = pMsg->Data.v;               /* Notification code */
 
    
    switch(Id) {
      
    case ID_BUTTON_EXIT_FROM_VIDEO: 
      switch(NCode) {
      case WM_NOTIFICATION_RELEASED:

        if(VideoPlayer_State != VIDEO_IDLE)
        {
          _StopPlay(&hvideo, &Video_File);
        }
        
        GUI_EndDialog(pMsg->hWin, 0);
        SelLayer = 0;
        GUI_SetLayerVisEx (1, 0);
        GUI_SelectLayer(0); 
        WM_HideWindow(hFrame);        
        WM_Exec();        
        WM_DeleteWindow(hFrame);
        WM_InvalidateWindow(VideoWin);
        break;
      }
      break;

    case ID_BUTTON_MENU: 
      switch(NCode) {
      case WM_NOTIFICATION_RELEASED:

        if(VideoPlayer_State != VIDEO_IDLE)
        {
          _StopPlay(&hvideo, &Video_File);
        }
        
        GUI_EndDialog(pMsg->hWin, 0);
        SelLayer = 0;
        GUI_SetLayerVisEx (1, 0);
        GUI_SelectLayer(0); 
        WM_DeleteWindow(hFrame);
        WM_HideWindow(VideoWin);        
        WM_Exec();
        WM_DeleteWindow(VideoWin);
        break;
      }
      break;
      
    case ID_BUTTON_STOP: 
      switch(NCode) {
      case WM_NOTIFICATION_RELEASED:
        if(VideoPlayer_State != VIDEO_IDLE)
        {
          VideoPlayer_State = VIDEO_STOP;
          _StopPlay(&hvideo, &Video_File);
        }
         WM_InvalidateWindow(pMsg->hWin);
        break;
      }
      break;
     
    case ID_BUTTON_FORE: 
      switch(NCode) {
      case WM_NOTIFICATION_RELEASED:
        if(VideoPlayer_State == VIDEO_PLAY)
        {
          if(file_pos < (VideoList.ptr - 1))
          {
            file_pos++;
          }
          else 
          {        
            file_pos = 0; 
          }  
          _StopPlay(&hvideo, &Video_File);
          _StartPlay(&hvideo, (char *)VideoList.file[file_pos].name, &Video_File, 0, 0);

        }
        break;
      }
      break;
      
    /* Notifications sent by 'progress' Slider */
    case ID_SLIDER_DURATION: 
      if(NCode == WM_NOTIFICATION_CLICKED)
      {
        hItem = WM_GetDialogItem(pMsg->hWin, ID_SLIDER_DURATION);
        int32_t newpos;
        if(VideoPlayer_State == VIDEO_PLAY)
        {
          GUI_MOVIE_Pause(hvideo);
          hItem = WM_GetDialogItem(pMsg->hWin, ID_SLIDER_DURATION);
          newpos = (SLIDER_GetValue(hItem) * Video_Info.NumFrames)/100;
          GUI_MOVIE_GotoFrame(hvideo, newpos);
          GUI_MOVIE_Play(hvideo);
          elapsed_time = (Video_Info.msPerFrame * newpos)/ 1000;
          hItem = WM_GetDialogItem(playbackwin, ID_ELAPSED_TIME);
          sprintf((char *)tmp , "%02lu:%02lu", elapsed_time/60, elapsed_time%60 );
          TEXT_SetText(hItem, tmp); 
          WM_InvalidateWindow(hItem);
          WM_Paint(hItem);
        }
        
      }
      break;
      
      
    case ID_BUTTON_BACK: 
      switch(NCode) {
      case WM_NOTIFICATION_RELEASED:
        if(VideoPlayer_State == VIDEO_PLAY)
        {
          if(file_pos > 0)
          {   
            file_pos--;
          }
          else 
          {        
            file_pos = VideoList.ptr - 1; 
          }  
          
          _StopPlay(&hvideo, &Video_File);
          _StartPlay(&hvideo, (char *)VideoList.file[file_pos].name, &Video_File, 0, 0); 
        }
        break;
      }
      break;
      
    case PLAY_VIDEO_ID: 
      switch(NCode) {
      case WM_NOTIFICATION_RELEASED:
          if((VideoPlayer_State == VIDEO_IDLE) || (VideoPlayer_State == VIDEO_PAUSE))
          {
            hTimer = WM_CreateTimer(playbackwin, 0, 1000, 0);  
            GUI_MOVIE_Play(hvideo); 
            VideoPlayer_State = VIDEO_PLAY;
          }
          else if(VideoPlayer_State == VIDEO_STOP)
          {
            _StartPlay(&hvideo, (char *)VideoList.file[file_pos].name, &Video_File, 0, 0);             
            VideoPlayer_State = VIDEO_PLAY;
          }
          else
          {
            GUI_MOVIE_Pause(hvideo);
            VideoPlayer_State = VIDEO_PAUSE; 
            if(hTimer != 0)
            {
              WM_DeleteTimer(hTimer);
              hTimer = 0;
            }            
          }
        break;
      }
      break;       
    }
    break;

  default:
    WM_DefaultProc(pMsg);
    break;
  }
}
Esempio n. 16
0
/*****************************
Initializacija paneli comunikaciji
*****************************/
void Modbus_panel_show(void)
{
  if (Modbus_FrameWin == WM_UNATTACHED)
  {
    //Stvorjujemo FrameWin
    Modbus_FrameWin = FRAMEWIN_CreateEx(X0, Y0, X_SIZE, Y_SIZE, 0, WM_CF_HIDE, 0, ID_MODBUS_FRAMEWIN, Modbus_panel_title.ptitle[sel_language], _cbProtection_FrameWin);
    FRAMEWIN_SetFont(Modbus_FrameWin, &GUI_FontArialBold14_8_Unicode);
    FRAMEWIN_SetTextAlign(Modbus_FrameWin, GUI_TA_HCENTER);
    FRAMEWIN_SetBarColor(Modbus_FrameWin, 1, GUI_GREEN);
    FRAMEWIN_SetBarColor(Modbus_FrameWin, 0, GUI_LIGHTGRAY);
    FRAMEWIN_SetTextColor(Modbus_FrameWin, GUI_BLUE);

#define COL_1_X         5
#define ROW_1_Y         10
#define HIGHT_Y         20
#define SHIFT_Y         (ROW_1_Y + HIGHT_Y)
#define WIDTH_X_T       165
#define WIDTH_X_V       60
#define SHIFT_X1        (WIDTH_X_T + 10)
#define SHIFT_X2        (SHIFT_X1 + WIDTH_X_V + 10)
    
    ScrollBar_Modbus = SCROLLBAR_CreateAttached(WM_GetClientWindow(Modbus_FrameWin), SCROLLBAR_CF_VERTICAL);
    SCROLLBAR_SetNumItems(ScrollBar_Modbus, MAX_NUMBER_ITEMS_MODBUS*SHIFT_Y);
    SCROLLBAR_SetPageSize(ScrollBar_Modbus, 6*SHIFT_Y);

    //Address
    Modbus_t[0] = TEXT_CreateEx(COL_1_X, ROW_1_Y + 0*SHIFT_Y, WIDTH_X_T, HIGHT_Y, WM_GetClientWindow(Modbus_FrameWin), WM_CF_SHOW, TEXT_CF_LEFT | TEXT_CF_VCENTER, ID_MODBUS_ADDRESS_TITLE,  Modbus_title[0].ptitle[sel_language]);
    TEXT_SetFont(Modbus_t[0], &GUI_FontArialStandard14_8_Unicode);
    Modbus_v[0] = EDIT_CreateUser(COL_1_X + SHIFT_X1, ROW_1_Y + 0*SHIFT_Y, WIDTH_X_V, HIGHT_Y, WM_GetClientWindow(Modbus_FrameWin), WM_CF_SHOW, 0, ID_MODBUS_ADDRESS_VALUE, 3, sizeof(__info_data));
    EDIT_SetFont(Modbus_v[0], &GUI_FontArialStandard14_8_Unicode);

    __info_data info_data;
    int shift = 0, max = KOEF_ADDRESS_MAX, min = 0;

    info_data.extra_param =  0;
    info_data.shift =  shift;
    float _shift = 0.0f;
    for (int rozrjad = 0; rozrjad < shift; rozrjad++) 
    {
      _shift /= 10.0f;
      _shift += 0.9f;
    }

//    int max_tmp = max;
//    float _max = 10;
//    while ( abs(max_tmp /= 10) >= 1) _max *= 10.0f;
//    if (max > 0)
//    {
//      _max = _max - 1 + _shift;
//    }
//    else if (max < 0)
//    {   
//      _max = -(_max / 10);
//    }
//    else _max = 0;
//    info_data.max =  _max;
    float _max = 255; //maksymalne odnobajtne chyslo, bo adresu ob'javleno jak typ char
    info_data.max =  _max;
    
    int min_tmp = min;
    float _min = 10;
    while ( abs(min_tmp /= 10) >= 1) _min *= 10.0f;
    if (min > 0)
    {
      _min = (_min / 10);
    }
    else if (min < 0)
    {
      _min = -(_min - 1 + _shift);
    }
    else _min = 0;
    info_data.min =  _min;
    
    EDIT_SetUserData(Modbus_v[0], &info_data, sizeof(__info_data));
    EDIT_SetFloatMode(Modbus_v[0], 0, _min, _max, shift, GUI_EDIT_SUPPRESS_LEADING_ZEROES);

    //Baud Rate
    Modbus_t[1] = TEXT_CreateEx(COL_1_X, ROW_1_Y + 1*SHIFT_Y, WIDTH_X_T, HIGHT_Y, WM_GetClientWindow(Modbus_FrameWin), WM_CF_SHOW, TEXT_CF_LEFT | TEXT_CF_VCENTER, ID_MODBUS_BAUD_RATE_TITLE,  Modbus_title[1].ptitle[sel_language]);
    TEXT_SetFont(Modbus_t[1], &GUI_FontArialStandard14_8_Unicode);
    Modbus_v[1] = DROPDOWN_CreateEx(COL_1_X + SHIFT_X1, ROW_1_Y + 1*SHIFT_Y, WIDTH_X_V, HIGHT_Y, WM_GetClientWindow(Modbus_FrameWin), WM_CF_SHOW, DROPDOWN_CF_AUTOSCROLLBAR, ID_MODBUS_BAUD_RATE_VALUE);
    DROPDOWN_SetFont(Modbus_v[1], &GUI_FontArialStandard14_8_Unicode);
    DROPDOWN_SetBkColor(Modbus_v[1],DROPDOWN_CI_UNSEL, GUI_GRAY);
    DROPDOWN_SetBkColor(Modbus_v[1],DROPDOWN_CI_SEL,  GUI_GRAY);
    DROPDOWN_SetBkColor(Modbus_v[1],DROPDOWN_CI_SELFOCUS, GUI_BLUE);
    DROPDOWN_AddString(Modbus_v[1], "");
    for (int i = 0; i < 7; i++) DROPDOWN_AddString(Modbus_v[1], Baud_rate_title[i]);

    //Parity
    Modbus_t[2] = TEXT_CreateEx(COL_1_X, ROW_1_Y + 2*SHIFT_Y, WIDTH_X_T, HIGHT_Y, WM_GetClientWindow(Modbus_FrameWin), WM_CF_SHOW, TEXT_CF_LEFT | TEXT_CF_VCENTER, ID_MODBUS_PARITY_TITLE,  Modbus_title[2].ptitle[sel_language]);
    TEXT_SetFont(Modbus_t[2], &GUI_FontArialStandard14_8_Unicode);
    Modbus_v[2] = DROPDOWN_CreateEx(COL_1_X + SHIFT_X1, ROW_1_Y + 2*SHIFT_Y, WIDTH_X_V, HIGHT_Y, WM_GetClientWindow(Modbus_FrameWin), WM_CF_SHOW, DROPDOWN_CF_AUTOSCROLLBAR, ID_MODBUS_PARITY_VALUE);
    DROPDOWN_SetFont(Modbus_v[2], &GUI_FontArialStandard14_8_Unicode);
    DROPDOWN_SetBkColor(Modbus_v[2],DROPDOWN_CI_UNSEL, GUI_GRAY);
    DROPDOWN_SetBkColor(Modbus_v[2],DROPDOWN_CI_SEL,  GUI_GRAY);
    DROPDOWN_SetBkColor(Modbus_v[2],DROPDOWN_CI_SELFOCUS, GUI_BLUE);
    DROPDOWN_AddString(Modbus_v[2], "");
    for (int i = 0; i < 3; i++) DROPDOWN_AddString(Modbus_v[2], Parity_title[i].ptitle[sel_language]);

    //Stop bits
    Modbus_t[3] = TEXT_CreateEx(COL_1_X, ROW_1_Y + 3*SHIFT_Y, WIDTH_X_T, HIGHT_Y, WM_GetClientWindow(Modbus_FrameWin), WM_CF_SHOW, TEXT_CF_LEFT | TEXT_CF_VCENTER, ID_MODBUS_STOP_BITS_TITLE,  Modbus_title[3].ptitle[sel_language]);
    TEXT_SetFont(Modbus_t[3], &GUI_FontArialStandard14_8_Unicode);
    Modbus_v[3] = DROPDOWN_CreateEx(COL_1_X + SHIFT_X1, ROW_1_Y + 3*SHIFT_Y, WIDTH_X_V, HIGHT_Y, WM_GetClientWindow(Modbus_FrameWin), WM_CF_SHOW, DROPDOWN_CF_AUTOSCROLLBAR, ID_MODBUS_STOP_BITS_VALUE);
    DROPDOWN_SetFont(Modbus_v[3], &GUI_FontArialStandard14_8_Unicode);
    DROPDOWN_SetBkColor(Modbus_v[3],DROPDOWN_CI_UNSEL, GUI_GRAY);
    DROPDOWN_SetBkColor(Modbus_v[3],DROPDOWN_CI_SEL,  GUI_GRAY);
    DROPDOWN_SetBkColor(Modbus_v[3],DROPDOWN_CI_SELFOCUS, GUI_BLUE);
    DROPDOWN_AddString(Modbus_v[3], "");
    for (int i = 0; i < 2; i++) DROPDOWN_AddString(Modbus_v[3], Stop_bits_title[i]);

    //Time-Out
    Modbus_t[4] = TEXT_CreateEx(COL_1_X, ROW_1_Y + 4*SHIFT_Y, WIDTH_X_T, HIGHT_Y, WM_GetClientWindow(Modbus_FrameWin), WM_CF_SHOW, TEXT_CF_LEFT | TEXT_CF_VCENTER, ID_MODBUS_TIMEOUT_TITLE,  Modbus_title[4].ptitle[sel_language]);
    TEXT_SetFont(Modbus_t[4], &GUI_FontArialStandard14_8_Unicode);
    Modbus_v[4] = EDIT_CreateUser(COL_1_X + SHIFT_X1, ROW_1_Y + 4*SHIFT_Y, WIDTH_X_V, HIGHT_Y, WM_GetClientWindow(Modbus_FrameWin), WM_CF_SHOW, 0, ID_MODBUS_TIMEOUT_VALUE, 5, sizeof(__info_data));
    EDIT_SetFont(Modbus_v[4], &GUI_FontArialStandard14_8_Unicode);

    shift = 1;
    max = VALUE_TIME_OUT_1_INTERFACE_MAX/10;
    min = 0;

    info_data.extra_param =  0;
    info_data.shift =  shift;
    _shift = 0.0f;
    for (int rozrjad = 0; rozrjad < shift; rozrjad++) 
    {
      _shift /= 10.0f;
      _shift += 0.9f;
    }

    int max_tmp = max;
    _max = 10;
    while ( abs(max_tmp /= 10) >= 1) _max *= 10.0f;
    if (max > 0)
    {   
      _max = _max - 1 + _shift;
    }
    else if (max < 0)
    {
      _max = -(_max / 10);
    }
    else _max = 0;
    info_data.max =  _max;
    
    min_tmp = min;
    _min = 10;
    while ( abs(min_tmp /= 10) >= 1) _min *= 10.0f;
    if (min > 0)
    {
      _min = (_min / 10);
    }
    else if (min < 0)
    {
      _min = -(_min - 1 + _shift);
    }
    else _min = 0;
    info_data.min =  _min;
    
    EDIT_SetUserData(Modbus_v[4], &info_data, sizeof(__info_data));
    EDIT_SetFloatMode(Modbus_v[4], 0, _min, _max, shift, GUI_EDIT_SUPPRESS_LEADING_ZEROES);

    Modbus_d = TEXT_CreateEx(COL_1_X + SHIFT_X2 , ROW_1_Y + 4*SHIFT_Y, 40, HIGHT_Y, WM_GetClientWindow(Modbus_FrameWin), WM_CF_SHOW, TEXT_CF_LEFT | TEXT_CF_VCENTER, ID_MODBUS_TIMEOUT_DIMENSION,  Modbus_Timeout_dimention.ptitle[sel_language]);
    TEXT_SetFont(Modbus_d, &GUI_FontArialStandard14_8_Unicode);
    
#undef COL_1_X
#undef ROW_1_Y
#undef HIGHT_Y
#undef SHIFT_Y
#undef WIDTH_X_T
#undef WIDTH_X_V
#undef SHIFT_X1
#undef SHIFT_X2
  }
  
  WM_BringToTop(Modbus_FrameWin);
  WM_ShowWindow(Modbus_FrameWin);
  
}
Esempio n. 17
0
void run_db(void)
{
/*	
	printf("Database name : %s\n", db->name);
	printf("Database nb children : %i\n", (int)db->nb_motifs);
	for (uint32_t i = 0; i < db->nb_motifs; i++)
	{
		motif_t * m = db->motifs;
		printf("    motif %i:\n", (int)i);
		printf("        name : %s\n", m->name);
		printf("        desc : %s\n", m->desc);
		printf("        img  : %s\n", m->image);
	}
*/
	char error_404[] = "No Motifs Found in Database!";


	if (db->motifs == NULL)
	{
		strcpy(current_motif_title, error_404);
	} else {
		current_motif_index = 1;
		//sprintf(current_motif_title, "%i/%i -- %s", (int)current_motif_index, (int)db->nb_motifs, db->motifs->name);
		//current_motif_desc = db->motifs->desc;
		update_motif();
	}

	WM_HWIN		db_nav_win = WINDOW_CreateEx(	0, 0,
												800, 480,
												WM_HBKWIN, WM_CF_SHOW,
												0, GUI_ID_USER+0,
												_cbrundb);

	WINDOW_SetBkColor(db_nav_win, GUI_WHITE);

	motif_name_widget = TEXT_CreateEx(	0, 0,
													800, 100,
													db_nav_win, WM_CF_SHOW,
													TEXT_CF_HCENTER | TEXT_CF_VCENTER, GUI_ID_TEXT0,
													(const char *)current_motif_title);

	
	motif_desc_widget = MULTIEDIT_CreateEx(	100, 100,
																600, 380,
																db_nav_win, WM_CF_SHOW,
																MULTIEDIT_CF_AUTOSCROLLBAR_V, GUI_ID_MULTIEDIT1,
																5000,
																(const char *) current_motif_desc
															);

	BUTTON_Handle bt_prev_widget = BUTTON_CreateEx(	0, 100,
													100, 380,
													db_nav_win, WM_CF_SHOW,
													0,  GUI_ID_BUTTON0);


	BUTTON_Handle bt_next_widget = BUTTON_CreateEx(	700, 100,
													100, 380,
													db_nav_win, WM_CF_SHOW,
													0,  GUI_ID_BUTTON1);
	
	TEXT_SetFont(motif_name_widget, GUI_FONT_24_1);
	BUTTON_SetFont(bt_prev_widget, GUI_FONT_24_1);
	BUTTON_SetFont(bt_next_widget, GUI_FONT_24_1);
	MULTIEDIT_SetFont(motif_desc_widget, GUI_FONT_24_1);
	MULTIEDIT_SetWrapWord(motif_desc_widget);

	BUTTON_SetBitmap(bt_prev_widget, BUTTON_BI_UNPRESSED, &bmarrowdefault);
	BUTTON_SetBitmap(bt_next_widget, BUTTON_BI_UNPRESSED, &bmarrowrdefault);
	BUTTON_SetBitmap(bt_prev_widget, BUTTON_BI_PRESSED  , &bmarrowclicked);
	BUTTON_SetBitmap(bt_next_widget, BUTTON_BI_PRESSED  , &bmarrowrclicked);

}
Esempio n. 18
0
/*********************************************************************
*
*       TEXT_Create
*/
TEXT_Handle TEXT_Create(int x0, int y0, int xsize, int ysize, int Id, int Flags, const char * s, int Align) {
  return TEXT_CreateEx(x0, y0, xsize, ysize, WM_HMEM_NULL, Flags, Align, Id, s);
}
/**
  * @brief  Callback routine of the Benchmark dialog
  * @param  pMsg: pointer to data structure of type WM_MESSAGE
  * @retval None
  */
static void _cbDialog(WM_MESSAGE * pMsg) {
  WM_HWIN hItem;
  int Id, NCode;
  WM_HWIN hGraph;
  int cpu_speed = 0;
  char temp[50];
  WM_CALLBACK  *_cb;

  switch (pMsg->MsgId) {
  case WM_INIT_DIALOG:

    /* Initialization of 'CPU' */
    hItem = pMsg->hWin;
    FRAMEWIN_SetFont(hItem, GUI_FONT_13HB_ASCII);
    FRAMEWIN_AddCloseButton(hItem, FRAMEWIN_BUTTON_RIGHT,  0);

    hItem = TEXT_CreateEx(10, 20, 100, 25, pMsg->hWin, WM_CF_SHOW,0, 0x123,"");
    TEXT_SetFont(hItem, GUI_FONT_13B_1);
    TEXT_SetTextColor(hItem, 0x00804000);
    TEXT_SetText(hItem, "CPU Usage %:");

    hItem = WM_GetDialogItem(pMsg->hWin, ID_BENCH_CPU);
    TEXT_SetFont(hItem, GUI_FONT_16B_ASCII);
    TEXT_SetTextColor(hItem, GUI_DARKRED);


    hItem = WM_GetDialogItem(pMsg->hWin, ID_CPU_GRAPH);
    FRAMEWIN_SetBarColor(hItem, 0, GUI_DARKGRAY);
    FRAMEWIN_SetBarColor(hItem, 1, GUI_DARKGRAY);

    hGraph = GRAPH_CreateEx(10, 35, 300, 95, pMsg->hWin, WM_CF_SHOW, 0, GUI_ID_GRAPH0);
    hData = GRAPH_DATA_YT_Create(GUI_LIGHTGREEN, 500, 0, 20);
    GRAPH_SetGridVis(hGraph, 1);
    GRAPH_SetBorder(hGraph, 20, 4, 5, 4);
    GRAPH_AttachData(hGraph, hData);

    hScale = GRAPH_SCALE_Create(20, GUI_TA_RIGHT, GRAPH_SCALE_CF_VERTICAL, 25);
    GRAPH_AttachScale(hGraph, hScale);
    GRAPH_SCALE_SetTextColor(hScale, GUI_YELLOW);
    GRAPH_SetGridDistX(hGraph, 25);
    GRAPH_SetGridDistY(hGraph, 25);

    WM_CreateWindowAsChild(80, 45, 354, 23, pMsg->hWin, WM_CF_SHOW | WM_CF_HASTRANS, _cbCpuWindow , 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_BENCH_CPU:
        Stop_Test = 0;

        WM_HideWindow(pMsg->hWin);

        _cb = WM_GetCallback(WM_HBKWIN);
        WM_SetCallback(WM_HBKWIN, _ClearDesktop);
        cpu_speed = Run_SpeedTest();

        WM_ShowWindow(pMsg->hWin);
        hItem = WM_GetDialogItem(pMsg->hWin, ID_BENCH_CPU);
        sprintf (temp, "%d  Pixels/s ", cpu_speed);
        TEXT_SetText(hItem, temp);
        WM_SetCallback(WM_HBKWIN, _cb);
        hItem = WM_GetDialogItem(WM_HBKWIN, ID_BUTTON_BKGND);
        WM_InvalidateWindow(hItem);
        WM_InvalidateWindow(WM_HBKWIN);
        WM_Paint(WM_HBKWIN);
        break;
      }
      break;

    case WM_NOTIFICATION_CHILD_DELETED:
      Stop_Test = 1;
      break;
    }
    break;

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

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

       break;
	
	case WM_KEY:

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

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

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

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

  default:
    WM_DefaultProc(pMsg);
    break;
  }
}