Ejemplo n.º 1
0
void ProcSelectChanged() {
    int currentSelected = ICONVIEW_GetSel(hIconView);
    if (currentSelected == 0) {
        WM_BringToTop(hWinIn);
        WM_Paint(hWinIn);
        /*xTaskCreate(scanClothesChanged, "clothes", 300, NULL, 1, NULL);*/
    } else {
        WM_BringToTop(hWinOut);
        WM_Paint(hWinOut);
    }
}
Ejemplo n.º 2
0
/*******************************************************************
*
*       _DemoBringToTop

  Demonstrates the use of WM_BringToTop
*/
static void _DemoBringToTop(void) {
  _ChangeInfoText("WM_BringToTop()");
//  GUIDEMO_Delay(SPEED);
  WM_BringToTop(_hWindow1);    
  GUIDEMO_Delay(SPEED);
  GUIDEMO_NotifyStartNext();
}
Ejemplo n.º 3
0
/**监控列表 LISTVIEW 的监听器(回调函数)
*
*/
static void myListViewListener(WM_MESSAGE* pMsg)
{
	 const WM_KEY_INFO * pInfo;
	 WM_HWIN thisListView  = pMsg->hWin; 
   
	switch(pMsg->MsgId)
	{
//		case WM_PAINT:
//			
//		GUI_SetColor(GUI_BLACK);
//		GUI_SetFont(&GUI_Font24_1);
//		GUI_DispStringAt("egg",330,160);
//		GUI_DispStringAt("eggg",400,450);
//			LISTVIEW_Callback(pMsg);
//	  	break;
		case WM_SET_FOCUS:

      if(LISTVIEW_GetNumRows(pMsg->hWin) && (LISTVIEW_GetSel(pMsg->hWin)<0))
         LISTVIEW_SetSel(pMsg->hWin, 0);
      LISTVIEW_Callback(pMsg);
      break;
		case WM_KEY:
			pInfo  = (WM_KEY_INFO*)pMsg->Data.p;
		
		  switch(pInfo->Key)
			{
				case GUI_KEY_UP:
				case GUI_KEY_DOWN:
					LISTVIEW_Callback(pMsg);	
   				showSelectedBoatInfo(thisListView);			
					break;
				
				case GUI_KEY_LEFT:				
					WM_SetFocus(menuWin);
					break;
				case GUI_KEY_MENU:
//         WM_BringToBottom(thisListView);
					WM_BringToTop(hDlg_FishMap);
				  WM_SetFocus(hDlg_FishMap);
					break;
				default:
					LISTVIEW_Callback(pMsg);
					break;
			}
			break;
		
		default:
			LISTVIEW_Callback(pMsg);
			break;
	}
}
Ejemplo n.º 4
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);
  
}
Ejemplo n.º 5
0
static void sldListener(WM_MESSAGE * pMsg)
{
   const WM_KEY_INFO * pInfo;
   WM_MESSAGE myMsg;
   
   
   switch(pMsg->MsgId)
   {
      case WM_KEY:
           pInfo  = (WM_KEY_INFO*)(pMsg->Data.p);
           switch(pInfo->Key)
           {
              case GUI_KEY_PWM_INC:       
                   WM_SendMessageNoPara(subWins[3], USER_MSG_DIM);
                   break;
              case GUI_KEY_BACKSPACE:
                   if(Mem_isEqual(&SysConf, &agentConf, sizeof(SysConf)) )
                   {
                      WM_SetFocus(Slideres[0]);
                      WM_SetFocus(menuWin);                      
                   }
                   else
                   {
                      myMsg.hWin  = WM_GetClientWindow(confirmWin);
                      myMsg.hWinSrc  = subWins[3];
                      myMsg.MsgId  = USER_MSG_CHOOSE;
                      myMsg.Data.v  = SYS_SETTING;
                      WM_SendMessage(myMsg.hWin, &myMsg);
                      
                      WM_BringToTop(confirmWin);
                      WM_SetFocus(WM_GetDialogItem (confirmWin,GUI_ID_BUTTON0));                    
                   }
                   break;
                                 
              default:
                   HSD_SLIDER_Callback(pMsg);
                   break;
           }
           break;
           
      default:
           HSD_SLIDER_Callback(pMsg);
           break;
   }
}
Ejemplo n.º 6
0
/*****************************************************************************
 * FUNCTION - ShowErrorMessage_C
 * DESCRIPTION: Displays an error message. 
 * Further actions (Rebooting or ignoring errors when not debugging) depend 
 * on the caller (or the caller of the caller...).
 *
 * Called by embOS\D3018X\OS_Error and Factory::FatalErrorOccured()
 *  
 ****************************************************************************/
extern "C" void ShowErrorMessage_C(const char* errorDescription = "-")
{
  int i;
  char sz_msg[250];
  WM_HWIN win;
  WM_HWIN win_next;
  GUI_RECT  rect;

  WM_SelectWindow(WM_GetDesktopWindow());
  win = WM_GetFirstChild(WM_GetDesktopWindow());

  while(win != (WM_HWIN) NULL)
  {
    win_next = WM_GetNextSibling(win);
    WM_DeleteWindow(win);
    win = win_next;
  }

  WM_SetStayOnTop(WM_GetDesktopWindow(),1);
  WM_BringToTop(WM_GetDesktopWindow());
  GUI_SetBkColor(GUI_WHITE);
  GUI_SetColor(GUI_BLACK);
  GUI_SetFont(&Helvetica_57_13);
  GUI_Clear();

  sprintf(sz_msg, "Fatal error.\n\n %s", errorDescription);

  rect.x0 = 0;
  rect.y0 = 10;
  rect.x1 = 239;
  rect.y1 = 319;

  for (i=0; i<5; i++)
  {
    GUI_Clear();
    GUI_Delay(100);
    GUI_DispStringInRect(sz_msg,&rect,GUI_TA_VCENTER|GUI_TA_HCENTER);
    GUI_Delay(500);
  }
}
Ejemplo n.º 7
0
/*********************************************************************
*
*       _OnTouch
*/
static int _OnTouch(FRAMEWIN_Handle hWin, WM_MESSAGE* pMsg) {
  if (pMsg->Data.p) {  /* Something happened in our area (pressed or released) */
    GUI_PID_STATE* pState;
    pState = (GUI_PID_STATE*)pMsg->Data.p;
    if (pState->Pressed) {
      int x, y;
      x = pState->x;
      y = pState->y;
      if (WM_HasCaptured(hWin) == 0) {
        GUI_RECT Rect;
        int Mode = 0;
        int BorderSize = 4;
        WM_GetClientRectEx(hWin, &Rect);
        if (x > (Rect.x1 - BorderSize)) {
          Mode |= RESIZE_X;
        } else if (x < BorderSize) {
          Mode |= RESIZE_X | REPOS_X;
        }
        if (y > (Rect.y1 - BorderSize)) {
          Mode |= RESIZE_Y;
        } else if (y < BorderSize) {
          Mode |= RESIZE_Y | REPOS_Y;
        }
        if (Mode) {
          WM_SetFocus(hWin);
          WM_BringToTop(hWin);
          _SetCapture(hWin, x, y, Mode);
          return 1;
        }
      } else if (_HasCaptured) {
        _ChangeWindowPosSize(hWin, &x, &y);
        _SetCapture(hWin, x, y, 0);
        return 1;
      }
    }
  }
  _HasCaptured = 0;
  return 0;
}
Ejemplo n.º 8
0
static void _OnTouch(FRAMEWIN_Handle hWin, FRAMEWIN_Obj* pObj, WM_MESSAGE* pMsg) {
  GUI_TOUCH_tState* pState;
  pState = (GUI_TOUCH_tState*)pMsg->Data.p;
  if (pMsg->Data.p) {  /* Something happened in our area (pressed or released) */
    if (pState->Pressed) {
      WM_SetFocus(hWin);
      WM_BringToTop(hWin);
      if (pObj->Flags & FRAMEWIN_SF_MOVEABLE) {
        if (!WM_HasCaptured(hWin)) {
          WM_SetCapture(hWin, 1);
          pObj->CapturePoint.x = pState->x;
          pObj->CapturePoint.y = pState->y;
        } else {
          int dx, dy;
          dx = pState->x - pObj->CapturePoint.x;
          dy = pState->y - pObj->CapturePoint.y;
          WM_MoveWindow(hWin, dx, dy);
        }
      }
    }
  }
}
Ejemplo n.º 9
0
    /*****************************************************************************
    * Function
    * DESCRIPTION:
    * Redraws this element. If it fails (for some reason) the
    * method returns false.
    *****************************************************************************/
    bool MenuBar::Redraw()
    {
      bool valid = mValid;
      if(IsVisible())
      {
        WM_BringToTop(GetWMHandle());
        const U16 child_count = Group::GetChildCount();
        const float child_width = GetWidth() / (float)child_count;
        const U16 child_height = GetHeight();

        float x = 0;

        MenuTab*  pChild = (MenuTab*)Group::GetFirstChild();
        while(pChild)
        {
/*          if(pChild->IsActive())
          {
            pChild->SetClientArea( Area( x, 1, x + child_width, child_height) );
          }
          else*/
          {
            pChild->SetClientArea( x, 0, x + child_width, child_height);
          }
          pChild->SetVisible();
          x += child_width;
          if( !valid )
          {
            pChild->Invalidate();
          }
          pChild = (MenuTab*)Group::GetNextChild(pChild);
        }
        Group::Redraw();
        return true;
      }
      Group::Redraw();
      
      return false;
    }
