From c0e24b4cf5d2fe360a1f4d15551bb7218aeec1b7 Mon Sep 17 00:00:00 2001 From: OMGeeky Date: Tue, 24 Jun 2025 18:45:15 +0200 Subject: [PATCH] fix bug, where condition buttons are enabled in readonly mode --- DEDUP-TODO.md | 4 +--- .../ui/gamedataeditors/CommonEditor.java | 18 +++++++++++++----- 2 files changed, 14 insertions(+), 8 deletions(-) diff --git a/DEDUP-TODO.md b/DEDUP-TODO.md index f3c5160..9ea4c9d 100644 --- a/DEDUP-TODO.md +++ b/DEDUP-TODO.md @@ -4,7 +4,5 @@ There are probably a lot of things that could be optimized, which will not be on this list (which will probably also be done, they are just not important enough to track them) - -- check, why for example the "Forever" button is active for not altered entities (ex.: NPC->hitEffect) if they have a condition already there - - apparently that's always been like that... (or at least on the most recent main branch) +- diff --git a/src/com/gpl/rpg/atcontentstudio/ui/gamedataeditors/CommonEditor.java b/src/com/gpl/rpg/atcontentstudio/ui/gamedataeditors/CommonEditor.java index f44c671..18a1d0f 100644 --- a/src/com/gpl/rpg/atcontentstudio/ui/gamedataeditors/CommonEditor.java +++ b/src/com/gpl/rpg/atcontentstudio/ui/gamedataeditors/CommonEditor.java @@ -321,20 +321,28 @@ public class CommonEditor { this.editor = editor; } - public void updateEffectTimedConditionWidgets(ELEMENT condition) { + public void updateEffectTimedConditionWidgets(ELEMENT condition) { + boolean writable = editor.target.writable; + boolean immunity = condition.isImmunity(); boolean clear = condition.isClear(); boolean forever = condition.isInfinite(); conditionClear.setSelected(clear); conditionApply.setSelected(!clear && !immunity); - conditionMagnitude.setEnabled(!clear && !immunity); conditionImmunity.setSelected(immunity); conditionTimed.setSelected(!forever); - conditionTimed.setEnabled(!clear); - conditionDuration.setEnabled(!clear && !forever); conditionForever.setSelected(forever); - conditionForever.setEnabled(!clear); + + conditionDuration.setEnabled(!clear && !forever && writable); + + conditionClear.setEnabled(writable); + conditionApply.setEnabled(writable); + conditionMagnitude.setEnabled(!clear && !immunity && writable); + + conditionImmunity.setEnabled(writable); + conditionTimed.setEnabled(!clear && writable); + conditionForever.setEnabled(!clear && writable); } public void updateEffectTimedConditionEditorPane(JPanel pane, ELEMENT condition, final FieldUpdateListener listener) {