From 09b19b4ec6796c83fb5e28a55ed5c29962130465 Mon Sep 17 00:00:00 2001 From: JoePfeiffer Date: Tue, 24 Jan 2023 09:23:18 -0700 Subject: [PATCH 1/3] Enable graphic editor selection in Preferences panel for UNIX-like (eg Linux) platforms not confined in a snap. --- .../gui/dialogs/preferences/GraphicsPreferencesPanel.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/swing/src/net/sf/openrocket/gui/dialogs/preferences/GraphicsPreferencesPanel.java b/swing/src/net/sf/openrocket/gui/dialogs/preferences/GraphicsPreferencesPanel.java index f2eed023d..65b12b145 100644 --- a/swing/src/net/sf/openrocket/gui/dialogs/preferences/GraphicsPreferencesPanel.java +++ b/swing/src/net/sf/openrocket/gui/dialogs/preferences/GraphicsPreferencesPanel.java @@ -145,7 +145,7 @@ public class GraphicsPreferencesPanel extends PreferencesPanel { * we will rely on using the xdg-open command which allows the user to pick * their preferred application. */ - if (SystemInfo.getPlatform() != Platform.UNIX && !SystemInfo.isConfined()) { + if (SystemInfo.getPlatform() != Platform.UNIX || !SystemInfo.isConfined()) { this.add(editorPrefPanel, "growx, span"); } From 4a4a89990fea030ce835b49c63930e71163d7845 Mon Sep 17 00:00:00 2001 From: JoePfeiffer Date: Tue, 24 Jan 2023 10:22:41 -0700 Subject: [PATCH 2/3] Enable command text input and chooser when Desktop or Desktop.Action.EDIT isn't supported --- swing/src/net/sf/openrocket/gui/dialogs/EditDecalDialog.java | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/swing/src/net/sf/openrocket/gui/dialogs/EditDecalDialog.java b/swing/src/net/sf/openrocket/gui/dialogs/EditDecalDialog.java index 316ccebbd..8ed3bf885 100644 --- a/swing/src/net/sf/openrocket/gui/dialogs/EditDecalDialog.java +++ b/swing/src/net/sf/openrocket/gui/dialogs/EditDecalDialog.java @@ -96,11 +96,11 @@ public class EditDecalDialog extends JDialog { } else { commandText = new JTextArea(); - commandText.setEnabled(false); + commandText.setEnabled(true); panel.add(commandText, "growx, wrap"); final JButton chooser = new SelectColorButton(trans.get("EditDecalDialog.btn.chooser")); - chooser.setEnabled(false); + chooser.setEnabled(true); chooser.addActionListener(new ActionListener() { @Override From 8a0ba46624d278a5e0f7acd909db43adc84fdf4a Mon Sep 17 00:00:00 2001 From: JoePfeiffer Date: Wed, 25 Jan 2023 09:24:20 -0700 Subject: [PATCH 3/3] Only case (I know of) to hide the Edit button is if we're both running Linux and confined to a snap --- .../sf/openrocket/gui/configdialog/AppearancePanel.java | 8 +++++--- .../gui/dialogs/preferences/GraphicsPreferencesPanel.java | 2 +- 2 files changed, 6 insertions(+), 4 deletions(-) diff --git a/swing/src/net/sf/openrocket/gui/configdialog/AppearancePanel.java b/swing/src/net/sf/openrocket/gui/configdialog/AppearancePanel.java index 1016ab875..d0569ea2f 100644 --- a/swing/src/net/sf/openrocket/gui/configdialog/AppearancePanel.java +++ b/swing/src/net/sf/openrocket/gui/configdialog/AppearancePanel.java @@ -32,6 +32,8 @@ import net.sf.openrocket.appearance.AppearanceBuilder; import net.sf.openrocket.appearance.Decal.EdgeMode; import net.sf.openrocket.appearance.DecalImage; import net.sf.openrocket.appearance.defaults.DefaultAppearance; +import net.sf.openrocket.arch.SystemInfo; +import net.sf.openrocket.arch.SystemInfo.Platform; import net.sf.openrocket.document.OpenRocketDocument; import net.sf.openrocket.gui.SpinnerEditor; import net.sf.openrocket.gui.adaptors.BooleanModel; @@ -576,14 +578,14 @@ public class AppearancePanel extends JPanel { p.add(textureDropDown, "grow"); panel.add(p, "spanx 3, growx, wrap"); order.add(textureDropDown); - + //// Edit button - if (Desktop.isDesktopSupported() && Desktop.getDesktop().isSupported(Desktop.Action.EDIT)) { + if ((SystemInfo.getPlatform() != Platform.UNIX) || !SystemInfo.isConfined()) { JButton editBtn = new SelectColorButton( trans.get("AppearanceCfg.but.edit")); - editBtn.setEnabled(!materialDefault.isSelected() && builder.getImage() != null); // Enable the editBtn only when the appearance builder has an Image // assigned to it. + editBtn.setEnabled(!materialDefault.isSelected() && builder.getImage() != null); builder.addChangeListener(new StateChangeListener() { @Override public void stateChanged(EventObject e) { diff --git a/swing/src/net/sf/openrocket/gui/dialogs/preferences/GraphicsPreferencesPanel.java b/swing/src/net/sf/openrocket/gui/dialogs/preferences/GraphicsPreferencesPanel.java index 65b12b145..b0b241b9b 100644 --- a/swing/src/net/sf/openrocket/gui/dialogs/preferences/GraphicsPreferencesPanel.java +++ b/swing/src/net/sf/openrocket/gui/dialogs/preferences/GraphicsPreferencesPanel.java @@ -145,7 +145,7 @@ public class GraphicsPreferencesPanel extends PreferencesPanel { * we will rely on using the xdg-open command which allows the user to pick * their preferred application. */ - if (SystemInfo.getPlatform() != Platform.UNIX || !SystemInfo.isConfined()) { + if ((SystemInfo.getPlatform() != Platform.UNIX) || !SystemInfo.isConfined()) { this.add(editorPrefPanel, "growx, span"); }