/*********************************************************************
*
*       _OnTouch
*/
static int _OnTouch(FRAMEWIN_Handle hWin, WM_MESSAGE* pMsg) {
    const GUI_PID_STATE* pState = (const GUI_PID_STATE*)pMsg->Data.p;
    if (pState) {  /* Something happened in our area (pressed or released) */
        int x, y, Mode;
        x    = pState->x;
        y    = pState->y;
        Mode = _CheckReactBorder(hWin, x, y);
        if (pState->Pressed == 1) {
            if (_CaptureFlags & FRAMEWIN_RESIZE) {
                _ChangeWindowPosSize(hWin, &x, &y);
                _SetCapture(hWin, x, y, 0);
                return 1;
            } else if (Mode) {
                WM_SetFocus(hWin);
                WM_BringToTop(hWin);
                _SetCapture(hWin, x, y, Mode);
                return 1;
            }
#if (GUI_SUPPORT_MOUSE & GUI_SUPPORT_CURSOR)
            else if (_CaptureFlags) {
                WM_ReleaseCapture();
                return 1;
            }
#endif
        } else if (WM_HasCaptured(hWin)) {
            _CaptureFlags &= ~(FRAMEWIN_RESIZE);
#if (GUI_SUPPORT_MOUSE & GUI_SUPPORT_CURSOR)
            if (!Mode)
#endif
            {
                WM_ReleaseCapture();
            }
            return 1;
        }
    }
    return 0;
}
Ejemplo n.º 11
0
/*******************************************************************
*
*       _DemoBringToTop

  Demonstrates the use of WM_BringToTop
*/
static void _DemoBringToTop(void) {
  _ChangeInfoText("WM_BringToTop()");
  GUI_Delay(SPEED);
  WM_BringToTop(_hWindow1);    
  GUI_Delay(SPEED);
}
Ejemplo n.º 12
0
/**监控设置 LISTVIEW 的监听器(回调函数)
*
*/
static void myListViewListener(WM_MESSAGE* pMsg)
{
	 const WM_KEY_INFO * pInfo;
	 WM_HWIN thisListView  = pMsg->hWin; 
	
	 int selectedRow  = -1;
  int index  = -1;
	
	switch(pMsg->MsgId)
	{
		case WM_SET_FOCUS:

      if(LISTVIEW_GetNumRows(pMsg->hWin) && (LISTVIEW_GetSel(pMsg->hWin)<0))
         LISTVIEW_SetSel(pMsg->hWin, 0);
      updateListViewContent(thisListView);
      LISTVIEW_Callback(pMsg);
      break;		
    case WM_KEY:
			pInfo  = (WM_KEY_INFO*)pMsg->Data.p;
		
		  switch(pInfo->Key)
			{
				case GUI_KEY_UP:
				case GUI_KEY_DOWN:
					LISTVIEW_Callback(pMsg);
				  //showSelectedBoatInfo(thisListView);
					break;
				
				case GUI_KEY_LEFT:				
					WM_SetFocus(menuWin);
					break;
				
				case GUI_KEY_RIGHT:
					WM_SetFocus(etWin);
					break;
				
				
				case GUI_KEY_ENTER:
//      selectedRow  = LISTVIEW_GetSel(thisListView);
//				 	index  = getSelectedBoatIndex(thisListView, 1, selectedRow);
      index  = LISTVIEW_GetSel(thisListView);
				  if(index >= 0)
      {
//         if( mntBoats[index].MNTState == MNTState_Default )
//         {
//            mntBoats[index].MNTState  = MNTState_None;
//            LISTVIEW_SetItemText(thisListView, 2, index, "x");
//         } 
//         else if(mntBoats[index].MNTState == MNTState_Monite)           
//         {
//            mntBoats[index].MNTState  = MNTState_Choosen;
//            LISTVIEW_SetItemText(thisListView, 2, index, "o");
//         }
//         switch(mntBoats[index].MNTState)
//         {
//            case MNTState_Choosen:
//                 mntBoats[index].MNTState  = MNTState_Monite;
//                 LISTVIEW_SetItemText(thisListView, 2, index, "x");
//                 break;
//            case MNTState_Default:  
//                 mntBoats[index].MNTState  = MNTState_None;
//                 LISTVIEW_SetItemText(thisListView, 2, index, "x");
//                 break;
//            case MNTState_Monite:
//                 mntBoats[index].MNTState  = MNTState_Choosen;
//                 LISTVIEW_SetItemText(thisListView, 2, index, "o");
//                 break;
//            case MNTState_None:
//                 mntBoats[index].MNTState  = MNTState_Default;
//                 LISTVIEW_SetItemText(thisListView, 2, index, "o");
//                 break;
//         }
       
      }
      
					break;
					
				case GUI_KEY_BACKSPACE:
INFO("case backspace");    
					WM_BringToTop(confirmWin);
				  WM_SetFocus(confirmWin);
          break;					
				
				case GUI_KEY_MENU:
					WM_BringToTop(hDlg_FishMap);
				  WM_SetFocus(hDlg_FishMap);
					break;
			
				default:
					LISTVIEW_Callback(pMsg);
					break;
			}
			break;
		
		default:
			LISTVIEW_Callback(pMsg);
			break;
	}
}
Ejemplo n.º 13
0
/**
  * @brief  Callback routine of desktop window.
  * @param  pMsg: pointer to data structure of type WM_MESSAGE
  * @retval None
  */
