/*********************************************************************
*
*       PROGBAR_SetText
*/
void PROGBAR_SetText(PROGBAR_Handle hObj, const char* s) {
    if (hObj) {
        PROGBAR_Obj* pObj;
        const GUI_FONT GUI_UNI_PTR * pOldFont;
        GUI_RECT r1;
        char acBuffer[5];
        WM_LOCK();
        pObj = PROGBAR_H2P(hObj);
        pOldFont = GUI_SetFont(pObj->Props.pFont);
        PROGBAR__GetTextRect(pObj, &r1, PROGBAR__GetText(pObj, acBuffer));
        if (!s) {
            PROGBAR__FreeText(hObj);
            WM_InvalidateRect(hObj, &r1);
        } else {
            if (GUI__SetText(&pObj->hpText, s)) {
                GUI_RECT r2;
                PROGBAR__GetTextRect(pObj, &r2, PROGBAR__GetText(pObj, acBuffer));
                GUI_MergeRect(&r1, &r1, &r2);
                WM_InvalidateRect(hObj, &r1);
            }
        }
        GUI_SetFont(pOldFont);
        WM_UNLOCK();
    }
}
U8 UpdateDistortionInfo(PDISTORTION_INFO pInfo)
{
	std::vector<int> effect;
	if(pInfo->Fx != DistortionGetFX())
	{
		MisaRadio_SetStatus(hCOMPcomm.hFX1,pInfo->Fx?0:1);
		MisaRadio_SetStatus(hCOMPcomm.hFX2,pInfo->Fx?1:0);
	}
	disIndex = pInfo->type%(sizeof(strDistype)/4);
	WM_InvalidateRect(hDistortion, &rectDisType);
	MisaCheckbox_SetStatus(hCOMPcomm.hCheckOn,pInfo->On);
	MisaProgressbar_SetPercentEx(hDistortionItems[DISTORTION_PROGDRIVE],pInfo->drive,0);
	MisaProgressbar_SetPercentEx(hDistortionItems[DISTORTION_PROGTONE],pInfo->tone,0);
	MisaProgressbar_SetPercentEx(hDistortionItems[DISTORTION_PROGLEVEL],pInfo->level,0);
	MisaProgressbar_SetPercentEx(hDistortionItems[DISTORTION_PROGNOISEREDUCTION],pInfo->noisereduction,0);
	MisaProgressbar_SetPercentEx(hDistortionItems[DISTORTION_PROGBOOSTER],pInfo->booster,0);
	effect = SynthFindEffect(SynthTranslateEffect(DISTORTION_ID_PROGDRIVE),DistortionGetFX());
	MisaProgressbar_SetCheck(hDistortionItems[DISTORTION_PROGDRIVE], effect.size()?1:0);
	effect = SynthFindEffect(SynthTranslateEffect(DISTORTION_ID_PROGTONE),DistortionGetFX());
	MisaProgressbar_SetCheck(hDistortionItems[DISTORTION_PROGTONE], effect.size()?1:0);
	effect = SynthFindEffect(SynthTranslateEffect(DISTORTION_ID_PROGLEVEL),DistortionGetFX());
	MisaProgressbar_SetCheck(hDistortionItems[DISTORTION_PROGLEVEL], effect.size()?1:0);

	SynthSetDragCentre(SynthTranslateEffect(DISTORTION_ID_PROGDRIVE),pInfo->Fx,pInfo->drive);
	SynthSetDragCentre(SynthTranslateEffect(DISTORTION_ID_PROGTONE),pInfo->Fx,pInfo->tone);
	SynthSetDragCentre(SynthTranslateEffect(DISTORTION_ID_PROGLEVEL),pInfo->Fx,pInfo->level);
	return 0;
}
Esempio n. 3
0
static void showSelectedBoatInfo(WM_HWIN thisHandle)
{
	
	WM_HWIN thisListView  = thisHandle;
	int SelectedRow  = -1;
	int i  = 0;
	
	long SelectedID  = 0;

	SelectedRow  = LISTVIEW_GetSel(thisListView);
	
	
	if(SelectedRow >= 0)
	{
		LISTVIEW_GetItemText(thisListView,1,SelectedRow,pStrBuf,10);
		
		SelectedID  = strtoi(pStrBuf);
		
		while((boat_list_p[i]->user_id!=SelectedID) && (i<3))
		{
			i++;
		}
		/// Find the boat
		if(i < 3)
		{	
       index  = i;
		}
		
		WM_InvalidateRect(subWins[0],&infoRect);

	}

}
Esempio n. 4
0
/* Invalidate, using desktop coordinates */
void WM_InvalidateBWinAbs(WM_HWIN hWin, const GUI_RECT*pRect) {
  GUI_RECT r = *pRect;
  WM_LOCK();
  GUI_MoveRect(&r, -WM_H2P(hWin)->Rect.x0, -WM_H2P(hWin)->Rect.y0);
  WM_InvalidateRect(hWin, &r);
  WM_UNLOCK();
}
Esempio n. 5
0
/*********************************************************************
*
*       Exported routines:  Various methods
*
**********************************************************************
*/
void PROGBAR_SetValue(PROGBAR_Handle hObj, int v) {
  PROGBAR_Obj* pObj;
  GUI_RECT r;
  if (hObj) {
    WM_LOCK();
    pObj= PROGBAR_H2P(hObj);
    /* Put v into legal range */
    if (v < pObj->Min)
	    v = pObj->Min;
    if (v > pObj->Max)
	    v = pObj->Max;
    if (pObj->v != v) {
      /* Invalidate */
      if (pObj->hpText) {
        /* Calculate invalid area */
        r.x0 = _Value2X(hObj, pObj->v);
        r.x1 = _Value2X(hObj, v);
        /* Make sure x0 <= x1 */
		    if (r.x0 > r.x1) {
			    int t = r.x0;
			    r.x0 = r.x1;
			    r.x1 = t;
		    }
		    r.y0 =0;
		    r.y1 =4095;
        WM_InvalidateRect(hObj,&r);
	    } else {
        Invalidate(hObj);
	    }
      pObj->v = v;                         /* Update stored value */
    }
    WM_UNLOCK();
  }
}
Esempio n. 6
0
/*********************************************************************
*
*       LISTVIEW__InvalidateInsideArea
*/
void LISTVIEW__InvalidateInsideArea(LISTVIEW_Handle hObj, LISTVIEW_Obj* pObj) {
  GUI_RECT Rect;
  int HeaderHeight;
  HeaderHeight = HEADER_GetHeight(pObj->hHeader);
  WM_GetInsideRectExScrollbar(hObj, &Rect);
  Rect.y0 += HeaderHeight;
  WM_InvalidateRect(hObj, &Rect);
}
/*********************************************************************
*
*       _InvalidateRowAndBelow
*/
static void _InvalidateRowAndBelow(LISTVIEW_Handle hObj, LISTVIEW_Obj* pObj, int Sel) {
    if (Sel >= 0) {
        GUI_RECT Rect;
        int HeaderHeight, RowDistY;
        HeaderHeight = HEADER_GetHeight(pObj->hHeader);
        RowDistY     = LISTVIEW__GetRowDistY(pObj);
        WM_GetInsideRectExScrollbar(hObj, &Rect);
        Rect.y0 += HeaderHeight + (Sel - pObj->ScrollStateV.v) * RowDistY;
        WM_InvalidateRect(hObj, &Rect);
    }
}
Esempio n. 8
0
/*********************************************************************
*
*       LISTBOX__InvalidateItemAndBelow
*/
void LISTBOX__InvalidateItemAndBelow(LISTBOX_Handle hObj, const LISTBOX_Obj* pObj, int Sel) {
  if (Sel >= 0) {
    int ItemPosY;
    ItemPosY = _GetItemPosY(hObj, pObj, Sel);
    if (ItemPosY >= 0) {
      GUI_RECT Rect;
      WM_GetInsideRectExScrollbar(hObj, &Rect);
      Rect.y0 += ItemPosY;
      WM_InvalidateRect(hObj, &Rect);
    }
  }
}
Esempio n. 9
0
/*********************************************************************
*
*       LISTBOX__InvalidateItem
*/
void LISTBOX__InvalidateItem(LISTBOX_Handle hObj, const LISTBOX_Obj* pObj, int Sel) {
  if (Sel >= 0) {
    int ItemPosY;
    ItemPosY = _GetItemPosY(hObj, pObj, Sel);
    if (ItemPosY >= 0) {
      GUI_RECT Rect;
      int ItemDistY;
      ItemDistY = _GetItemSizeY(hObj, pObj, Sel);
      WM_GetInsideRectExScrollbar(hObj, &Rect);
      Rect.y0 += ItemPosY;
      Rect.y1  = Rect.y0 + ItemDistY - 1;
      WM_InvalidateRect(hObj, &Rect);
    }
  }
}
Esempio n. 10
0
/*********************************************************************
*
*       PROGBAR_SetValue
*/
void PROGBAR_SetValue(PROGBAR_Handle hObj, int v) {
  if (hObj) {
    PROGBAR_Obj* pObj;
    WM_LOCK();
    pObj= PROGBAR_H2P(hObj);
    /* Put v into legal range */
    if (v < pObj->Min) {
	    v = pObj->Min;
    }
    if (v > pObj->Max) {
	    v = pObj->Max;
    }
    if (pObj->v != v) {
      GUI_RECT r;
      /* Get x values */
      if (v < pObj->v) {
        r.x0 = _Value2X(pObj, v);
        r.x1 = _Value2X(pObj, pObj->v);
      } else {
        r.x0 = _Value2X(pObj, pObj->v);
        r.x1 = _Value2X(pObj, v);
      }
		  r.y0    = 0;
		  r.y1    = 4095;
      if (pObj->hpText == 0) {
        const GUI_FONT GUI_UNI_PTR * pOldFont;
        char acBuffer[5];
        GUI_RECT rText;
        pOldFont = GUI_SetFont(pObj->pFont);
        _GetTextRect(pObj, &rText, _GetText(pObj, acBuffer));
        GUI_MergeRect(&r, &r, &rText);
        pObj->v = v;
        _GetTextRect(pObj, &rText, _GetText(pObj, acBuffer));
        GUI_MergeRect(&r, &r, &rText);
        GUI_SetFont(pOldFont);
      } else {
        pObj->v = v;
      }
      WM_InvalidateRect(hObj, &r);
    }
    WM_UNLOCK();
  }
}
Esempio n. 11
0
static void DistortionProc(WM_MESSAGE* pMsg)
{
	int x, y;
	int NCode,Id;
	ProcessCommComponent(pMsg, &hCOMPcomm);
	switch (pMsg->MsgId)
	{
	case WM_CREATE:
		DistortionCreateItems(pMsg->hWin);
		break;
	case WM_DELETE:
		DistortionDeleteItems();
		break;
	case WM_PAINT:
		GUI_SetBkColor(GUI_BLACK);
		GUI_Clear();
		GUI_SetTextMode(GUI_TEXTMODE_TRANS);
		GUI_DrawBitmap(&bmEMPTYTITLEBAR, 0, 0);
		x = 222;
		y = bmEMPTYTITLEBAR.YSize;
		GUI_DrawBitmap(&bmDISTYPEAREA, x, y);
		GUI_SetFont(&GUI_Font32B_ASCII);
		x = WM_GetWindowSizeX(pMsg->hWin);
		{
			std::string title("Distortion");
			GUI_DispStringHCenterAt(GetTitleWithPreset(title).c_str(), x / 2, 5);
		}
		y += 20;
		GUI_DispStringHCenterAt(strDistype[disIndex], x / 2, y);
		break;
	case WM_NOTIFY_PARENT:
		if(DispatchCommComponent(pMsg,&hCOMPcomm))
		{
			Id = WM_GetId(pMsg->hWinSrc);
			NCode = pMsg->Data.v;
			switch(NCode)
			{
			case WM_NOTIFICATION_CLICKED:
				DEBUG_STDOUT("Distortion button clicked!");
				break;
			case WM_NOTIFICATION_RELEASED:
				switch(Id)
				{
				case DISTORTION_ID_LEFTARROW:
					--disIndex;
					if(0>disIndex)
					{
						disIndex = sizeof(strDistype)/4-1;
					}
					WM_InvalidateRect(pMsg->hWin, &rectDisType);
					DistortionSetType(DistortionGetFX(),disIndex);
					break;
				case DISTORTION_ID_RIGHTARROW:
					++disIndex;
					if(sizeof(strDistype)/4 <= disIndex)
					{
						disIndex = 0;
					}
					WM_InvalidateRect(pMsg->hWin, &rectDisType);
					DistortionSetType(DistortionGetFX(),disIndex);
					break;
				case COMMON_ID_CHECKON:
					DistortionOn(DistortionGetFX(), MisaCheckbox_GetStatus(hCOMPcomm.hCheckOn)?true:false);
					break;
				case COMMON_ID_FX1:
				case COMMON_ID_FX2:
				case COMMON_ID_CLOSE:
					UpdateSynthSettingEx(MISAMODULE_DISTORTION);
					break;
				case CTL_NONE_ID:
				case CTL_TOUCH_X_ID:
				case CTL_TOUCH_Y_ID:
				case CTL_DRAG_X_ID:
				case CTL_DRAG_Y_ID:
				case CTL_BALL_X_ID:
				case CTL_BALL_Y_ID:
				case CTL_VARIATION_ID:
					DistortionControlMenuProc(Id);
					break;
#if 0
				case DISTORTION_ID_PROGDRIVE:
					x = MisaProgressbar_GetPercent(pMsg->hWinSrc);
					DistortionSetDrive(DistortionGetFX(),x<127?x:127);
					break;
				case DISTORTION_ID_PROGTONE:
					x = MisaProgressbar_GetPercent(pMsg->hWinSrc);
					DistortionSetTone(DistortionGetFX(),x<127?x:127);
					break;
				case DISTORTION_ID_PROGLEVEL:
					x = MisaProgressbar_GetPercent(pMsg->hWinSrc);
					DistortionSetLevel(DistortionGetFX(),x<127?x:127);
					break;
#endif
				default:
					;
				}
				DEBUG_STDOUT("Distortion button released!");
				break;
			case WM_NOTIFICATION_VALUE_CHANGED:
				switch(Id)
				{
				case DISTORTION_ID_PROGDRIVE:
					x = MisaProgressbar_GetPercent(pMsg->hWinSrc);
					DistortionSetDrive(DistortionGetFX(),x<127?x:127);
					break;
				case DISTORTION_ID_PROGTONE:
					x = MisaProgressbar_GetPercent(pMsg->hWinSrc);
					DistortionSetTone(DistortionGetFX(),x<127?x:127);
					break;
				case DISTORTION_ID_PROGLEVEL:
					x = MisaProgressbar_GetPercent(pMsg->hWinSrc);
					DistortionSetLevel(DistortionGetFX(),x<127?x:127);
					break;
				case DISTORTION_ID_PROGNOISEREDUCTION:
					x = MisaProgressbar_GetPercent(pMsg->hWinSrc);
					DistortionNoiseReduction(DistortionGetFX(),x);
					break;
				case DISTORTION_ID_PROGBOOSTER:
					x = MisaProgressbar_GetPercent(pMsg->hWinSrc);
					DistortionSetBooster(DistortionGetFX(),x<127?x/32:3);
					break;
				default:
					;
				}
				break;
			case WM_NOTIFICATION_SEL_CHANGED:
				if(hDistortionItems[DISTORTION_PROGNOISEREDUCTION]!=pMsg->hWinSrc && hDistortionItems[DISTORTION_PROGBOOSTER]!=pMsg->hWinSrc)
				{
					std::vector<int> effect;
					x = WM_GetWindowOrgX(pMsg->hWinSrc)+50;
					y = WM_GetWindowOrgY(pMsg->hWinSrc)+340;
					MisaSetcontrolmenu_Popup(pMsg->hWin,pMsg->hWinSrc,x,y);
					effect = SynthFindEffect(SynthTranslateEffect(Id),DistortionGetFX());
					y = effect.size();
					for(x=0;x<y;x++)
					{
						if(-1 != effect[x])
						{
							MisaMenu_SetStatus(AssigneMentMenuTranslate(effect[x]&0x000000FF),2,0,(effect[x]>>8)&0x000000FF);
							MisaMenu_SetStatus(CTL_VARMIN,0,(effect[x]>>16)&0x000000FF,(effect[x]>>8)&0x000000FF);
							MisaMenu_SetStatus(CTL_VARMAX,0,(effect[x]>>24)&0x000000FF,(effect[x]>>8)&0x000000FF);
						}
					}
				}
				break;
			}
Esempio n. 12
0
void WM_InvalidateWindow(WM_HWIN hWin) {
  WM_InvalidateRect(hWin, NULL);
}
Esempio n. 13
0
/*********************************************************************
*
*       LISTBOX__InvalidateInsideArea
*/
void LISTBOX__InvalidateInsideArea(LISTBOX_Handle hObj) {
  GUI_RECT Rect;
  WM_GetInsideRectExScrollbar(hObj, &Rect);
  WM_InvalidateRect(hObj, &Rect);
}
Esempio n. 14
0
static void updateListViewContent(WM_HWIN thisHandle)
{
   WM_HWIN thisListView  = thisHandle;
   int  i             = 0;
   int  selRow        = -1;
   long selectedMMSI  = 0;
   
   if(N_boat <= 0)
   {
     // modifided by Bill
     LISTVIEW_GetItemText(thisListView, LV_AllList_Col_MMSI, 0, pStrBuf, 11);     
     selectedMMSI  = strtoi(pStrBuf); 
PRINT("SelMMSI:%d", selectedMMSI);
     if(selectedMMSI)
     {
       for(i=0; i<9; i++)
       {
         LISTVIEW_SetItemText(thisListView, LV_AllList_Col_DIST, i, "");
         LISTVIEW_SetItemText(thisListView, LV_AllList_Col_MMSI, i, "");
         LISTVIEW_SetItemText(thisListView, LV_AllList_Col_STT,  i, "");
       }
       LISTVIEW_SetSel(thisListView, 0);
       WM_InvalidateRect(subWins[2], &lvIndicate);  
       return ;
     }
     return ;
   } 
   
   selRow  = LISTVIEW_GetSel(thisListView);  
   LISTVIEW_GetItemText(thisListView, LV_AllList_Col_MMSI, selRow, pStrBuf, 11); 
   selectedMMSI  = strtoi(pStrBuf); 
PRINT("-SelMMSI:%ld", selectedMMSI);   
   if(selectedMMSI)
   {
      for(i=0; i<N_boat; i++)
      {
         if(SimpBerthes[i].pBerth->Boat.user_id == selectedMMSI)
         {
            LV_Page  = i/LV_PAGE_SIZE;
            selRow  = i%LV_PAGE_SIZE;
            break;
         }
      }
      
      /// Selected boat has gone
      if(i >= N_boat ){
PRINT("sel has gone");         
         if(N_boat > LV_Page * LV_PAGE_SIZE + selRow){
            selRow  = 0;          
         }
         else{
            LV_Page  = (N_boat-1) /LV_PAGE_SIZE;
            selRow  = 0;
         }
      }
   }
   else 
   {
      LV_Page  = (N_boat-1) / LV_PAGE_SIZE;
      selRow  = (N_boat-1) % LV_PAGE_SIZE;
   }
   
   LV_turnPage(thisListView, LV_Page);
   
   LISTVIEW_SetSel(thisListView, selRow);
   
   WM_InvalidateRect(subWins[2], &lvIndicate);  
}
Esempio n. 15
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;
	}
}
Esempio n. 16
0
/*********************************************************************
*
*       MainTask
*/
void MainTask(void) {
  WM_HWIN hWin;
  GUI_MEMDEV_Handle hMemWin;  // Memory device to be used in window
  GUI_MEMDEV_Handle hMemDraw; // Memory device for drawing operation
  U32 * pDataWin;
  U32 * pDataDraw;
  int i, yPos, Cnt, xSizeWindow, ySizeWindow, xPosWindow, yPosWindow, xSizeDisplay, ySizeDisplay;
  GUI_RECT Rect;

  xSizeDisplay = LCD_GetXSize();
  ySizeDisplay = LCD_GetYSize();
  xSizeWindow = 100;
  ySizeWindow = 100;
  xPosWindow = (xSizeDisplay - xSizeWindow) / 2;
  yPosWindow = (ySizeDisplay - ySizeWindow) / 2;
  Cnt = 0;
  Rect.y0 = 0;
  Rect.y1 = ySizeWindow - 1;
  WM_SetCreateFlags(WM_CF_MEMDEV);
  GUI_Init();
  WM_SetCallback(WM_HBKWIN, _cbBk);
  //
  // Create window
  //
  hWin = WINDOW_CreateUser(xPosWindow, yPosWindow, xSizeWindow, ySizeWindow, 0, WM_CF_SHOW, 0, 0, _cbWin, sizeof(hMemWin));
  //
  // Create a memory device for the window
  //
  hMemWin = GUI_MEMDEV_CreateFixed(0, 0, 100, 100, GUI_MEMDEV_NOTRANS, GUI_MEMDEV_APILIST_32, GUICC_8888);
  //
  // Attach memory device to window data
  //
  WINDOW_SetUserData(hWin, &hMemWin, sizeof(hMemWin));
  //
  // Create small memory device for drawing one line of gradient data
  // representing the real data to be used
  //
  hMemDraw = GUI_MEMDEV_CreateFixed(xPosWindow, yPosWindow, 1, ySizeWindow, GUI_MEMDEV_NOTRANS, GUI_MEMDEV_APILIST_32, GUICC_8888);
  //
  // Initialize random value
  //
  yPos = rand() % ySizeWindow;
  while (1) {
    //
    // Create some data to be added to the windows memory device
    //
    GUI_MEMDEV_Select(hMemDraw);
    GUI_DrawGradientV(xPosWindow, yPosWindow, xPosWindow, yPosWindow + yPos, GUI_RED, GUI_YELLOW);
    GUI_MEMDEV_Select(0);
    //
    // Get data pointers immediately before accessing data
    //
    pDataWin  = GUI_MEMDEV_GetDataPtr(hMemWin);
    pDataDraw = GUI_MEMDEV_GetDataPtr(hMemDraw);
    //
    // Initially clear memory device
    //
    if (Cnt == 0) {
      memset(pDataWin, 0, sizeof(U32) * xSizeWindow * ySizeWindow);
      WM_InvalidateWindow(hWin);
    }
    //
    // Copy data from drawing device into windows memory device
    //
    for (i = 0, pDataWin += xSizeWindow * (ySizeWindow - 1) + Cnt; i <= yPos; i++, pDataWin -= xSizeWindow, pDataDraw++) {
      *pDataWin = *pDataDraw;
    }
    //
    // Optimized invalidating, only the new line will be drawn
    //
    Rect.x0 = Rect.x1 = Cnt;
    WM_InvalidateRect(hWin, &Rect);
    //
    // Increment counter
    //
    Cnt++;
    Cnt = (Cnt >= 100) ? 0 : Cnt;
    //
    // Modify random value
    //
    yPos += (rand() % 5) - 2;
    yPos = (yPos < 0) ? 0 : (yPos >= ySizeWindow) ? ySizeWindow - 1 : yPos;
    //
    // Wait a while and redraw window
    //
    GUI_Delay(50);
  }
}