diff --git a/src/com/jpexs/decompiler/flash/gui/MainPanel.java b/src/com/jpexs/decompiler/flash/gui/MainPanel.java index f041a166e..a7eac7550 100644 --- a/src/com/jpexs/decompiler/flash/gui/MainPanel.java +++ b/src/com/jpexs/decompiler/flash/gui/MainPanel.java @@ -469,6 +469,14 @@ public final class MainPanel extends JPanel implements TreeSelectionListener, Se return; } TreeItem item = (TreeItem) paths[0].getLastPathComponent(); + + if (item instanceof Tag) { + if (((Tag)item).isReadOnly()) { + return; + } + } + + if (e.getKeyCode() == KeyEvent.VK_UP) { contextPopupMenu.moveUpDown(item, true); } @@ -564,6 +572,14 @@ public final class MainPanel extends JPanel implements TreeSelectionListener, Se tagItems.add((Tag) item); } } + boolean allWritable = true; + for (TreeItem item:tagItems) { + if (((Tag)item).isReadOnly()) { + allWritable = false; + break; + } + } + if (e.getKeyCode() == 'C') { if (e.isShiftDown()) { contextPopupMenu.copyTagToClipboardWithDependenciesActionPerformed(null, tagItems); @@ -571,7 +587,7 @@ public final class MainPanel extends JPanel implements TreeSelectionListener, Se contextPopupMenu.copyTagToClipboardActionPerformed(null, tagItems); } } - if (e.getKeyCode() == 'X') { + if (e.getKeyCode() == 'X' && allWritable) { contextPopupMenu.update(tagItems); if (e.isShiftDown()) { contextPopupMenu.cutTagToClipboardWithDependenciesActionPerformed(null); diff --git a/src/com/jpexs/decompiler/flash/gui/tagtree/TagTreeContextMenu.java b/src/com/jpexs/decompiler/flash/gui/tagtree/TagTreeContextMenu.java index a5e36cc8c..0111ff429 100644 --- a/src/com/jpexs/decompiler/flash/gui/tagtree/TagTreeContextMenu.java +++ b/src/com/jpexs/decompiler/flash/gui/tagtree/TagTreeContextMenu.java @@ -626,8 +626,23 @@ public class TagTreeContextMenu extends JPopupMenu { public boolean canRemove(final List items) { for (TreeItem item : items) { - if (!(item instanceof Tag) && !(item instanceof Frame)) { + if (item instanceof Tag) + { + if (((Tag)item).isReadOnly()) { + return false; + } + } else if (item instanceof Frame) { + Frame frame = (Frame) item; + if (frame.timeline.timelined instanceof DefineSpriteTag) { + if (((Tag)frame.timeline.timelined).isReadOnly()) { + return false; + } + } + } else { if (item instanceof TagScript) { + if (((TagScript)item).getTag().isReadOnly()) { + return false; + } continue; }