static void _cbBk(WM_MESSAGE * pMsg) {
  
  MENU_MSG_DATA* pData;
  uint32_t NCode, Id;
  static uint8_t sel = 0;
  
  switch (pMsg->MsgId) 
  {

  case WM_MENU:
    /* Process the menu message */
    pData = (MENU_MSG_DATA*)pMsg->Data.p;
    switch (pData->MsgType) 
    {
    case MENU_ON_ITEMSELECT:
      /* A menu item has been selected */
      switch (pData->ItemId) 
      {  
        
      case ID_MENU_LOG:
        if (hLog == 0)
        {
          hLog = GUI_CreateDialogBox(_aKernelLogDialogCreate, 
                                     GUI_COUNTOF(_aProcessManagerDialogCreate), 
                                     _cbKernelLogDialog, 
                                     pMsg->hWin, 
                                     FRAMEWIN_CF_MOVEABLE | WM_CF_FGND | WM_CF_STAYONTOP, 
                                     50);  
        }
        else
        {
          WM_ShowWindow(hLog);
          WM_BringToTop(hLog);
        }        
        break;
        
      case ID_MENU_PMGR:
        if(hProcess == 0)
        {
          hProcess = GUI_CreateDialogBox(_aProcessManagerDialogCreate, 
                                         GUI_COUNTOF(_aProcessManagerDialogCreate), 
                                         _cbProcessManagerDialog, 
                                         pMsg->hWin, 
                                         FRAMEWIN_CF_MOVEABLE | WM_CF_FGND | WM_CF_STAYONTOP, 
                                         50);  
        }
        else
        {
          WM_ShowWindow(hProcess);
          WM_BringToTop(hProcess);
        }
        break;
        
      case ID_MENU_PERF:
        if(hPerformance == 0)
        {
          hPerformance = GUI_CreateDialogBox(_aPerformanceDialogCreate, 
                                             GUI_COUNTOF(_aPerformanceDialogCreate), 
                                             _cbPerformanceDialog, 
                                             pMsg->hWin, 
                                             FRAMEWIN_CF_MOVEABLE | WM_CF_FGND | WM_CF_STAYONTOP, 
                                             50);
        }
        else
        {
          WM_ShowWindow(hPerformance);
          WM_BringToTop(hPerformance);
        }
        break;
        
      case ID_MENU_EXIT:
        break;
      }
    }
    break;
      
  case WM_PAINT:
    GUI_SetBkColor(GUI_TRANSPARENT);
    GUI_Clear();
    if(hIcon)
    {
      WM_BringToBottom(hIcon);
    }
    break;
    
  case WM_NOTIFY_PARENT:
    Id    = WM_GetId(pMsg->hWinSrc);     
    NCode = pMsg->Data.v;  
    
    switch (NCode) 
    {  
      
    case WM_NOTIFICATION_CHILD_DELETED:
      SpriteDisabled = 0;
      GUI_SPRITE_Show(_aSprite[0].hSprite);
      break;
      
    case WM_NOTIFICATION_CLICKED:   
      if (Id == ID_ICONVIEW_MENU)
      { 
        
        sel = ICONVIEW_GetSel(pMsg->hWinSrc);
        
        if(hPerformance != 0)
        {
          WM_HideWindow(hPerformance);
        } 
        
        if(sel < k_ModuleGetNumber())
        {    
          if(sel < 8)
          {
            ICONVIEW_SetSel(pMsg->hWinSrc, -1);
          }
          else
          {
            ICONVIEW_SetSel(pMsg->hWinSrc, k_ModuleGetNumber() + 1); 
          }
        }
      }    
      break;
      
    case WM_NOTIFICATION_RELEASED:
      if (Id == ID_ICONVIEW_MENU)
      {
        
        if(sel < k_ModuleGetNumber())
        { 
          SpriteDisabled = 1;
          GUI_SPRITE_Hide(_aSprite[0].hSprite);
          module_prop[sel].module->startup(pMsg->hWin, 0, 26);
          sel = 0;
        }
      }
      else if (Id == ID_BUTTON_BKGND)
      {
        /* Create popup menu after touching the display */
        _OpenPopup(WM_HBKWIN, _aMenuItems, GUI_COUNTOF(_aMenuItems),0 , 25);  
      }
      break;
    
    default:
      break;
    }
    break;
  default:
    WM_DefaultProc(pMsg);
  }
}
Ejemplo n.º 14
0
/**监控设置 LISTVIEW 的监听器(回调函数)
*
*/
static void myListViewListener(WM_MESSAGE* pMsg)
{
	 const WM_KEY_INFO * pInfo;
	 WM_HWIN thisListView  = pMsg->hWin; 
	 WM_MESSAGE myMsg;
  int i  = 0;
 
  MNT_BERTH * pIterator  = NULL;
 
	 int selectedRow  = -1;
  int index  = -1;
	
  switch(pMsg->MsgId)
  {
   case WM_SET_FOCUS:

        if(pMsg->Data.v)
        {
           if(LISTVIEW_GetNumRows(pMsg->hWin))
           {
              LISTVIEW_SetSel(pMsg->hWin, 0);
           } 
           if(pMntHeader)
           {
              myMsg.hWin  = WM_GetClientWindow(mntSettingWin);
              myMsg.MsgId = USER_MSG_LV_MOVE;
              myMsg.Data.p  = (void*)pMntHeader;           
              WM_SendMessage(myMsg.hWin, &myMsg);
           }
        }
        LISTVIEW_Callback(pMsg);
        break;

        
   case WM_KEY:
        pInfo  = (WM_KEY_INFO*)pMsg->Data.p;
   
      switch(pInfo->Key)
      {
       case GUI_KEY_PWM_INC:       
            WM_SendMessageNoPara(subWins[3], USER_MSG_DIM);
            break;
       case GUI_KEY_UP:
       case GUI_KEY_DOWN:
            LISTVIEW_Callback(pMsg); 
            selectedRow  = LISTVIEW_GetSel(thisListView);            
            pIterator  = pMntHeader;
            for(index=0; index < selectedRow; index++)
            {
               pIterator  = pIterator->pNext;
            }
            myMsg.hWin     = WM_GetClientWindow(mntSettingWin);
            myMsg.MsgId    = USER_MSG_LV_MOVE;
            myMsg.Data.p   = (void*)pIterator;           
            WM_SendMessage(myMsg.hWin, &myMsg);
            break;
       
       case GUI_KEY_RIGHT:
            if(pMntHeader)
            {
               selectedRow  = LISTVIEW_GetSel(thisListView);
               pIterator  = pMntHeader;
               for(index=0;  index < selectedRow; index++)
               {
                  pIterator  = pIterator->pNext;
               }
               
               if(pIterator)
               {
                  if(pIterator->chsState == MNTState_Monitored)
                  {
                     pIterator->chsState  = MNTState_Choosen;
                     LISTVIEW_SetItemText(thisListView, 2, selectedRow, "吖");
                  }
                  else if(pIterator->chsState == MNTState_None)
                  {
                     pIterator->chsState  = MNTState_Default;
                     LISTVIEW_SetItemText(thisListView, 2, selectedRow, "吖");
                  }     
               }
//               else
//               {
//                  INFO("Err!");            
//               }
               myMsg.hWin     = WM_GetClientWindow(mntSettingWin);
               myMsg.hWinSrc  = pMsg->hWin;
               myMsg.Data.p   = (void*)pIterator;           
               
               myMsg.MsgId    = USER_MSG_FOCUS;                
               WM_SendMessage(myMsg.hWin, &myMsg);                
            }
//            WM_SetFocus(mntSettingWin);
            break;
          
       case GUI_KEY_ENTER:
            selectedRow  = LISTVIEW_GetSel(thisListView);
            pIterator  = pMntHeader;
            
            for(index=0;index<selectedRow;index++)
            {
              pIterator  = pIterator->pNext;
            }
            
            switch(pIterator->chsState)
            {
               case MNTState_Choosen:
                    pIterator->chsState  = MNTState_Monitored;
                    LISTVIEW_SetItemText(thisListView, 2, selectedRow, "啊");
                    break;
               case MNTState_Default:
                    pIterator->chsState  = MNTState_None;
                    LISTVIEW_SetItemText(thisListView, 2, selectedRow, "啊");
                    break;
               case MNTState_None:
                    pIterator->chsState  = MNTState_Default;
                    LISTVIEW_SetItemText(thisListView, 2, selectedRow, "吖");
                    break;
               default:
                    pIterator->chsState  = MNTState_Choosen;
                    LISTVIEW_SetItemText(thisListView, 2, selectedRow, "吖");
                    break;
            }      
            break;
        
       case GUI_KEY_BACKSPACE:  
            if(pMntHeader)
            {
               pIterator  = pMntHeader;
               while(pIterator)
               {
                  pIterator->chsState  = MNTState_Monitored;
                  
                  pIterator  = pIterator->pNext;
               }
               myMsg.hWin  = WM_GetClientWindow(menuWin);               
               myMsg.MsgId  = USER_MSG_DFULT_CNT;
               myMsg.Data.v  = 0;
               WM_SendMessage(myMsg.hWin, &myMsg);
            }             
            WM_SetFocus(menuWin);
            break;	
       
       case GUI_KEY_MENU:
            WM_BringToTop(mapWin);
            WM_SetFocus(mapWin);
            break;
          
       default:
            LISTVIEW_Callback(pMsg);
        break;
    }
    break;
   
   
   
   default:
    LISTVIEW_Callback(pMsg);
    break;
  }
}
Ejemplo n.º 15
0
//
//MenuCallback
//
static void MenuCall(WM_MESSAGE *pMsg)
{
	 WM_HWIN hWin = pMsg->hWin;
	 WM_KEY_INFO *KEY;
	 MENU_ITEM_DATA *pData;
	 int16_t PrintMenuID;
	 PrintMenuID = WM_GetId(hWin);
  switch (pMsg->MsgId)
	 {
			case USER_MSG_LANGUAGE:
				    pLanguage = &Lguprintwin[Language];
			     PrintSetItemText(hWin,PrintMenuID);
			     TEXT_SetText(PrintHintText,"");
				    break;

			case WM_KEY:
								KEY = (WM_KEY_INFO*)pMsg->Data.p;
								switch (KEY->Key)
								{
									
									  case GUI_KEY_MENU:
												    WM_BringToTop(Menuwin);
											     WM_SetFocus(WM_GetDialogItem(Menuwin,ID_MENU));
											     MENU_SetSel(WM_GetDialogItem(Menuwin,ID_MENU),0);
											     MenuSel = 0;
												    break;
											case GUI_KEY_PRINT:
												    WM_BringToTop(mainwin);
											     WM_SetFocus(mainwin);
											     break;
											
											case GUI_KEY_LEFT:
											case GUI_KEY_RIGHT:
												    if(PrintActiveId >= ID_Print_Site_SiteSet_Prt_0 && PrintActiveId <= ID_Print_Site_SiteSet_Prt_4) 
																{
																				PrintSiteindex = PrintActiveId - 2068;
																	   if (Language == 0)
																				{
																							if (PrintSiteSet[PrintSiteindex] == 0)
																							{
																											sprintf(pStrBuf,"%c""%s",PrintSiteindex+65,"不打印");
																											_SetMenuItem(pMsg->hWin,0,pStrBuf,PrintActiveId,0);
																											PrintSiteSet[PrintSiteindex] = 1;
																							}
																							else
																							{																					
																											sprintf(pStrBuf,"%c""%s",PrintSiteindex+65,"打印");
																											_SetMenuItem(pMsg->hWin,0,pStrBuf,PrintActiveId,0);
																											PrintSiteSet[PrintSiteindex] = 0;

																							}
																				}
																				else //english
																				{
																								if (PrintSiteSet[PrintSiteindex] == 0)
																							{
																											sprintf(pStrBuf,"%c"" ""%s",PrintSiteindex+65,"REJ");
																											_SetMenuItem(pMsg->hWin,0,pStrBuf,PrintActiveId,0);
																											PrintSiteSet[PrintSiteindex] = 1;
																							}
																							else
																							{																					
																											sprintf(pStrBuf,"%c"" ""%s",PrintSiteindex+65,"SEL");
																											_SetMenuItem(pMsg->hWin,0,pStrBuf,PrintActiveId,0);
																											PrintSiteSet[PrintSiteindex] = 0;

																							}																				  
																				}
																}
												    else if(PrintActiveId >= ID_Print_Info_InfoSet_Prt_0 && PrintActiveId <= ID_Print_Info_InfoSet_Prt_4)
																{
																				PrintInfoindex = PrintActiveId - 2073;
																	   if(Language == 0)
																				{
																							if (PrintInfoSet[PrintInfoindex] == 0)
																							{
																											INFO("INDEX = %d",PrintInfoindex);
																											sprintf(pStrBuf,"%c""%s",PrintInfoindex+65,"不打印");
																											_SetMenuItem(pMsg->hWin,0,pStrBuf,PrintActiveId,0);
																											PrintSiteSet[PrintInfoindex] = 1;
																							}
																							else
																							{																					
																											sprintf(pStrBuf,"%c""%s",PrintInfoindex+65,"打印");
																											_SetMenuItem(pMsg->hWin,0,pStrBuf,PrintActiveId,0);
																											PrintSiteSet[PrintInfoindex] = 0;

																							}
																				}
																				else  //english
																				{
																							if (PrintInfoSet[PrintInfoindex] == 0)
																							{
																											INFO("INDEX = %d",PrintInfoindex);
																											sprintf(pStrBuf,"%c"" ""%s",PrintInfoindex+65,"REJ");
																											_SetMenuItem(pMsg->hWin,0,pStrBuf,PrintActiveId,0);
																											PrintSiteSet[PrintInfoindex] = 1;
																							}
																							else
																							{																					
																											sprintf(pStrBuf,"%c"" ""%s",PrintInfoindex+65,"SEL");
																											_SetMenuItem(pMsg->hWin,0,pStrBuf,PrintActiveId,0);
																											PrintSiteSet[PrintInfoindex] = 0;

																							}																					
																				}
																}																
																break;
											case GUI_KEY_ESCAPE:
																PrintMenuThird = 0;
											     if (PrintActiveId >= ID_Print_All && PrintActiveId <= ID_Print_Info)
																	   break;
																
											case GUI_KEY_ENTER:
																PrintMenuThird = 0;
											default:
														MENU_Callback(pMsg);
														break;
								}
								break;
								
			case WM_POST_PAINT:
        if(PrintMenuID == ID_PrintMenu)
								{
									  GUI_SetColor(GUI_BLACK);
									  if (Language == 0)
											{
													GUI_DrawLine(193,0,193,197);
													GUI_DrawLine(0,197,193,197);
											}
											else  //english
											{
												 GUI_DrawLine(240,0,240,147);
													GUI_DrawLine(0,147,240,147);
											}
								}									
								break;
				default:
							 MENU_Callback(pMsg);
						 	break;
		}
}
Ejemplo n.º 16
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;
		}
		
}
Ejemplo n.º 17
0
//
//  PrintWinCallback
//
static void _cbDialog(WM_MESSAGE *pMsg)
{

		WM_KEY_INFO *KEY;
 	MENU_MSG_DATA * pData;
  switch (pMsg->MsgId)
	 {
			 case USER_MSG_LANGUAGE:
					    //pLanguage = &Lguprintwin[Language];
					    //TEXT_SetText(hPrintText,pLanguage->PrintTitle);
				     break;
			 case WM_PAINT:
									GUI_SetBkColor(GUI_WHITE);
									GUI_Clear();
									GUI_SetFont(&GUI_Font30);
									GUI_SetColor(GUI_BLACK);
				     //GUI_DispStringAt("打印选项",40,25);
				     if (Language == 0)
									{
										  GUI_DispStringAt("打印选项",40,25);
												GUI_DrawLine(0,59,193,59);
												GUI_DrawLine(193,20,193,59);
												GUI_DrawLine(0,20,193,20);
									}
									else  //ENGLISH
									{
										  GUI_DispStringAt("PRINT OPTIONS",30,25);
										  GUI_DrawLine(0,59,240,59);
												GUI_DrawLine(240,20,240,59);
												GUI_DrawLine(0,20,240,20);
									}
									break;
			
				case WM_MENU:
									pData = (MENU_MSG_DATA*)pMsg->Data.p;
									switch (pData->MsgType)
									{
							    case MENU_ON_ITEMSELECT:  // 选中
												    INFO("ISOK");
												    MENU_SetSel(hPrintMenu, 0);
											     PrintActiveId = ID_Print_All;
																switch (pData->ItemId)
																{
																	  case ID_Print_Fre_Int: 
																	  case ID_Print_Fre_Loc1:
																	  case ID_Print_Fre_Loc2:
																			case ID_Print_Fre_Chs : 
																			case ID_Print_Info_Prt:
																			case ID_Print_Site_Prt:
																			case ID_Print_All:
																			case ID_Print_Showing:
																				    pTooltip = &Lgutooltip[Language];
																				    StarPrint = 1;
																								//ptipText = "正在打印......";
																								WM_BringToTop(ToolTip);
																								WM_SetFocus(ToolTip);
																								WM_HideWindow(ToolTip_BUTTON[0]);
																								WM_HideWindow(ToolTip_BUTTON[1]);
																								WM_HideWindow(ToolTipText1);
																								TEXT_SetText(ToolTipText0,pTooltip->Text1[4]);
																			
																			     PrintTimer = WM_CreateTimer(ToolTip,0,2000,0);
																			
																								break;
																}
																break;
										
												case MENU_ON_ITEMACTIVATE:  //高亮
													    PrintActiveId = pData->ItemId;
												     _SetHintText(PrintHintText,PrintActiveId,1);  //设置提示信息
																	switch (pData->ItemId)    //用于修正第三级菜单的窗口位置	
																	{
																					case ID_Print_Site_SiteSet_Prt_0:
																						    if(Language == 0)
																										{
																													if (PrintMenuThird == 0)
																													{
																																WM_MoveWindow(hSiteSet,195,81);
																																PrintMenuThird = 1;
																													}
																										}
																										else  
																										{
																											  if (PrintMenuThird == 0)
																													{
																																WM_MoveWindow(hSiteSet,240,90);
																																PrintMenuThird = 1;
																													}
																										}
																										break;
																								
																					case ID_Print_Info_InfoSet_Prt_0:
																										if (Language == 0)
																										{
																													if(PrintMenuThird == 0)
																													{
																																WM_MoveWindow(hInfoSet,195,121);
																																PrintMenuThird = 1;
																													}
																										}
																										else
																										{
																											  if(PrintMenuThird == 0)
																													{
																																WM_MoveWindow(hInfoSet,240,121);
																																PrintMenuThird = 1;
																													}
																										}
																								  break; 
                     default:
												             WM_DefaultProc(pMsg);
												            break;																								
																	}
																	break;
									  default:
												     WM_DefaultProc(pMsg);
												     break;
									}
         break;
							
			default:		
						WM_DefaultProc(pMsg);
						break;
		}
		WM_DefaultProc(pMsg);
}
Ejemplo n.º 18
0
/*********************************************************************
*
*       WIDGET_HandleActive
*/
int WIDGET_HandleActive(WM_HWIN hObj, WM_MESSAGE* pMsg) {
  int Diff, Notification;
  WIDGET* pWidget = WIDGET_H2P(hObj);
  switch (pMsg->MsgId) {
  case WM_WIDGET_SET_EFFECT:
    Diff = pWidget->pEffect->EffectSize;
    pWidget->pEffect = (const WIDGET_EFFECT*)pMsg->Data.p;
    Diff -= pWidget->pEffect->EffectSize;
    _UpdateChildPostions(hObj, Diff);
    WM_InvalidateWindow(hObj);
    return 0;                        /* Message handled -> Return */
  case WM_GET_ID:
    pMsg->Data.v = pWidget->Id;
    return 0;                        /* Message handled -> Return */
  case WM_PID_STATE_CHANGED:
    if (pWidget->State & WIDGET_STATE_FOCUSSABLE) {
      const WM_PID_STATE_CHANGED_INFO * pInfo = (const WM_PID_STATE_CHANGED_INFO*)pMsg->Data.p;
      if (pInfo->State) {
        WM_SetFocus(hObj);
      }
    }
    break;
  case WM_TOUCH_CHILD:
    /* A descendent (child) has been touched or released.
       If it has been touched, we need to get to top.
     */
    {
      const WM_MESSAGE * pMsgOrg;
      const GUI_PID_STATE * pState;
      pMsgOrg = (const WM_MESSAGE*)pMsg->Data.p;      /* The original touch message */
      pState = (const GUI_PID_STATE*)pMsgOrg->Data.p;
      if (pState) {          /* Message may not have a valid pointer (moved out) ! */
        if (pState->Pressed) {
          WM_BringToTop(hObj);
          return 0;                    /* Message handled -> Return */
        }
      }
    }
    break;
  case WM_SET_ID:
    pWidget->Id = pMsg->Data.v;
    return 0;                        /* Message handled -> Return */
  case WM_SET_FOCUS:
    if (pMsg->Data.v == 1) {
      WIDGET_SetState(hObj, pWidget->State |  WIDGET_STATE_FOCUS);
      Notification = WM_NOTIFICATION_GOT_FOCUS;
    } else {
      WIDGET_SetState(hObj, pWidget->State & ~WIDGET_STATE_FOCUS);
      Notification = WM_NOTIFICATION_LOST_FOCUS;
    }
    WM_NotifyParent(hObj, Notification);
    pMsg->Data.v = 0;   /* Focus change accepted */
    return 0;
  case WM_GET_ACCEPT_FOCUS:
    pMsg->Data.v = (pWidget->State & WIDGET_STATE_FOCUSSABLE) ? 1 : 0;               /* Can handle focus */
    return 0;                         /* Message handled */
  case WM_GET_INSIDE_RECT:
    WIDGET__GetInsideRect(pWidget, (GUI_RECT*)pMsg->Data.p);
    return 0;                         /* Message handled */
  }
  return 1;                           /* Message NOT handled */
}
Ejemplo n.º 19
0
/*********************************************************************
*
*       _cbDialog
*/
static void _cbDialog(WM_MESSAGE * pMsg) {
  WM_HWIN hItem;
  int     NCode;
  int     Id;
  int     key_num;
  // USER START (Optionally insert additional variables)
  // USER END
  int i;
  switch (pMsg->MsgId) {
  case WM_INIT_DIALOG:
    //
    // Initialization of 'Edit'
    //
    GUI_UC_SetEncodeUTF8();

#if 1   
    hItem=WM_GetDialogItem(pMsg->hWin,ID_BUTTON_2);
    BUTTON_SetBkColor(hItem,0,GUI_GREEN);
    WIDGET_AndState(hItem,WIDGET_STATE_FOCUSSABLE);
#endif

    hItem=WM_GetDialogItem(pMsg->hWin,ID_BUTTON_3);
    BUTTON_SetBkColor(hItem,0,GUI_YELLOW);
    WIDGET_AndState(hItem,WIDGET_STATE_FOCUSSABLE);

    hItem=WM_GetDialogItem(pMsg->hWin,ID_BUTTON_4);
    BUTTON_SetBkColor(hItem,0,GUI_CYAN);
    WIDGET_AndState(hItem,WIDGET_STATE_FOCUSSABLE);


    hItem=WM_GetDialogItem(pMsg->hWin,ID_BUTTON_1);
    WIDGET_AndState(hItem,WIDGET_STATE_FOCUSSABLE);
    BUTTON_SetBkColor(hItem,0,GUI_CYAN);
    
    hItem=WM_GetDialogItem(pMsg->hWin,ID_BUTTON_0);
    BUTTON_SetBkColor(hItem,0,GUI_CYAN);
    WIDGET_AndState(hItem,WIDGET_STATE_FOCUSSABLE);
    
    hItem = WM_GetDialogItem(pMsg->hWin, ID_EDIT_0);
    WM_DisableWindow(hItem);
    EDIT_SetText(hItem, (const char *)GUI_hex2MeterAddrStr(g_sys_ctrl.recentMeterAddr, 6));

    for(i = 0;i < 5; i++)
    {
        hItem=WM_GetDialogItem(pMsg->hWin,(ID_EDIT_3+i));
        EDIT_SetText(hItem, "0");
        WIDGET_AndState(hItem,WIDGET_STATE_FOCUSSABLE);
        WM_DisableWindow(hItem);
    }
    
    PUB_InitFreq(pMsg,ID_EDIT_2);
    hItem = WM_GetDialogItem(pMsg->hWin,ID_EDIT_2);
    WM_DisableWindow(hItem);
    
    hItem = WM_GetDialogItem(pMsg->hWin, ID_EDIT_1);

    if(DL645_2007 == g_rom_para.protocol)
    {   
        //EDIT_SetText(hItem, pReadSel_07[g_sys_ctrl.data_item_index]);
        EDIT_SetText(hItem, pReadSel_07[0]);
        
        memcpy(g_gui_para.dataItem,
            &c_645dataItemDef[g_rom_para.protocol][0],
            4);
        
        g_gui_para.ctrlCode=0x11;
    }
    else if(DL645_1997 == g_rom_para.protocol)
    {
        //EDIT_SetText(hItem, pReadSel_97[g_sys_ctrl.data_item_index]);
        EDIT_SetText(hItem, pReadSel_97[0]);
        
        memcpy(g_gui_para.dataItem,
            &c_645dataItemDef[g_rom_para.protocol][0],
            2);
        g_gui_para.ctrlCode=0x01; 

    }
    
    WM_DisableWindow(hItem);

    hItem = WM_GetDialogItem(pMsg->hWin, ID_PROGBAR_0);
    PROGBAR_SetBarColor(hItem,0,GUI_GREEN);
   
    break;

  case WM_KEY:
    Id  = WM_GetId(pMsg->hWinSrc);
    if((((WM_KEY_INFO*)(pMsg->Data.p))->PressedCnt) == 1)
    {
        switch(((WM_KEY_INFO*)(pMsg->Data.p))->Key)
        {
            case GUI_KEY_YELLOW:
                WM_DeleteWindow(g_hWin_ReadMeter);
                g_hWin_ReadMeter=HBWIN_NULL;
                WM_BringToBottom(g_hWin_msg);
                WM_HideWindow(g_hWin_msg);
                WM_ShowWindow(g_hWin_TimeBar);
                WM_ShowWindow(g_hWin_Date);
                WM_SetFocus(g_hWin_menu);
                RMD_key_cnt = 0;
                g_gui_para.state = GUI_STATE_IDLE;
                break;

            case GUI_KEY_GREEN:
                g_hWin_MeterTime = CreateExtFnct();
                hItem = MTD_GetMeterAddr();
                WM_SetFocus(hItem);
                MTD_SetAddrBkColor(hItem);
                
                
                break;
                
            case GUI_KEY_F1: /*获取表号*/
                if(CHANNEL_RF != g_rom_para.channel)
                {
                    g_gui_para.ctrlCode = 0x13;
                    g_gui_para.cmd = GUI_CMD_BROAD_READ_ADDR;
                    g_gui_para.state = GUI_STATE_AMR;                        
                    OSMboxPost(g_sys_ctrl.up_mbox, (void*)&g_gui_para);
                }
                else 
                {
                    ERR_NOTE(g_hWin_ReadMeter,GUI_MSBOX_FUN_DISALE_ERROR);
                }
                break;
                
            case '#':
                WM_BringToTop(g_hWin_msg);
                WM_ShowWindow(g_hWin_msg);                    
                WM_SetFocus(g_hWin_msg);
                break;
                
            case GUI_KEY_F2:  /*抄表*/              
                if(DEV_OK == RMD_Get_Para(pMsg))//获取参数数据
                {
                    g_gui_para.state = GUI_STATE_AMR;
                    OSMboxPost(g_sys_ctrl.up_mbox, (void*)&g_gui_para);
                }
                break;

            case GUI_KEY_UP:
                RMD_SelEdt_Up(pMsg);
                //RMD_Color_Change();
                GUI_Color_Change(g_hWin_ReadMeter, ID_EDIT_0, 3);
                break;

            case GUI_KEY_DOWN:
                RMD_SelEdt_Down(pMsg);
                //RMD_Color_Change();
                GUI_Color_Change(g_hWin_ReadMeter, ID_EDIT_0, 3);
                break;
            case GUI_KEY_ENTER:
                switch(Id)
                {
                    case ID_EDIT_0:
                        g_sys_ctrl.selectWidget=EDIT_METER_NUM;
                        g_hWin_Input=Create_Edit_Set(g_hWin_ReadMeter);
                        WM_SetFocus(g_hWin_Input);
                        break;
                    case ID_EDIT_1:
                        g_sys_ctrl.selectWidget=LISTBOX_READ_SEL;
                        g_hWin_Input=Create_ListBox_Set(g_hWin_ReadMeter);
                        WM_SetFocus(g_hWin_Input);
                        break;
                        
                    case ID_EDIT_2:
                        //g_sys_ctrl.selectWidget=LISTBOX_SPEED;
                        //g_hWin_Input=Create_ListBox_Set(g_hWin_ReadMeter);
                        //WM_SetFocus(g_hWin_Input);
                        g_hWin_freq = CreateSpeed(g_hWin_ReadMeter);
                        //WM_SetFocus(g_hWin_freq);
                         break;
                 }
       }
    }
    break;
#if 0
    if((((WM_KEY_INFO*)(pMsg->Data.p))->PressedCnt)==1)//按键点击。
    {
        switch(Id)
        {
          case ID_EDIT_0:
            if(key_num==GUI_KEY_ENTER)
            {
              g_sys_ctrl.selectWidget=EDIT_METER_NUM;
              g_hWin_Input=Create_Edit_Set(g_hWin_ReadMeter);
              WM_SetFocus(g_hWin_Input);
            }
            break;
          case ID_EDIT_1:
            if(key_num==GUI_KEY_ENTER)
            {
              g_sys_ctrl.selectWidget=LISTBOX_READ_SEL;
              g_hWin_Input=Create_ListBox_Set(g_hWin_ReadMeter);
              WM_SetFocus(g_hWin_Input);
            }
            break;
            
          case ID_EDIT_2:
            if(key_num==GUI_KEY_ENTER)
            {
              //g_sys_ctrl.selectWidget=LISTBOX_SPEED;
              //g_hWin_Input=Create_ListBox_Set(g_hWin_ReadMeter);
              //WM_SetFocus(g_hWin_Input);
              g_hWin_freq = CreateSpeed(g_hWin_ReadMeter);
              //WM_SetFocus(g_hWin_freq);
            }
            break;
        }
    }

                
    switch(((WM_KEY_INFO *)(pMsg->Data.p))->Key)
    {
        case GUI_KEY_YELLOW:
            if((((WM_KEY_INFO*)(pMsg->Data.p))->PressedCnt)==1)
            {
                WM_DeleteWindow(g_hWin_ReadMeter);
                g_hWin_ReadMeter=HBWIN_NULL;
                WM_BringToBottom(g_hWin_msg);
                WM_HideWindow(g_hWin_msg);
                WM_ShowWindow(g_hWin_TimeBar);
                WM_ShowWindow(g_hWin_Date);
                WM_SetFocus(g_hWin_menu);
                RMD_key_cnt = 0;
                g_gui_para.state = GUI_STATE_IDLE;
            }
            break;
            
        case GUI_KEY_F1: /*获取表号*/
            if((((WM_KEY_INFO*)(pMsg->Data.p))->PressedCnt)==0)
            {
                if(CHANNEL_RF != g_rom_para.channel)
                {
                    g_gui_para.cmd = GUI_CMD_BROAD_READ_ADDR;
                    g_gui_para.state = GUI_STATE_AMR;                        
                    OSMboxPost(g_sys_ctrl.up_mbox, (void*)&g_gui_para);
                }
            }
            break;
            
        case '#':
            if((((WM_KEY_INFO*)(pMsg->Data.p))->PressedCnt)==0)
            {
                 WM_BringToTop(g_hWin_msg);
                 WM_ShowWindow(g_hWin_msg);                    
                 WM_SetFocus(g_hWin_msg);
            }
            break;
            
        case GUI_KEY_F2:  /*抄表*/              
            if((((WM_KEY_INFO*)(pMsg->Data.p))->PressedCnt)==0)
            {
                if(DEV_OK == RMD_Get_Para(pMsg))//获取参数数据
                {
                    g_gui_para.state = GUI_STATE_AMR;
                    OSMboxPost(g_sys_ctrl.up_mbox, (void*)&g_gui_para);
                }
            }
       
            break;

        case GUI_KEY_UP:
            if((((WM_KEY_INFO*)(pMsg->Data.p))->PressedCnt)==0)
            {
                RMD_SelEdt_Up(pMsg);
                //RMD_Color_Change();
            }
            break;

        case GUI_KEY_DOWN:
            if((((WM_KEY_INFO*)(pMsg->Data.p))->PressedCnt)==0)
            {
                RMD_SelEdt_Down(pMsg);
                //RMD_Color_Change();
                GUI_Color_Change(g_hWin_ReadMeter, ID_EDIT_0, 3);
            }
            break;
        case GUI_KEY_TAB:
            if((((WM_KEY_INFO*)(pMsg->Data.p))->PressedCnt)==0)
            {
                //RMD_Sel_Down(pMsg);
                RMD_Color_Change();
            }
            break;
#endif

  case WM_MSG_CLOSE:
    WM_DeleteWindow(g_hWin_ReadMeter);
	break;
    
  default:
    WM_DefaultProc(pMsg);
    break;
  }
}

/*********************************************************************
*
*       CreateReadMeter
*/
WM_HWIN CreateReadMeter(void);
WM_HWIN CreateReadMeter(void) {
  WM_HWIN hWin;

  hWin = GUI_CreateDialogBox(_aDialogCreate, GUI_COUNTOF(_aDialogCreate), _cbDialog, g_hWin_menu, 0, 0);
  return hWin;
}
Ejemplo n.º 20
0
//
// Buttoncallback;
//
void mybutton (WM_MESSAGE *pMsg) 
{
	WM_HWIN hWin;
	WM_KEY_INFO *pInfo;
	int column,row,row_index,del_row;
	int i;
	hWin = pMsg->hWin;
	switch (pMsg->MsgId)
	{
		
		 case USER_MSG_LANGUAGE: //更改语言
				    pLanguage = &Lgumainwin[Language];
			     if (Language == 0)
								{
									  BUTTON_SetFont(hButton,&GUI_Font30);
									  TEXT_SetFont(mainwinText[5],&GUI_Font30);
									  HEADER_SetFont(hListhead,&GUI_Font24);
								}
								else
								{
									  BUTTON_SetFont(hButton,&GUI_Font20_1);
									  TEXT_SetFont(mainwinText[5],&GUI_Font24_1);
									  HEADER_SetFont(hListhead,&GUI_Font16_1);			
           LISTVIEW_SetHeaderHeight(hListview,29);									
								}
								DisPage();
			     BUTTON_SetText(hButton,pLanguage->ButtonInfo[0]);
			     for(i = 0; i<7; i++)
											HEADER_SetItemText(hListhead,i,pLanguage->ListHead[i]);
				    break;
			
			case WM_SET_FOCUS:
								if (pMsg->Data.v)
								{
											BUTTON_SetBkColor(hButton,BUTTON_CI_UNPRESSED,GUI_GRAY);
											BUTTON_SetTextColor(hButton,BUTTON_CI_UNPRESSED,GUI_WHITE);
											BUTTON_SetFocusColor(hButton,GUI_GRAY);
								}
								else 	
								{
									BUTTON_SetBkColor(hButton,BUTTON_CI_UNPRESSED,GUI_WHITE);//BUTTON_SetTextColor (hButton,BUTTON_CI_UNPRESSED,GUI_BLACK);
									BUTTON_SetTextColor(hButton,BUTTON_CI_UNPRESSED,GUI_BLACK);
									BUTTON_SetFocusColor(hButton,GUI_WHITE);
								}
								BUTTON_Callback(pMsg);
								break;
		
			case WM_KEY:
				    pInfo = (WM_KEY_INFO*)pMsg->Data.p;
							switch (pInfo->Key)
							{ 
								
								 case GUI_KEY_ENTER:
										    break;
									
								 case GUI_KEY_PRINT:
														WM_BringToTop(PrintWin);
														WM_SetFocus(WM_GetDialogItem(PrintWin,ID_PrintMenu));
										    break;
									case GUI_KEY_MENU:
										    WM_BringToTop(Menuwin);
										    WM_SetFocus  (WM_GetDialogItem(Menuwin,ID_MENU));
									     MENU_SetSel (WM_GetDialogItem(Menuwin,ID_MENU),0);
									     MenuSel = 0;
										    break;
				
				     case GUI_KEY_LOC1:
							       pCannel = "  490 横";
							       WM_InvalidateWindow(WM_GetDialogItem(mainwin,ID_TEXT_1));
							       break;
									
				     case GUI_KEY_LOC2:
							       pCannel = "4209.5横";
						       	WM_InvalidateWindow(WM_GetDialogItem(mainwin,ID_TEXT_1));
							       break;
									
				     case GUI_KEY_CHS:
							       pCannel = "  486 横";
							       WM_InvalidateWindow(WM_GetDialogItem(mainwin,ID_TEXT_1));
					         break;
				  
		     		case GUI_KEY_UP:
						       	break;
									
				     case GUI_KEY_DOWN:
					         if (LISTVIEW_GetNumRows(hListview))
				         	{
																	thispage = 1;
																	WM_SetFocus(hListview);
																	LISTVIEW_SetSel(hListview,0);
																	DisPage();			
																	//WM_InvalidateRect(mainwin,&PageRect);  //刷新页数提示
														}
														break;
				
									case GUI_KEY_LEFT:
										    if(InfoType > 0)
											     InfoType--;
										    else InfoType = 3;
					         switch (InfoType)
														{
																case 0:
																					BUTTON_SetText(hWin,pLanguage->ButtonInfo[0]);
																					LISTVIEW_DeleteAllRows(hListview);
																					InfoSel(0,1);
																					break;
																
																case 1:
																					BUTTON_SetText(hWin,pLanguage->ButtonInfo[1]);
																				 LISTVIEW_DeleteAllRows(hListview);
																					InfoSel(1,1);
																	    break;
																
																case 2:
																				BUTTON_SetText(hWin,pLanguage->ButtonInfo[2]);
																			 LISTVIEW_DeleteAllRows(hListview);
																				InfoSel(2,1);
																			 break;
																
																case 3:
																					BUTTON_SetText(hWin,pLanguage->ButtonInfo[3]);
																					LISTVIEW_DeleteAllRows(hListview);
																					InfoSel(3,1);					
																					break;
													}
													if (rowindex<8)
													{	
														pageNum = 1;
													}
													else if (rowindex%8 == 0)
														pageNum = rowindex/8;
													else pageNum = rowindex/8+1;
													thispage = 1;
													DisPage();			
													//WM_InvalidateRect(mainwin,&PageRect);//刷新页数提示
													break;
													
								case GUI_KEY_RIGHT:
												InfoType++;
												if(InfoType == 4)
													  InfoType = 0;
												switch (InfoType)
												{
														case 0:
																			BUTTON_SetText(hWin,pLanguage->ButtonInfo[0]);
																			LISTVIEW_DeleteAllRows(hListview);
																			InfoSel(0,1);
																		 break;
														
														case 1:
																			BUTTON_SetText(hWin,pLanguage->ButtonInfo[1]);
																			LISTVIEW_DeleteAllRows(hListview);
																			InfoSel(1,1);
																		 break;
														
														case 2:
																			BUTTON_SetText(hWin,pLanguage->ButtonInfo[2]);
																			LISTVIEW_DeleteAllRows(hListview);
																			InfoSel(2,1);
																	 	break;
														 
														case 3:
																			BUTTON_SetText(hWin,pLanguage->ButtonInfo[3]);
																			LISTVIEW_DeleteAllRows(hListview);
																			InfoSel(3,1);		
																			break;
												}
												if (rowindex<8)
												  	pageNum = 1;
												else if (rowindex%8 == 0)
													  pageNum = rowindex/8;
												else pageNum = rowindex/8+1;
												thispage = 1;				
												DisPage();												
												//WM_InvalidateRect(mainwin,&PageRect);//刷新页数提示
												break;
							}
				   break;
							
			default :
			    BUTTON_Callback(pMsg);
		     break;
	}
}
Ejemplo n.º 21
0
static void mylistview(WM_MESSAGE *pMsg)
{
	WM_HWIN hWin;
	CHAR RowNum;
	CHAR RowLineIndex;
	const WM_KEY_INFO *pInfo;
	int16_t  i  = 0;
	static char addrow = 0;
	hWin = pMsg->hWin;

	switch (pMsg->MsgId)
	{
		 case WM_KEY:
			     pInfo = (WM_KEY_INFO*)pMsg->Data.p;
		     switch (pInfo->Key)
	      {
								  case GUI_KEY_MENU:
											    WM_BringToTop(Menuwin);
										     WM_SetFocus(WM_GetDialogItem(Menuwin,ID_MENU));
										     MENU_SetSel(WM_GetDialogItem(Menuwin,ID_MENU),0);
										     MenuSel = 0;
											    break;
								  case GUI_KEY_PRINT:
														 WM_BringToTop(PrintWin);
														 WM_SetFocus(WM_GetDialogItem(PrintWin,ID_PrintMenu));
										     break;
										
			      	case GUI_KEY_LOC1:
							        pCannel = "  490 横";
							        WM_InvalidateWindow(WM_GetDialogItem(mainwin,ID_TEXT_1));
							        break;
										
			      	case GUI_KEY_LOC2:
															pCannel = "4209.5横";
															WM_InvalidateWindow(WM_GetDialogItem(mainwin,ID_TEXT_1));
							        break;
										
			      	case GUI_KEY_CHS:
							        pCannel = "  486 横";
															WM_InvalidateWindow(WM_GetDialogItem(mainwin,ID_TEXT_1));
												  	break;
			
			       case GUI_KEY_LOCK:							
															SelRow = LISTVIEW_GetSel(hListview);
															LISTVIEW_GetItemText(hListview,0,SelRow,pStrBuf,5);
															InfoId = atoi(pStrBuf);
															Info  = pInfoHeader;
															if (pInfoHeader)
															do 
															{
																	if (Info->ID == InfoId)
																	{
																				if (Info->isLocked == 0)
																				{      
																					LISTVIEW_SetItemText(hListview,6,SelRow,"          锁");
																					Info->isLocked = 1;
																				}
																				else if (Info->isLocked == 1)
																				{
																					LISTVIEW_SetItemText(hListview,6,SelRow,"");
																					Info->isLocked = 0;
																				}
																				break;
																	}
															}while (Info = Info->pNext);
														 break;
					 
			       case GUI_KEY_DOWN:

															SelRow = LISTVIEW_GetSel(hListview);
															if (thispage < pageNum)
															{
																		if (SelRow == 7)
																		{
																				thispage++;
																				InfoSel(InfoType,thispage);
																				DisPage();																						 
																				//WM_InvalidateRect(mainwin,&PageRect);
																		}
															}
													 	break;
				
										case GUI_KEY_UP:
															SelRow = LISTVIEW_GetSel(hListview);
															if(SelRow == 0 && thispage == 1)
																		WM_SetFocus(hButton);
															if (thispage>1)
															{
																		if(SelRow == 0)
																		{
																			  SelBottom = 1;		
																					thispage--;
																					InfoSel(InfoType,thispage);
																					DisPage();										
																					GUI_StoreKeyMsg(GUI_KEY_RIGHT,1);  //选择列表中最后一行
																		}
															}
															break;
					
									case GUI_KEY_RIGHT:
														if (SelBottom == 1)
														{
																	LISTVIEW_SetSel(hListview,7);
																	SelBottom = 0;
														}
														break;
									
									case GUI_KEY_ESCAPE:
														SelRow = LISTVIEW_GetSel(hListview);
														WM_SetFocus(hButton);
														break;
				
									case GUI_KEY_ENTER:
														SelRow = LISTVIEW_GetSel(hListview);
														LISTVIEW_GetItemText(hListview,0,SelRow,pStrBuf,5);
														InfoId = atoi(pStrBuf);
														Info  = pInfoHeader;
														if (pInfoHeader)
														do 
														{
																if (Info->ID == InfoId)
																{
																			if (Info->state == INFO_STT_New)
																				LISTVIEW_SetItemBitmap(hListview,6,SelRow,10,7,NULL);
																			if (Info->isLocked == 0)
																						TEXT_SetText(WM_GetDialogItem(InfoText,ID_TEXT_0),"");
																			else TEXT_SetText(WM_GetDialogItem(InfoText,ID_TEXT_0),"锁");
																			Info->state = INFO_STT_Choosen;
																			sprintf(pStrBuf,"%s",pStrBuf);
																			BUTTON_SetText(WM_GetDialogItem(InfoText,ID_BUTTON_0),pStrBuf);
																			MULTIEDIT_SetText(WM_GetDialogItem(InfoText, ID_MULTIEDIT_0),Info->pContent);
																			break;
																}
														}while (Info = Info->pNext);
															WM_BringToTop (InfoText);
															WM_SetFocus (InfoText);
														break;

							  }
		
	 	case WM_POST_PAINT: //行分割线
								RowNum = LISTVIEW_GetNumRows(hListview);
								GUI_SetColor(GUI_BLACK);
								for (RowLineIndex = 0; RowLineIndex<RowNum; RowLineIndex++)
												GUI_DrawLine(0,(68+40*(RowLineIndex)),720,(68+40*(RowLineIndex)));

		 default :
			     LISTVIEW_Callback(pMsg);
	      	break;
	}
}
Ejemplo n.º 22
0
static void myListViewListener(WM_MESSAGE* pMsg)
{
	const WM_KEY_INFO* pInfo;
	WM_HWIN thisListView  = pMsg->hWin;
 
 WM_MESSAGE myMsg;
 
 int selectedRow  = -1;
 long selectedMMSI  = 0;
	int i  = 0;
 Bool isAdded  = FALSE;
	switch(pMsg->MsgId)
	{  
    case WM_SET_FOCUS:
         if(pMsg->Data.v)
         {
            LV_Page  = 0;
            LV_turnPage(thisListView, LV_Page);
            LISTVIEW_SetSel(thisListView, 0);
            WM_InvalidateRect(subWins[2], &lvIndicate); 
         }
         else
         {
            WM_InvalidateRect(subWins[2], &lvIndicate);
            WM_InvalidateRect(subWins[2], &infoRect);
         }
         LISTVIEW_Callback(pMsg);
         break;
    case WM_KEY:
			 pInfo  = (WM_KEY_INFO*)pMsg->Data.p; 
		  switch(pInfo->Key)
		 	{            
				   case GUI_KEY_UP:
            selectedRow  = LISTVIEW_GetSel(thisListView);          
            if(selectedRow == 0)
            {
               if(LV_Page)
               {
                  LV_Page--;
                  LV_turnPage(thisListView, LV_Page);   
                  LISTVIEW_SetSel(thisListView, LV_PAGE_SIZE-1);               
               }
            }
            else
            {
               LISTVIEW_SetSel(thisListView, selectedRow-1);
            }
            WM_InvalidateRect(subWins[2],&lvRect); 
            WM_InvalidateRect(subWins[2],&lvIndicate);          
            break;
         
		 		case GUI_KEY_DOWN:
				      selectedRow  = LISTVIEW_GetSel(thisListView);       
          if(selectedRow == LV_PAGE_SIZE-1)
          {
             if(LV_Page < (N_boat-1)/LV_PAGE_SIZE)
             {
               LV_Page++;
               LV_turnPage(thisListView, LV_Page);
               LISTVIEW_SetSel(thisListView, 0);
             }
          }
          else if(LV_Page*LV_PAGE_SIZE+selectedRow+1 < N_boat)
          {
             LISTVIEW_SetSel(thisListView, selectedRow+1);
          }
          WM_InvalidateRect(subWins[2],&lvRect);
          WM_InvalidateRect(subWins[2],&lvIndicate);          
          break;
				
    case GUI_KEY_RIGHT:
         if(LV_Page < (N_boat-1)/LV_PAGE_SIZE)
         {
           LV_Page++;
           LV_turnPage(thisListView, LV_Page);
           LISTVIEW_SetSel(thisListView, 0);
         }
         WM_InvalidateRect(subWins[2],&lvRect);
         WM_InvalidateRect(subWins[2],&lvIndicate);          
         break;
         
    case GUI_KEY_LEFT:
         if(LV_Page > 0)
         {
            LV_Page--;
            LV_turnPage(thisListView, LV_Page);
            LISTVIEW_SetSel(thisListView, 0);
         }
         WM_InvalidateRect(subWins[2],&lvRect);
         WM_InvalidateRect(subWins[2],&lvIndicate);          
         break;
    
				case GUI_KEY_BACKSPACE:  
    
//         OSSchedLock();    
         for(i=N_boat-1;i>=0;i--) 
         {
            if(MNTState_Choosen == SimpBerthes[i].pBerth->mntState)
            {    
//               SimpBerthes[i].pBerth->mntState  = MNTState_Add;            
               isAdded  = MNT_add(SimpBerthes[i].pBerth);

               if( isAdded )
               {         
                  SimpBerthes[i].pBerth->mntState  = MNTState_Monitored ;   
               }
               else
               {
                  break;
               }
            }            
         }
//         OSSchedUnlock();
         
         myMsg.hWin  = WM_GetClientWindow(menuWin);
         myMsg.MsgId  = USER_MSG_DFULT_CNT;
         myMsg.Data.v  = MNT_getDefaultNum(); 
//INFO("default num:%d",myMsg.Data.v);   
         WM_SendMessage(myMsg.hWin, &myMsg);      
         WM_SetFocus(menuWin);
         break;
         
    case GUI_KEY_MONITORING:
         selectedRow  = LISTVIEW_GetSel(thisListView);
         
         LISTVIEW_GetItemText(thisListView, LV_AllList_Col_MMSI, selectedRow, pStrBuf, 11);
         selectedMMSI  = strtoi(pStrBuf);
         
         if(selectedMMSI <= 0)
            break;
         
         for(i=N_boat;i>0;i--)
         {
     
            if(SimpBerthes[i-1].pBerth->Boat.user_id == selectedMMSI)
            {          
               break;
            }
         }
         
         if(i)
            i--;
         else
         {
            INFO("Err!");
            break;
         }
              
         if(SimpBerthes[i].pBerth->mntState == MNTState_None)     
         {
            SimpBerthes[i].pBerth->mntState  = MNTState_Choosen;
            LISTVIEW_SetItemText(thisListView, LV_AllList_Col_STT, selectedRow, "吖");
         }
         break;
         
    case GUI_KEY_CANCEL:
         selectedRow  = LISTVIEW_GetSel(thisListView);
         
         LISTVIEW_GetItemText(thisListView, LV_AllList_Col_MMSI, selectedRow, pStrBuf, 11);
         selectedMMSI  = strtoi(pStrBuf);
         
         if(selectedMMSI <= 0)
            break;
         
         for(i=N_boat;i>0;i--)
         {
            if(SimpBerthes[i-1].pBerth->Boat.user_id == selectedMMSI)
            {          
               break;
            }
         }
         
         if(i)
            i--;
         else 
         {
            INFO("Err!");
            break;
         }

         if(MNTState_Choosen  == SimpBerthes[i].pBerth->mntState)
         {
     
            SimpBerthes[i].pBerth->mntState  = MNTState_None;
            LISTVIEW_SetItemText(thisListView, LV_AllList_Col_STT, selectedRow, "啊");
         }
         
         else if(MNTState_Monitored  <= SimpBerthes[i].pBerth->mntState)
         {  
            MMSI  = SimpBerthes[i].pBerth->Boat.user_id;
            myMsg.hWin     = WM_GetClientWindow(confirmWin);
            myMsg.hWinSrc  = thisListView;
            myMsg.MsgId    = USER_MSG_CHOOSE;
            myMsg.Data.v   = CANCEL_MONITED;
            WM_SendMessage(myMsg.hWin, &myMsg); 
           	WM_BringToTop(confirmWin);
				        WM_SetFocus(WM_GetDialogItem (confirmWin,GUI_ID_BUTTON0));  
         }               
         break;    
     
    case GUI_KEY_ENTER:
         selectedRow  = LISTVIEW_GetSel(thisListView);
        
         LISTVIEW_GetItemText(thisListView, LV_AllList_Col_MMSI, selectedRow, pStrBuf, 11);
         selectedMMSI  = strtoi(pStrBuf);
         
         if(selectedMMSI <= 0)
            break;
            
         for(i=0; i<N_boat; i++)
         {
     
            if(SimpBerthes[i].pBerth->Boat.user_id == selectedMMSI)
            {          
               break;
            }
         }
                 
         
         if(MNTState_None == SimpBerthes[i].pBerth->mntState)
         {
       
            SimpBerthes[i].pBerth->mntState  = MNTState_Choosen;
            LISTVIEW_SetItemText(thisListView, LV_AllList_Col_STT, selectedRow, "吖");
         }
         else if(MNTState_Choosen  == SimpBerthes[i].pBerth->mntState)
         {
     
            SimpBerthes[i].pBerth->mntState  = MNTState_None;
            LISTVIEW_SetItemText(thisListView, LV_AllList_Col_STT, selectedRow, "啊");
         }
         
         else if(MNTState_Monitored  == SimpBerthes[i].pBerth->mntState)
         {  
            MMSI  = SimpBerthes[i].pBerth->Boat.user_id;
            myMsg.hWin     = WM_GetClientWindow(confirmWin);
            myMsg.hWinSrc  = thisListView;
            myMsg.MsgId    = USER_MSG_CHOOSE;
            myMsg.Data.v   = CANCEL_MONITED;
            WM_SendMessage(myMsg.hWin, &myMsg); 
           	WM_BringToTop(confirmWin);
				        WM_SetFocus(WM_GetDialogItem (confirmWin,GUI_ID_BUTTON0));  
         }
         break;

         
				default:
      LISTVIEW_Callback(pMsg);
      break;
			}
			break;
			
   case USER_MSG_REPLY:
       switch(pMsg->Data.v)
       {
          case REPLY_OK:
               LISTVIEW_SetItemText(thisListView, LV_AllList_Col_STT, LISTVIEW_GetSel(thisListView), "啊");
               if(MNT_removeById(MMSI))
               {
                  for(i=N_boat-1;i>=0;i--)
                  {
                     if(SimpBerthes[i].pBerth->Boat.user_id == MMSI)
                     {
                        SimpBerthes[i].pBerth->mntState  = MNTState_None;
                        break;
                     }
                  }
                                 
                 WM_SetFocus(subWins[2]);
               }
               else 
               {
INFO("Error!"); 
                  WM_SetFocus(menuWin);                
               }
               break;
          case REPLY_CANCEL:         
               WM_SetFocus(pMsg->hWin);
               break;
               
           default:
INFO("Something err!");           
           break;
       }
  break;

				default:
					LISTVIEW_Callback(pMsg);
					break;
	}
}
Ejemplo n.º 23
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
}
Ejemplo n.º 24
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);
  
}
Ejemplo n.º 25
0
static void sldReviveCallback(WM_MESSAGE* pMsg)
{
   const WM_KEY_INFO* pKeyInfo;
   
   WM_MESSAGE  myMsg;
   
   switch(pMsg->MsgId)
   {
      case WM_KEY:
           pKeyInfo  = (WM_KEY_INFO*)pMsg->Data.p;
           switch(pKeyInfo->Key)
           {
              case GUI_KEY_RIGHT:
              case GUI_KEY_ENTER:
                   myMsg.hWin      = WM_GetClientWindow(confirmWin);            
                   myMsg.hWinSrc   = pMsg->hWin;
                   myMsg.MsgId     = USER_MSG_CHOOSE;
                   myMsg.Data.v    = SYS_REVIVE;
                   WM_SendMessage(myMsg.hWin, &myMsg);
 
                   WM_BringToTop(confirmWin);
                   WM_SetFocus(WM_GetDialogItem(confirmWin, GUI_ID_BUTTON0));
                   break;
              
              case GUI_KEY_BACKSPACE:
                   if(Mem_isEqual(&SysConf, &agentConf, sizeof(SysConf)) )
                   {
                      WM_SetFocus(Slideres[0]);
                      WM_SetFocus(menuWin);                      
                   }
                   else
                   {
                      myMsg.hWin  = WM_GetClientWindow(confirmWin);
                      myMsg.hWinSrc  = subWins[3];
                      myMsg.MsgId  = USER_MSG_CHOOSE;
                      myMsg.Data.v  = SYS_SETTING;
                      WM_SendMessage(myMsg.hWin, &myMsg);
                      
                      WM_BringToTop(confirmWin);
                      WM_SetFocus(WM_GetDialogItem (confirmWin,GUI_ID_BUTTON0));                    
                   }
                   break;
                   
             default:
                   HSD_SLIDER_Callback(pMsg);
                   break;
           }
           break;
           
      case USER_MSG_REPLY:
           WM_SetFocus(Slideres[0]);
           WM_BringToTop(subWins[3]);
           if(pMsg->Data.v == REPLY_OK )
           {
              if(SysConf.Skin != DEFAULT_SKIN) 
              {
                 myMsg.MsgId  = USER_MSG_SKIN;
                 myMsg.Data.v  = DEFAULT_SKIN;
                 WM_BroadcastMessage(&myMsg);
                 agentConf.Skin  = SysConf.Skin;
              }
              
              if(SysConf.Shape != DEFAULT_SHAPE)
              {
                 myMsg.hWin  = mapWin;
                 myMsg.MsgId  = USER_MSG_SHAPE;
                 myMsg.Data.v  = DEFAULT_SHAPE;
                 WM_SendMessage(myMsg.hWin, &myMsg);
                 agentConf.Shape  = SysConf.Shape;
              } 
              sysRevive();
              
              HSD_SLIDER_SetValue(Slideres[0], SysConf.Skin);
              HSD_SLIDER_SetValue(Slideres[5], 0);
              GUI_Delay(1000);
              HSD_SLIDER_SetValue(Slideres[1], SysConf.Brt);
              HSD_SLIDER_SetValue(Slideres[5], 1);
              GUI_Delay(1000);
              
              HSD_SLIDER_SetValue(Slideres[2], SysConf.Vol);
              HSD_SLIDER_SetValue(Slideres[5], 2);
              GUI_Delay(1000);
              
              HSD_SLIDER_SetValue(Slideres[3], SysConf.Unit);
              HSD_SLIDER_SetValue(Slideres[5], 3);
              GUI_Delay(1000);
              
              HSD_SLIDER_SetValue(Slideres[4], SysConf.Shape);
              HSD_SLIDER_SetValue(Slideres[5], 4);
              GUI_Delay(1000);
              
              HSD_SLIDER_SetValue(Slideres[5], 0);
              
              NVIC_SystemReset();
              
           } 

           break;
           
    default:
           HSD_SLIDER_Callback(pMsg);
           break;
   }
}
Ejemplo n.º 26
0
void _cbWindowSetting(WM_MESSAGE* pMsg) 
{
	WM_HWIN hWin = pMsg->hWin;
	WM_HWIN _edit0;
	WM_HWIN _edit1;
  int edit_id = 256;
	int     VALUE;
	int      i = 0;
	switch (pMsg->MsgId) 
	{
		case WM_CREATE:

 			WIDGET_SetDefaultEffect (&WIDGET_Effect_None);
		
			EDIT_SetDefaultTextAlign(GUI_TA_HCENTER | GUI_TA_VCENTER);
			EDIT_SetDefaultFont(&GUI_Font28);
 			EDIT_CreateEx(200,60,62,30,hWin,WM_CF_SHOW,0,GUI_ID_EDIT0,1);//夜间模式
		
 			EDIT_CreateEx(150,110,62,30,hWin,WM_CF_SHOW,0,GUI_ID_EDIT1,1);//音量
		
			EDIT_CreateEx(150,160,62,30,hWin,WM_CF_SHOW,0,GUI_ID_EDIT2,1);//亮度
		
 			EDIT_CreateEx(150,210,62,30,hWin,WM_CF_SHOW,0,GUI_ID_EDIT3,2);//时区
			
 			EDIT_CreateEx(240,260,62,30,hWin,WM_CF_SHOW,0,GUI_ID_EDIT4,1);//报警音1
			
 			EDIT_CreateEx(170,310,62,30,hWin,WM_CF_SHOW,0,GUI_ID_EDIT5,1);//按键音1
 			EDIT_CreateEx(200,360,62,30,hWin,WM_CF_SHOW,0,GUI_ID_EDIT6,1);//单位显示
 			EDIT_CreateEx(200,410,62,30,hWin,WM_CF_SHOW,0,GUI_ID_EDIT7,1);//船形显示
			
			for (i = 0; i < 8; i++) {
				_edit0 = WM_GetDialogItem(hWin, GUI_ID_EDIT0 + i);

 				EDIT_SetText(_edit0,"0");
 				EDIT_SetpfAddKeyEx (_edit0,_cbEditAddKey);
				EDIT_SetBkColor(_edit0,1,GUI_LIGHTBLUE);
				EDIT_SetBkColor(_edit0,0,GUI_WHITE);
		}
		break;
		
		case WM_PAINT:
 			GUI_SetBkColor (GUI_LIGHTBLUE);
 			GUI_Clear();
 		
				for (i = 0; i < 8; i++) {
				_edit0 = WM_GetDialogItem(hWin, GUI_ID_EDIT0 + i);
				EDIT_SetTextColor(_edit0,0,GUI_BLACK);
			}
			EDIT_SetTextColor (WM_GetDialogItem(hWin, edit_id),0,GUI_WHITE);
			
			GUI_SetTextMode(GUI_TEXTMODE_TRANS);
			GUI_SetColor (GUI_BLACK);
			GUI_SetFont (&GUI_Font28);
			GUI_DispStringAt ("系统设置",230,10);
			GUI_DispStringAt ("01:夜间模式:",5,60);
			GUI_DispStringAt ("02:音量:",5,110);
			GUI_DispStringAt ("03:亮度:",5,160);
			GUI_DispStringAt ("04:时区:",5,210);
			GUI_DispStringAt ("05:报警音选择:",5,260);
			GUI_DispStringAt ("06:按键音:",5,310);
			GUI_DispStringAt ("07:单位设置:",5,360);
			GUI_DispStringAt ("08:船位显示:",5,410);
			GUI_DispStringAt ("09:船迹存储时间:",330,60);
			GUI_DispStringAt ("10:软件更新:",330,110);
			GUI_DispStringAt ("11:系统版本:",330,160);
			GUI_SetColor (GUI_WHITE);
			GUI_SetPenSize(2);
			GUI_DrawLine(1,50,1,470);
			GUI_DrawLine(1,50,673,50);
			GUI_DrawLine(673,50,673,470);
			GUI_DrawLine(1,470,673,470);
		break;

 		case WM_KEY:
 			switch (((WM_KEY_INFO*)(pMsg->Data.p))->Key)
 			{
				case GUI_KEY_TAB:
					//判断当前焦点所在的位置,将焦点移至下一个窗口
					downlistfocus++;
					if (downlistfocus == 369)
							downlistfocus = 384;
					if (downlistfocus == 388)
						  downlistfocus = 256;
					if (downlistfocus == 257)
							downlistfocus = 368;
					//设置焦点
						WM_SetFocus(WM_GetDialogItem (hWin, downlistfocus));

				break;

				case GUI_KEY_BACKTAB:
					//判断当前焦点所在的位置,将焦点移至上一个窗口
							downlistfocus--;
					if (downlistfocus == 383)
							downlistfocus = 368;
					if (downlistfocus == 367)
							downlistfocus = 256;
					if (downlistfocus == 255)
							downlistfocus = 387;
					//设置焦点		
 						WM_SetFocus (WM_GetDialogItem(hWin, downlistfocus));					

				break;
				
				case GUI_KEY_RIGHT:	
				break;
				
				case GUI_KEY_F1:	
				break;
				
				case GUI_KEY_F2:
				break;
				
				case GUI_KEY_SPACE:
					printf ("ddsf");
				break;
				
				case GUI_KEY_ENTER:
				break;
				
				case GUI_KEY_UP:
					
				break;
				
				case GUI_KEY_DOWN:
 					WM_SetFocusOnNextChild(hWin);
					//edit_id ++;
				break;
				
 				case GUI_KEY_LEFT:
					menufocus -= 5;
					focuschange = 0;
					WM_SetFocus(WM_GetDialogItem (hDlg_Menu, menufocus));
					WM_Paint(hDlg_Menu);
				break;

 				case GUI_KEY_MENU:
					WM_BringToTop (hDlg_FishMap);
					WM_SetFocus (hDlg_FishMap);
					menufocus = 368;
				break;
			}
		break;

		default:
		WM_DefaultProc(pMsg);
	}
}