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); } }
static void UpdateListViewContent(WM_HWIN thisListView) { int selMMSI = 0; int selRow = 0; if(N_boat <= 0){ LISTVIEW_GetItemText(thisListView, LV_AllList_Col_MMSI, 0, pStrBuf, 11); if(strlen(pStrBuf) > 0){ LV_JumpToRowOf(thisListView, 0); } else{ return ; } } selRow = LISTVIEW_GetSel(thisListView); LISTVIEW_GetItemText(thisListView, LV_AllList_Col_MMSI, selRow, pStrBuf, 11); }
void ProcListviewChanged() { int currentSelected = LISTVIEW_GetSel(hListview); char buf[10]; LISTVIEW_GetItemText(hListview, 1, currentSelected, buf, 10); int dis; int res = sscanf(buf, "%d", &dis); if (res == 1) { printf("[Listview] sel = %d, dis = %d\r\n", currentSelected, dis); int led = (dis / 10) - 1; if (led >= 0 && led < 6) { LEDDecoderSet(led); } } }
void OnxxxClicked_SAVE(WM_MESSAGE * pMsg,ESaveState save_state) { int i,j,k; LISTVIEW_Handle hObj; char buf[10]; hObj = WM_GetDialogItem(pMsg->hWin,GUI_ID_LISTVIEW_RESULT); tget_record.act_record_lenth = LISTVIEW_GetNumRows(hObj); for(i=0;i<LISTVIEW_GetNumRows(hObj);i++) { LISTVIEW_GetItemText(hObj,0,i,tget_record.sig_record[i].order,4); LISTVIEW_GetItemText(hObj,1,i,tget_record.sig_record[i].V1,5); LISTVIEW_GetItemText(hObj,2,i,tget_record.sig_record[i].V2,5); LISTVIEW_GetItemText(hObj,3,i,tget_record.sig_record[i].result_r_e,5); LISTVIEW_GetItemText(hObj,4,i,tget_record.sig_record[i].state,8); LISTVIEW_GetItemText(hObj,5,i,tget_record.sig_record[i].time,6); LISTVIEW_GetItemText(hObj,6,i,tget_record.sig_record[i].dir,3); } if(save_state == RemberToSd) { tget_record.year = Tim.year; tget_record.month = Tim.month; tget_record.date = Tim.date; file_clear(); save_custormer(); save_parameters(); save_get_record(); } }
static void LV_JumpToRowOf(WM_HWIN thisListView, int row) { int visibleRowNum = 0; /// 本页可见的列表项条目数 int orgIndex = 0; /// 本页起始列表项对应的SimpBerth索引 int i = 0; if(row+1 < N_boat){ row = N_boat -1; } visibleRowNum = (N_boat-1) % LV_PAGE_SIZE +1; orgIndex = N_boat - visibleRowNum; for(i=0; i<visibleRowNum; i++){ disttostr(pStrBuf, SimpBerthes[orgIndex].Dist); LISTVIEW_SetItemText(thisListView, LV_AllList_Col_DIST, i, pStrBuf); sprintf(pStrBuf, "%09ld", SimpBerthes[orgIndex].pBerth->Boat.user_id); LISTVIEW_SetItemText(thisListView, LV_AllList_Col_MMSI, i, pStrBuf); if(MNTState_None == SimpBerthes[orgIndex].pBerth->mntState){ LISTVIEW_SetItemText(thisListView, LV_AllList_Col_STT, i, "啊"); } else{ LISTVIEW_SetItemText(thisListView, LV_AllList_Col_STT, i, "吖"); } } for(; i<LV_PAGE_SIZE; i++){ LISTVIEW_GetItemText(thisListView, LV_AllList_Col_MMSI, i, pStrBuf, 11); if(strlen(pStrBuf) > 0){ 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, visibleRowNum -1); }
void OnButtonTSaveClicked(WM_MESSAGE * pMsg,ESaveState save_state) { int i,j,k; LISTVIEW_Handle hObj; char buf[10]; hObj = WM_GetDialogItem(pMsg->hWin,GUI_ID_LISTVIEW_RESULT_T); tget_record.act_record_lenth = LISTVIEW_GetNumRows(hObj); for(i=0;i<LISTVIEW_GetNumRows(hObj);i++) { LISTVIEW_GetItemText(hObj,0,i,tget_record.sig_record[i].order,4); LISTVIEW_GetItemText(hObj,1,i,tget_record.sig_record[i].V1,5); LISTVIEW_GetItemText(hObj,2,i,tget_record.sig_record[i].V2,5); LISTVIEW_GetItemText(hObj,3,i,tget_record.sig_record[i].result_r_e,5); LISTVIEW_GetItemText(hObj,4,i,tget_record.sig_record[i].state,8); LISTVIEW_GetItemText(hObj,5,i,tget_record.sig_record[i].time,6); LISTVIEW_GetItemText(hObj,6,i,tget_record.sig_record[i].dir,3); } if(save_state == RemberToSd) { tget_record.year = Tim.year; tget_record.month = Tim.month; tget_record.date = Tim.date; file_clear(); save_data_to_file( "speedt.lt", (TCustormer*)&custormer,sizeof(TCustormer)); save_data_to_file( "speedt.lt", (TTPars*)&ttpars,sizeof(TTPars)); save_data_to_file( "speedt.lt", (TGetRecord*)&tget_record,sizeof(TGetRecord)); } }
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; } }
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); }
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; } }
/********************************************************************* * * _cbDialog */ static void _cbDialog(WM_MESSAGE * pMsg) { WM_HWIN hItem; int SelectedRow = -1; long SelectedMMSI = 0; int i; switch (pMsg->MsgId) { case USER_MSG_LV_UPDATE: updateListViewContent(WM_GetDialogItem(pMsg->hWin, ID_LISTVIEW_0)); break; case USER_MSG_SKIN: pSkin = &(lvWinSkins[pMsg->Data.v]); INFO("case skin:%s",pMsg->Data.v==SKIN_Day?"Day":"Night"); WINDOW_SetBkColor(pMsg->hWin,pSkin->bkColor); hItem = WM_GetDialogItem(pMsg->hWin, ID_TEXT_0); TEXT_SetTextColor(hItem, pSkin->ttl_Text); hItem = WM_GetDialogItem(pMsg->hWin, ID_TEXT_1); TEXT_SetTextColor(hItem, pSkin->ttl_Text); hItem = WM_GetDialogItem(pMsg->hWin, ID_TEXT_2); TEXT_SetTextColor(hItem, pSkin->inf_Label); hItem = WM_GetDialogItem(pMsg->hWin, ID_TEXT_3); TEXT_SetTextColor(hItem, pSkin->inf_Label); hItem = WM_GetDialogItem(pMsg->hWin, ID_TEXT_4); TEXT_SetTextColor(hItem, pSkin->inf_Label); hItem = WM_GetDialogItem(pMsg->hWin, ID_TEXT_5); TEXT_SetTextColor(hItem, pSkin->inf_Label); hItem = WM_GetDialogItem(pMsg->hWin, ID_TEXT_6); TEXT_SetTextColor(hItem, pSkin->inf_Label); hItem = WM_GetDialogItem(pMsg->hWin, ID_LISTVIEW_0); LISTVIEW_SetBkColor(hItem, LISTVIEW_CI_UNSEL, pSkin->itm_bkUnsel); LISTVIEW_SetBkColor(hItem, LISTVIEW_CI_SEL, pSkin->itm_bkSel); LISTVIEW_SetBkColor(hItem, LISTVIEW_CI_SELFOCUS, pSkin->itm_bkFocus); LISTVIEW_SetTextColor(hItem,LISTVIEW_CI_UNSEL, pSkin->itm_txUnsel); LISTVIEW_SetTextColor(hItem,LISTVIEW_CI_SEL, pSkin->itm_txSel); LISTVIEW_SetTextColor(hItem,LISTVIEW_CI_SELFOCUS, pSkin->itm_txFocus); hItem = LISTVIEW_GetHeader(hItem); HEADER_SetBkColor(hItem,pSkin->Header_Bk); HEADER_SetTextColor(hItem,pSkin->Header_Text); break; case WM_INIT_DIALOG: pSkin = &(lvWinSkins[SysConf.Skin]); hItem = pMsg->hWin; WINDOW_SetBkColor(hItem, pSkin->bkColor); hItem = WM_GetDialogItem(pMsg->hWin, ID_TEXT_0); TEXT_SetTextColor(hItem, pSkin->ttl_Text); hItem = WM_GetDialogItem(pMsg->hWin, ID_TEXT_1); TEXT_SetTextColor(hItem, pSkin->ttl_Text); hItem = WM_GetDialogItem(pMsg->hWin, ID_TEXT_2); TEXT_SetTextColor(hItem, pSkin->inf_Label); hItem = WM_GetDialogItem(pMsg->hWin, ID_TEXT_3); TEXT_SetTextColor(hItem, pSkin->inf_Label); hItem = WM_GetDialogItem(pMsg->hWin, ID_TEXT_4); TEXT_SetTextColor(hItem, pSkin->inf_Label); hItem = WM_GetDialogItem(pMsg->hWin, ID_TEXT_5); TEXT_SetTextColor(hItem, pSkin->inf_Label); hItem = WM_GetDialogItem(pMsg->hWin, ID_TEXT_6); TEXT_SetTextColor(hItem, pSkin->inf_Label); hItem = WM_GetDialogItem(pMsg->hWin, ID_LISTVIEW_0); WM_SetCallback(hItem, &myListViewListener); LISTVIEW_AddColumn(hItem, LV_AllList_Col_0_WIDTH, "距离", GUI_TA_HCENTER | GUI_TA_VCENTER); LISTVIEW_AddColumn(hItem, LV_AllList_Col_2_WIDTH, "MMSI", GUI_TA_HCENTER | GUI_TA_VCENTER); LISTVIEW_AddColumn(hItem, LV_AllList_Col_3_WIDTH, "状态", GUI_TA_HCENTER | GUI_TA_VCENTER); LISTVIEW_AddRow(hItem, NULL); LISTVIEW_SetGridVis(hItem, 1); LISTVIEW_SetHeaderHeight(hItem,LV_MoniteList_Header_HEIGHT); LISTVIEW_SetRowHeight(hItem,LV_MoniteList_Row_HEIGHT); LISTVIEW_SetFont(hItem,&GUI_Font30); LISTVIEW_SetBkColor(hItem, LISTVIEW_CI_UNSEL, pSkin->itm_bkUnsel); LISTVIEW_SetBkColor(hItem, LISTVIEW_CI_SEL, pSkin->itm_bkSel); LISTVIEW_SetBkColor(hItem, LISTVIEW_CI_SELFOCUS, pSkin->itm_bkFocus); LISTVIEW_SetTextColor(hItem,LISTVIEW_CI_UNSEL, pSkin->itm_txUnsel); LISTVIEW_SetTextColor(hItem,LISTVIEW_CI_SEL, pSkin->itm_txSel); LISTVIEW_SetTextColor(hItem,LISTVIEW_CI_SELFOCUS, pSkin->itm_txFocus); for(i=LV_PAGE_SIZE; i>0; i--) { LISTVIEW_AddRow(hItem, NULL); } LISTVIEW_SetSel(hItem, 0); hItem = LISTVIEW_GetHeader(hItem); HEADER_SetBkColor(hItem,pSkin->Header_Bk); HEADER_SetTextColor(hItem,pSkin->Header_Text); isSub2Inited = 1; break; case WM_PAINT: GUI_SetColor(pSkin->inf_bkColor); GUI_FillRectEx(&infoRect); GUI_SetTextMode(GUI_TM_TRANS); GUI_SetFont(&GUI_Font24); GUI_SetColor(pSkin->inf_Label); GUI_DispStringAt("按确定键选择或取消选择监控的网位仪", LV_AllList_WIDTH+20, LV_AllList_Y+240); GUI_SetFont(&GUI_Font24_1); GUI_SetColor(pSkin->inf_txColor); hItem = WM_GetDialogItem(pMsg->hWin, ID_LISTVIEW_0); if(WM_HasFocus(hItem) == FALSE) { sprintf(pStrBuf, " 0/%3d", N_boat); GUI_DispStringAt(pStrBuf,LV_AllList_WIDTH-80,LV_AllList_Y-20); break; } // if( N_boat <= 0 ){ // sprintf(pStrBuf, " 0/ 0"); // GUI_DispStringAt(pStrBuf, LV_AllList_WIDTH-80, LV_AllList_Y-20); // break; // } SelectedRow = LISTVIEW_GetSel(hItem); LISTVIEW_GetItemText(WM_GetDialogItem(pMsg->hWin, ID_LISTVIEW_0), LV_AllList_Col_MMSI, SelectedRow, pStrBuf, 11); SelectedMMSI = strtoi(pStrBuf); if(SelectedMMSI <= 0) { sprintf(pStrBuf," 0/%3d", N_boat); GUI_DispStringAt(pStrBuf,LV_AllList_WIDTH-80,LV_AllList_Y-20); break; } for(i=0; i<N_boat ; i++) { if(SimpBerthes[i].pBerth->Boat.user_id == SelectedMMSI) { break; } } if(i<N_boat) { sprintf(pStrBuf,"%3d/%3d", i+1 ,N_boat); GUI_DispStringAt(pStrBuf,LV_AllList_WIDTH-80,LV_AllList_Y-20); GUI_DispStringAt(SimpBerthes[i].pBerth->Boat.name,LV_AllList_WIDTH+80,85); lltostr(SimpBerthes[i].latitude,pStrBuf); GUI_DispStringAt(pStrBuf,LV_AllList_WIDTH+80,125); lltostr(SimpBerthes[i].longitude,pStrBuf); GUI_DispStringAt(pStrBuf,LV_AllList_WIDTH+80,165); // if(SysConf.Unit == UNIT_km) // { // int sog = SimpBerthes[i].pBerth->Boat.SOG *18; // sprintf(pStrBuf, "%3d.%02dkm",sog/100, sog%100); // } // else // { // sprintf(pStrBuf, "%2d.%dkt", SimpBerthes[i].pBerth->Boat.SOG/10, // SimpBerthes[i].pBerth->Boat.SOG%10); // } sprintf(pStrBuf, "%2d.%dkt", SimpBerthes[i].pBerth->Boat.SOG/10, SimpBerthes[i].pBerth->Boat.SOG%10); GUI_DispStringAt(pStrBuf, LV_AllList_WIDTH+80,205); sprintf(pStrBuf, "%3d", SimpBerthes[i].pBerth->Boat.COG/10); pStrBuf[3] = 194; pStrBuf[4] = 176; pStrBuf[5] = '\0'; GUI_DispStringAt(pStrBuf,LV_AllList_WIDTH+80,245); } break; default: WM_DefaultProc(pMsg); break; } }