| 2487 | static int s_AutoMapReferenceCurrent = -100; |
| 2488 | |
| 2489 | CUi::EPopupMenuFunctionResult CEditor::PopupSelectAutoMapReference(void *pContext, CUIRect View, bool Active) |
| 2490 | { |
| 2491 | CEditor *pEditor = static_cast<CEditor *>(pContext); |
| 2492 | std::shared_ptr<CLayerTiles> pLayer = std::static_pointer_cast<CLayerTiles>(pEditor->Map()->SelectedLayer(0)); |
| 2493 | |
| 2494 | const float ButtonHeight = 12.0f; |
| 2495 | const float ButtonMargin = 2.0f; |
| 2496 | |
| 2497 | static CListBox s_ListBox; |
| 2498 | s_ListBox.DoStart(ButtonHeight, std::size(AUTOMAP_REFERENCE_NAMES) + 1, 1, 4, s_AutoMapReferenceCurrent + 1, &View, false); |
| 2499 | s_ListBox.DoAutoSpacing(ButtonMargin); |
| 2500 | |
| 2501 | for(int i = 0; i < static_cast<int>(std::size(AUTOMAP_REFERENCE_NAMES)) + 1; i++) |
| 2502 | { |
| 2503 | static int s_NoneButton = 0; |
| 2504 | CListboxItem Item = s_ListBox.DoNextItem(i == 0 ? (void *)&s_NoneButton : AUTOMAP_REFERENCE_NAMES[i - 1], (i - 1) == s_AutoMapReferenceCurrent, 3.0f); |
| 2505 | if(!Item.m_Visible) |
| 2506 | continue; |
| 2507 | |
| 2508 | CUIRect Label; |
| 2509 | Item.m_Rect.VMargin(5.0f, &Label); |
| 2510 | |
| 2511 | SLabelProperties Props; |
| 2512 | Props.m_MaxWidth = Label.w; |
| 2513 | Props.m_EllipsisAtEnd = true; |
| 2514 | pEditor->Ui()->DoLabel(&Label, i == 0 ? "None" : AUTOMAP_REFERENCE_NAMES[i - 1], EditorFontSizes::MENU, TEXTALIGN_ML, Props); |
| 2515 | } |
| 2516 | |
| 2517 | int NewSelected = s_ListBox.DoEnd() - 1; |
| 2518 | if(NewSelected != s_AutoMapReferenceCurrent) |
| 2519 | s_AutoMapReferenceSelected = NewSelected; |
| 2520 | |
| 2521 | return CUi::POPUP_KEEP_OPEN; |
| 2522 | } |
| 2523 | |
| 2524 | void CEditor::PopupSelectAutoMapReferenceInvoke(int Current, float x, float y) |
| 2525 | { |
nothing calls this directly
no test coverage detected