| 2426 | static int s_AutoMapConfigCurrent = -100; |
| 2427 | |
| 2428 | CUi::EPopupMenuFunctionResult CEditor::PopupSelectConfigAutoMap(void *pContext, CUIRect View, bool Active) |
| 2429 | { |
| 2430 | CEditor *pEditor = static_cast<CEditor *>(pContext); |
| 2431 | std::shared_ptr<CLayerTiles> pLayer = std::static_pointer_cast<CLayerTiles>(pEditor->Map()->SelectedLayer(0)); |
| 2432 | CAutoMapper *pAutoMapper = &pEditor->Map()->m_vpImages[pLayer->m_Image]->m_AutoMapper; |
| 2433 | |
| 2434 | const float ButtonHeight = 12.0f; |
| 2435 | const float ButtonMargin = 2.0f; |
| 2436 | |
| 2437 | static CListBox s_ListBox; |
| 2438 | s_ListBox.DoStart(ButtonHeight, pAutoMapper->ConfigNamesNum() + 1, 1, 4, s_AutoMapConfigCurrent + 1, &View, false); |
| 2439 | s_ListBox.SetScrollbarWidth(15.0f); |
| 2440 | s_ListBox.DoAutoSpacing(ButtonMargin); |
| 2441 | |
| 2442 | for(int i = 0; i < pAutoMapper->ConfigNamesNum() + 1; i++) |
| 2443 | { |
| 2444 | static int s_NoneButton = 0; |
| 2445 | CListboxItem Item = s_ListBox.DoNextItem(i == 0 ? (void *)&s_NoneButton : pAutoMapper->GetConfigName(i - 1), (i - 1) == s_AutoMapConfigCurrent, 3.0f); |
| 2446 | if(!Item.m_Visible) |
| 2447 | continue; |
| 2448 | |
| 2449 | CUIRect Label; |
| 2450 | Item.m_Rect.VMargin(5.0f, &Label); |
| 2451 | |
| 2452 | SLabelProperties Props; |
| 2453 | Props.m_MaxWidth = Label.w; |
| 2454 | Props.m_EllipsisAtEnd = true; |
| 2455 | pEditor->Ui()->DoLabel(&Label, i == 0 ? "None" : pAutoMapper->GetConfigName(i - 1), EditorFontSizes::MENU, TEXTALIGN_ML, Props); |
| 2456 | } |
| 2457 | |
| 2458 | int NewSelected = s_ListBox.DoEnd() - 1; |
| 2459 | if(NewSelected != s_AutoMapConfigCurrent) |
| 2460 | s_AutoMapConfigSelected = NewSelected; |
| 2461 | |
| 2462 | return CUi::POPUP_KEEP_OPEN; |
| 2463 | } |
| 2464 | |
| 2465 | void CEditor::PopupSelectConfigAutoMapInvoke(int Current, float x, float y) |
| 2466 | { |
nothing calls this directly
no test coverage detected