Skip to content

Commit 2833873

Browse files
committed
Add "Delete all" button to EnrouteScreen
Closes #73 Signed-off-by: Octol1ttle <[email protected]>
1 parent 1acb87d commit 2833873

File tree

3 files changed

+10
-0
lines changed

3 files changed

+10
-0
lines changed

src/main/kotlin/ru/octol1ttle/flightassistant/screen/fms/enroute/EnrouteScreen.kt

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@ import ru.octol1ttle.flightassistant.screen.FABaseScreen
1616
import ru.octol1ttle.flightassistant.screen.components.SmartStringWidget
1717

1818
class 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

src/main/resources/assets/flightassistant/lang/en_us.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -306,6 +306,7 @@ menu.flightassistant:
306306
minimum_climb_speed: 'Minimum climb speed: '
307307
enroute:
308308
.: Enroute
309+
delete_all: Delete all
309310
add_waypoint: Add waypoint
310311
direct_to: Direct-to
311312
unsaved_changes: UNSAVED CHANGES

src/main/resources/assets/flightassistant/lang/ru_ru.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -310,6 +310,7 @@ menu.flightassistant:
310310
minimum_climb_speed: 'Минимальная скорость набора: '
311311
enroute:
312312
.: Маршрут
313+
delete_all: Удалить все
313314
add_waypoint: Добавить точку
314315
direct_to: Прямо-на
315316
unsaved_changes: НЕСОХРАНЕН ИЗМЕНЕНИЯ

0 commit comments

Comments
 (0)