From 083926b2ae357fb76d332457d36668200fc76374 Mon Sep 17 00:00:00 2001 From: Steven Yi Date: Sun, 19 Nov 2023 20:14:23 -0500 Subject: [PATCH] fix(jmask): add showing of parameter names in parameter visibility popup --- ChangeLog.md | 8 +++++ .../blue/soundObject/editor/JMaskEditor.java | 31 +++++++++++-------- 2 files changed, 26 insertions(+), 13 deletions(-) diff --git a/ChangeLog.md b/ChangeLog.md index 8a18ae01e..0559ba5bf 100755 --- a/ChangeLog.md +++ b/ChangeLog.md @@ -16,11 +16,19 @@ information. ### Updated * Updated Jython interpreter to 2.7.3 + ### FIX * Redid filechooser manager to hold on to Filechoosers so that they will maintain last state (i.e., last file or folder selected) between uses +* JMask: + + * Maintain name of parameter when changing parameter type + + * Show parameter name in the popup for setting visibility of parameters + + ## [2.9.1] - 2023-09-10 ### FIX diff --git a/blue-ui-core/src/main/java/blue/soundObject/editor/JMaskEditor.java b/blue-ui-core/src/main/java/blue/soundObject/editor/JMaskEditor.java index c60ce56de..3d0b2cbf6 100644 --- a/blue-ui-core/src/main/java/blue/soundObject/editor/JMaskEditor.java +++ b/blue-ui-core/src/main/java/blue/soundObject/editor/JMaskEditor.java @@ -79,7 +79,7 @@ public JMaskEditor() { final Box topPanel = new Box(BoxLayout.X_AXIS); topPanel.setBorder(BorderFactory.createCompoundBorder(BorderFactory. createBevelBorder(BevelBorder.RAISED), new EmptyBorder(3, 3, - 3, 3))); + 3, 3))); topPanel.add(new JLabel("JMask")); topPanel.add(Box.createHorizontalStrut(5)); final JButton optionsButton = new JButton(IconFactory.getDownArrowIcon()); @@ -97,20 +97,20 @@ public JMaskEditor() { }); useSeedCheckBox.addActionListener((ActionEvent e) -> { - if(jmask != null) { + if (jmask != null) { jmask.setSeedUsed(useSeedCheckBox.isSelected()); } }); - + seedSpinner.addChangeListener((ChangeEvent e) -> { - if(jmask != null) { - jmask.setSeed(((Number)seedSpinner.getValue()).longValue()); + if (jmask != null) { + jmask.setSeed(((Number) seedSpinner.getValue()).longValue()); } }); - - seedSpinner.setMaximumSize(new Dimension(140,200)); - seedSpinner.setPreferredSize(new Dimension(140,22)); - + + seedSpinner.setMaximumSize(new Dimension(140, 200)); + seedSpinner.setPreferredSize(new Dimension(140, 22)); + topPanel.add(useSeedCheckBox); topPanel.add(seedSpinner); topPanel.add(Box.createHorizontalStrut(5)); @@ -151,10 +151,10 @@ public void editScoreObject(ScoreObject sObj) { JMask jmask = (JMask) sObj; this.jmask = null; - + useSeedCheckBox.setSelected(jmask.isSeedUsed()); seedSpinner.setValue(jmask.getSeed()); - + editorListPanel.setJMask(jmask); this.jmask = jmask; @@ -178,7 +178,7 @@ private void testScore() { if (notes != null) { InfoDialog.showInformationDialog(SwingUtilities.getRoot(this), notes.toString(), BlueSystem.getString( - "soundObject.generatedScore")); + "soundObject.generatedScore")); } } @@ -198,8 +198,13 @@ private void updatePopup() { for (int i = 0; i < this.field.getSize(); i++) { Parameter param = this.field.getParameter(i); + var paramName = param.getName(); + String itemName = paramName != null && !paramName.isEmpty() + ? String.format("Parameter %d - %s", (i + 1), paramName) + : String.format("Parameter %d", (i + 1)); + JCheckBoxMenuItem menuItem = new JCheckBoxMenuItem( - "Parameter " + (i + 1)); + itemName); menuItem.setSelected(param.isVisible()); menuItem.putClientProperty("parameter", param); popup.add(menuItem);