mirror of
https://git.huckle.dev/Huckles-Minecraft-Archive/jpexs-decompiler.git
synced 2026-07-12 14:28:36 +00:00
Disable writing keystrokes for readonly tags (imported)
This commit is contained in:
@@ -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);
|
||||
|
||||
@@ -626,8 +626,23 @@ public class TagTreeContextMenu extends JPopupMenu {
|
||||
|
||||
public boolean canRemove(final List<TreeItem> 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;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user