Added: Disable AS1/2/3 direct editation when editing P-code

This commit is contained in:
Jindra Petřík
2025-05-31 12:52:53 +02:00
parent f88f7ced70
commit bc85daca85
6 changed files with 15 additions and 2 deletions

View File

@@ -23,6 +23,7 @@ All notable changes to this project will be documented in this file.
- AS1/2/3 - underline errors in the code (also in edit mode)
- AS1/2/3 - highlight variables and errors on panel next to vertical scrollbar
- AS1/2 direct editation - hide P-code panel when editing
- Disable AS1/2/3 direct editation when editing P-code
### Changed
- AS1/2 - Single DoAction tag inside frame is now displayed directly as frame node

View File

@@ -216,6 +216,12 @@ public class ABCPanel extends JPanel implements ItemListener, SearchListener<Scr
public ScriptPack getPack() {
return decompiledTextArea.getScriptLeaf();
}
public void setDecompiledEditEnabled(boolean value) {
decompiledTextArea.setEnabled(value);
editDecompiledButton.setEnabled(value);
toolbarPanel.setEnabled(value);
}
public List<ABCSearchResult> search(final Openable openable, final String txt, boolean ignoreCase, boolean regexp, boolean pcode, CancellableWorker<Void> worker, List<ScriptPack> scope) {
if (txt != null && !txt.isEmpty()) {

View File

@@ -620,6 +620,9 @@ public class DecompiledEditorPane extends DebuggableEditorPane implements CaretL
@Override
public void caretUpdate(final CaretEvent e) {
if (!isEnabled()) {
return;
}
ABC abc = getABC();
if (abc == null) {
return;

View File

@@ -207,6 +207,7 @@ public class DetailPanel extends JPanel implements TagEditorPanel {
editButton.setVisible(!val);
cancelButton.setVisible(val);
selectedLabel.setIcon(val ? View.getIcon("editing16") : null);
abcPanel.setDecompiledEditEnabled(!val);
}
public void showCard(final String name, final Trait trait, int traitIndex, ABC abc) {

View File

@@ -1192,7 +1192,9 @@ public class ActionPanel extends JPanel implements SearchListener<ScriptSearchRe
saveButton.setVisible(val);
saveButton.setEnabled(false);
editButton.setVisible(!val);
cancelButton.setVisible(val);
cancelButton.setVisible(val);
editDecompiledButton.setEnabled(!val);
}
editor.getCaret().setVisible(true);

View File

@@ -553,5 +553,5 @@ public class LineMarkedEditorPane extends UndoFixedEditorPane implements LinkHan
fgp.paint(g, lineStart.getVal(), lineEnd.getVal(), null, this);
}
}
}
}
}