/*********************************************************************
*
*       _cbCallback
*/
static void _cbCallback(WM_MESSAGE * pMsg) {
  WM_HWIN hDlg, hWinSrc, hItem;
  int Id, NCode;
  hWinSrc = pMsg->hWinSrc;
  hDlg = pMsg->hWin;
  switch (pMsg->MsgId) {
  case WM_INIT_DIALOG:
    FRAMEWIN_SetFont(hDlg, &GUI_Font24B_ASCII);
    FRAMEWIN_SetTextAlign(hDlg, GUI_TA_HCENTER);
    FRAMEWIN_SetClientColor(hDlg, GUI_RED);
    hItem = WM_GetDialogItem(hDlg, GUI_ID_CHECK0); CHECKBOX_SetText(hItem, "Enable alarm");
    hItem = WM_GetDialogItem(hDlg, GUI_ID_CHECK1); CHECKBOX_SetText(hItem, "Enable display lighting");
    hItem = WM_GetDialogItem(hDlg, GUI_ID_CHECK2); CHECKBOX_SetText(hItem, "Enable color mode");
    break;
  case WM_NOTIFY_PARENT:
    Id    = WM_GetId(hWinSrc);      /* Id of widget */
    NCode = pMsg->Data.v;                 /* Notification code */
    if (NCode == WM_NOTIFICATION_RELEASED) {      /* React only if released */
      if (Id == GUI_ID_OK) {            /* OK Button */
        GUI_SetOrg(0, 0);
        WM_SetFocus(_hPrevWin);
      }
    }
    break;
  default:
    WM_DefaultProc(pMsg);
  }
}
Ejemplo n.º 2
0
/*********************************************************************
*
*       _cbCallbackOptions
*
* Purpose:
*   Callback of the options dialog box, sets the widget effects
*/
static void _cbCallbackOptions(WM_MESSAGE * pMsg) {
  WM_HWIN hDlg, hItem;
  hDlg = pMsg->hWin;
  switch (pMsg->MsgId) {
    case WM_INIT_DIALOG:
      /* Init check box */
      hItem = WM_GetDialogItem(hDlg, GUI_ID_CHECK0);
      CHECKBOX_Check(hItem);
      CHECKBOX_SetText(hItem, "Auto");
      /* Init radio button */
      hItem = WM_GetDialogItem(hDlg, GUI_ID_RADIO0);
      RADIO_SetText(hItem, "3D",     0);
      RADIO_SetText(hItem, "Simple", 1);
      RADIO_SetText(hItem, "None",   2);
      break;
    case WM_NOTIFY_PARENT:
      if (pMsg->Data.v == WM_NOTIFICATION_VALUE_CHANGED) {
        hItem = WM_GetDialogItem(hDlg, GUI_ID_RADIO0);
        if (pMsg->hWinSrc == hItem) {
          _SetEffect(RADIO_GetValue(hItem));
        }
      } else if (pMsg->Data.v == WM_NOTIFICATION_RELEASED) {
        hItem = WM_GetDialogItem(hDlg, GUI_ID_CHECK0);
        if (pMsg->hWinSrc == hItem) {
          _AutoMode = CHECKBOX_IsChecked(hItem);
        }
      }
      break;
    default:
      WM_DefaultProc(pMsg);
  }
}
Ejemplo n.º 3
0
void configuration_panel_init() {
  int frmWinWidth = GUI_X_MAX;
  int frmWinHeight = GUI_Y_MAX - 40;
  int x0 = 0;
  int y0 = 20;
  
  int checkBoxX = 5;
  int checkBoxY = 22;
  int checkBoxWidth = 60;
  int checkBoxHeight = 15;
  
  int buttonWidth = 90;
  int buttonHeight = 20;
  int buttonX = 5;
  int buttonY = frmWinHeight - (buttonHeight + 5);
  
  sel_conf_language = sel_language;
  
  configPageWin = FRAMEWIN_Create(confFrmText[sel_language], _cbConfigWin, WM_CF_SHOW, x0, y0, frmWinWidth, frmWinHeight);
  FRAMEWIN_SetFont(configPageWin, &GUI_FontArialBold14_8_Unicode);
  
  for (int i = 0; i < NUM_CONF_ITEMS; i++) {
    int id = i + ID_CONF_DSTP_CFG_PRT_ONB;
    CHECKBOX_Handle checkBox = CHECKBOX_Create(checkBoxX, checkBoxY, checkBoxWidth, checkBoxHeight, configPageWin, id, WM_CF_SHOW);
    CHECKBOX_SetFont(checkBox, &GUI_FontArialStandard14_8_Unicode);
    CHECKBOX_SetText(checkBox, conf_checkbox_item[sel_language][i]);
    CHECKBOX_SetBoxBkColor(checkBox, GUI_USER_LIGHTGRAY, CHECKBOX_CI_DISABLED);
    CHECKBOX_SetBoxBkColor(checkBox, GUI_YELLOW, CHECKBOX_CI_ENABLED);
    CHECKBOX_SetFocusColor(checkBox, GUI_BLUE);
    checkBoxY += 15;
  }
  
  BUTTON_Handle ESC_Button = BUTTON_CreateEx(buttonX, buttonY, buttonWidth, buttonHeight, configPageWin, WM_CF_SHOW, 0, ID_CONF_BUTTON_ESC);
  BUTTON_SetFont(ESC_Button, &GUI_FontArialBold14_8_Unicode);
  BUTTON_SetText(ESC_Button, escButtonExpl[sel_language]);
  
  buttonX = frmWinWidth - (buttonWidth + 5);
  BUTTON_Handle ENTER_Button = BUTTON_CreateEx(buttonX, buttonY, buttonWidth, buttonHeight, configPageWin, WM_CF_SHOW, 0, ID_CONF_BUTTON_ENTER);
  BUTTON_SetFont(ENTER_Button, &GUI_FontArialBold14_8_Unicode);
  BUTTON_SetText(ENTER_Button, enterButtonExpl[sel_language]);
}
Ejemplo n.º 4
0
/*********************************************************************
*
*       _cbCallback
*
* Purpose:
*   Callback function of the dialog
*/
static void _cbCallback(WM_MESSAGE * pMsg) {
  int NCode, Id, Value, i;
  WM_HWIN hDlg, hItem;
  hDlg = pMsg->hWin;
  switch (pMsg->MsgId) {
  case WM_INIT_DIALOG:
    hItem = WM_GetDialogItem(hDlg, GUI_ID_GRAPH0);
    _InitPoints();
    /* Add graphs */
    for (i = 0; i < 3; i++) {
      GRAPH_DATA_Handle  hDataXY;
      hDataXY = GRAPH_DATA_XY_Create(_aColor[i], GUI_COUNTOF(_aPoint[i]), _aPoint[i], GUI_COUNTOF(_aPoint[i]));
      GRAPH_DATA_XY_SetLineStyle(hDataXY, _aLStyle[i]);
      GRAPH_AttachData(hItem, hDataXY);
    }
    /* Set graph attributes */
    GRAPH_SetGridDistY(hItem, 25);
    GRAPH_SetGridVis(hItem, 1);
    GRAPH_SetUserDraw(hItem, _UserDraw);
    /* Create and add vertical scale */
    _hScaleV = GRAPH_SCALE_Create( 35, GUI_TA_RIGHT, GRAPH_SCALE_CF_VERTICAL, 25);
    GRAPH_SCALE_SetOff(_hScaleV, 100);
    GRAPH_SCALE_SetFactor(_hScaleV, 0.04f);
    GRAPH_SCALE_SetTextColor(_hScaleV, GUI_RED);
    GRAPH_AttachScale(hItem, _hScaleV);
    /* Create and add horizontal scale */
    _hScaleH = GRAPH_SCALE_Create(70, GUI_TA_HCENTER, GRAPH_SCALE_CF_HORIZONTAL, 50);
    GRAPH_SCALE_SetFactor(_hScaleH, 0.02f);
    GRAPH_SCALE_SetTextColor(_hScaleH, GUI_DARKGREEN);
    GRAPH_AttachScale(hItem, _hScaleH);
    /* Init check boxes */
    hItem = WM_GetDialogItem(hDlg, GUI_ID_CHECK2);
    CHECKBOX_SetText(hItem, "L");
    CHECKBOX_SetState(hItem, 1);
    hItem = WM_GetDialogItem(hDlg, GUI_ID_CHECK3);
    CHECKBOX_SetText(hItem, "T");
    hItem = WM_GetDialogItem(hDlg, GUI_ID_CHECK4);
    CHECKBOX_SetText(hItem, "R");
    hItem = WM_GetDialogItem(hDlg, GUI_ID_CHECK5);
    CHECKBOX_SetText(hItem, "B");
    hItem = WM_GetDialogItem(hDlg, GUI_ID_CHECK1);
    CHECKBOX_SetText(hItem, "Grid");
    CHECKBOX_SetState(hItem, 1);
    hItem = WM_GetDialogItem(hDlg, GUI_ID_CHECK6);
    CHECKBOX_SetText(hItem, "HScroll");
    hItem = WM_GetDialogItem(hDlg, GUI_ID_CHECK7);
    CHECKBOX_SetText(hItem, "VScroll");
    /* Init slider widgets */
    hItem = WM_GetDialogItem(hDlg, GUI_ID_SLIDER0);
    SLIDER_SetRange(hItem, 0, 10);
    SLIDER_SetValue(hItem, 5);
    SLIDER_SetNumTicks(hItem, 6);
    hItem = WM_GetDialogItem(hDlg, GUI_ID_SLIDER1);
    SLIDER_SetRange(hItem, 0, 20);
    SLIDER_SetValue(hItem, 5);
    SLIDER_SetNumTicks(hItem, 6);
    /* Init radio widget */
    hItem = WM_GetDialogItem(hDlg, GUI_ID_RADIO0);
    RADIO_SetText(hItem, "3D", 0);
    RADIO_SetText(hItem, "flat", 1);
    RADIO_SetText(hItem, "-", 2);
    /* Init button widget */
    hItem = WM_GetDialogItem(hDlg, GUI_ID_BUTTON0);
    WM_SetStayOnTop(hItem, 1);
    break;
  case WM_NOTIFY_PARENT:
    Id    = WM_GetId(pMsg->hWinSrc);      /* Id of widget */
    NCode = pMsg->Data.v;                 /* Notification code */
    switch (NCode) {
    case WM_NOTIFICATION_CLICKED:
      switch (Id) {
      case GUI_ID_BUTTON0:
        _ToggleFullScreenMode(hDlg);
        break;
      }
      break;
    case WM_NOTIFICATION_VALUE_CHANGED:
      switch (Id) {
      case GUI_ID_CHECK1:
        /* Toggle grid */
        hItem = WM_GetDialogItem(hDlg, GUI_ID_GRAPH0);
        GRAPH_SetGridVis(hItem, CHECKBOX_IsChecked(WM_GetDialogItem(hDlg, GUI_ID_CHECK1)));
        break;
      case GUI_ID_CHECK2:
      case GUI_ID_CHECK3:
      case GUI_ID_CHECK4:
      case GUI_ID_CHECK5:
        /* Toggle border */
        hItem = WM_GetDialogItem(hDlg, GUI_ID_GRAPH0);
        GRAPH_SetBorder(hItem, 
                        CHECKBOX_IsChecked(WM_GetDialogItem(hDlg, GUI_ID_CHECK2)) * 40, 
                        CHECKBOX_IsChecked(WM_GetDialogItem(hDlg, GUI_ID_CHECK3)) * 5, 
                        CHECKBOX_IsChecked(WM_GetDialogItem(hDlg, GUI_ID_CHECK4)) * 5, 
                        CHECKBOX_IsChecked(WM_GetDialogItem(hDlg, GUI_ID_CHECK5)) * 5);
        break;
      case GUI_ID_SLIDER0:
        /* Set horizontal grid spacing */
        hItem = WM_GetDialogItem(hDlg, GUI_ID_GRAPH0);
        Value = SLIDER_GetValue(pMsg->hWinSrc) * 10;
        GRAPH_SetGridDistX(hItem, Value);
        GRAPH_SCALE_SetTickDist(_hScaleH, Value);
        if (Value != 50) {
          GRAPH_SCALE_SetNumDecs(_hScaleH, 1);
        } else {
          GRAPH_SCALE_SetNumDecs(_hScaleH, 0);
        }
        break;
      case GUI_ID_SLIDER1:
        /* Set vertical grid spacing */
        hItem = WM_GetDialogItem(hDlg, GUI_ID_GRAPH0);
        Value = SLIDER_GetValue(pMsg->hWinSrc) * 5;
        GRAPH_SetGridDistY(hItem, Value);
        GRAPH_SCALE_SetTickDist(_hScaleV, Value);
        if (Value != 25) {
          GRAPH_SCALE_SetNumDecs(_hScaleV, 1);
        } else {
          GRAPH_SCALE_SetNumDecs(_hScaleV, 0);
        }
        break;
      case GUI_ID_RADIO0:
        /* Set the widget effect */
        hItem = WM_GetDialogItem(hDlg, GUI_ID_GRAPH0);
        switch (RADIO_GetValue(pMsg->hWinSrc)) {
        case 0:
          WIDGET_SetEffect(hItem, &WIDGET_Effect_3D);
          break;
        case 1:
          WIDGET_SetEffect(hItem, &WIDGET_Effect_Simple);
          break;
        case 2:
          WIDGET_SetEffect(hItem, &WIDGET_Effect_None);
          break;
        }
        break;
      case GUI_ID_CHECK6:
        /* Toggle horizontal scroll bar */
        hItem = WM_GetDialogItem(hDlg, GUI_ID_GRAPH0);
        if (CHECKBOX_IsChecked(WM_GetDialogItem(hDlg, GUI_ID_CHECK6))) {
          GRAPH_SetVSizeX(hItem, 500);
        } else {
          GRAPH_SetVSizeX(hItem, 0);
        }
        break;
      case GUI_ID_CHECK7:
        /* Toggle vertical scroll bar */
        hItem = WM_GetDialogItem(hDlg, GUI_ID_GRAPH0);
        if (CHECKBOX_IsChecked(WM_GetDialogItem(hDlg, GUI_ID_CHECK7))) {
          GRAPH_SetVSizeY(hItem, 300);
        } else {
          GRAPH_SetVSizeY(hItem, 0);
        }
        break;
      }
      break;
    }
    break;
  default:
    WM_DefaultProc(pMsg);
  }
}
/*********************************************************************
*
*       _cbDialog
*
* Function description
*   Callback routine of dialog
*/
static void _cbDialog(WM_MESSAGE * pMsg) {
  static WM_HWIN   hCellEdit = 0;
  CELL_EDIT_ORG    CellEditOrg;
  WM_KEY_INFO    * pKeyInfo;
  GUI_RECT         ItemRect;
  WM_HWIN          hDlg;
  WM_HWIN          hItem;
  char             acItemText[LEN_ITEM_TEXT];
  int              CheckState;
  int              NCode;
  int              Id;
  int              i;

  hDlg = pMsg->hWin;
  switch (pMsg->MsgId) {
  case WM_INIT_DIALOG:
    //
    // Set listview properties
    //
    hItem = WM_GetDialogItem(hDlg, GUI_ID_LISTVIEW0);
    WM_SetCallback(hItem, _cbList);
    HEADER_SetDragLimit(LISTVIEW_GetHeader(hItem), 1);
    LISTVIEW_SetAutoScrollV(hItem, 1);
    LISTVIEW_SetGridVis(hItem, 1);
    LISTVIEW_SetRBorder(hItem, 5);
    LISTVIEW_SetLBorder(hItem, 5);
    for (i = 0; i < 3; i++) {
      LISTVIEW_AddColumn(hItem, _aColProps[i].Width, _aColProps[i].pText, _aColProps[i].Align);
      LISTVIEW_SetCompareFunc(hItem, i, _aColProps[i].fpCompare);
    }
    LISTVIEW_EnableSort(hItem);
    for (i = 0; i < 6; i++) {
      if (_AddRow(hItem, 1)) {
        break;
      }
    }
    //
    // Set radio button text
    //
    hItem = WM_GetDialogItem(hDlg, GUI_ID_RADIO0);
    RADIO_SetText(hItem, "Sorted",   0);
    RADIO_SetText(hItem, "Unsorted", 1);
    //
    // Init checkbox text
    //
    hItem = WM_GetDialogItem(hDlg, GUI_ID_CHECK0);
    CHECKBOX_SetTextAlign(hItem, GUI_TA_LEFT);
    CHECKBOX_SetText(hItem, "Cell select");
    break;
  case WM_KEY:
    hItem = WM_GetDialogItem(hDlg, GUI_ID_LISTVIEW0);
    if (pMsg->hWinSrc == hItem) {
      pKeyInfo = (WM_KEY_INFO *)pMsg->Data.p;
      if (pKeyInfo->PressedCnt == 0) {
        if (pKeyInfo->Key == GUI_KEY_ENTER) {
          if (hCellEdit == 0) {
            CellEditOrg.Row = LISTVIEW_GetSel(hItem);
            CellEditOrg.Col = LISTVIEW_GetSelCol(hItem);
            LISTVIEW_GetItemRect(hItem, CellEditOrg.Col, CellEditOrg.Row, &ItemRect);
            LISTVIEW_GetItemTextSorted(hItem, CellEditOrg.Col, CellEditOrg.Row, acItemText, LEN_ITEM_TEXT);
            hCellEdit = EDIT_CreateUser(ItemRect.x0, ItemRect.y0, ItemRect.x1 - ItemRect.x0 + 2, ItemRect.y1 - ItemRect.y0 + 1, hItem, WM_CF_SHOW, 0, 0, LEN_ITEM_TEXT, sizeof(CELL_EDIT_ORG));
            EDIT_SetUserData(hCellEdit, &CellEditOrg, sizeof(CELL_EDIT_ORG));
            WIDGET_SetEffect(hCellEdit, &WIDGET_Effect_Simple);
            WM_SetCallback(hCellEdit, _cbCellEdit);
            WM_SetFocus(hCellEdit);
            EDIT_SetText(hCellEdit, acItemText);
          }
        }
      }
    }
    break;
  case WM_NOTIFY_PARENT:
    Id    = WM_GetId(pMsg->hWinSrc);
    NCode = pMsg->Data.v;
    switch (NCode) {
    case WM_NOTIFICATION_CHILD_DELETED:
      if (pMsg->hWinSrc == hCellEdit) {
        hCellEdit = 0;
      }
      break;
    case WM_NOTIFICATION_VALUE_CHANGED:
      switch (Id) {
      case GUI_ID_RADIO0:
        //
        // Enable/Disable sorting
        //
        hItem = WM_GetDialogItem(hDlg, GUI_ID_LISTVIEW0);
        switch (RADIO_GetValue(WM_GetDialogItem(hDlg, GUI_ID_RADIO0))) {
        case 0:
          LISTVIEW_EnableSort(hItem);
          break;
        default:
          LISTVIEW_DisableSort(hItem);
          break;
        }
        break;
      }
      break;
    case WM_NOTIFICATION_RELEASED:
      switch (Id) {
      case GUI_ID_BUTTON0:
        //
        // Add new row
        //
        hItem = WM_GetDialogItem(hDlg, GUI_ID_LISTVIEW0);
        _AddRow(hItem, 0);
        break;
      case GUI_ID_BUTTON1:
        //
        // Insert new row
        //
        hItem = WM_GetDialogItem(hDlg, GUI_ID_LISTVIEW0);
        i     = LISTVIEW_GetSelUnsorted(hItem);
        _AddRow(hItem, 1);
        if (i >= 0) {
          LISTVIEW_SetSelUnsorted(hItem, i + 1);
        }
        break;
      case GUI_ID_BUTTON2:
        //
        // Delete row
        //
        hItem = WM_GetDialogItem(hDlg, GUI_ID_LISTVIEW0);
        i     = LISTVIEW_GetSelUnsorted(hItem);
        LISTVIEW_DeleteRow(hItem, (i >= 0) ? i : 0);
        break;
      case GUI_ID_OK:
        //
        // End dialog
        //
        GUI_EndDialog(hDlg, 0);
        break;
      case GUI_ID_CHECK0:
        //
        // Enable/Disable cell selection
        //
        hItem      = WM_GetDialogItem(hDlg, GUI_ID_CHECK0);
        CheckState = CHECKBOX_GetState(hItem);
        hItem      = WM_GetDialogItem(hDlg, GUI_ID_LISTVIEW0);
        if (CheckState) {
          LISTVIEW_EnableCellSelect(hItem, 1);
        } else {
          LISTVIEW_EnableCellSelect(hItem, 0);
        }
        break;
      }
      break;
    }
    break;
  default:
    WM_DefaultProc(pMsg);
  }
}
void Checkbox_Set_Text(WM_HWIN hWin, int checkboxId, char *string)
{
    WM_HWIN hItem;
    hItem = WM_GetDialogItem(hWin, checkboxId);
    CHECKBOX_SetText(hItem, string);
}
/*********************************************************************
*
*       _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 'START'
    //
    hItem = WM_GetDialogItem(pMsg->hWin, ID_BUTTON_0);
    BUTTON_SetFont(hItem, GUI_FONT_24_ASCII);
    //
    // Initialization of 'Msg Edit'
    //
    hItem = WM_GetDialogItem(pMsg->hWin, ID_EDIT_0);
    EDIT_SetText(hItem, "123");
    EDIT_SetFont(hItem, GUI_FONT_20_ASCII);
    //
    // Initialization of 'cbxWheel Test'
    //
    hItem = WM_GetDialogItem(pMsg->hWin, ID_CHECKBOX_0);
    CHECKBOX_SetText(hItem, "Wheel Test");
    CHECKBOX_SetFont(hItem, GUI_FONT_16B_ASCII);
    //
    // Initialization of 'cbxSBrush Test'
    //
    hItem = WM_GetDialogItem(pMsg->hWin, ID_CHECKBOX_1);
    CHECKBOX_SetText(hItem, "SBrush Test");
    CHECKBOX_SetFont(hItem, GUI_FONT_16B_ASCII);
    //
    // Initialization of 'cbxMBrush Test'
    //
    hItem = WM_GetDialogItem(pMsg->hWin, ID_CHECKBOX_2);
    CHECKBOX_SetText(hItem, "MBrush Test");
    CHECKBOX_SetFont(hItem, GUI_FONT_16B_ASCII);
    //
    // Initialization of 'cbxFan Test'
    //
    hItem = WM_GetDialogItem(pMsg->hWin, ID_CHECKBOX_3);
    CHECKBOX_SetText(hItem, "Fan Test");
    CHECKBOX_SetFont(hItem, GUI_FONT_16B_ASCII);
    //
    // Initialization of 'cbxIFRD Test'
    //
    hItem = WM_GetDialogItem(pMsg->hWin, ID_CHECKBOX_4);
    CHECKBOX_SetText(hItem, "IFRD Test");
    CHECKBOX_SetFont(hItem, GUI_FONT_16B_ASCII);
    //
    // Initialization of 'cbxCollision Test'
    //
    hItem = WM_GetDialogItem(pMsg->hWin, ID_CHECKBOX_5);
    CHECKBOX_SetText(hItem, "Collision Test");
    CHECKBOX_SetFont(hItem, GUI_FONT_16B_ASCII);
    //
    // Initialization of 'cbxWheelFloat Test'
    //
    hItem = WM_GetDialogItem(pMsg->hWin, ID_CHECKBOX_6);
    CHECKBOX_SetText(hItem, "WheelFloat Test");
    CHECKBOX_SetFont(hItem, GUI_FONT_16B_ASCII);
    //
    // Initialization of 'cbxAshTray Test'
    //
    hItem = WM_GetDialogItem(pMsg->hWin, ID_CHECKBOX_7);
    CHECKBOX_SetText(hItem, "AshTray Test");
    CHECKBOX_SetFont(hItem, GUI_FONT_16B_ASCII);
    //
    // Initialization of 'cbxUniWheel Test'
    //
    hItem = WM_GetDialogItem(pMsg->hWin, ID_CHECKBOX_8);
    CHECKBOX_SetText(hItem, "UniWheel Test");
    CHECKBOX_SetFont(hItem, GUI_FONT_16B_ASCII);
    //
    // Initialization of 'cbxKey Test'
    //
    hItem = WM_GetDialogItem(pMsg->hWin, ID_CHECKBOX_9);
    CHECKBOX_SetText(hItem, "Key Test");
    CHECKBOX_SetFont(hItem, GUI_FONT_16B_ASCII);
    //
    // Initialization of 'cbxIRDA Test'
    //
    hItem = WM_GetDialogItem(pMsg->hWin, ID_CHECKBOX_10);
    CHECKBOX_SetText(hItem, "IRDA Test");
    CHECKBOX_SetFont(hItem, GUI_FONT_16B_ASCII);
    //
    // Initialization of 'cbxBuzzer Test'
    //
    hItem = WM_GetDialogItem(pMsg->hWin, ID_CHECKBOX_11);
    CHECKBOX_SetText(hItem, "Buzzer Test");
    CHECKBOX_SetFont(hItem, GUI_FONT_16B_ASCII);
    //
    // Initialization of 'STOP'
    //
    hItem = WM_GetDialogItem(pMsg->hWin, ID_BUTTON_1);
    BUTTON_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 'START'
      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_EDIT_0: // Notifications sent by 'Msg 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 'cbxWheel Test'
      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 'cbxSBrush Test'
      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_2: // Notifications sent by 'cbxMBrush Test'
      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_3: // Notifications sent by 'cbxFan Test'
      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_4: // Notifications sent by 'cbxIFRD Test'
      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_5: // Notifications sent by 'cbxCollision Test'
      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_6: // Notifications sent by 'cbxWheelFloat Test'
      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_7: // Notifications sent by 'cbxAshTray Test'
      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_8: // Notifications sent by 'cbxUniWheel Test'
      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_9: // Notifications sent by 'cbxKey Test'
      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_10: // Notifications sent by 'cbxIRDA Test'
      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_11: // Notifications sent by 'cbxBuzzer Test'
      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 'STOP'
      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.º 8
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:
  	  {

//			  hItem = WM_GetDialogItem(pMsg->hWin, ID_FRAMEWIN_0);
////			  FRAMEWIN_SetResizeable(hItem,1);
//			  FRAMEWIN_SetFont(hItem,GUI_FONT_COMIC24B_ASCII);
////			  FRAMEWIN_SetMoveable(hItem,1);
////			  GUI_ExecCreatedDialog(hItem);
  		  hItem = WM_GetDialogItem(pMsg->hWin, ID_BUTTON_0);
  		  BUTTON_SetSkin(hItem,BUTTON_SKIN_FLEX);

  		  hItem = WM_GetDialogItem(pMsg->hWin, ID_BUTTON_1);
  		  BUTTON_SetSkin(hItem,BUTTON_SKIN_FLEX);
			//
			// Initialization of 'Edit'
			//
			hItem = WM_GetDialogItem(pMsg->hWin, ID_EDIT_0);
			EDIT_SetText(hItem, "blabalbalablablaba");
			//
			// Initialization of 'Listwheel'
			//

			hItem = WM_GetDialogItem(pMsg->hWin, ID_LISTWHEEL_0);
			LISTWHEEL_SetLBorder(hItem,10);
			LISTWHEEL_SetFont(hItem,GUI_FONT_COMIC24B_ASCII);
			LISTWHEEL_AddString(hItem, "jeden");
			LISTWHEEL_AddString(hItem, "dwa");
			LISTWHEEL_AddString(hItem, "trzy");
			LISTWHEEL_AddString(hItem, "cztery");
			LISTWHEEL_AddString(hItem, "piec");
			LISTWHEEL_AddString(hItem, "szesc");
			LISTWHEEL_AddString(hItem, "siedem");
			//
			// Initialization of 'Checkbox'
			//
			hItem = WM_GetDialogItem(pMsg->hWin, ID_CHECKBOX_0);
			CHECKBOX_SetText(hItem, "Check");
			//
			// Initialization of 'Checkbox'
			//
			hItem = WM_GetDialogItem(pMsg->hWin, ID_CHECKBOX_1);
			CHECKBOX_SetText(hItem, "Check");
			// USER START (Optionally insert additional code for further widget initialization)
			// USER END
			 hItem=WM_GetDialogItem(pMsg->hWin,ID_PROGBAR_0);
		     PROGBAR_SetMinMax(hItem,0,15);
		     PROGBAR_SetSkin(hItem,PROGBAR_SKIN_FLEX);

    	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
		  WM_DeleteWindow(hBox);
		  hBox = MESSAGEBOX_Create("Keyboard not supported yet!","ERROR", GUI_MESSAGEBOX_CF_MOVEABLE);
        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:
		  {

			  CreateMojeokno2();
			  hItem=WM_GetDialogItem(pMsg->hWin,ID_PROGBAR_0);
			  PROGBAR_SetValue(hItem,il++);
			break;
		  }

      }
      break;
    case ID_BUTTON_1: // Notifications sent by 'Button'
      switch(NCode)
      {
		  case WM_NOTIFICATION_CLICKED:
		  {

			break;
		  }
		  case WM_NOTIFICATION_RELEASED:
		  {

			  CreateGraph();
//			  WM_DeleteWindow(hBox);
//			  hBox = MESSAGEBOX_Create("Release the BUTTON !","ERROR", GUI_MESSAGEBOX_CF_MOVEABLE);
//			  WM_DeleteWindow(hBox);
			break;

		  }
      }
      break;
    case ID_LISTWHEEL_0: // Notifications sent by 'Listwheel'
      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_SEL_CHANGED:
        // USER START (Optionally insert code for reacting on notification message)
        // USER END
        break;
      // USER START (Optionally insert additional code for further notification handling)
      // USER END
      }
      break;
    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;
    // 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_KEY_INFO * pKeyInfo;
  WM_HWIN       hItem;
  WM_HWIN       hDlg;
  int           NCode;
  int           Id;
  int           i;

  hDlg = pMsg->hWin;
  switch (pMsg->MsgId) {
  case WM_PAINT:
    _OnPaint();
    return;
  case WM_INIT_DIALOG:
    //
    // Init SLIDER and EDIT widgets
    //
    for (i = 0; i < 3; i++) {
      hItem = WM_GetDialogItem(hDlg, GUI_ID_SLIDER0 + i);
      SLIDER_SetRange(hItem, 0, 255);
      SLIDER_SetValue(hItem, _aColorSep[i]);
      hItem = WM_GetDialogItem(hDlg, GUI_ID_EDIT0 + i);
      EDIT_SetDecMode(hItem, _aColorSep[i],   0, 255, 0, 0);
    }
    //
    // Init CHECKBOX
    //
    hItem = WM_GetDialogItem(hDlg, GUI_ID_CHECK0);
    CHECKBOX_SetText(hItem, "Auto");
    CHECKBOX_SetState(hItem, _Auto);
    break;
  case WM_KEY:
    pKeyInfo = (WM_KEY_INFO *)(pMsg->Data.p);
    switch (pKeyInfo->Key) {
    case GUI_KEY_ESCAPE:
      break;
    case GUI_KEY_ENTER:
      GUI_EndDialog(hDlg, 0);
      break;
    }
    break;
  case WM_NOTIFY_PARENT:
    Id    = WM_GetId(pMsg->hWinSrc);
    NCode = pMsg->Data.v;
    switch (NCode) {
    case WM_NOTIFICATION_RELEASED:
      if (Id == GUI_ID_OK) {
        GUI_EndDialog(hDlg, 0);
      }
      if (Id == GUI_ID_CANCEL) {
        GUI_EndDialog(hDlg, 1);
      }
      break;
    case WM_NOTIFICATION_VALUE_CHANGED:
      switch (Id) {
      case GUI_ID_CHECK0:
        hItem = WM_GetDialogItem(hDlg, Id);
        _Auto = CHECKBOX_GetState(hItem);
        break;
      default:
        _OnValueChanged(hDlg, Id);
        break;
      }
      break;
    }
    break;
  default:
    WM_DefaultProc(pMsg);
  }
}
Ejemplo n.º 10
0
static void _cbDialog_VNC_SETTINGS(WM_MESSAGE * pMsg) {
  WM_HWIN hItem;
  int Id, NCode;
  
  switch (pMsg->MsgId) {
  case WM_INIT_DIALOG: 
    
    /* Restore VNC settings */
    _VNCServer_RestoreSettings(); 

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

  switch (pMsg->MsgId) {
  case WM_INIT_DIALOG:
    //
    // Initialization of 'Framewin'
    //
    hItem = pMsg->hWin;
    FRAMEWIN_SetTitleHeight(hItem, 20);
    FRAMEWIN_SetText(hItem, "Framewin");
    FRAMEWIN_SetFont(hItem, GUI_FONT_13B_ASCII);
    FRAMEWIN_SetTextAlign(hItem, GUI_TA_HCENTER | GUI_TA_VCENTER);
    FRAMEWIN_SetTextColor(hItem, 0x00FF0000);
    //
    // Initialization of 'Edit'
    //
    hItem = WM_GetDialogItem(pMsg->hWin, ID_EDIT_0);
    EDIT_SetText(hItem, "123");
    //
    // Initialization of 'Button'
    //
    hItem = WM_GetDialogItem(pMsg->hWin, ID_BUTTON_0);
    BUTTON_SetText(hItem, "Browse");
    //
    // Initialization of 'Button'
    //
    hItem = WM_GetDialogItem(pMsg->hWin, ID_BUTTON_1);
    BUTTON_SetText(hItem, "Start");
    //
    // Initialization of 'Checkbox'
    //
    hItem = WM_GetDialogItem(pMsg->hWin, ID_CHECKBOX_0);
    CHECKBOX_SetText(hItem, "Check-1");
    //
    // Initialization of 'Checkbox'
    //
    hItem = WM_GetDialogItem(pMsg->hWin, ID_CHECKBOX_1);
    CHECKBOX_SetText(hItem, "Check-2");
    // USER START (Optionally insert additional code for further widget initialization)
    // USER END
    break;
  case WM_NOTIFY_PARENT:
    Id    = WM_GetId(pMsg->hWinSrc);
    NCode = pMsg->Data.v;
    switch(Id) {
    case ID_EDIT_0: // Notifications sent by 'Edit'
      switch(NCode) {
      case WM_NOTIFICATION_CLICKED:
        // USER START (Optionally insert code for reacting on notification message)
        // USER END
        break;
      case WM_NOTIFICATION_RELEASED:
        // USER START (Optionally insert code for reacting on notification message)
        // USER END
        break;
      case WM_NOTIFICATION_VALUE_CHANGED:
        // USER START (Optionally insert code for reacting on notification message)
        // USER END
        break;
      // USER START (Optionally insert additional code for further notification handling)
      // USER END
      }
      break;
    case ID_BUTTON_0: // Notifications sent by 'Button'
      switch(NCode) {
      case WM_NOTIFICATION_CLICKED:
        // USER START (Optionally insert code for reacting on notification message)
        // USER END
        break;
      case WM_NOTIFICATION_RELEASED:
        // USER START (Optionally insert code for reacting on notification message)
        // USER END
        break;
      // USER START (Optionally insert additional code for further notification handling)
      // USER END
      }
      break;
    case ID_BUTTON_1: // Notifications sent by 'Button'
      switch(NCode) {
      case WM_NOTIFICATION_CLICKED:
        // USER START (Optionally insert code for reacting on notification message)
        // USER END
        break;
      case WM_NOTIFICATION_RELEASED:
        // USER START (Optionally insert code for reacting on notification message)
        // USER END
        break;
      // USER START (Optionally insert additional code for further notification handling)
      // USER END
      }
      break;
    case ID_CHECKBOX_0: // Notifications sent by 'Checkbox'
      switch(NCode) {
      case WM_NOTIFICATION_CLICKED:
        // USER START (Optionally insert code for reacting on notification message)
        // USER END
        break;
      case WM_NOTIFICATION_RELEASED:
        // USER START (Optionally insert code for reacting on notification message)
        // USER END
        break;
      case WM_NOTIFICATION_VALUE_CHANGED:
        // USER START (Optionally insert code for reacting on notification message)
        // USER END
        break;
      // USER START (Optionally insert additional code for further notification handling)
      // USER END
      }
      break;
    case ID_CHECKBOX_1: // Notifications sent by 'Checkbox'
      switch(NCode) {
      case WM_NOTIFICATION_CLICKED:
        // USER START (Optionally insert code for reacting on notification message)
        // USER END
        break;
      case WM_NOTIFICATION_RELEASED:
        // USER START (Optionally insert code for reacting on notification message)
        // USER END
        break;
      case WM_NOTIFICATION_VALUE_CHANGED:
        // USER START (Optionally insert code for reacting on notification message)
        // USER END
        break;
      // USER START (Optionally insert additional code for further notification handling)
      // USER END
      }
      break;
    case ID_SLIDER_0: // Notifications sent by 'Slider'
      switch(NCode) {
      case WM_NOTIFICATION_CLICKED:
        // USER START (Optionally insert code for reacting on notification message)
        // USER END
        break;
      case WM_NOTIFICATION_RELEASED:
        // USER START (Optionally insert code for reacting on notification message)
        // USER END
        break;
      case WM_NOTIFICATION_VALUE_CHANGED:
        // USER START (Optionally insert code for reacting on notification message)
        // USER END
        break;
      // USER START (Optionally insert additional code for further notification handling)
      // USER END
      }
      break;
    // USER START (Optionally insert additional code for further Ids)
    // USER END
    }
    break;
  // USER START (Optionally insert additional message handling)
  // USER END
  default:
    WM_DefaultProc(pMsg);
    break;
  }
}
Ejemplo n.º 12
0
void InitDialog_Lim(WM_MESSAGE * pMsg)
{
	int i,j;
	char buf[8];
	GUI_ConstString _ListBox[] = {"1", "0", "0","E", "", "","R"};
    WM_HWIN hWin = pMsg->hWin,hGraph = 0;
	WM_HWIN hDlg, hItem;
	hDlg = pMsg->hWin;
    //
    //FRAMEWIN
    //
    //FRAMEWIN_AddCloseButton(hWin, FRAMEWIN_BUTTON_RIGHT, 0);
    //FRAMEWIN_AddMaxButton(hWin, FRAMEWIN_BUTTON_RIGHT, 1);
    //FRAMEWIN_AddMinButton(hWin, FRAMEWIN_BUTTON_RIGHT, 2);
    //
    //GUI_ID_BUTTON_PARM_SET
    //
    BUTTON_SetFont(WM_GetDialogItem(hWin,GUI_ID_BUTTON_PARM_SET),&GUI_FontHZ_SongTi_16);
    //
    //GUI_ID_BUTTON_PRINT
    //
    BUTTON_SetFont(WM_GetDialogItem(hWin,GUI_ID_BUTTON_PRINT),&GUI_FontHZ_SongTi_16);
    //
    //GUI_ID_BUTTON_SAVE
    //
    BUTTON_SetFont(WM_GetDialogItem(hWin,GUI_ID_BUTTON_SAVE),&GUI_FontHZ_SongTi_16);
    //
    //GUI_ID_BUTTON_HOME
    //
    BUTTON_SetFont(WM_GetDialogItem(hWin,GUI_ID_BUTTON_HOME),&GUI_FontHZ_SongTi_16);
    //
    //GUI_ID_BUTTON_CR
    //
    BUTTON_SetFont(WM_GetDialogItem(hWin,GUI_ID_BUTTON_CR),&GUI_FontHZ_SongTi_16);
    //
    //GUI_ID_BUTTON_STOP
    //
    BUTTON_SetFont(WM_GetDialogItem(hWin,GUI_ID_BUTTON_STOP),&GUI_FontHZ_SongTi_16);
    //
    //GUI_ID_PROGBAR0
    //
    PROGBAR_SetValue(WM_GetDialogItem(hWin,GUI_ID_PROGBAR0),50);
    //
    //GUI_ID_LISTVIEW_RESULT
    //
    //LISTBOX_SetBkColor(WM_GetDialogItem(hWin,GUI_ID_LISTVIEW_RESULT),0,0xffffff);
    LISTVIEW_SetFont(WM_GetDialogItem(hWin,GUI_ID_LISTVIEW_RESULT),&GUI_FontHZ_SongTi_16);
    LISTVIEW_SetAutoScrollH(WM_GetDialogItem(hWin,GUI_ID_LISTVIEW_RESULT),1);
    LISTVIEW_SetAutoScrollV(WM_GetDialogItem(hWin,GUI_ID_LISTVIEW_RESULT),1);
    LISTVIEW_AddColumn(WM_GetDialogItem(hWin,GUI_ID_LISTVIEW_RESULT),30,"order",GUI_TA_VCENTER|GUI_TA_LEFT);
    LISTVIEW_AddColumn(WM_GetDialogItem(hWin,GUI_ID_LISTVIEW_RESULT),70,"V1",GUI_TA_VCENTER|GUI_TA_LEFT);
    LISTVIEW_AddColumn(WM_GetDialogItem(hWin,GUI_ID_LISTVIEW_RESULT),70,"V2",GUI_TA_VCENTER|GUI_TA_LEFT);
	LISTVIEW_AddColumn(WM_GetDialogItem(hWin,GUI_ID_LISTVIEW_RESULT),65,"Res",GUI_TA_VCENTER|GUI_TA_LEFT);
    LISTVIEW_AddColumn(WM_GetDialogItem(hWin,GUI_ID_LISTVIEW_RESULT),60,"State",GUI_TA_VCENTER|GUI_TA_LEFT);
	LISTVIEW_AddColumn(WM_GetDialogItem(hWin,GUI_ID_LISTVIEW_RESULT),70,"Time",GUI_TA_VCENTER|GUI_TA_LEFT);
	LISTVIEW_AddColumn(WM_GetDialogItem(hWin,GUI_ID_LISTVIEW_RESULT),50,"Dir",GUI_TA_VCENTER|GUI_TA_LEFT);

    //LISTVIEW_AddRow(WM_GetDialogItem(hWin,GUI_ID_LISTVIEW_RESULT),_lvTable_100);
    //
    //GUI_ID_BUTTON_START
    //
    BUTTON_SetFont(WM_GetDialogItem(hWin,GUI_ID_BUTTON_START),&GUI_FontHZ_SongTi_16);
    //
    //GUI_ID_CHECKBOX_MULT
    //
    CHECKBOX_SetText(WM_GetDialogItem(hWin,GUI_ID_CHECKBOX_MULT),"多曲线显示");
    CHECKBOX_SetFont(WM_GetDialogItem(hWin,GUI_ID_CHECKBOX_MULT),&GUI_FontHZ_SongTi_16);
    //
    //GUI_ID_BUTTON_DATA
    //
    BUTTON_SetFont(WM_GetDialogItem(hWin,GUI_ID_BUTTON_DATA),&GUI_FontHZ_SongTi_16);
    //
    //GUI_ID_BUTTON_DELET
    //
    BUTTON_SetFont(WM_GetDialogItem(hWin,GUI_ID_BUTTON_DELET),&GUI_FontHZ_SongTi_16);




	for(i=0;i< tget_record.act_record_lenth;i++)
	{
	_ListBox[0] = tget_record.sig_record[i].order;
	_ListBox[1] = tget_record.sig_record[i].V1;
	_ListBox[2] = tget_record.sig_record[i].V2;
	_ListBox[3] = tget_record.sig_record[i].result_r_e;
	_ListBox[4] = tget_record.sig_record[i].state;
	_ListBox[5] = tget_record.sig_record[i].time;
	_ListBox[6] = tget_record.sig_record[i].dir;

	LISTVIEW_AddRow(WM_GetDialogItem(hWin,GUI_ID_LISTVIEW_RESULT),_ListBox);
		
	}

	for(i=0;i<TEST_TIMES;i++)
	{
	exist[i] = 0;
	}


	
	#if 0
	hItem = WM_GetDialogItem(hDlg, GUI_ID_GRAPH0);
	/* Add graphs */
    for (i = 0; i < GUI_COUNTOF(_aColor); i++) {
      _aValue[i] = rand() % 180;
      _ahData[i] = GRAPH_DATA_YT_Create(_aColor[i], 500, 0, 0);
      GRAPH_AttachData(hItem, _ahData[i]);
    }
	 /* Set graph attributes */
    GRAPH_SetGridDistY(hItem, 2);
    GRAPH_SetGridVis(hItem, 1);
    GRAPH_SetGridFixedX(hItem, 1);
    GRAPH_SetUserDraw(hItem, _UserDraw);
    /* Create and add vertical scale */
    _hScaleV = GRAPH_SCALE_Create( 5, GUI_TA_RIGHT, GRAPH_SCALE_CF_VERTICAL, 5);
    GRAPH_SCALE_SetTextColor(_hScaleV, GUI_YELLOW);
    GRAPH_AttachScale(hItem, _hScaleV);
    /* Create and add horizontal scale */
    _hScaleH = GRAPH_SCALE_Create(15, GUI_TA_HCENTER, GRAPH_SCALE_CF_HORIZONTAL, 5);
    GRAPH_SCALE_SetTextColor(_hScaleH, GUI_DARKGREEN);
    GRAPH_AttachScale(hItem, _hScaleH);
	#endif 
}
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
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]);
}