Skip to content

Conversation

@SiboVG
Copy link
Member

@SiboVG SiboVG commented Jan 8, 2023

This PR fixes #960 by adding an OK and Cancel button to the component config dialog. I know that in PR #960 @neilweinstock expressed the desire for an alternative nomenclature, but I still want to stick with the "OK" and "Cancel" buttons simply because the texts are so dissimilar and short. If we were for instance to use "Cancel" and "Close", it would be easy for a user to misread e.g. "Cancel" for "Close". Or if you name it "Revert" and "Close", those are longer to read than simply "OK" and "Cancel".

Now in an attempt to still please Neil, I added a modification indicator to the component config. The config title will now show an asterisk symbol (*) when the component is modified.

Demo:

Screen.Recording.2023-01-08.at.04.36.47.mp4

As you can see, the previous "Close" button is now replaced by "OK", and there is a "Cancel" button. Clicking the "Cancel" button will launch a yes/no option pane to ask if you really want to discard your changes (or undo a component addition). You can opt to not show that dialog again.

Some things to note:

  • the mechanism behind the Cancel-action is that the button will fire an undo-action on the document. This has the benefit that if you discard changes made to a component, you can still get them back by doing a Redo action (Edit > Redo, or Ctrl/Cmd + Y).
  • the Cancel-button is the only way to discard changes. All other exit methods (clicking the red cross in the top left window corner, or hitting the Escape-key) are equivalent to the OK-action. So no change in functionality with the current unstable.

Additional Note: if you enable the "Don't ask again" checkbox, there is no way to bring it back other than going to the preference panel and resetting all preferences. I didn't want to add an extra checkbox in the preferences panel to enable/disable the "Don't ask again" setting (similar to the "Show warning when saving in RockSim format) as to not clutter the preference dialog. If you think such an option is still useful, I can add it.


While working on this PR, I came across the very fun bug #1956. Since I initially thought I messed up the PR, I was already working on a fix. So this PR also fixes #1956, instead of it being in a separate PR.

@SiboVG
Copy link
Member Author

SiboVG commented Jan 8, 2023

By the way, I'm sorry that I'm not abiding to the feature-frozen rule, but I really wanted to get this in before the final release.

@hcraigmiller
Copy link
Collaborator

This will be a nice addition. . . eliminating one of my minor pet peeves.

Functions as expected; no anomalies found.

Build 1416
[Windows 11 Pro; Version 22H2; OS Build 22621.521; Windows Feature Experience Pack 1000.22634.1000.0]
[Java "11.0.15" 2022-04-19 LTS; Java(TM) SE Runtime Environment 18.9 (build 11.0.15+8-LTS-149)]

@JoePfeiffer
Copy link
Contributor

One little thing -- I like that if I click "Cancel" I get a confirmation dialog that asks if I really want to delete my changes. But if I answer "No" it closes the configuration dialog. To me, the expected behavior at that point would be to revert my changes, but leave the configuration dialog open.

@SiboVG
Copy link
Member Author

SiboVG commented Jan 8, 2023

One little thing -- I like that if I click "Cancel" I get a confirmation dialog that asks if I really want to delete my changes. But if I answer "No" it closes the configuration dialog. To me, the expected behavior at that point would be to revert my changes, but leave the configuration dialog open.

Fixed now.

@JoePfeiffer
Copy link
Contributor

Seeing another problem -- Open a design, edit the sustainer (I'm not seeing it with other components, but I haven't tested exhaustively). Change a parameter, click "Cancel", click "Yes". I get
--------- Exception stack trace ----------
java.lang.IllegalStateException: getRocket() called with root component Stage
at net.sf.openrocket.rocketcomponent.RocketComponent.getRocket(RocketComponent.java:2006)
at net.sf.openrocket.rocketcomponent.AxialStage.getSeparationConfiguration(AxialStage.java:208)
at net.sf.openrocket.rocketcomponent.AxialStage.clearConfigListeners(AxialStage.java:245)
at net.sf.openrocket.gui.configdialog.ComponentConfigDialog$1.windowClosed(ComponentConfigDialog.java:78)
at java.desktop/java.awt.AWTEventMulticaster.windowClosed(AWTEventMulticaster.java:368)
at java.desktop/java.awt.AWTEventMulticaster.windowClosed(AWTEventMulticaster.java:367)
at java.desktop/java.awt.Window.processWindowEvent(Window.java:2081)
at java.desktop/javax.swing.JDialog.processWindowEvent(JDialog.java:686)
at java.desktop/java.awt.Window.processEvent(Window.java:2037)
at java.desktop/java.awt.Component.dispatchEventImpl(Component.java:5011)
at java.desktop/java.awt.Container.dispatchEventImpl(Container.java:2321)
at java.desktop/java.awt.Window.dispatchEventImpl(Window.java:2772)
at java.desktop/java.awt.Component.dispatchEvent(Component.java:4843)
at java.desktop/java.awt.EventQueue.dispatchEventImpl(EventQueue.java:772)
at java.desktop/java.awt.EventQueue$4.run(EventQueue.java:721)
at java.desktop/java.awt.EventQueue$4.run(EventQueue.java:715)
at java.base/java.security.AccessController.doPrivileged(Native Method)
at java.base/java.security.ProtectionDomain$JavaSecurityAccessImpl.doIntersectionPrivilege(ProtectionDomain.java:85)
at java.base/java.security.ProtectionDomain$JavaSecurityAccessImpl.doIntersectionPrivilege(ProtectionDomain.java:95)
at java.desktop/java.awt.EventQueue$5.run(EventQueue.java:745)
at java.desktop/java.awt.EventQueue$5.run(EventQueue.java:743)
at java.base/java.security.AccessController.doPrivileged(Native Method)
at java.base/java.security.ProtectionDomain$JavaSecurityAccessImpl.doIntersectionPrivilege(ProtectionDomain.java:85)
at java.desktop/java.awt.EventQueue.dispatchEvent(EventQueue.java:742)
at java.desktop/java.awt.EventDispatchThread.pumpOneEventForFilters(EventDispatchThread.java:203)
at java.desktop/java.awt.EventDispatchThread.pumpEventsForFilter(EventDispatchThread.java:124)
at java.desktop/java.awt.EventDispatchThread.pumpEventsForHierarchy(EventDispatchThread.java:113)
at java.desktop/java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:109)
at java.desktop/java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:101)
at java.desktop/java.awt.EventDispatchThread.run(EventDispatchThread.java:90)

@SiboVG
Copy link
Member Author

SiboVG commented Jan 8, 2023

Seeing another problem -- Open a design, edit the sustainer (I'm not seeing it with other components, but I haven't tested exhaustively). Change a parameter, click "Cancel", click "Yes". I get

Hm, good catch!

It's exclusive to stages and boosters, because after the undo-action, the stage's and booster's parent is set to null (because the reference changes after a loadFromRocket or something).

@SiboVG
Copy link
Member Author

SiboVG commented Jan 8, 2023

Okay, should be fixed, thanks again @JoePfeiffer.

@JoePfeiffer JoePfeiffer merged commit 3e94343 into openrocket:unstable Jan 8, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

3 participants