static void OnPaintListItem(WindowControl * Sender, LKSurface& Surface) { if (!Sender) { return; } unsigned int n = UpLimit - LowLimit; TCHAR sTmp[50]; Surface.SetTextColor(RGB_BLACK); const int LineHeight = Sender->GetHeight(); const int TextHeight = Surface.GetTextHeight(_T("dp")); const int TextPos = (LineHeight - TextHeight) / 2; // offset for text vertical center if (DrawListIndex < n) { const size_t i = (FullFlag) ? StrIndex[LowLimit + DrawListIndex] : (LowLimit + DrawListIndex); // Poco::Thread::sleep(100); const int width = Sender->GetWidth(); // total width const int w0 = LineHeight; // Picto Width const int w2 = Surface.GetTextWidth(TEXT(" 000km")); // distance Width _stprintf(sTmp, _T(" 000%s "), MsgToken(2179)); const int w3 = Surface.GetTextWidth(sTmp); // bearing width const int w1 = width - w0 - 2*w2 - w3; // Max Name width // Draw Picto const RECT PictoRect = {0, 0, w0, LineHeight}; AirspaceSelectInfo[i].airspace->DrawPicto(Surface, PictoRect); // Draw Name Surface.DrawTextClip(w0, TextPos, AirspaceSelectInfo[i].airspace->Name() , w1); LK_tcsncpy(sTmp, CAirspaceManager::GetAirspaceTypeShortText(AirspaceSelectInfo[i].Type) , 4); const int w4 = Surface.GetTextWidth(sTmp); Surface.DrawTextClip(w1+w2, TextPos, sTmp,w4); // Draw Distance : right justified after waypoint Name _stprintf(sTmp, TEXT("%.0f%s"), AirspaceSelectInfo[i].Distance , Units::GetDistanceName()); const int x2 = width - w3 - Surface.GetTextWidth(sTmp); Surface.DrawText(x2, TextPos, sTmp); // Draw Bearing right justified after distance _stprintf(sTmp, TEXT("%d%s"), iround(AirspaceSelectInfo[i].Direction), MsgToken(2179)); const int x3 = width - Surface.GetTextWidth(sTmp); Surface.DrawText(x3, TextPos, sTmp); } else { if (DrawListIndex == 0) { // LKTOKEN _@M466_ = "No Match!" Surface.DrawText(IBLSCALE(2), TextPos, MsgToken(466)); } } }
void OnPaintListItem(WindowControl * Sender, LKSurface& Surface) { CBtHandler* pBtHandler = CBtHandler::Get(); if (pBtHandler) { CBtDevice * bt = pBtHandler->GetDevice(DrawListIndex); if (bt) { int w1 = Surface.GetTextWidth(TEXT("PAIRED")); int w0 = Sender->GetWidth(); Surface.DrawTextClip(2 * ScreenScale, 2 * ScreenScale, bt->GetName().c_str(), w0 - w1 - ScreenScale * 5); if ((bt->m_src & (BDSRC_REGSVC | BDSRC_REGNAV | BDSRC_REGPIN))) { Surface.DrawTextClip(2 * ScreenScale + w0 - w1, 2 * ScreenScale, _T("Paired"), w1); } } } }
static void OnPaintComboPopupListItem(WindowControl * Sender, LKSurface& Surface) { if (Sender) { if (ComboListPopup->ComboPopupDrawListIndex >= 0 && ComboListPopup->ComboPopupDrawListIndex < ComboListPopup->ComboPopupItemCount) { // Fill Background with Highlight color if Selected Item if (!Sender->HasFocus() && ComboListPopup->ComboPopupItemIndex == ComboListPopup->ComboPopupDrawListIndex) { RECT rc = Sender->GetClientRect(); Surface.FillRect(&rc, LKBrush_Higlighted); } const int w = Sender->GetWidth(); const int h = Sender->GetHeight(); const TCHAR* szText = ComboListPopup->ComboPopupItemList[ComboListPopup->ComboPopupDrawListIndex]->StringValueFormatted; Surface.SetBackgroundTransparent(); Surface.SetTextColor(RGB_BLACK); const int xText = 3 * ScreenScale; const int yText = (h - Surface.GetTextHeight(szText)) / 2; Surface.DrawTextClip(xText, yText, szText, w - ScreenScale * 5); } } }
void OnPaintIgcFileListItem(WindowControl * Sender, LKSurface& Surface) { if (DrawListIndex < FileList.size()) { FileList_t::const_iterator ItFileName = FileList.begin(); std::advance(ItFileName, DrawListIndex); int w0 = Sender->GetWidth(); Surface.SetTextColor(RGB_BLACK); Surface.DrawTextClip(2 * ScreenScale, 2 * ScreenScale, ItFileName->c_str(), w0 - ScreenScale * 5); } }
static void OnAirspacePaintListItem(WindowControl * Sender, LKSurface& Surface){ TCHAR label[40]; (void)Sender; if (DrawListIndex < AIRSPACECLASSCOUNT){ int i = DrawListIndex; LK_tcsncpy(label, CAirspaceManager::Instance().GetAirspaceTypeText(i), 39); int w0, w1, w2, x0; if (ScreenLandscape) { w0 = 202*ScreenScale; } else { w0 = 225*ScreenScale; } // LKTOKEN _@M789_ = "Warn" w1 = Surface.GetTextWidth(MsgToken(789))+ScreenScale*10; // LKTOKEN _@M241_ = "Display" w2 = Surface.GetTextWidth(MsgToken(241))+ScreenScale*10; x0 = w0-w1-w2; Surface.SetTextColor(RGB_BLACK); Surface.DrawTextClip(2*ScreenScale, 2*ScreenScale, label, x0-ScreenScale*10); if (colormode) { Surface.SelectObject(LK_WHITE_PEN); Surface.SelectObject(LKBrush_White); Surface.Rectangle(x0, 2*ScreenScale,w0, 22*ScreenScale); Surface.SetTextColor(MapWindow::GetAirspaceColourByClass(i)); Surface.SetBkColor(LKColor(0xFF, 0xFF, 0xFF)); Surface.SelectObject(MapWindow::GetAirspaceBrushByClass(i)); Surface.Rectangle(x0, 2*ScreenScale,w0, 22*ScreenScale); } else { bool iswarn; bool isdisplay; iswarn = (MapWindow::iAirspaceMode[i]>=2); isdisplay = ((MapWindow::iAirspaceMode[i]%2)>0); if (iswarn) { // LKTOKEN _@M789_ = "Warn" _tcscpy(label, MsgToken(789)); Surface.DrawText(w0-w1-w2, 2*ScreenScale, label); } if (isdisplay) { // LKTOKEN _@M241_ = "Display" _tcscpy(label, MsgToken(241)); Surface.DrawText(w0-w2, 2*ScreenScale, label); } } } }
static void OnTaskPaintListItem(WindowControl * Sender, LKSurface& Surface){ int n = UpLimit - LowLimit; TCHAR sTmp[120]; TCHAR wpName[120]; TCHAR landableStr[5] = TEXT(" [X]"); // LKTOKEN _@M1238_ "L" landableStr[2] = MsgToken(1238)[0]; LockTaskData(); const PixelRect rcClient(Sender->GetClientRect()); const int w0 = rcClient.GetSize().cx - DLGSCALE(1); const int w1 = Surface.GetTextWidth(TEXT(" 000km")); _stprintf(sTmp, _T(" 000%s"), MsgToken(2179)); const int w2 = Surface.GetTextWidth(sTmp); const int TextMargin = (rcClient.GetSize().cy - Surface.GetTextHeight(TEXT("A"))) / 2; const int p1 = w0-w1-w2- rcClient.GetSize().cy - DLGSCALE(2); const int p2 = w0-w2- rcClient.GetSize().cy - DLGSCALE(2); const PixelRect rc = { 0, 0, rcClient.GetSize().cy, rcClient.GetSize().cy }; if (DrawListIndex < n){ int i = LowLimit + DrawListIndex; // if ((WayPointList[Task[i].Index].Flags & LANDPOINT) >0) // MapWindow::DrawRunway(hDC, &WayPointList[Task[i].Index], rc, 3000,true); MapWindow::DrawTaskPicto(Surface, DrawListIndex, rc, 2500); if (Task[i].Index>=0) { _stprintf(wpName, TEXT("%s%s"), WayPointList[Task[i].Index].Name, (WayPointList[Task[i].Index].Flags & LANDPOINT) ? landableStr : TEXT("")); if (AATEnabled && ValidTaskPoint(i+1) && (i>0)) { if (Task[i].AATType==0 || Task[i].AATType==3) { _stprintf(sTmp, TEXT("%s %.1f"), wpName, Task[i].AATCircleRadius*DISTANCEMODIFY); } else { if(Task[i].AATType==2 && DoOptimizeRoute()) { _stprintf(sTmp, TEXT("%s %.1f/1"), wpName, Task[i].PGConeSlope); } else { _stprintf(sTmp, TEXT("%s %.1f"), wpName, Task[i].AATSectorRadius*DISTANCEMODIFY); } } } else { _stprintf(sTmp, TEXT("%s"), wpName); } Surface.SetBackgroundTransparent(); Surface.SetTextColor(RGB_BLACK); Surface.DrawTextClip(rc.right + DLGSCALE(2), TextMargin, sTmp, p1-DLGSCALE(4)); _stprintf(sTmp, TEXT("%.0f %s"),Task[i].Leg*DISTANCEMODIFY,Units::GetDistanceName()); Surface.DrawText(rc.right+p1+w1-Surface.GetTextWidth(sTmp), TextMargin, sTmp); _stprintf(sTmp, TEXT("%d%s"), iround(Task[i].InBound),MsgToken(2179)); Surface.DrawText(rc.right +p2+w2-Surface.GetTextWidth(sTmp), TextMargin, sTmp); } } else { Surface.SetTextColor(RGB_BLACK); // if (DrawListIndex==n) { // patchout 091126 if (DrawListIndex==n && UpLimit < MAXTASKPOINTS) { // patch 091126 // LKTOKEN _@M832_ = "add waypoint" _stprintf(sTmp, TEXT(" (%s)"), MsgToken(832)); Surface.DrawText(rc.right +DLGSCALE(2), TextMargin, sTmp); } else if ((DrawListIndex==n+1) && ValidTaskPoint(0)) { if (!AATEnabled || ISPARAGLIDER) { // LKTOKEN _@M735_ = "Total:" Surface.DrawText(rc.right +DLGSCALE(2), TextMargin, MsgToken(735)); _stprintf(sTmp, TEXT("%.0f %s%s"), lengthtotal*DISTANCEMODIFY, Units::GetDistanceName(), fai_ok?_T(" FAI"):_T("")); Surface.DrawText(rc.right +p1+w1-Surface.GetTextWidth(sTmp), TextMargin, sTmp); } else { double d1 = CALCULATED_INFO.TaskDistanceToGo; if ((CALCULATED_INFO.TaskStartTime>0.0) && (CALCULATED_INFO.Flying) && (ActiveTaskPoint>0)) { d1 += CALCULATED_INFO.TaskDistanceCovered; } if (d1==0.0) { d1 = CALCULATED_INFO.AATTargetDistance; } _stprintf(sTmp, TEXT("%s %.0f min %.0f (%.0f) %s"), // LKTOKEN _@M735_ = "Total:" MsgToken(735), AATTaskLength*1.0, DISTANCEMODIFY*lengthtotal, DISTANCEMODIFY*d1, Units::GetDistanceName()); Surface.DrawText(rc.right +DLGSCALE(2), TextMargin, sTmp); } } } UnlockTaskData(); }
static void OnTaskPaintListItem(WindowControl * Sender, LKSurface& Surface){ (void)Sender; int n = UpLimit - LowLimit; TCHAR sTmp[120]; TCHAR wpName[120]; TCHAR landableStr[5] = TEXT(" [X]"); // LKTOKEN _@M1238_ "L" landableStr[2] = gettext(TEXT("_@M1238_"))[0]; LockTaskData(); int w0 = Sender->GetWidth()-1; int w1 = Surface.GetTextWidth(TEXT(" 000km")); _stprintf(sTmp, _T(" 000%s"), gettext(_T("_@M2179_"))); int w2 = Surface.GetTextWidth(sTmp); int TextMargin = (Sender->GetHeight() - Surface.GetTextHeight(TEXT("A"))) / 2; int p1 = w0-w1-w2- Sender->GetHeight()-2; int p2 = w0-w2- Sender->GetHeight()-2; RECT rc = {0*ScreenScale, 0*ScreenScale, Sender->GetHeight(), Sender->GetHeight()}; if (DrawListIndex < n){ int i = LowLimit + DrawListIndex; // if ((WayPointList[Task[i].Index].Flags & LANDPOINT) >0) // MapWindow::DrawRunway(hDC, &WayPointList[Task[i].Index], rc, 3000,true); MapWindow::DrawTaskPicto(Surface, DrawListIndex, rc, 2500); if (Task[i].Index>=0) { _stprintf(wpName, TEXT("%s%s"), WayPointList[Task[i].Index].Name, (WayPointList[Task[i].Index].Flags & LANDPOINT) ? landableStr : TEXT("")); if (AATEnabled && ValidTaskPoint(i+1) && (i>0)) { if (Task[i].AATType==0) { _stprintf(sTmp, TEXT("%s %.1f"), wpName, Task[i].AATCircleRadius*DISTANCEMODIFY); } else { if(Task[i].AATType==2 && DoOptimizeRoute()) { _stprintf(sTmp, TEXT("%s %.1f/1"), wpName, Task[i].PGConeSlope); } else { _stprintf(sTmp, TEXT("%s %.1f"), wpName, Task[i].AATSectorRadius*DISTANCEMODIFY); } } } else { _stprintf(sTmp, TEXT("%s"), wpName); } Surface.SetBackgroundTransparent(); Surface.SetTextColor(RGB_BLACK); Surface.DrawTextClip(Sender->GetHeight()+2*ScreenScale, TextMargin, sTmp, p1-4*ScreenScale); _stprintf(sTmp, TEXT("%.0f %s"), Task[i].Leg*DISTANCEMODIFY, Units::GetDistanceName()); Surface.DrawText(Sender->GetHeight()+p1+w1-Surface.GetTextWidth(sTmp), TextMargin, sTmp, _tcslen(sTmp)); _stprintf(sTmp, TEXT("%d%s"), iround(Task[i].InBound),gettext(_T("_@M2179_"))); Surface.DrawText(Sender->GetHeight()+p2+w2-Surface.GetTextWidth(sTmp), TextMargin, sTmp, _tcslen(sTmp)); } } else { Surface.SetTextColor(RGB_BLACK); // if (DrawListIndex==n) { // patchout 091126 if (DrawListIndex==n && UpLimit < MAXTASKPOINTS) { // patch 091126 // LKTOKEN _@M832_ = "add waypoint" _stprintf(sTmp, TEXT(" (%s)"), gettext(TEXT("_@M832_"))); Surface.DrawText(Sender->GetHeight()+2*ScreenScale, TextMargin, sTmp, _tcslen(sTmp)); } else if ((DrawListIndex==n+1) && ValidTaskPoint(0)) { if (!AATEnabled || ISPARAGLIDER) { // LKTOKEN _@M735_ = "Total:" _tcscpy(sTmp, gettext(TEXT("_@M735_"))); Surface.DrawText(Sender->GetHeight()+2*ScreenScale, TextMargin, sTmp, _tcslen(sTmp)); if (fai_ok) { _stprintf(sTmp, TEXT("%.0f %s FAI"), lengthtotal*DISTANCEMODIFY, Units::GetDistanceName()); } else { _stprintf(sTmp, TEXT("%.0f %s"), lengthtotal*DISTANCEMODIFY, Units::GetDistanceName()); } Surface.DrawText(Sender->GetHeight()+p1+w1-Surface.GetTextWidth(sTmp), TextMargin, sTmp, _tcslen(sTmp)); } else { double d1 = CALCULATED_INFO.TaskDistanceToGo; if ((CALCULATED_INFO.TaskStartTime>0.0) && (CALCULATED_INFO.Flying) && (ActiveWayPoint>0)) { d1 += CALCULATED_INFO.TaskDistanceCovered; } if (d1==0.0) { d1 = CALCULATED_INFO.AATTargetDistance; } _stprintf(sTmp, TEXT("%s %.0f min %.0f (%.0f) %s"), // LKTOKEN _@M735_ = "Total:" gettext(TEXT("_@M735_")), AATTaskLength*1.0, DISTANCEMODIFY*lengthtotal, DISTANCEMODIFY*d1, Units::GetDistanceName()); Surface.DrawText(Sender->GetHeight()+2*ScreenScale, TextMargin, sTmp, _tcslen(sTmp)); } } } UnlockTaskData(); }