| 2244 | auto AnyClosableIn = [this, &Order, Count](int32 First, int32 Last, int32 Skip) -> bool |
| 2245 | { |
| 2246 | for (int32 i = eastl::max(0, First); i <= Last && i < Count; ++i) |
| 2247 | { |
| 2248 | if (i != Skip && CanCloseTool(Order[i])) |
| 2249 | { |
| 2250 | return true; |
| 2251 | } |
| 2252 | } |
| 2253 | return false; |
| 2254 | }; |
| 2255 | |
| 2256 | auto CloseRange = [this, &Order, Count](int32 First, int32 Last, int32 Skip) |
| 2257 | { |
| 2258 | for (int32 i = eastl::max(0, First); i <= Last && i < Count; ++i) |
| 2259 | { |
| 2260 | if (i != Skip) |
| 2261 | { |
| 2262 | RequestCloseTool(Order[i]); |
| 2263 | } |
| 2264 | } |
| 2265 | }; |
| 2266 | |
| 2267 | if (ImGui::MenuItem(LE_ICON_CLOSE " Close", nullptr, false, CanCloseTool(EditorTool))) |
| 2268 | { |
| 2269 | RequestCloseTool(EditorTool); |
| 2270 | } |
| 2271 | |
| 2272 | if (ImGui::MenuItem("Close Others", nullptr, false, SelfIndex >= 0 && AnyClosableIn(0, Count - 1, SelfIndex))) |
| 2273 | { |
| 2274 | CloseRange(0, Count - 1, SelfIndex); |
| 2275 | } |
| 2276 | |
| 2277 | if (ImGui::MenuItem("Close to the Right", nullptr, false, SelfIndex >= 0 && AnyClosableIn(SelfIndex + 1, Count - 1, -1))) |
| 2278 | { |
| 2279 | CloseRange(SelfIndex + 1, Count - 1, -1); |
| 2280 | } |
| 2281 | |
| 2282 | ImGui::Separator(); |
| 2283 | |
| 2284 | if (ImGui::MenuItem("Close All", nullptr, false, AnyClosableIn(0, Count - 1, -1))) |
| 2285 | { |
| 2286 | CloseRange(0, Count - 1, -1); |
| 2287 | } |
| 2288 | |
| 2289 | ImGui::EndPopup(); |
| 2290 | } |
| 2291 | |
| 2292 | void FEditorUI::DrawToolContents(const FUpdateContext& UpdateContext, FEditorTool* Tool) |
| 2293 | { |
| 2294 | LUMINA_PROFILE_SCOPE(); |
| 2295 | |
| 2296 | // This is the second Begin(), as SubmitToolMainWindow() has already done one |
| 2297 | // (Therefore only the p_open and flags of the first call to Begin() applies) |
| 2298 | ImGui::Begin(Tool->GetToolName().c_str()); |
| 2299 | |
| 2300 | ASSERT(ImGui::GetCurrentWindow()->BeginCount == 2); |
| 2301 | |
| 2302 | const ImGuiID dockspaceID = Tool->GetCurrentDockspaceID(); |
| 2303 | const ImVec2 DockspaceSize = ImGui::GetContentRegionAvail(); |
nothing calls this directly
no test coverage detected