Skip to content

Add confirmation dialog before resetting work coordinate zero#3126

Merged
breiler merged 1 commit into
winder:masterfrom
mvanhorn:feature/3040-reset-zero-confirmation
Jun 14, 2026
Merged

Add confirmation dialog before resetting work coordinate zero#3126
breiler merged 1 commit into
winder:masterfrom
mvanhorn:feature/3040-reset-zero-confirmation

Conversation

@mvanhorn

Copy link
Copy Markdown
Contributor

Summary

The DRO "Reset Zero" buttons (all-axes and per-axis X/Y/Z/A/B/C) now show a confirmation dialog before they wipe the work-coordinate zero. The dialog includes a "Don't ask again" checkbox; if checked, the prompt is permanently dismissed and the choice is persisted to settings. The confirmation is on by default, so existing users get the safety net immediately and anyone who finds it annoying can opt out in one click.

Implementation:

  • Settings.java gains a confirmResetZero flag (default true) with isConfirmResetZero() / setConfirmResetZero(boolean) accessors following the existing scrollWindowEnabled boolean pattern.
  • New ResetZeroConfirmation helper centralizes the prompt: short-circuits to true when confirmation is disabled, otherwise shows a JOptionPane yes/no dialog with the opt-out checkbox and persists the choice via SettingsFactory.saveSettings.
  • All seven actions (ResetCoordinatesToZeroAction and Reset{X,Y,Z,A,B,C}CoordinateToZeroAction) guard their actionPerformed with ResetZeroConfirmation.confirmResetZero(backend) before calling backend.resetCoordinate(s)ToZero(...).
  • New localization keys in MessagesBundle_en_US.properties.

Why this matters

Users accidentally hit the reset-zero buttons when they meant to run a return-to-zero macro, silently destroying a carefully set work origin. This implements the design the maintainer specified in the issue thread: "a confirmation box, asking if the user is sure to reset the zero coordinates with an option to hide future questions." #3040

Testing

  • mvn -pl ugs-core,ugs-platform/ugs-platform-ugscore -am compile succeeds.
  • New ResetZeroConfirmationTest (4 tests, all green): verifies the helper returns true without showing a dialog when confirmation is disabled (and leaves the flag untouched), handles a null Settings, that the setting defaults to true, and that the setter updates the value.
  • The Swing yes/no dialog interaction itself was verified manually since it requires a display; the headless short-circuit and persistence logic is covered by the unit tests.

Fixes #3040

@breiler breiler merged commit 8f0a7d2 into winder:master Jun 14, 2026
1 check passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Please add the confirmation dialog when resetting x, y, z to 0.

2 participants