@@ -16,6 +16,7 @@ import ru.octol1ttle.flightassistant.screen.FABaseScreen
1616import ru.octol1ttle.flightassistant.screen.components.SmartStringWidget
1717
1818class EnrouteScreen (parent : Screen ) : FABaseScreen(parent, Component .translatable("menu.flightassistant.fms.enroute")) {
19+ private lateinit var deleteAll: Button
1920 private lateinit var discardChanges: Button
2021 private lateinit var save: Button
2122 private lateinit var done: Button
@@ -33,6 +34,11 @@ class EnrouteScreen(parent: Screen) : FABaseScreen(parent, Component.translatabl
3334
3435 val list: EnrouteWaypointsList = this .addRenderableWidget(EnrouteWaypointsList (Y0 + 10 , this .height - Y0 * 2 , this .width, optimumColumnsSize, computers, state))
3536
37+ deleteAll = this .addRenderableWidget(Button .builder(Component .translatable(" menu.flightassistant.fms.enroute.delete_all" )) {
38+ state.waypoints.clear()
39+ list.rebuildEntries()
40+ }.bounds(10 , this .height - Y0 * 2 + 5 , 80 , 20 ).build())
41+
3642 this .addRenderableWidget(Button .builder(Component .translatable(" menu.flightassistant.fms.enroute.add_waypoint" )) {
3743 state.waypoints.add(EnrouteScreenState .Waypoint (active = if (state.waypoints.isEmpty()) FlightPlanComputer .EnrouteWaypoint .Active .TARGET else null ))
3844 list.rebuildEntries()
@@ -54,6 +60,8 @@ class EnrouteScreen(parent: Screen) : FABaseScreen(parent, Component.translatabl
5460 }
5561
5662 override fun render (guiGraphics : GuiGraphics , mouseX : Int , mouseY : Int , delta : Float ) {
63+ deleteAll.active = state.waypoints.isNotEmpty()
64+
5765 val hasUnsavedChanges: Boolean = ! state.equals(EnrouteScreenState .load(computers.plan))
5866 save.active = hasUnsavedChanges
5967 discardChanges.active = hasUnsavedChanges
0 commit comments